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 P_1^{(\alpha,\beta)}(z)= (\alpha+1) + (\alpha+\beta+2)\frac{z-1}{2},}

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

Semantic latex: \JacobipolyP{\alpha}{\beta}{1}@{z} =(\alpha + 1) +(\alpha + \beta + 2) \frac{z-1}{2}

Confidence: 0.70338171203013

Mathematica

Translation: JacobiP[1, \[Alpha], \[Beta], z] == (\[Alpha]+ 1)+(\[Alpha]+ \[Beta]+ 2)*Divide[z - 1,2]

Information

Sub Equations

  • JacobiP[1, \[Alpha], \[Beta], z] = (\[Alpha]+ 1)+(\[Alpha]+ \[Beta]+ 2)*Divide[z - 1,2]

Free variables

  • \[Alpha]
  • \[Beta]
  • 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: (JacobiP[1, \[Alpha], \[Beta], z])-((\[Alpha]+ 1)+(\[Alpha]+ \[Beta]+ 2)*Divide[z - 1,2])

ERROR:

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

SymPy

Translation: jacobi(1, Symbol('alpha'), Symbol('beta'), z) == (Symbol('alpha')+ 1)+(Symbol('alpha')+ Symbol('beta')+ 2)*(z - 1)/(2)

Information

Sub Equations

  • jacobi(1, Symbol('alpha'), Symbol('beta'), z) = (Symbol('alpha')+ 1)+(Symbol('alpha')+ Symbol('beta')+ 2)*(z - 1)/(2)

Free variables

  • Symbol('alpha')
  • Symbol('beta')
  • 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: JacobiP(1, alpha, beta, z) = (alpha + 1)+(alpha + beta + 2)*(z - 1)/(2)

Information

Sub Equations

  • JacobiP(1, alpha, beta, z) = (alpha + 1)+(alpha + beta + 2)*(z - 1)/(2)

Free variables

  • alpha
  • beta
  • 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

Complete translation information:

{
  "id" : "FORMULA_ca61fa237002fce94643d9197732d667",
  "formula" : "P_1^{(\\alpha,\\beta)}(z)= (\\alpha+1) + (\\alpha+\\beta+2)\\frac{z-1}{2}",
  "semanticFormula" : "\\JacobipolyP{\\alpha}{\\beta}{1}@{z} =(\\alpha + 1) +(\\alpha + \\beta + 2) \\frac{z-1}{2}",
  "confidence" : 0.7033817120301267,
  "translations" : {
    "Mathematica" : {
      "translation" : "JacobiP[1, \\[Alpha], \\[Beta], z] == (\\[Alpha]+ 1)+(\\[Alpha]+ \\[Beta]+ 2)*Divide[z - 1,2]",
      "translationInformation" : {
        "subEquations" : [ "JacobiP[1, \\[Alpha], \\[Beta], z] = (\\[Alpha]+ 1)+(\\[Alpha]+ \\[Beta]+ 2)*Divide[z - 1,2]" ],
        "freeVariables" : [ "\\[Alpha]", "\\[Beta]", "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" : "JacobiP[1, \\[Alpha], \\[Beta], z]",
          "rhs" : "(\\[Alpha]+ 1)+(\\[Alpha]+ \\[Beta]+ 2)*Divide[z - 1,2]",
          "testExpression" : "(JacobiP[1, \\[Alpha], \\[Beta], z])-((\\[Alpha]+ 1)+(\\[Alpha]+ \\[Beta]+ 2)*Divide[z - 1,2])",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "jacobi(1, Symbol('alpha'), Symbol('beta'), z) == (Symbol('alpha')+ 1)+(Symbol('alpha')+ Symbol('beta')+ 2)*(z - 1)/(2)",
      "translationInformation" : {
        "subEquations" : [ "jacobi(1, Symbol('alpha'), Symbol('beta'), z) = (Symbol('alpha')+ 1)+(Symbol('alpha')+ Symbol('beta')+ 2)*(z - 1)/(2)" ],
        "freeVariables" : [ "Symbol('alpha')", "Symbol('beta')", "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" : "JacobiP(1, alpha, beta, z) = (alpha + 1)+(alpha + beta + 2)*(z - 1)/(2)",
      "translationInformation" : {
        "subEquations" : [ "JacobiP(1, alpha, beta, z) = (alpha + 1)+(alpha + beta + 2)*(z - 1)/(2)" ],
        "freeVariables" : [ "alpha", "beta", "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" : 4,
    "sentence" : 0,
    "word" : 2
  } ],
  "includes" : [ "P_{n}^{(\\alpha, \\beta)}(x)", "P_{n}^{(\\alpha, \\beta)}", "\\alpha,\\beta", "z" ],
  "isPartOf" : [ ],
  "definiens" : [ ]
}

Specify your own input