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_{3}^{2}(x)=15x(1-x^2)}

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

Semantic latex: \assLegendreP[2]{3}@{x} = 15 x(1 - x^2)

Confidence: 0.77035532448677

Mathematica

Translation: LegendreP[3, 2, 3, x] == 15*x*(1 - (x)^(2))

Information

Sub Equations

  • LegendreP[3, 2, 3, x] = 15*x*(1 - (x)^(2))

Free variables

  • x

Symbol info

  • associated Legendre polynomial of the first kind; Example: \assLegendreP[mu]{nu}@{z}

Will be translated to: LegendreP[$1, $0, 3, $2] Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.21#Ex1 Mathematica: https://reference.wolfram.com/language/ref/LegendreP.html

Tests

Symbolic

Test expression: (LegendreP[3, 2, 3, x])-(15*x*(1 - (x)^(2)))

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

Tests

Symbolic
Numeric

Maple

Translation: LegendreP(3, 2, x) = 15*x*(1 - (x)^(2))

Information

Sub Equations

  • LegendreP(3, 2, x) = 15*x*(1 - (x)^(2))

Free variables

  • x

Symbol info

  • associated Legendre polynomial of the first kind; Example: \assLegendreP[mu]{nu}@{z}

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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • Legendre function
  • negative value

Complete translation information:

{
  "id" : "FORMULA_0691eac040cc0adf81be5ce568096d79",
  "formula" : "P_{3}^{2}(x)=15x(1-x^2)",
  "semanticFormula" : "\\assLegendreP[2]{3}@{x} = 15 x(1 - x^2)",
  "confidence" : 0.7703553244867746,
  "translations" : {
    "Mathematica" : {
      "translation" : "LegendreP[3, 2, 3, x] == 15*x*(1 - (x)^(2))",
      "translationInformation" : {
        "subEquations" : [ "LegendreP[3, 2, 3, x] = 15*x*(1 - (x)^(2))" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\assLegendreP1" : "associated Legendre polynomial of the first kind; Example: \\assLegendreP[mu]{nu}@{z}\nWill be translated to: LegendreP[$1, $0, 3, $2]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/14.21#Ex1\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" : 1,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 1,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "LegendreP[3, 2, 3, x]",
          "rhs" : "15*x*(1 - (x)^(2))",
          "testExpression" : "(LegendreP[3, 2, 3, x])-(15*x*(1 - (x)^(2)))",
          "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: \\assLegendreP [\\assLegendreP]"
        }
      }
    },
    "Maple" : {
      "translation" : "LegendreP(3, 2, x) = 15*x*(1 - (x)^(2))",
      "translationInformation" : {
        "subEquations" : [ "LegendreP(3, 2, x) = 15*x*(1 - (x)^(2))" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\assLegendreP1" : "associated Legendre polynomial of the first kind; Example: \\assLegendreP[mu]{nu}@{z}\nWill be translated to: LegendreP($1, $0, $2)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/14.21#Ex1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreP"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 7,
    "sentence" : 0,
    "word" : 31
  } ],
  "includes" : [ "P_{\\ell}^{m}", "P_\\ell^{m}(x)", "P", "P_\\lambda^{\\mu}(z)" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "Legendre function",
    "score" : 0.6859086196238077
  }, {
    "definition" : "negative value",
    "score" : 0.5988174995334326
  } ]
}

Specify your own input