seamless conversion between Desmos LaTeX equations and executable Python code.
Project description
convert Desmos equations to executable Python code
Links
Dependencies
Build/Dev
GNU Make
docker
Libraries
required
pandoc (e.g. apt-get install pandoc for Debian-based, or pacman -S pandoc for Arch Linux)
(optional) For headless browser functionality (uses ``selenium``):
pyenv
libxext6
libxt6
geckodriver and firefox
Compatibility
python3.10
NOTE: working on expanding compatibility…
NOTE: still a work in progress for sure.
Helpful tips
…definitely recommend using a virtual environment, e.g. via docker or conda.
Install
From PyPi:
python3 -m pip install desmos2python
Examples
DesmosLatexParser API Example:
import desmos2python as d2p
# `file` contains a JSON-formatted list of latex equations
# loads the example defined in 'resources/latex_json/ex.json'
dlp = d2p.DesmosLatexParser(file='ex.json')
# `pycode_string` contains the ready-to-eval Desmos model namespace
print(dlp.pycode_string)
# Instantiate a model namespace
# The attributes define any formulas, parameters from the specified Desmos graph
dmn = dlp.DesmosModelNS()
# for example, evaluate the function E(x) over the domain x=(1, 2, 3)
result = dmn.E([1, 2, 3])
print(result)
# see ./tests for more examples!
Development
Build locally: make build
Testing: pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for desmos2python-0.3.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13ef67c7eb9212b71349aaa35527a1bfd217cf4be9b8a2b5d786d810b752f73a |
|
MD5 | 9407484de9a78d1cdea8a8f1608a9dd7 |
|
BLAKE2b-256 | 5f9e533a3aa3fe7acca2c7d9573d4aa86583fc2dd51649c53e4fd4bb0e7b2f38 |