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 \sum_{n=0}^\infty P_n^{(\alpha,\beta)}(z) t^n = 2^{\alpha + \beta} R^{-1} (1 - t + R)^{-\alpha} (1 + t + R)^{-\beta}, }

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

Semantic latex: \sum_{n=0}^\infty \JacobipolyP{\alpha}{\beta}{n}@{z} t^n = 2^{\alpha + \beta} R^{-1}(1 - t + R)^{-\alpha}(1 + t + R)^{-\beta}

Confidence: 0.89530287320794

Mathematica

Translation: Sum[JacobiP[n, \[Alpha], \[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None] == (2)^(\[Alpha]+ \[Beta])* (R)^(- 1)*(1 - t + R)^(- \[Alpha])*(1 + t + R)^(- \[Beta])

Information

Sub Equations

  • Sum[JacobiP[n, \[Alpha], \[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None] = (2)^(\[Alpha]+ \[Beta])* (R)^(- 1)*(1 - t + R)^(- \[Alpha])*(1 + t + R)^(- \[Beta])

Free variables

  • R
  • \[Alpha]
  • \[Beta]
  • t
  • z

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

  • 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.

Tests

Symbolic

Test expression: (Sum[JacobiP[n, \[Alpha], \[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None])-((2)^(\[Alpha]+ \[Beta])* (R)^(- 1)*(1 - t + R)^(- \[Alpha])*(1 + t + R)^(- \[Beta]))

ERROR:

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

SymPy

Translation: Sum(jacobi(n, Symbol('alpha'), Symbol('beta'), z)*(t)**(n), (n, 0, oo)) == (2)**(Symbol('alpha')+ Symbol('beta'))* (R)**(- 1)*(1 - t + R)**(- Symbol('alpha'))*(1 + t + R)**(- Symbol('beta'))

Information

Sub Equations

  • Sum(jacobi(n, Symbol('alpha'), Symbol('beta'), z)*(t)**(n), (n, 0, oo)) = (2)**(Symbol('alpha')+ Symbol('beta'))* (R)**(- 1)*(1 - t + R)**(- Symbol('alpha'))*(1 + t + R)**(- Symbol('beta'))

Free variables

  • R
  • Symbol('alpha')
  • Symbol('beta')
  • t
  • z

Symbol info

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

Will be translated to: jacobi($2, $0, $1, $3) Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r2 SymPy: https://docs.sympy.org/latest/modules/functions/special.html#jacobi-polynomials

  • 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.

Tests

Symbolic
Numeric

Maple

Translation: sum(JacobiP(n, alpha, beta, z)*(t)^(n), n = 0..infinity) = (2)^(alpha + beta)* (R)^(- 1)*(1 - t + R)^(- alpha)*(1 + t + R)^(- beta)

Information

Sub Equations

  • sum(JacobiP(n, alpha, beta, z)*(t)^(n), n = 0..infinity) = (2)^(alpha + beta)* (R)^(- 1)*(1 - t + R)^(- alpha)*(1 + t + R)^(- beta)

Free variables

  • R
  • alpha
  • beta
  • t
  • z

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

  • 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.

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • function of the Jacobi polynomial
  • branch of square root

Complete translation information:

{
  "id" : "FORMULA_43e16b736c3ae9163cfddd4918b3c9b8",
  "formula" : "\\sum_{n=0}^\\infty P_n^{(\\alpha,\\beta)}(z) t^n = 2^{\\alpha + \\beta} R^{-1} (1 - t + R)^{-\\alpha} (1 + t + R)^{-\\beta}",
  "semanticFormula" : "\\sum_{n=0}^\\infty \\JacobipolyP{\\alpha}{\\beta}{n}@{z} t^n = 2^{\\alpha + \\beta} R^{-1}(1 - t + R)^{-\\alpha}(1 + t + R)^{-\\beta}",
  "confidence" : 0.8953028732079359,
  "translations" : {
    "Mathematica" : {
      "translation" : "Sum[JacobiP[n, \\[Alpha], \\[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None] == (2)^(\\[Alpha]+ \\[Beta])* (R)^(- 1)*(1 - t + R)^(- \\[Alpha])*(1 + t + R)^(- \\[Beta])",
      "translationInformation" : {
        "subEquations" : [ "Sum[JacobiP[n, \\[Alpha], \\[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None] = (2)^(\\[Alpha]+ \\[Beta])* (R)^(- 1)*(1 - t + R)^(- \\[Alpha])*(1 + t + R)^(- \\[Beta])" ],
        "freeVariables" : [ "R", "\\[Alpha]", "\\[Beta]", "t", "z" ],
        "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",
          "\\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"
        }
      },
      "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" : "Sum[JacobiP[n, \\[Alpha], \\[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None]",
          "rhs" : "(2)^(\\[Alpha]+ \\[Beta])* (R)^(- 1)*(1 - t + R)^(- \\[Alpha])*(1 + t + R)^(- \\[Beta])",
          "testExpression" : "(Sum[JacobiP[n, \\[Alpha], \\[Beta], z]*(t)^(n), {n, 0, Infinity}, GenerateConditions->None])-((2)^(\\[Alpha]+ \\[Beta])* (R)^(- 1)*(1 - t + R)^(- \\[Alpha])*(1 + t + R)^(- \\[Beta]))",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "Sum(jacobi(n, Symbol('alpha'), Symbol('beta'), z)*(t)**(n), (n, 0, oo)) == (2)**(Symbol('alpha')+ Symbol('beta'))* (R)**(- 1)*(1 - t + R)**(- Symbol('alpha'))*(1 + t + R)**(- Symbol('beta'))",
      "translationInformation" : {
        "subEquations" : [ "Sum(jacobi(n, Symbol('alpha'), Symbol('beta'), z)*(t)**(n), (n, 0, oo)) = (2)**(Symbol('alpha')+ Symbol('beta'))* (R)**(- 1)*(1 - t + R)**(- Symbol('alpha'))*(1 + t + R)**(- Symbol('beta'))" ],
        "freeVariables" : [ "R", "Symbol('alpha')", "Symbol('beta')", "t", "z" ],
        "tokenTranslations" : {
          "\\JacobipolyP" : "Jacobi polynomial; Example: \\JacobipolyP{\\alpha}{\\beta}{n}@{x}\nWill be translated to: jacobi($2, $0, $1, $3)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/18.3#T1.t1.r2\nSymPy: https://docs.sympy.org/latest/modules/functions/special.html#jacobi-polynomials",
          "\\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"
        }
      }
    },
    "Maple" : {
      "translation" : "sum(JacobiP(n, alpha, beta, z)*(t)^(n), n = 0..infinity) = (2)^(alpha + beta)* (R)^(- 1)*(1 - t + R)^(- alpha)*(1 + t + R)^(- beta)",
      "translationInformation" : {
        "subEquations" : [ "sum(JacobiP(n, alpha, beta, z)*(t)^(n), n = 0..infinity) = (2)^(alpha + beta)* (R)^(- 1)*(1 - t + R)^(- alpha)*(1 + t + R)^(- beta)" ],
        "freeVariables" : [ "R", "alpha", "beta", "t", "z" ],
        "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",
          "\\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"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 10,
    "sentence" : 0,
    "word" : 10
  } ],
  "includes" : [ "n=m", "\\alpha,\\beta", "n", "P_{n}^{(\\alpha, \\beta)}", "P_{n}^{(\\alpha, \\beta)}(x)", "z" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "function of the Jacobi polynomial",
    "score" : 0.6859086196238077
  }, {
    "definition" : "branch of square root",
    "score" : 0.5988174995334326
  } ]
}

Specify your own input