LaTeX to CAS translator

Jump to navigation Jump to search

This mockup demonstrates the concept of TeX to Computer Algebra System (CAS) conversion.

The demo-application converts LaTeX functions which directly translate to CAS counterparts.

Functions without explicit CAS support are available for translation via a DRMF package (under development).

The following LaTeX input ...

{\displaystyle \begin{align} C &= 2\pi a \left[{1 - \left(\frac{1}{2}\right)^2e^2 - \left(\frac{1\cdot 3}{2\cdot 4}\right)^2\frac{e^4}{3} - \left(\frac{1\cdot 3\cdot 5}{2\cdot 4\cdot 6}\right)^2\frac{e^6}{5} - \cdots}\right] \\ &= 2\pi a \left[1 - \sum_{n=1}^\infty \left(\frac{(2n-1)!!}{(2n)!!}\right)^2 \frac{e^{2n}}{2n-1}\right] \\ &= -2\pi a \sum_{n=0}^\infty \left(\frac{(2n-1)!!}{(2n)!!}\right)^2 \frac{e^{2n}}{2n-1}, \end{align} }

... is translated to the CAS output ...

Semantic latex: \begin{align}C &= 2 \cpi a [{1 -(\frac{1}{2})^2 \expe^2 -(\frac{1\cdot 3}{2\cdot 4})^2 \frac{\expe^4}{3} -(\frac{1\cdot 3\cdot 5}{2\cdot 4\cdot 6})^2 \frac{\expe^6}{5} - \cdots}] \\ &= 2 \cpi a [1 - \sum_{n=1}^\infty(\frac{(2n-1)!!}{(2n)!!})^2 \frac{\expe^{2n}}{2n-1}] \\ &= - 2 \cpi a \sum_{n=0}^\infty(\frac{(2n-1)!!}{(2n)!!})^2 \frac{\expe^{2n}}{2n-1} ,\end{align}

Confidence: 0

Mathematica

Translation: == C == 2*Pi*a[1 -(Divide[1,2])^(2)* Exp[2]-(Divide[1 * 3,2 * 4])^(2)*Divide[Exp[4],3]-(Divide[1 * 3 * 5,2 * 4 * 6])^(2)*Divide[Exp[6],5]- \[Ellipsis]] == 2*Pi*a[(1 - Sum[(Divide[(2*n - 1)!!,(2*n)!!])^(2)*Divide[Exp[2*n],2*n - 1], {n, 1, Infinity}, GenerateConditions->None])] == - 2*Pi*a[Sum[, {n, 0, Infinity}, GenerateConditions->None]]

Information

Free variables

  • C

Symbol info

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Pi was translated to: Pi
  • was translated to: *
  • Recognizes e with power as the exponential function. It was translated as a function.

Tests

Symbolic
Numeric

SymPy

Translation: == C == 2*pi*a(1 -((1)/(2))**(2)* exp(2)-((1 * 3)/(2 * 4))**(2)*(exp(4))/(3)-((1 * 3 * 5)/(2 * 4 * 6))**(2)*(exp(6))/(5)- null) == 2*pi*a(1 - Sum(((factorial2(2*n - 1))/(factorial2(2*n)))**(2)*(exp(2*n))/(2*n - 1), (n, 1, oo))) == - 2*pi*a(Sum(, (n, 0, oo)))

Information

Free variables

  • C

Symbol info

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Pi was translated to: pi
  • was translated to: *
  • Recognizes e with power as the exponential function. It was translated as a function.

Tests

Symbolic
Numeric

Maple

Translation: = C = 2*Pi*a(1 -((1)/(2))^(2)* exp(2)-((1 * 3)/(2 * 4))^(2)*(exp(4))/(3)-((1 * 3 * 5)/(2 * 4 * 6))^(2)*(exp(6))/(5)- ..) = 2*Pi*a(1 - sum(((doublefactorial(2*n - 1))/(doublefactorial(2*n)))^(2)*(exp(2*n))/(2*n - 1), n = 1..infinity)) = - 2*Pi*a(sum(, n = 0..infinity))

Information

Free variables

  • C

Symbol info

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Pi was translated to: Pi
  • was translated to: *
  • Recognizes e with power as the exponential function. It was translated as a function.

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Is part of

Complete translation information:

{
  "id" : "FORMULA_23f77a23cd8d033ec5d2c085ad3da3e3",
  "formula" : "\\begin{align}\n  C &= 2\\pi a \\left[{1 - \\left(\\frac{1}{2}\\right)^2e^2 - \\left(\\frac{1\\cdot 3}{2\\cdot 4}\\right)^2\\frac{e^4}{3} - \\left(\\frac{1\\cdot 3\\cdot 5}{2\\cdot 4\\cdot 6}\\right)^2\\frac{e^6}{5} - \\cdots}\\right] \\\\\n    &= 2\\pi a \\left[1 - \\sum_{n=1}^\\infty \\left(\\frac{(2n-1)!!}{(2n)!!}\\right)^2 \\frac{e^{2n}}{2n-1}\\right] \\\\\n    &= -2\\pi a \\sum_{n=0}^\\infty \\left(\\frac{(2n-1)!!}{(2n)!!}\\right)^2 \\frac{e^{2n}}{2n-1},\n\\end{align}",
  "semanticFormula" : "\\begin{align}C &= 2 \\cpi a [{1 -(\\frac{1}{2})^2 \\expe^2 -(\\frac{1\\cdot 3}{2\\cdot 4})^2 \\frac{\\expe^4}{3} -(\\frac{1\\cdot 3\\cdot 5}{2\\cdot 4\\cdot 6})^2 \\frac{\\expe^6}{5} - \\cdots}] \\\\ &= 2 \\cpi a [1 - \\sum_{n=1}^\\infty(\\frac{(2n-1)!!}{(2n)!!})^2 \\frac{\\expe^{2n}}{2n-1}] \\\\ &= - 2 \\cpi a \\sum_{n=0}^\\infty(\\frac{(2n-1)!!}{(2n)!!})^2 \\frac{\\expe^{2n}}{2n-1} ,\\end{align}",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "==  C == 2*Pi*a[1 -(Divide[1,2])^(2)* Exp[2]-(Divide[1 * 3,2 * 4])^(2)*Divide[Exp[4],3]-(Divide[1 * 3 * 5,2 * 4 * 6])^(2)*Divide[Exp[6],5]- \\[Ellipsis]] == 2*Pi*a[(1 - Sum[(Divide[(2*n - 1)!!,(2*n)!!])^(2)*Divide[Exp[2*n],2*n - 1], {n, 1, Infinity}, GenerateConditions->None])] == - 2*Pi*a[Sum[, {n, 0, Infinity}, GenerateConditions->None]]",
      "translationInformation" : {
        "freeVariables" : [ "C" ],
        "tokenTranslations" : {
          "a" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\cpi" : "Pi was translated to: Pi",
          "\\cdot" : "was translated to: *",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function."
        }
      }
    },
    "SymPy" : {
      "translation" : "==  C == 2*pi*a(1 -((1)/(2))**(2)* exp(2)-((1 * 3)/(2 * 4))**(2)*(exp(4))/(3)-((1 * 3 * 5)/(2 * 4 * 6))**(2)*(exp(6))/(5)- null) == 2*pi*a(1 - Sum(((factorial2(2*n - 1))/(factorial2(2*n)))**(2)*(exp(2*n))/(2*n - 1), (n, 1, oo))) == - 2*pi*a(Sum(, (n, 0, oo)))",
      "translationInformation" : {
        "freeVariables" : [ "C" ],
        "tokenTranslations" : {
          "a" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\cpi" : "Pi was translated to: pi",
          "\\cdot" : "was translated to: *",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function."
        }
      }
    },
    "Maple" : {
      "translation" : "=  C = 2*Pi*a(1 -((1)/(2))^(2)* exp(2)-((1 * 3)/(2 * 4))^(2)*(exp(4))/(3)-((1 * 3 * 5)/(2 * 4 * 6))^(2)*(exp(6))/(5)- ..) = 2*Pi*a(1 - sum(((doublefactorial(2*n - 1))/(doublefactorial(2*n)))^(2)*(exp(2*n))/(2*n - 1), n = 1..infinity)) = - 2*Pi*a(sum(, n = 0..infinity))",
      "translationInformation" : {
        "freeVariables" : [ "C" ],
        "tokenTranslations" : {
          "a" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\cpi" : "Pi was translated to: Pi",
          "\\cdot" : "was translated to: *",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function."
        }
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "C", "= 1", "2\\pi a", "a", "= 0", "n", "\\begin{align}  C &= 2\\pi a \\left[{1 - \\left(\\frac{1}{2}\\right)^2e^2 - \\left(\\frac{1\\cdot 3}{2\\cdot 4}\\right)^2\\frac{e^4}{3} - \\left(\\frac{1\\cdot 3\\cdot 5}{2\\cdot 4\\cdot 6}\\right)^2\\frac{e^6}{5} - \\cdots}\\right] \\\\    &= 2\\pi a \\left[1 - \\sum_{n=1}^\\infty \\left(\\frac{(2n-1)!!}{(2n)!!}\\right)^2 \\frac{e^{2n}}{2n-1}\\right] \\\\    &= -2\\pi a \\sum_{n=0}^\\infty \\left(\\frac{(2n-1)!!}{(2n)!!}\\right)^2 \\frac{e^{2n}}{2n-1},\\end{align}", "\\pi a b", "", "\\pi", "= 2", "e", "\\pi a^2", "\\pi b^2" ],
  "isPartOf" : [ "\\begin{align}  C &= 2\\pi a \\left[{1 - \\left(\\frac{1}{2}\\right)^2e^2 - \\left(\\frac{1\\cdot 3}{2\\cdot 4}\\right)^2\\frac{e^4}{3} - \\left(\\frac{1\\cdot 3\\cdot 5}{2\\cdot 4\\cdot 6}\\right)^2\\frac{e^6}{5} - \\cdots}\\right] \\\\    &= 2\\pi a \\left[1 - \\sum_{n=1}^\\infty \\left(\\frac{(2n-1)!!}{(2n)!!}\\right)^2 \\frac{e^{2n}}{2n-1}\\right] \\\\    &= -2\\pi a \\sum_{n=0}^\\infty \\left(\\frac{(2n-1)!!}{(2n)!!}\\right)^2 \\frac{e^{2n}}{2n-1},\\end{align}" ],
  "definiens" : [ ]
}

Specify your own input