The Chinese version is the original documentation. The English version is translated from the Chinese version using LLM.
Project Under Development
oloc is a lightweight Python library that provides basic operations and simplification functionality for expressions described as strings.
oloc has the following standout features:
- Fraction-based operations to ensure accurate results
- Support for common functions
- Robust compatibility with input:
- Implements multiple forms of the same content through a symbol mapping table
- For example, the mathematical constant
πcan be represented aspi,p, etc., while the multiplication symbol can be represented as*,×,・, etc. In some cases, it can even support near-natural language inputs likeOne plus one equalsor一百的阶乘. - The symbol mapping table supports custom extensions.
- For example, the mathematical constant
- Implements different ways to call the same function through a function conversion table
- For instance, the expressions
1/2^0.5,pow(1/2,1/2), andsqrt(1/2)are equivalent. - The function conversion table supports custom extensions.
- For instance, the expressions
- Supports various formats of numerical input
- The primary format is fractions (e.g.,
3/4), but it also supports common integers (e.g.,100), decimals (e.g.,-0.1234), and even less common formats like mixed fractions (e.g.,2\1/2) and repeating decimals (e.g.,2.33...). - Compatible with diverse input forms, such as number separators and scientific notation.
- The primary format is fractions (e.g.,
- Implements multiple forms of the same content through a symbol mapping table
- Supports irrational numbers
- In addition to built-in irrational numbers like
πand𝑒, custom irrational numbers are also supported, including short custom irrational numbers (e.g.,x,y) and long custom irrational numbers enclosed in<>(e.g.,<Irrational>, which can easily represent variables in expressions). These can be used for expression simplification.
- In addition to built-in irrational numbers like
- Supports adding comments in expressions, such as
1+1 #The Most basic calculation# = - Comprehensive exception handling, precisely pointing out errors and their locations with corresponding suggestions
- Neat and formatted output results
- The formatting features can be customized.
- The results provide a method to print the calculation of each specific detail.
- Ability to retrieve step-by-step calculation results
- Multi-type conversion support, including
int,float, and the nativeFractiontype- Includes controllable floating-point conversion precision: explicitly specify it using the
?operator or modify the default precision.
- Includes controllable floating-point conversion precision: explicitly specify it using the
- Computation timeout restrictions
oloc relies on the simpsave library for data storage functionality (e.g., symbol mapping tables).
simpsaveis a simple Python-native data persistence library. See simpsave.
In oloc_release, a ready-to-use CLI computation terminal and a GUI implemented by Tkinter are also provided.
oloc offers comprehensive documentation support.
- Read the usage tutorial at Usage Tutorial
- Understand the working principles at Project Description
This document applies to
olocversion:0.1.0.