How can I display python code as a math formula?

Question:

How can I display python code as a math formula in the console application?

Example:

 a=1
 b=1
 c=1
 y=(pow(a,2)-2*b-pow(c,2))/(3*a*b)

enter image description here

Asked By: turaltahmazli

||

Answers:

I believe the sympy package is what you’re looking for. It can pretty print equations in the console. You’ll want to use the the preview function to creat e.g. a PNG, which a browser can easily open or can be linked to in a HTML file— you’ll need to have LaTeX installed to do this.

Answered By: thebadgateway
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.