Metadata-Version: 2.1
Name: latexcalc
Version: 0.8.0
Summary: LaTeXcalc is a LaTeX-Calculation-library for python3 accepting an optional values-dict for variables
Home-page: https://github.com/polarwinkel/latexcalc
Author: Dirk Winkel
Author-email: it@polarwinkel.de
Project-URL: Bug Reports, https://github.com/polarwinkel/latexcalc/issues
Project-URL: Source, https://github.com/polarwinkel/latexcalc
Keywords: TeX,LaTeX,Markdown,HTML markdown2html,latex2mathml
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Text Processing :: Markup :: LaTeX
Requires-Python: >=3.7, <4
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: latexcalc

# LaTeXcalc

## What is this?

LaTeXcalc is a LaTeX-Calculation-library for python3.

This calculates a mathematical formula written as a LaTeX-string.
It can use a given value-dict for variables in the formula.
The return-value is int or float.

## Supported features

LaTeXcalc can handle the following LaTeX-operations:

- apply `+`, `-`, `*`, `/` operators and the `-` as algebraic sign
- multiplication and division first, then addition and subtraction
- power `^`
- brackets `()`, `[]` and `{}` (also with `\left(`..`\right)`)
- squareroot `\sqrt{}`
- trigonometric functions like `\sin` or `\arctan`
- exponential numbers linke `1e+12`
- `\log` and `e^`
- `\pi` or `pi` and `e` as default-values `math.pi` and `math.e`
- `\frac{}{}` (works as abbreviated `\frac 1 2` as well)

make sure you always use `*` (or `\cdot`), because `xy` != `x*y`, in that case xy would be a value!

## How to use

You can install this by using pip: `pip install latexcalc` or alternatively by including the folder `latexcalc` in your python3-project.

Then all you need to do is

```
import latexcalc

c = latexcalc.calc('\sqrt{3^2+4^2}')
# or with variables:
c = latexcalc.calc(\sqrt(a^2+b^2)', {'a':3,'b':4})
print(c) # 5
```

## Limitations

All testet cases work, but there might still be wrong calculations in
special cases, so test it for your needs!

## Something missing?

Feel free to submit an issue if you find a bug or if you think something important is missing.
In that case please add a Line for the `test.py` to show the desired operation!

## Alternatives

There are some other libraries out there doing similar things, but at time of writing I didn't find anything that fulfilled my needs (lightweight, working with variables, ...).
So depending on your requirements this or maybe something else might be the right choise, thank's for cheching this out!
