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_n^{(\alpha,\beta)}(\cos \theta) = n^{-\frac{1}{2}}k(\theta)\cos (N\theta + \gamma) + O \left (n^{-\frac{3}{2}} \right ),}

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

Semantic latex: \JacobipolyP{\alpha}{\beta}{n}@{\cos \theta} = n^{-\frac{1}{2}} k(\theta) \cos(N \theta + \gamma) + O(n^{-\frac{3}{2}})

Confidence: 0.70338171203013

Mathematica

Translation: JacobiP[n, \[Alpha], \[Beta], Cos[\[Theta]]] == (n)^(-Divide[1,2])* k[\[Theta]]* Cos[N*\[Theta]+ \[Gamma]]+ O[(n)^(-Divide[3,2])]

Information

Sub Equations

  • JacobiP[n, \[Alpha], \[Beta], Cos[\[Theta]]] = (n)^(-Divide[1,2])* k[\[Theta]]* Cos[N*\[Theta]+ \[Gamma]]+ O[(n)^(-Divide[3,2])]

Free variables

  • N
  • \[Alpha]
  • \[Beta]
  • \[Gamma]
  • \[Theta]
  • n

Symbol info

  • Cosine; Example: \cos@@{z}

Will be translated to: Cos[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 Mathematica: https://reference.wolfram.com/language/ref/Cos.html

  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Could be the Euler-Mascheroni constant.

But it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant! Use the DLMF-Macro \EulerConstant to translate \gamma as a constant.

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic

Test expression: (JacobiP[n, \[Alpha], \[Beta], Cos[\[Theta]]])-((n)^(-Divide[1,2])* k*(\[Theta])*Cos[N*\[Theta]+ \[Gamma]]+ O*((n)^(-Divide[3,2])))

ERROR:

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

SymPy

Translation: jacobi(n, Symbol('alpha'), Symbol('beta'), cos(Symbol('theta'))) == (n)**(-(1)/(2))* k(Symbol('theta'))* cos(N*Symbol('theta')+ Symbol('gamma'))+ O((n)**(-(3)/(2)))

Information

Sub Equations

  • jacobi(n, Symbol('alpha'), Symbol('beta'), cos(Symbol('theta'))) = (n)**(-(1)/(2))* k(Symbol('theta'))* cos(N*Symbol('theta')+ Symbol('gamma'))+ O((n)**(-(3)/(2)))

Free variables

  • N
  • Symbol('alpha')
  • Symbol('beta')
  • Symbol('gamma')
  • Symbol('theta')
  • n

Symbol info

  • Cosine; Example: \cos@@{z}

Will be translated to: cos($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos

  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Could be the Euler-Mascheroni constant.

But it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant! Use the DLMF-Macro \EulerConstant to translate \gamma as a constant.

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Maple

Translation: JacobiP(n, alpha, beta, cos(theta)) = (n)^(-(1)/(2))* k(theta)* cos(N*theta + gamma)+ O((n)^(-(3)/(2)))

Information

Sub Equations

  • JacobiP(n, alpha, beta, cos(theta)) = (n)^(-(1)/(2))* k(theta)* cos(N*theta + gamma)+ O((n)^(-(3)/(2)))

Free variables

  • N
  • alpha
  • beta
  • gamma
  • n
  • theta

Symbol info

  • Cosine; Example: \cos@@{z}

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

  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Could be the Euler-Mascheroni constant.

But it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant! Use the DLMF-Macro \EulerConstant to translate \gamma as a constant.

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • Darboux formula
  • asymptotic
  • interior
  • interval
  • term

Complete translation information:

{
  "id" : "FORMULA_9dc229093c0cfe263c966e50e7f0a24a",
  "formula" : "P_n^{(\\alpha,\\beta)}(\\cos \\theta) = n^{-\\frac{1}{2}}k(\\theta)\\cos (N\\theta + \\gamma) + O \\left (n^{-\\frac{3}{2}} \\right )",
  "semanticFormula" : "\\JacobipolyP{\\alpha}{\\beta}{n}@{\\cos \\theta} = n^{-\\frac{1}{2}} k(\\theta) \\cos(N \\theta + \\gamma) + O(n^{-\\frac{3}{2}})",
  "confidence" : 0.7033817120301267,
  "translations" : {
    "Mathematica" : {
      "translation" : "JacobiP[n, \\[Alpha], \\[Beta], Cos[\\[Theta]]] == (n)^(-Divide[1,2])* k[\\[Theta]]* Cos[N*\\[Theta]+ \\[Gamma]]+ O[(n)^(-Divide[3,2])]",
      "translationInformation" : {
        "subEquations" : [ "JacobiP[n, \\[Alpha], \\[Beta], Cos[\\[Theta]]] = (n)^(-Divide[1,2])* k[\\[Theta]]* Cos[N*\\[Theta]+ \\[Gamma]]+ O[(n)^(-Divide[3,2])]" ],
        "freeVariables" : [ "N", "\\[Alpha]", "\\[Beta]", "\\[Gamma]", "\\[Theta]", "n" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: Cos[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E2\nMathematica:  https://reference.wolfram.com/language/ref/Cos.html",
          "\\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",
          "k" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\gamma" : "Could be the Euler-Mascheroni constant.\nBut it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant!\nUse the DLMF-Macro \\EulerConstant to translate \\gamma as a constant.\n",
          "\\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",
          "O" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      },
      "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[n, \\[Alpha], \\[Beta], Cos[\\[Theta]]]",
          "rhs" : "(n)^(-Divide[1,2])* k*(\\[Theta])*Cos[N*\\[Theta]+ \\[Gamma]]+ O*((n)^(-Divide[3,2]))",
          "testExpression" : "(JacobiP[n, \\[Alpha], \\[Beta], Cos[\\[Theta]]])-((n)^(-Divide[1,2])* k*(\\[Theta])*Cos[N*\\[Theta]+ \\[Gamma]]+ O*((n)^(-Divide[3,2])))",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "jacobi(n, Symbol('alpha'), Symbol('beta'), cos(Symbol('theta'))) == (n)**(-(1)/(2))* k(Symbol('theta'))* cos(N*Symbol('theta')+ Symbol('gamma'))+ O((n)**(-(3)/(2)))",
      "translationInformation" : {
        "subEquations" : [ "jacobi(n, Symbol('alpha'), Symbol('beta'), cos(Symbol('theta'))) = (n)**(-(1)/(2))* k(Symbol('theta'))* cos(N*Symbol('theta')+ Symbol('gamma'))+ O((n)**(-(3)/(2)))" ],
        "freeVariables" : [ "N", "Symbol('alpha')", "Symbol('beta')", "Symbol('gamma')", "Symbol('theta')", "n" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos",
          "\\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",
          "k" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\gamma" : "Could be the Euler-Mascheroni constant.\nBut it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant!\nUse the DLMF-Macro \\EulerConstant to translate \\gamma as a constant.\n",
          "\\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",
          "O" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      }
    },
    "Maple" : {
      "translation" : "JacobiP(n, alpha, beta, cos(theta)) = (n)^(-(1)/(2))* k(theta)* cos(N*theta + gamma)+ O((n)^(-(3)/(2)))",
      "translationInformation" : {
        "subEquations" : [ "JacobiP(n, alpha, beta, cos(theta)) = (n)^(-(1)/(2))* k(theta)* cos(N*theta + gamma)+ O((n)^(-(3)/(2)))" ],
        "freeVariables" : [ "N", "alpha", "beta", "gamma", "n", "theta" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cos",
          "\\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",
          "k" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\gamma" : "Could be the Euler-Mascheroni constant.\nBut it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant!\nUse the DLMF-Macro \\EulerConstant to translate \\gamma as a constant.\n",
          "\\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",
          "O" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      }
    }
  },
  "positions" : [ {
    "section" : 11,
    "sentence" : 0,
    "word" : 21
  } ],
  "includes" : [ "\\alpha,\\beta", "n", "P_{n}^{(\\alpha, \\beta)}", "P_{n}^{(\\alpha, \\beta)}(x)", "k", "O" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "Darboux formula",
    "score" : 0.722
  }, {
    "definition" : "asymptotic",
    "score" : 0.6859086196238077
  }, {
    "definition" : "interior",
    "score" : 0.6460746792928004
  }, {
    "definition" : "interval",
    "score" : 0.6460746792928004
  }, {
    "definition" : "term",
    "score" : 0.5988174995334326
  } ]
}

Specify your own input