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 t = \tan^2(\theta)}

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

Semantic latex: t = \tan^2(\theta)

Confidence: 0

Mathematica

Translation: t == (Tan[\[Theta]])^(2)

Information

Sub Equations

  • t = (Tan[\[Theta]])^(2)

Free variables

  • \[Theta]
  • t

Symbol info

  • Tangent; Example: \tan@@{z}

Will be translated to: Tan[$0] Constraints: z != (k+1/2)*\cpi \forall k \in \Integers Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E4 Mathematica: https://reference.wolfram.com/language/ref/Tan.html

Tests

Symbolic

Test expression: (t)-((Tan[\[Theta]])^(2))

ERROR:

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

SymPy

Translation: t == (tan(Symbol('theta')))**(2)

Information

Sub Equations

  • t = (tan(Symbol('theta')))**(2)

Free variables

  • Symbol('theta')
  • t

Symbol info

  • Tangent; Example: \tan@@{z}

Will be translated to: tan($0) Constraints: z != (k+1/2)*\cpi \forall k \in \Integers Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E4 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#tan

Tests

Symbolic
Numeric

Maple

Translation: t = (tan(theta))^(2)

Information

Sub Equations

  • t = (tan(theta))^(2)

Free variables

  • t
  • theta

Symbol info

  • Tangent; Example: \tan@@{z}

Will be translated to: tan($0) Constraints: z != (k+1/2)*\cpi \forall k \in \Integers Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E4 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=tan

Tests

Symbolic
Numeric

Dependency Graph Information

Description

  • second one

Complete translation information:

{
  "id" : "FORMULA_ceb7513adc1dec60819074f26c8c15d5",
  "formula" : "t = \\tan^2(\\theta)",
  "semanticFormula" : "t = \\tan^2(\\theta)",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "t == (Tan[\\[Theta]])^(2)",
      "translationInformation" : {
        "subEquations" : [ "t = (Tan[\\[Theta]])^(2)" ],
        "freeVariables" : [ "\\[Theta]", "t" ],
        "tokenTranslations" : {
          "\\tan" : "Tangent; Example: \\tan@@{z}\nWill be translated to: Tan[$0]\nConstraints: z != (k+1/2)*\\cpi \\forall k \\in \\Integers\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E4\nMathematica:  https://reference.wolfram.com/language/ref/Tan.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" : "t",
          "rhs" : "(Tan[\\[Theta]])^(2)",
          "testExpression" : "(t)-((Tan[\\[Theta]])^(2))",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "t == (tan(Symbol('theta')))**(2)",
      "translationInformation" : {
        "subEquations" : [ "t = (tan(Symbol('theta')))**(2)" ],
        "freeVariables" : [ "Symbol('theta')", "t" ],
        "tokenTranslations" : {
          "\\tan" : "Tangent; Example: \\tan@@{z}\nWill be translated to: tan($0)\nConstraints: z != (k+1/2)*\\cpi \\forall k \\in \\Integers\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E4\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#tan"
        }
      }
    },
    "Maple" : {
      "translation" : "t = (tan(theta))^(2)",
      "translationInformation" : {
        "subEquations" : [ "t = (tan(theta))^(2)" ],
        "freeVariables" : [ "t", "theta" ],
        "tokenTranslations" : {
          "\\tan" : "Tangent; Example: \\tan@@{z}\nWill be translated to: tan($0)\nConstraints: z != (k+1/2)*\\cpi \\forall k \\in \\Integers\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E4\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=tan"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 5,
    "sentence" : 1,
    "word" : 14
  } ],
  "includes" : [ ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "second one",
    "score" : 0.6859086196238077
  } ]
}

Specify your own input