What is a good language to represent a mathematical formulas as code?

I am interested in representing my math formulas in various documents so that they can easily implemented in various programming languages.

This is important to me because in addition to representing the formula in the usual mathematical notation, I would like to represent it using a modeling or markup language that is not overly verbose (i.e. without to many unnecessary tags and thing of that nature ... I would like it to readable and intuitive). This way a software developer can translate the model representation into a software implementation (C, Matlab, Java, etc.)

For instance if I have a functions like:

G = ∫∫ xy^2dydyx

y = x^2 - x - 6

Is there a good (markup or modeling) language that can represent a mathematical formula as code?

I do not want to use MathML because it is overly verbose. I would like some kind of language that is perhaps more readable.

I want to create a library of mathematical formulas (that I commonly use) and represent them in a form that lends itself to software implementation (from the math friendly language).

  • 3
    $\begingroup$ mmh . . . latex? $\endgroup$
    – janmarqz
    Oct 23, 2015 at 23:27
  • $\begingroup$ I want an intermediate representation that is readable and can be transformed into C, Matlab or Java code. Latex would describe it, but is likely unsuitable for this. $\endgroup$
    – Xofo
    Oct 23, 2015 at 23:29
  • $\begingroup$ Scipy (a Python library) has a nice symbolic library: sympy, or perhaps I'm missing the point $\endgroup$ Oct 23, 2015 at 23:30
  • $\begingroup$ Use a lisp format. $\endgroup$
    – copper.hat
    Oct 23, 2015 at 23:39
  • $\begingroup$ The idea is that I have a formula such as: y = x^2 - x - 6 I document this formula in my document and say function y is defined as y = x^2 - x - 6 and represents the polynomial that does the foo_bar function. Now I want to create a software representation of function y, but I want to represent it in a modeling language to make it generic. I could use straight Matlab, but is there something perhaps an open standard? $\endgroup$
    – Xofo
    Oct 23, 2015 at 23:40

1 Answer 1


This is an old question but I'd suggest you first look at TeXmacs. I believe it takes LaTeX and runs the operations on it.

Also have a look at Python's module called Sympy. It's not strictly the same as what you'd enter using mathematical symbols, but converting some of the syntax to Sympy's extensive options will allow you to symbolically manipulate this.

Alternatively, there are also commercial products called Mathematica and Maple which also provide symbolic manipulation.

The key word you want to research is Computer Algebra System or CAS

Here is Wikipedia's list of CASs.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .