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 Q_n^{m}(x) = (-1)^m (1-x^2)^\frac{m}{2} \frac{\mathrm{d}^m}{\mathrm{d}x^m}Q_n(x)\,. }

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

Semantic latex: \assLegendreOlverQ[m]{n}@{x} =(- 1)^m(1 - x^2)^\frac{m}{2} \deriv [m]{ }{x} \assLegendreQ{n}@{x}

Confidence: 0.56076556462412

Mathematica

Translation: Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1] == (- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}]

Information

Sub Equations

  • Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1] = (- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}]

Free variables

  • m
  • n
  • x

Symbol info

  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: D[$1, {$2, $0}] Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 Mathematica: https://reference.wolfram.com/language/ref/D.html

  • Legendre function of second kind; Example: \assLegendreQ{\nu}@{z}

Will be translated to: LegendreQ[$0, 0, 3, $1] Branch Cuts: (-\infty, 1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.2#i Mathematica: https://reference.wolfram.com/language/ref/LegendreQ.html

  • Olver's associated Legendre function; Example: \assLegendreOlverQ[\mu]{\nu}@{z}

Will be translated to: Alternative translations: [Exp[-($0) Pi I] LegendreQ[$1, $0, 3, $2]/Gamma[$1 + $0 + 1]]Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.3#E10 Mathematica:

Tests

Symbolic

Test expression: (Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1])-((- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}])

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: \assLegendreOlverQ [\assLegendreOlverQ]

Tests

Symbolic
Numeric

Maple

Translation: exp(-(m)*Pi*I)*LegendreQ(n,m,x)/GAMMA(n+m+1) = (- 1)^(m)*(1 - (x)^(2))^((m)/(2))* diff(LegendreQ(n, x), [x$(m)])

Information

Sub Equations

  • exp(-(m)*Pi*I)*LegendreQ(n,m,x)/GAMMA(n+m+1) = (- 1)^(m)*(1 - (x)^(2))^((m)/(2))* diff(LegendreQ(n, x), [x$(m)])

Free variables

  • m
  • n
  • x

Symbol info

  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: diff($1, [$2$($0)]) Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 Maple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=diff

  • Legendre function of second kind; Example: \assLegendreQ{\nu}@{z}

Will be translated to: LegendreQ($0, $1) Branch Cuts: (-\infty, 1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.2#i Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreQ

  • Olver's associated Legendre function; Example: \assLegendreOlverQ[\mu]{\nu}@{z}

Will be translated to: exp(-($0)*Pi*I)*LegendreQ($1,$0,$2)/GAMMA($1+$0+1) Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.3#E10 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreQ

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Is part of

Complete translation information:

{
  "id" : "FORMULA_431033c7865a2b7913591f6f89fda419",
  "formula" : "Q_n^{m}(x)\n=\n(-1)^m (1-x^2)^\\frac{m}{2} \\frac{\\mathrm{d}^m}{\\mathrm{d}x^m}Q_n(x)",
  "semanticFormula" : "\\assLegendreOlverQ[m]{n}@{x} =(- 1)^m(1 - x^2)^\\frac{m}{2} \\deriv [m]{ }{x} \\assLegendreQ{n}@{x}",
  "confidence" : 0.5607655646241182,
  "translations" : {
    "Mathematica" : {
      "translation" : "Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1] == (- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}]",
      "translationInformation" : {
        "subEquations" : [ "Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1] = (- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}]" ],
        "freeVariables" : [ "m", "n", "x" ],
        "tokenTranslations" : {
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: D[$1, {$2, $0}]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/1.4#E4\nMathematica:  https://reference.wolfram.com/language/ref/D.html",
          "\\assLegendreQ" : "Legendre function of second kind; Example: \\assLegendreQ{\\nu}@{z}\nWill be translated to: LegendreQ[$0, 0, 3, $1]\nBranch Cuts: (-\\infty, 1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/14.2#i\nMathematica:  https://reference.wolfram.com/language/ref/LegendreQ.html",
          "\\assLegendreOlverQ1" : "Olver's associated Legendre function; Example: \\assLegendreOlverQ[\\mu]{\\nu}@{z}\nWill be translated to: \nAlternative translations: [Exp[-($0) Pi I] LegendreQ[$1, $0, 3, $2]/Gamma[$1 + $0 + 1]]Relevant links to definitions:\nDLMF:         http://dlmf.nist.gov/14.3#E10\nMathematica:  "
        }
      },
      "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" : "Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1]",
          "rhs" : "(- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}]",
          "testExpression" : "(Exp[-(m) Pi I] LegendreQ[n, m, 3, x]/Gamma[n + m + 1])-((- 1)^(m)*(1 - (x)^(2))^(Divide[m,2])* D[LegendreQ[n, 0, 3, x], {x, m}])",
          "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: \\assLegendreOlverQ [\\assLegendreOlverQ]"
        }
      }
    },
    "Maple" : {
      "translation" : "exp(-(m)*Pi*I)*LegendreQ(n,m,x)/GAMMA(n+m+1) = (- 1)^(m)*(1 - (x)^(2))^((m)/(2))* diff(LegendreQ(n, x), [x$(m)])",
      "translationInformation" : {
        "subEquations" : [ "exp(-(m)*Pi*I)*LegendreQ(n,m,x)/GAMMA(n+m+1) = (- 1)^(m)*(1 - (x)^(2))^((m)/(2))* diff(LegendreQ(n, x), [x$(m)])" ],
        "freeVariables" : [ "m", "n", "x" ],
        "tokenTranslations" : {
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: diff($1, [$2$($0)])\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/1.4#E4\nMaple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=diff",
          "\\assLegendreQ" : "Legendre function of second kind; Example: \\assLegendreQ{\\nu}@{z}\nWill be translated to: LegendreQ($0, $1)\nBranch Cuts: (-\\infty, 1]\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/14.2#i\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreQ",
          "\\assLegendreOlverQ1" : "Olver's associated Legendre function; Example: \\assLegendreOlverQ[\\mu]{\\nu}@{z}\nWill be translated to: exp(-($0)*Pi*I)*LegendreQ($1,$0,$2)/GAMMA($1+$0+1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/14.3#E10\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreQ"
        }
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "P_{n}", "Q", "Q_n^{m}(x)=(-1)^m (1-x^2)^\\frac{m}{2} \\frac{\\mathrm{d}^m}{\\mathrm{d}x^m}Q_n(x)\\,", "Q_{n}", "-1" ],
  "isPartOf" : [ "Q_n^{m}(x)=(-1)^m (1-x^2)^\\frac{m}{2} \\frac{\\mathrm{d}^m}{\\mathrm{d}x^m}Q_n(x)\\," ],
  "definiens" : [ ]
}

Specify your own input