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 \mathbf{J}_\nu(z)=\frac{1}{\pi} \int_0^\pi \cos (\nu\theta-z\sin\theta) \,d\theta}

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

Semantic latex: \AngerJ{\nu}@{z} = \frac{1}{\cpi} \int_0^{\cpi} \cos(\nu \theta - z \sin \theta) \diff{\theta}

Confidence: 0.70910057604668

Mathematica

Translation: AngerJ[\[Nu], z] == Divide[1,Pi]*Integrate[Cos[\[Nu]*\[Theta]- z*Sin[\[Theta]]], {\[Theta], 0, Pi}, GenerateConditions->None]

Information

Sub Equations

  • AngerJ[\[Nu], z] = Divide[1,Pi]*Integrate[Cos[\[Nu]*\[Theta]- z*Sin[\[Theta]]], {\[Theta], 0, Pi}, GenerateConditions->None]

Free variables

  • \[Nu]
  • z

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

  • Anger function; Example: \AngerJ{v}@{z}

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

  • Pi was translated to: Pi
  • 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: (AngerJ[\[Nu], z])-(Divide[1,Pi]*Integrate[Cos[\[Nu]*\[Theta]- z*Sin[\[Theta]]], {\[Theta], 0, Pi}, GenerateConditions->None])

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

Tests

Symbolic
Numeric

Maple

Translation: AngerJ(nu, z) = (1)/(Pi)*int(cos(nu*theta - z*sin(theta)), theta = 0..Pi)

Information

Sub Equations

  • AngerJ(nu, z) = (1)/(Pi)*int(cos(nu*theta - z*sin(theta)), theta = 0..Pi)

Free variables

  • nu
  • z

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

  • Anger function; Example: \AngerJ{v}@{z}

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

  • Pi was translated to: Pi
  • 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

Is part of

Complete translation information:

{
  "id" : "FORMULA_450922890270147d90f3cfc35d21d320",
  "formula" : "\\mathbf{J}_\\nu(z)=\\frac{1}{\\pi} \\int_0^\\pi \\cos (\\nu\\theta-z\\sin\\theta) d\\theta",
  "semanticFormula" : "\\AngerJ{\\nu}@{z} = \\frac{1}{\\cpi} \\int_0^{\\cpi} \\cos(\\nu \\theta - z \\sin \\theta) \\diff{\\theta}",
  "confidence" : 0.709100576046682,
  "translations" : {
    "Mathematica" : {
      "translation" : "AngerJ[\\[Nu], z] == Divide[1,Pi]*Integrate[Cos[\\[Nu]*\\[Theta]- z*Sin[\\[Theta]]], {\\[Theta], 0, Pi}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "AngerJ[\\[Nu], z] = Divide[1,Pi]*Integrate[Cos[\\[Nu]*\\[Theta]- z*Sin[\\[Theta]]], {\\[Theta], 0, Pi}, GenerateConditions->None]" ],
        "freeVariables" : [ "\\[Nu]", "z" ],
        "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",
          "\\AngerJ" : "Anger function; Example: \\AngerJ{v}@{z}\nWill be translated to: AngerJ[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/11.10#E1\nMathematica:  https://reference.wolfram.com/language/ref/AngerJ.html",
          "\\cpi" : "Pi was translated to: Pi",
          "\\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" : "AngerJ[\\[Nu], z]",
          "rhs" : "Divide[1,Pi]*Integrate[Cos[\\[Nu]*\\[Theta]- z*Sin[\\[Theta]]], {\\[Theta], 0, Pi}, GenerateConditions->None]",
          "testExpression" : "(AngerJ[\\[Nu], z])-(Divide[1,Pi]*Integrate[Cos[\\[Nu]*\\[Theta]- z*Sin[\\[Theta]]], {\\[Theta], 0, Pi}, GenerateConditions->None])",
          "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: \\AngerJ [\\AngerJ]"
        }
      }
    },
    "Maple" : {
      "translation" : "AngerJ(nu, z) = (1)/(Pi)*int(cos(nu*theta - z*sin(theta)), theta = 0..Pi)",
      "translationInformation" : {
        "subEquations" : [ "AngerJ(nu, z) = (1)/(Pi)*int(cos(nu*theta - z*sin(theta)), theta = 0..Pi)" ],
        "freeVariables" : [ "nu", "z" ],
        "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",
          "\\AngerJ" : "Anger function; Example: \\AngerJ{v}@{z}\nWill be translated to: AngerJ($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/11.10#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=AngerJ",
          "\\cpi" : "Pi was translated to: Pi",
          "\\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" : [ "\\mathbf{J}_{\\nu}", "\\mathbf{J}_\\nu(z)=\\frac{1}{\\pi} \\int_0^\\pi \\cos (\\nu\\theta-z\\sin\\theta) \\,d\\theta", "J_{\\nu}", "\\nu" ],
  "isPartOf" : [ "\\mathbf{J}_\\nu(z)=\\frac{1}{\\pi} \\int_0^\\pi \\cos (\\nu\\theta-z\\sin\\theta) \\,d\\theta" ],
  "definiens" : [ ]
}

Specify your own input