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 \int_{-1}^1 P_n(x)\,dx = 0 \text{ for } n\ge1,}

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

Semantic latex: \int_{-1}^1 \LegendrepolyP{n}@{x} \diff{x} = 0 for n \ge 1

Confidence: 0.72556733422884

Mathematica

Translation: Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None] == 0*f*o*r*n >= 1

Information

Sub Equations

  • Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None] = 0*f*o*r*n
  • 0*f*o*r*n >= 1

Free variables

  • f
  • n
  • o
  • r

Symbol info

  • Legendre polynomial; Example: \LegendrepolyP{n}@{x}

Will be translated to: LegendreP[$0, $1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r10 Mathematica: https://reference.wolfram.com/language/ref/LegendreP.html

Tests

Symbolic

Test expression: (Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None])-(0*f*o*r*n)

ERROR:

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

Test expression: 0*f*o*r*n\geq1

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

Tests

Symbolic
Numeric

Maple

Translation: int(LegendreP(n, x), x = - 1..1) = 0*f*o*r*n >= 1

Information

Sub Equations

  • int(LegendreP(n, x), x = - 1..1) = 0*f*o*r*n
  • 0*f*o*r*n >= 1

Free variables

  • f
  • n
  • o
  • r

Symbol info

  • Legendre polynomial; Example: \LegendrepolyP{n}@{x}

Will be translated to: LegendreP($0, $1) Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r10 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreP

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Is part of

Complete translation information:

{
  "id" : "FORMULA_19d856e47dc6350e3cc44ebb62d6dbc8",
  "formula" : "\\int_{-1}^1 P_n(x)dx = 0 \\text{ for } n\\ge1",
  "semanticFormula" : "\\int_{-1}^1 \\LegendrepolyP{n}@{x} \\diff{x} = 0 for n \\ge 1",
  "confidence" : 0.7255673342288351,
  "translations" : {
    "Mathematica" : {
      "translation" : "Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None] == 0*f*o*r*n >= 1",
      "translationInformation" : {
        "subEquations" : [ "Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None] = 0*f*o*r*n", "0*f*o*r*n >= 1" ],
        "freeVariables" : [ "f", "n", "o", "r" ],
        "tokenTranslations" : {
          "\\LegendrepolyP" : "Legendre polynomial; Example: \\LegendrepolyP{n}@{x}\nWill be translated to: LegendreP[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/18.3#T1.t1.r10\nMathematica:  https://reference.wolfram.com/language/ref/LegendreP.html"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "ERROR",
        "numberOfTests" : 2,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 2,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None]",
          "rhs" : "0*f*o*r*n",
          "testExpression" : "(Integrate[LegendreP[n, x], {x, - 1, 1}, GenerateConditions->None])-(0*f*o*r*n)",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        }, {
          "lhs" : "0*f*o*r*n",
          "rhs" : "1",
          "testExpression" : "0*f*o*r*n\\geq1",
          "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: \\LegendrepolyP [\\LegendrepolyP]"
        }
      }
    },
    "Maple" : {
      "translation" : "int(LegendreP(n, x), x = - 1..1) = 0*f*o*r*n >= 1",
      "translationInformation" : {
        "subEquations" : [ "int(LegendreP(n, x), x = - 1..1) = 0*f*o*r*n", "0*f*o*r*n >= 1" ],
        "freeVariables" : [ "f", "n", "o", "r" ],
        "tokenTranslations" : {
          "\\LegendrepolyP" : "Legendre polynomial; Example: \\LegendrepolyP{n}@{x}\nWill be translated to: LegendreP($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/18.3#T1.t1.r10\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreP"
        }
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "P", "n", "x", "P_{n}(x)", "P_n(x)", "P_n", "Q_n", "\\int_{-1}^1 P_n(x)\\,dx = 0 \\text{ for } n\\ge1", "P_m" ],
  "isPartOf" : [ "\\int_{-1}^1 P_n(x)\\,dx = 0 \\text{ for } n\\ge1" ],
  "definiens" : [ ]
}

Specify your own input