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 x=\cos(\theta)}

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

Semantic latex: x=\cos(\theta)

Confidence: 0

Mathematica

Translation: x == Cos[\[Theta]]

Information

Sub Equations

  • x = Cos[\[Theta]]

Free variables

  • \[Theta]
  • x

Symbol info

  • Cosine; Example: \cos@@{z}

Will be translated to: Cos[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 Mathematica: https://reference.wolfram.com/language/ref/Cos.html

Tests

Symbolic

Test expression: (x)-(Cos[\[Theta]])

ERROR:

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

SymPy

Translation: x == cos(Symbol('theta'))

Information

Sub Equations

  • x = cos(Symbol('theta'))

Free variables

  • Symbol('theta')
  • x

Symbol info

  • Cosine; Example: \cos@@{z}

Will be translated to: cos($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos

Tests

Symbolic
Numeric

Maple

Translation: x = cos(theta)

Information

Sub Equations

  • x = cos(theta)

Free variables

  • theta
  • x

Symbol info

  • Cosine; Example: \cos@@{z}

Will be translated to: cos($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cos

Tests

Symbolic
Numeric

Dependency Graph Information

Description

  • polynomial
  • term of basic hypergeometric function
  • Pochhammer symbol

Complete translation information:

{
  "id" : "FORMULA_ed175092aefc6bdf61da55d2a9ba420b",
  "formula" : "x=\\cos(\\theta)",
  "semanticFormula" : "x=\\cos(\\theta)",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "x == Cos[\\[Theta]]",
      "translationInformation" : {
        "subEquations" : [ "x = Cos[\\[Theta]]" ],
        "freeVariables" : [ "\\[Theta]", "x" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: Cos[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E2\nMathematica:  https://reference.wolfram.com/language/ref/Cos.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" : "x",
          "rhs" : "Cos[\\[Theta]]",
          "testExpression" : "(x)-(Cos[\\[Theta]])",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "x == cos(Symbol('theta'))",
      "translationInformation" : {
        "subEquations" : [ "x = cos(Symbol('theta'))" ],
        "freeVariables" : [ "Symbol('theta')", "x" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos"
        }
      }
    },
    "Maple" : {
      "translation" : "x = cos(theta)",
      "translationInformation" : {
        "subEquations" : [ "x = cos(theta)" ],
        "freeVariables" : [ "theta", "x" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cos"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 1,
    "sentence" : 0,
    "word" : 18
  } ],
  "includes" : [ ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "polynomial",
    "score" : 0.6859086196238077
  }, {
    "definition" : "term of basic hypergeometric function",
    "score" : 0.6859086196238077
  }, {
    "definition" : "Pochhammer symbol",
    "score" : 0.5988174995334326
  } ]
}

Specify your own input