How to automatically convert a LaTeX math-mode equation into Python / numpy code?

Viewed 755

Mathpix can automatically convert scanned formulas into LaTeX math code.

Is there a similar tool that automatically converts scanned formulas or LaTeX math-mode equations (code) into python (numpy) code?

1 Answers

As far as I know, there's nothing that's really comprehensive. However, there is this tool, called latex2sympy, that converts (some) LaTeX equations to SymPy. It's SymPy, not numpy (so will give you, e.g., x**2 and not np.square(x), but might help. Here's a screenshot of its README info showing some basic usage. It's not going to handle anything complicated or unusual, but for basic equations it might do the trick.

latex2sympyREADME

Related