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 = \exp \left(-\frac{1}{2k^2} \right) .}

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

Semantic latex: q = \exp(- \frac{1}{2k^2})

Confidence: 0

Mathematica

Translation: q == Exp[-Divide[1,2*(k)^(2)]]

Information

Sub Equations

  • q = Exp[-Divide[1,2*(k)^(2)]]

Free variables

  • k
  • q

Symbol info

  • Exponential function; Example: \exp@@{z}

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

Tests

Symbolic

Test expression: (q)-(Exp[-Divide[1,2*(k)^(2)]])

ERROR:

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

SymPy

Translation: q == exp(-(1)/(2*(k)**(2)))

Information

Sub Equations

  • q = exp(-(1)/(2*(k)**(2)))

Free variables

  • k
  • q

Symbol info

  • Exponential function; Example: \exp@@{z}

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

Tests

Symbolic
Numeric

Maple

Translation: q = exp(-(1)/(2*(k)^(2)))

Information

Sub Equations

  • q = exp(-(1)/(2*(k)^(2)))

Free variables

  • k
  • q

Symbol info

  • Exponential function; Example: \exp@@{z}

Will be translated to: exp($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E19 Maple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/Trace

Tests

Symbolic
Numeric

Dependency Graph Information

Description

  • polynomial
  • term of basic hypergeometric function
  • Pochhammer symbol

Complete translation information:

{
  "id" : "FORMULA_12cecd6c38c48006b123419d6c8721d6",
  "formula" : "q = \\exp \\left(-\\frac{1}{2k^2} \\right)",
  "semanticFormula" : "q = \\exp(- \\frac{1}{2k^2})",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "q == Exp[-Divide[1,2*(k)^(2)]]",
      "translationInformation" : {
        "subEquations" : [ "q = Exp[-Divide[1,2*(k)^(2)]]" ],
        "freeVariables" : [ "k", "q" ],
        "tokenTranslations" : {
          "\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: Exp[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.2#E19\nMathematica:  https://reference.wolfram.com/language/ref/Exp.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" : "q",
          "rhs" : "Exp[-Divide[1,2*(k)^(2)]]",
          "testExpression" : "(q)-(Exp[-Divide[1,2*(k)^(2)]])",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "q == exp(-(1)/(2*(k)**(2)))",
      "translationInformation" : {
        "subEquations" : [ "q = exp(-(1)/(2*(k)**(2)))" ],
        "freeVariables" : [ "k", "q" ],
        "tokenTranslations" : {
          "\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: exp($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.2#E19\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#exp"
        }
      }
    },
    "Maple" : {
      "translation" : "q = exp(-(1)/(2*(k)^(2)))",
      "translationInformation" : {
        "subEquations" : [ "q = exp(-(1)/(2*(k)^(2)))" ],
        "freeVariables" : [ "k", "q" ],
        "tokenTranslations" : {
          "\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: exp($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.2#E19\nMaple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/Trace"
        }
      }
    }
  },
  "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