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 C_n^{(\alpha)}(x) = \frac{(2\alpha)_n}{(\alpha+\frac{1}{2})_{n}}P_n^{(\alpha-1/2,\alpha-1/2)}(x).}

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

Semantic latex: \ultrasphpoly{\alpha}{n}@{x} = \frac{\Pochhammersym{2 \alpha}{n}}{\Pochhammersym{\alpha + \frac{1}{2}}{n}} \JacobipolyP{\alpha - 1 / 2}{\alpha - 1 / 2}{n}@{x}

Confidence: 0.74750232869021

Mathematica

Translation: GegenbauerC[n, \[Alpha], x] == Divide[Pochhammer[2*\[Alpha], n],Pochhammer[\[Alpha]+Divide[1,2], n]]*JacobiP[n, \[Alpha]- 1/2, \[Alpha]- 1/2, x]

Information

Sub Equations

  • GegenbauerC[n, \[Alpha], x] = Divide[Pochhammer[2*\[Alpha], n],Pochhammer[\[Alpha]+Divide[1,2], n]]*JacobiP[n, \[Alpha]- 1/2, \[Alpha]- 1/2, x]

Free variables

  • \[Alpha]
  • n
  • x

Symbol info

  • Jacobi polynomial; Example: \JacobipolyP{\alpha}{\beta}{n}@{x}

Will be translated to: JacobiP[$2, $0, $1, $3] Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r2 Mathematica: https://reference.wolfram.com/language/ref/JacobiP.html?q=JacobiP

  • Ultraspherical Gegenbauer polynomial; Example: \ultrasphpoly{\lambda}{n}@{x}

Will be translated to: GegenbauerC[$1, $0, $2] Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r3 Mathematica: https://reference.wolfram.com/language/ref/GegenbauerC.html

  • Could be the second Feigenbaum constant.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Pochhammer symbol; Example: \Pochhammersym{a}{n}

Will be translated to: Pochhammer[$0, $1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/5.2#iii Mathematica: https://reference.wolfram.com/language/ref/Pochhammer.html

Tests

Symbolic

Test expression: (GegenbauerC[n, \[Alpha], x])-(Divide[Pochhammer[2*\[Alpha], n],Pochhammer[\[Alpha]+Divide[1,2], n]]*JacobiP[n, \[Alpha]- 1/2, \[Alpha]- 1/2, x])

ERROR:

{
    "result": "ERROR",
    "testTitle": "Simple",
    "testExpression": null,
    "resultExpression": null,
    "wasAborted": false,
    "conditionallySuccessful": false
}
Numeric

SymPy

Translation:

Information

Symbol info

  • (LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \ultrasphpoly [\ultrasphpoly]

Tests

Symbolic
Numeric

Maple

Translation: GegenbauerC(n, alpha, x) = (pochhammer(2*alpha, n))/(pochhammer(alpha +(1)/(2), n))*JacobiP(n, alpha - 1/2, alpha - 1/2, x)

Information

Sub Equations

  • GegenbauerC(n, alpha, x) = (pochhammer(2*alpha, n))/(pochhammer(alpha +(1)/(2), n))*JacobiP(n, alpha - 1/2, alpha - 1/2, x)

Free variables

  • alpha
  • n
  • x

Symbol info

  • Jacobi polynomial; Example: \JacobipolyP{\alpha}{\beta}{n}@{x}

Will be translated to: JacobiP($2, $0, $1, $3) Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=JacobiP

  • Ultraspherical Gegenbauer polynomial; Example: \ultrasphpoly{\lambda}{n}@{x}

Will be translated to: GegenbauerC($1, $0, $2) Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r3 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=GegenbauerC

  • Could be the second Feigenbaum constant.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Pochhammer symbol; Example: \Pochhammersym{a}{n}

Will be translated to: pochhammer($0, $1) Relevant links to definitions: DLMF: http://dlmf.nist.gov/5.2#iii Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=pochhammer

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • special case of the Jacobi polynomial

Complete translation information:

{
  "id" : "FORMULA_987c5c425e1be53500b40f2724d8e681",
  "formula" : "C_n^{(\\alpha)}(x) = \\frac{(2\\alpha)_n}{(\\alpha+\\frac{1}{2})_{n}}P_n^{(\\alpha-1/2,\\alpha-1/2)}(x)",
  "semanticFormula" : "\\ultrasphpoly{\\alpha}{n}@{x} = \\frac{\\Pochhammersym{2 \\alpha}{n}}{\\Pochhammersym{\\alpha + \\frac{1}{2}}{n}} \\JacobipolyP{\\alpha - 1 / 2}{\\alpha - 1 / 2}{n}@{x}",
  "confidence" : 0.7475023286902113,
  "translations" : {
    "Mathematica" : {
      "translation" : "GegenbauerC[n, \\[Alpha], x] == Divide[Pochhammer[2*\\[Alpha], n],Pochhammer[\\[Alpha]+Divide[1,2], n]]*JacobiP[n, \\[Alpha]- 1/2, \\[Alpha]- 1/2, x]",
      "translationInformation" : {
        "subEquations" : [ "GegenbauerC[n, \\[Alpha], x] = Divide[Pochhammer[2*\\[Alpha], n],Pochhammer[\\[Alpha]+Divide[1,2], n]]*JacobiP[n, \\[Alpha]- 1/2, \\[Alpha]- 1/2, x]" ],
        "freeVariables" : [ "\\[Alpha]", "n", "x" ],
        "tokenTranslations" : {
          "\\JacobipolyP" : "Jacobi polynomial; Example: \\JacobipolyP{\\alpha}{\\beta}{n}@{x}\nWill be translated to: JacobiP[$2, $0, $1, $3]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/18.3#T1.t1.r2\nMathematica:  https://reference.wolfram.com/language/ref/JacobiP.html?q=JacobiP",
          "\\ultrasphpoly" : "Ultraspherical Gegenbauer polynomial; Example: \\ultrasphpoly{\\lambda}{n}@{x}\nWill be translated to: GegenbauerC[$1, $0, $2]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/18.3#T1.t1.r3\nMathematica:  https://reference.wolfram.com/language/ref/GegenbauerC.html",
          "\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\Pochhammersym" : "Pochhammer symbol; Example: \\Pochhammersym{a}{n}\nWill be translated to: Pochhammer[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/5.2#iii\nMathematica:  https://reference.wolfram.com/language/ref/Pochhammer.html"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "ERROR",
        "numberOfTests" : 1,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 1,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "GegenbauerC[n, \\[Alpha], x]",
          "rhs" : "Divide[Pochhammer[2*\\[Alpha], n],Pochhammer[\\[Alpha]+Divide[1,2], n]]*JacobiP[n, \\[Alpha]- 1/2, \\[Alpha]- 1/2, x]",
          "testExpression" : "(GegenbauerC[n, \\[Alpha], x])-(Divide[Pochhammer[2*\\[Alpha], n],Pochhammer[\\[Alpha]+Divide[1,2], n]]*JacobiP[n, \\[Alpha]- 1/2, \\[Alpha]- 1/2, x])",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "",
      "translationInformation" : {
        "tokenTranslations" : {
          "Error" : "(LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \\ultrasphpoly [\\ultrasphpoly]"
        }
      }
    },
    "Maple" : {
      "translation" : "GegenbauerC(n, alpha, x) = (pochhammer(2*alpha, n))/(pochhammer(alpha +(1)/(2), n))*JacobiP(n, alpha - 1/2, alpha - 1/2, x)",
      "translationInformation" : {
        "subEquations" : [ "GegenbauerC(n, alpha, x) = (pochhammer(2*alpha, n))/(pochhammer(alpha +(1)/(2), n))*JacobiP(n, alpha - 1/2, alpha - 1/2, x)" ],
        "freeVariables" : [ "alpha", "n", "x" ],
        "tokenTranslations" : {
          "\\JacobipolyP" : "Jacobi polynomial; Example: \\JacobipolyP{\\alpha}{\\beta}{n}@{x}\nWill be translated to: JacobiP($2, $0, $1, $3)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/18.3#T1.t1.r2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=JacobiP",
          "\\ultrasphpoly" : "Ultraspherical Gegenbauer polynomial; Example: \\ultrasphpoly{\\lambda}{n}@{x}\nWill be translated to: GegenbauerC($1, $0, $2)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/18.3#T1.t1.r3\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=GegenbauerC",
          "\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\Pochhammersym" : "Pochhammer symbol; Example: \\Pochhammersym{a}{n}\nWill be translated to: pochhammer($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/5.2#iii\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=pochhammer"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 1,
    "sentence" : 9,
    "word" : 9
  } ],
  "includes" : [ "C_{n}^{(\\alpha)}(x)", "(2\\alpha)_{n}", "\\alpha", "n", "(\\theta)_n" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "special case of the Jacobi polynomial",
    "score" : 0.7125985104912714
  } ]
}

Specify your own input