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(x)=\frac{n!}{1\cdot3\cdots(2n+1)}\left(x^{-(n+1)}+\frac{(n+1)(n+2)}{2(2n+3)}x^{-(n+3)}+\frac{(n+1)(n+2)(n+3)(n+4)}{2\cdot4(2n+3)(2n+5)}x^{-(n+5)}+\cdots\right)}

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

Semantic latex: \assLegendreQ{n}@{x} = \frac{n!}{1\cdot3\cdots(2n+1)}(x^{-(n+1)} + \frac{(n+1)(n+2)}{2(2n+3)} x^{-(n+3)} + \frac{(n+1)(n+2)(n+3)(n+4)}{2\cdot4(2n+3)(2n+5)} x^{-(n+5)} + \cdots)

Confidence: 0.5398725926064

Mathematica

Translation: LegendreQ[n, 0, 3, x] == Divide[(n)!,1 * 3 \[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \[Ellipsis])

Information

Sub Equations

  • LegendreQ[n, 0, 3, x] = Divide[(n)!,1 * 3 \[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \[Ellipsis])

Free variables

  • n
  • x

Symbol info

  • was translated to: *
  • 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

Tests

Symbolic

Test expression: (LegendreQ[n, 0, 3, x])-(Divide[(n)!,1 * 3 \[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \[Ellipsis]))

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

Tests

Symbolic
Numeric

Maple

Translation: LegendreQ(n, x) = (factorial(n))/(1 * 3 .. (2*n + 1))*((x)^(-(n + 1))+((n + 1)*(n + 2))/(2*(2*n + 3))*(x)^(-(n + 3))+((n + 1)*(n + 2)*(n + 3)*(n + 4))/(2 * 4*(2*n + 3)*(2*n + 5))*(x)^(-(n + 5))+ ..)

Information

Sub Equations

  • LegendreQ(n, x) = (factorial(n))/(1 * 3 .. (2*n + 1))*((x)^(-(n + 1))+((n + 1)*(n + 2))/(2*(2*n + 3))*(x)^(-(n + 3))+((n + 1)*(n + 2)*(n + 3)*(n + 4))/(2 * 4*(2*n + 3)*(2*n + 5))*(x)^(-(n + 5))+ ..)

Free variables

  • n
  • x

Symbol info

  • was translated to: *
  • 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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • solution

Complete translation information:

{
  "id" : "FORMULA_964717a264b28b551e0186224fe79528",
  "formula" : "Q_n(x)=\\frac{n!}{1\\cdot3\\cdots(2n+1)}\\left(x^{-(n+1)}+\\frac{(n+1)(n+2)}{2(2n+3)}x^{-(n+3)}+\\frac{(n+1)(n+2)(n+3)(n+4)}{2\\cdot4(2n+3)(2n+5)}x^{-(n+5)}+\\cdots\\right)",
  "semanticFormula" : "\\assLegendreQ{n}@{x} = \\frac{n!}{1\\cdot3\\cdots(2n+1)}(x^{-(n+1)} + \\frac{(n+1)(n+2)}{2(2n+3)} x^{-(n+3)} + \\frac{(n+1)(n+2)(n+3)(n+4)}{2\\cdot4(2n+3)(2n+5)} x^{-(n+5)} + \\cdots)",
  "confidence" : 0.5398725926063954,
  "translations" : {
    "Mathematica" : {
      "translation" : "LegendreQ[n, 0, 3, x] == Divide[(n)!,1 * 3 \\[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \\[Ellipsis])",
      "translationInformation" : {
        "subEquations" : [ "LegendreQ[n, 0, 3, x] = Divide[(n)!,1 * 3 \\[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \\[Ellipsis])" ],
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "\\cdot" : "was translated to: *",
          "\\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"
        }
      },
      "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" : "LegendreQ[n, 0, 3, x]",
          "rhs" : "Divide[(n)!,1 * 3 \\[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \\[Ellipsis])",
          "testExpression" : "(LegendreQ[n, 0, 3, x])-(Divide[(n)!,1 * 3 \\[Ellipsis](2*n + 1)]*((x)^(-(n + 1))+Divide[(n + 1)*(n + 2),2*(2*n + 3)]*(x)^(-(n + 3))+Divide[(n + 1)*(n + 2)*(n + 3)*(n + 4),2 * 4*(2*n + 3)*(2*n + 5)]*(x)^(-(n + 5))+ \\[Ellipsis]))",
          "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: \\assLegendreQ [\\assLegendreQ]"
        }
      }
    },
    "Maple" : {
      "translation" : "LegendreQ(n, x) = (factorial(n))/(1 * 3 .. (2*n + 1))*((x)^(-(n + 1))+((n + 1)*(n + 2))/(2*(2*n + 3))*(x)^(-(n + 3))+((n + 1)*(n + 2)*(n + 3)*(n + 4))/(2 * 4*(2*n + 3)*(2*n + 5))*(x)^(-(n + 5))+ ..)",
      "translationInformation" : {
        "subEquations" : [ "LegendreQ(n, x) = (factorial(n))/(1 * 3 .. (2*n + 1))*((x)^(-(n + 1))+((n + 1)*(n + 2))/(2*(2*n + 3))*(x)^(-(n + 3))+((n + 1)*(n + 2)*(n + 3)*(n + 4))/(2 * 4*(2*n + 3)*(2*n + 5))*(x)^(-(n + 5))+ ..)" ],
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "\\cdot" : "was translated to: *",
          "\\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"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 3,
    "sentence" : 1,
    "word" : 4
  } ],
  "includes" : [ "P_{n}", "Q", "Q_{n}" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "solution",
    "score" : 0.722
  } ]
}

Specify your own input