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 \operatorname{Si}(x)=\frac{\pi}{2}-f(x)\cos(x)-g(x)\sin(x)}

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

Semantic latex: \operatorname{Si}(x) = \frac{\cpi}{2} - \auxFresnelf@{x} \cos(x) - \auxFresnelg@{x} \sin(x)

Confidence: 0.65966666666667

Mathematica

Translation: Si[x] == Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x]

Information

Sub Equations

  • Si[x] = Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x]

Free variables

  • 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

  • Fresnel Auxiliaty Functions; Example: \auxFresnelg@{z}

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

  • Pi was translated to: Pi
  • Fresnel Auxiliaty Functions; Example: \auxFresnelf@{z}

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

  • Was interpreted as a function call because of a leading \operatorname.
  • Sine; Example: \sin@@{z}

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

Tests

Symbolic

Test expression: (Si[x])-(Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x])

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

Tests

Symbolic
Numeric

Maple

Translation: Si(x) = (Pi)/(2)- Fresnelf(x)*cos(x)- Fresnelg(x)*sin(x)

Information

Sub Equations

  • Si(x) = (Pi)/(2)- Fresnelf(x)*cos(x)- Fresnelg(x)*sin(x)

Free variables

  • 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

  • Fresnel Auxiliaty Functions; Example: \auxFresnelg@{z}

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

  • Pi was translated to: Pi
  • Fresnel Auxiliaty Functions; Example: \auxFresnelf@{z}

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

  • Was interpreted as a function call because of a leading \operatorname.
  • Sine; Example: \sin@@{z}

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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Complete translation information:

{
  "id" : "FORMULA_50457a94016b44c95c2a82957e097f50",
  "formula" : "\\operatorname{Si}(x)=\\frac{\\pi}{2}-f(x)\\cos(x)-g(x)\\sin(x)",
  "semanticFormula" : "\\operatorname{Si}(x) = \\frac{\\cpi}{2} - \\auxFresnelf@{x} \\cos(x) - \\auxFresnelg@{x} \\sin(x)",
  "confidence" : 0.6596666666666666,
  "translations" : {
    "Mathematica" : {
      "translation" : "Si[x] == Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x]",
      "translationInformation" : {
        "subEquations" : [ "Si[x] = Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x]" ],
        "freeVariables" : [ "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",
          "\\auxFresnelg" : "Fresnel Auxiliaty Functions; Example: \\auxFresnelg@{z}\nWill be translated to: FresnelG[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/7.2#E11\nMathematica:  https://reference.wolfram.com/language/ref/FresnelG.html",
          "\\cpi" : "Pi was translated to: Pi",
          "\\auxFresnelf" : "Fresnel Auxiliaty Functions; Example: \\auxFresnelf@{z}\nWill be translated to: FresnelF[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/7.2#E10\nMathematica:  https://reference.wolfram.com/language/ref/FresnelF.html",
          "Si" : "Was interpreted as a function call because of a leading \\operatorname.",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: Sin[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E1\nMathematica:  https://reference.wolfram.com/language/ref/Sin.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" : "Si[x]",
          "rhs" : "Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x]",
          "testExpression" : "(Si[x])-(Divide[Pi,2]- FresnelF[x]*Cos[x]- FresnelG[x]*Sin[x])",
          "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: \\auxFresnelf [\\auxFresnelf]"
        }
      }
    },
    "Maple" : {
      "translation" : "Si(x) = (Pi)/(2)- Fresnelf(x)*cos(x)- Fresnelg(x)*sin(x)",
      "translationInformation" : {
        "subEquations" : [ "Si(x) = (Pi)/(2)- Fresnelf(x)*cos(x)- Fresnelg(x)*sin(x)" ],
        "freeVariables" : [ "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",
          "\\auxFresnelg" : "Fresnel Auxiliaty Functions; Example: \\auxFresnelg@{z}\nWill be translated to: Fresnelg($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/7.2#E11\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Fresnelg",
          "\\cpi" : "Pi was translated to: Pi",
          "\\auxFresnelf" : "Fresnel Auxiliaty Functions; Example: \\auxFresnelf@{z}\nWill be translated to: Fresnelf($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/7.2#E10\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Fresnelf",
          "Si" : "Was interpreted as a function call because of a leading \\operatorname.",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: sin($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=sin"
        }
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "\\pi", "Si", "f(x)", "x", "Si(x)", "g(x)" ],
  "isPartOf" : [ ],
  "definiens" : [ ]
}

Specify your own input