Skip to main content

Tools for calculations

Project description

def sort(arr: List[Any], key: Callable[[Any], Any] = lambda x: x, reverse: bool = False) -> None:

内省排序Introsort,结合了多种排序算法的优点,以确保在各种情况下都能获得高效的性能,不返回列表。arr,待排序的列表。key,用于比较的键函数,自定义排序规则,而不必修改原始数据。reverse,是否降序排列,默认为升序。

Introsort, which combines the advantages of multiple sorting algorithms to ensure efficient performance in all cases. Does not return a list. arr is the list to be sorted. key is a function to extract a comparison key from each element, allowing custom sorting without modifying the original data. reverse specifies whether to sort in descending order (default is ascending).

def log(n, m, precision=50):

精确计算以m为底n的对数,参照math.log()参数顺序。默认保留50位小数,若计算结果非常接近整数,函数会返回四舍五入后的整数结果。m为对数的底数(int/float/Decimal类型),n为真数(int/float/Decimal类型),precision为可选的计算精度参数(整数类型,默认50位小数)。

Accurately calculate the logarithm of n with base m. Follow the parameter order of math.log(). The result retains 50 decimal places by default. If the calculation result is very close to an integer, the function will return the rounded integer value. m is the base of the logarithm (of type int/float/Decimal), n is the argument (of type int/float/Decimal), and precision is an optional calculation precision parameter (integer type, defaulting to 50 decimal places).

def calculate_latex(latex_expr, precision=10):

计算LaTeX表达式,返回字符串。latex_expr,LaTeX格式的数学表达式,字符串。precision,计算结果的精度,默认为10位有效数字,整数。

Evaluate LaTeX expression, return string. latex_expr(str), a mathematical expression in LaTeX format. precision(int), the precision of the result, defaults to 10 significant digits.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calctool-0.1.2.5.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

CalcTool-0.1.2.5-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file calctool-0.1.2.5.tar.gz.

File metadata

  • Download URL: calctool-0.1.2.5.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for calctool-0.1.2.5.tar.gz
Algorithm Hash digest
SHA256 36d2686420e50580ff81ea5eebb904514f9daec3ea24622fe959dc3a510017fa
MD5 d4f287e3a0520f50beb6f8695c05c35c
BLAKE2b-256 31716ccdde53d53ad3f699b8d34294ddc5647db9a8ce5cac4ce8d2f01c4d52be

See more details on using hashes here.

File details

Details for the file CalcTool-0.1.2.5-py3-none-any.whl.

File metadata

  • Download URL: CalcTool-0.1.2.5-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for CalcTool-0.1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4fa50859dcda06b30d73d7401bfc852f50309fe574d797acf79b455172b8e5c5
MD5 c0bdb205426fa30ae885186cdfc85029
BLAKE2b-256 39ece6501c22c10f8f0d0bd27409a2345208ab24b3c9dc7734a17cc41df1d817

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page