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{H}_\alpha(z) = \sum_{m=0}^\infty \frac{(-1)^m}{\Gamma \left (m+\frac{3}{2} \right ) \Gamma \left (m+\alpha+\frac{3}{2} \right )} \left({\frac{z}{2}}\right)^{2m+\alpha+1},}

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

Semantic latex: \StruveH{\alpha}@{z} = \sum_{m=0}^\infty \frac{(-1)^m}{\EulerGamma@{m + \frac{3}{2}} \EulerGamma@{m + \alpha + \frac{3}{2}}}({\frac{z}{2}})^{2m+\alpha+1}

Confidence: 0.85867763172474

Mathematica

Translation: StruveH[\[Alpha], z] == Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \[Alpha]+ 1), {m, 0, Infinity}, GenerateConditions->None]

Information

Sub Equations

  • StruveH[\[Alpha], z] = Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \[Alpha]+ 1), {m, 0, Infinity}, GenerateConditions->None]

Free variables

  • \[Alpha]
  • z

Symbol info

  • Could be the second Feigenbaum constant.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Struve function; Example: \StruveH{\nu}@{z}

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

  • Euler Gamma function; Example: \EulerGamma@{z}

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

Tests

Symbolic

Test expression: (StruveH[\[Alpha], z])-(Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \[Alpha]+ 1), {m, 0, Infinity}, 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: \StruveH [\StruveH]

Tests

Symbolic
Numeric

Maple

Translation: StruveH(alpha, z) = sum(((- 1)^(m))/(GAMMA(m +(3)/(2))*GAMMA(m + alpha +(3)/(2)))*((z)/(2))^(2*m + alpha + 1), m = 0..infinity)

Information

Sub Equations

  • StruveH(alpha, z) = sum(((- 1)^(m))/(GAMMA(m +(3)/(2))*GAMMA(m + alpha +(3)/(2)))*((z)/(2))^(2*m + alpha + 1), m = 0..infinity)

Free variables

  • alpha
  • z

Symbol info

  • Could be the second Feigenbaum constant.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Struve function; Example: \StruveH{\nu}@{z}

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

  • Euler Gamma function; Example: \EulerGamma@{z}

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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • gamma function
  • power series
  • Struve

Complete translation information:

{
  "id" : "FORMULA_7a2f8e9616a5d6155cf21f91fe6bf5e1",
  "formula" : "\\mathbf{H}_\\alpha(z) = \\sum_{m=0}^\\infty \\frac{(-1)^m}{\\Gamma \\left (m+\\frac{3}{2} \\right ) \\Gamma \\left (m+\\alpha+\\frac{3}{2} \\right )} \\left({\\frac{z}{2}}\\right)^{2m+\\alpha+1}",
  "semanticFormula" : "\\StruveH{\\alpha}@{z} = \\sum_{m=0}^\\infty \\frac{(-1)^m}{\\EulerGamma@{m + \\frac{3}{2}} \\EulerGamma@{m + \\alpha + \\frac{3}{2}}}({\\frac{z}{2}})^{2m+\\alpha+1}",
  "confidence" : 0.858677631724739,
  "translations" : {
    "Mathematica" : {
      "translation" : "StruveH[\\[Alpha], z] == Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \\[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \\[Alpha]+ 1), {m, 0, Infinity}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "StruveH[\\[Alpha], z] = Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \\[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \\[Alpha]+ 1), {m, 0, Infinity}, GenerateConditions->None]" ],
        "freeVariables" : [ "\\[Alpha]", "z" ],
        "tokenTranslations" : {
          "\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\StruveH" : "Struve function; Example: \\StruveH{\\nu}@{z}\nWill be translated to: StruveH[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/11.2#E1\nMathematica:  https://reference.wolfram.com/language/ref/StruveH.html",
          "\\EulerGamma" : "Euler Gamma function; Example: \\EulerGamma@{z}\nWill be translated to: Gamma[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/5.2#E1\nMathematica:  https://reference.wolfram.com/language/ref/Gamma.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" : "StruveH[\\[Alpha], z]",
          "rhs" : "Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \\[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \\[Alpha]+ 1), {m, 0, Infinity}, GenerateConditions->None]",
          "testExpression" : "(StruveH[\\[Alpha], z])-(Sum[Divide[(- 1)^(m),Gamma[m +Divide[3,2]]*Gamma[m + \\[Alpha]+Divide[3,2]]]*(Divide[z,2])^(2*m + \\[Alpha]+ 1), {m, 0, Infinity}, 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: \\StruveH [\\StruveH]"
        }
      }
    },
    "Maple" : {
      "translation" : "StruveH(alpha, z) = sum(((- 1)^(m))/(GAMMA(m +(3)/(2))*GAMMA(m + alpha +(3)/(2)))*((z)/(2))^(2*m + alpha + 1), m = 0..infinity)",
      "translationInformation" : {
        "subEquations" : [ "StruveH(alpha, z) = sum(((- 1)^(m))/(GAMMA(m +(3)/(2))*GAMMA(m + alpha +(3)/(2)))*((z)/(2))^(2*m + alpha + 1), m = 0..infinity)" ],
        "freeVariables" : [ "alpha", "z" ],
        "tokenTranslations" : {
          "\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\StruveH" : "Struve function; Example: \\StruveH{\\nu}@{z}\nWill be translated to: StruveH($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/11.2#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=StruveH",
          "\\EulerGamma" : "Euler Gamma function; Example: \\EulerGamma@{z}\nWill be translated to: GAMMA($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/5.2#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=GAMMA"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 2,
    "sentence" : 0,
    "word" : 11
  } ],
  "includes" : [ "\\mathbf{K}_\\alpha(x)", "\\mathbf{L}_{\\alpha}(x)", "\\alpha", "\\mathbf{H}_{\\alpha}(z)", "\\mathbf{H}_{\\alpha}(x)", "\\mathbf{M}_\\alpha(x)", "\\Gamma(z)", "Y_{\\alpha}(x)" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "gamma function",
    "score" : 0.7125985104912714
  }, {
    "definition" : "power series",
    "score" : 0.6460746792928004
  }, {
    "definition" : "Struve",
    "score" : 0.6460746792928004
  } ]
}

Specify your own input