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) = \begin{cases} \frac{1}{2} \log \frac{1+x}{1-x} & n = 0 \\ P_1(x) Q_0(x) - 1 & n = 1 \\ \frac{2n-1}{n} x Q_{n-1}(x) - \frac{n-1}{n} Q_{n-2}(x) & n \geq 2 \,. \end{cases} }

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

Semantic latex: \assLegendreQ{n}@{x} = \begin{cases}\frac{1}{2} \log \frac{1+x}{1-x} & n = 0 \LegendrepolyP{1}@{x} \assLegendreQ{0}@{x} - 1 n = 1 \frac{2n-1}{n} x \assLegendreQ{n-1}@{x} - \frac{n-1}{n} \assLegendreQ{n-2}@{x} n \geq 2 .\end{cases}

Confidence: 0.63080360740902

Mathematica

Translation: LegendreQ[n, 0, 3, x] ==

Information

Free variables

  • n
  • x

Symbol info

  • 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
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) =

Information

Free variables

  • n
  • x

Symbol info

  • 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

Is part of

Complete translation information:

{
  "id" : "FORMULA_4ad16ba52f07a0747cc1caf916ae6d51",
  "formula" : "Q_n(x)\n=\n\\begin{cases}\n  \\frac{1}{2} \\log \\frac{1+x}{1-x}\n  & n = 0\n  \\\\\n  P_1(x) Q_0(x) - 1\n  & n = 1\n  \\\\\n  \\frac{2n-1}{n} x Q_{n-1}(x) - \\frac{n-1}{n} Q_{n-2}(x)\n  & n \\geq 2 .\n\\end{cases}",
  "semanticFormula" : "\\assLegendreQ{n}@{x} = \\begin{cases}\\frac{1}{2} \\log \\frac{1+x}{1-x}\n  & n = 0 \\LegendrepolyP{1}@{x} \\assLegendreQ{0}@{x} - 1 n = 1 \\frac{2n-1}{n} x \\assLegendreQ{n-1}@{x} - \\frac{n-1}{n} \\assLegendreQ{n-2}@{x} n \\geq 2 .\\end{cases}",
  "confidence" : 0.6308036074090242,
  "translations" : {
    "Mathematica" : {
      "translation" : "LegendreQ[n, 0, 3, x] == ",
      "translationInformation" : {
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "\\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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "SymPy" : {
      "translation" : "",
      "translationInformation" : {
        "tokenTranslations" : {
          "Error" : "(LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \\assLegendreQ [\\assLegendreQ]"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "Maple" : {
      "translation" : "LegendreQ(n, x) = ",
      "translationInformation" : {
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "\\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"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "Q_n(x)=\\begin{cases}  \\frac{1}{2} \\log \\frac{1+x}{1-x}  & n = 0  \\\\  P_1(x) Q_0(x) - 1  & n = 1  \\\\  \\frac{2n-1}{n} x Q_{n-1}(x) - \\frac{n-1}{n} Q_{n-2}(x)  & n \\geq 2 \\,.\\end{cases}", "P_{n}", "Q", "P_s", "P", "Q_{n}", "-1" ],
  "isPartOf" : [ "Q_n(x)=\\begin{cases}  \\frac{1}{2} \\log \\frac{1+x}{1-x}  & n = 0  \\\\  P_1(x) Q_0(x) - 1  & n = 1  \\\\  \\frac{2n-1}{n} x Q_{n-1}(x) - \\frac{n-1}{n} Q_{n-2}(x)  & n \\geq 2 \\,.\\end{cases}" ],
  "definiens" : [ ]
}

Specify your own input