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) = \frac{z^{\alpha+1}}{2^{\alpha}\sqrt{\pi} \Gamma \left (\alpha+\tfrac{3}{2} \right )} {}_1F_2 \left (1,\tfrac{3}{2}, \alpha+\tfrac{3}{2},-\tfrac{z^2}{4} \right ).}

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

Semantic latex: \StruveH{\alpha}@{z} = \frac{z^{\alpha+1}}{2^{\alpha} \sqrt{\cpi} \EulerGamma@{\alpha + \tfrac{3}{2}}}{}_1 F_2(1 , \tfrac{3}{2} , \alpha + \tfrac{3}{2} , - \tfrac{z^2}{4})

Confidence: 0.65998166233304

Mathematica

Translation: StruveH[\[Alpha], z] == Divide[(z)^(\[Alpha]+ 1),(2)^\[Alpha]*Sqrt[Pi]*Gamma[\[Alpha]+Divide[3,2]]]Subscript[, 1]*Subscript[F, 2][1 ,Divide[3,2], \[Alpha]+Divide[3,2], -Divide[(z)^(2),4]]

Information

Sub Equations

  • StruveH[\[Alpha], z] = Divide[(z)^(\[Alpha]+ 1),(2)^\[Alpha]*Sqrt[Pi]*Gamma[\[Alpha]+Divide[3,2]]]Subscript[, 1]*Subscript[F, 2][1 ,Divide[3,2], \[Alpha]+Divide[3,2], -Divide[(z)^(2),4]]

Free variables

  • \[Alpha]
  • z

Symbol info

  • 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

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • 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
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) = ((z)^(alpha + 1))/((2)^(alpha)*sqrt(Pi)*GAMMA(alpha +(3)/(2)))[1]*F[2](1 ,(3)/(2), alpha +(3)/(2), -((z)^(2))/(4))

Information

Sub Equations

  • StruveH(alpha, z) = ((z)^(alpha + 1))/((2)^(alpha)*sqrt(Pi)*GAMMA(alpha +(3)/(2)))[1]*F[2](1 ,(3)/(2), alpha +(3)/(2), -((z)^(2))/(4))

Free variables

  • alpha
  • z

Symbol info

  • 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

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • 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

  • hypergeometric function
  • Gauss
  • term
  • order
  • Struve

Complete translation information:

{
  "id" : "FORMULA_6dc2da7f595d2f199fbc15768167f006",
  "formula" : "\\mathbf{H}_{\\alpha}(z) = \\frac{z^{\\alpha+1}}{2^{\\alpha}\\sqrt{\\pi} \\Gamma \\left (\\alpha+\\tfrac{3}{2} \\right )} {}_1F_2 \\left (1,\\tfrac{3}{2}, \\alpha+\\tfrac{3}{2},-\\tfrac{z^2}{4} \\right )",
  "semanticFormula" : "\\StruveH{\\alpha}@{z} = \\frac{z^{\\alpha+1}}{2^{\\alpha} \\sqrt{\\cpi} \\EulerGamma@{\\alpha + \\tfrac{3}{2}}}{}_1 F_2(1 , \\tfrac{3}{2} , \\alpha + \\tfrac{3}{2} , - \\tfrac{z^2}{4})",
  "confidence" : 0.6599816623330422,
  "translations" : {
    "Mathematica" : {
      "translation" : "StruveH[\\[Alpha], z] == Divide[(z)^(\\[Alpha]+ 1),(2)^\\[Alpha]*Sqrt[Pi]*Gamma[\\[Alpha]+Divide[3,2]]]Subscript[, 1]*Subscript[F, 2][1 ,Divide[3,2], \\[Alpha]+Divide[3,2], -Divide[(z)^(2),4]]",
      "translationInformation" : {
        "subEquations" : [ "StruveH[\\[Alpha], z] = Divide[(z)^(\\[Alpha]+ 1),(2)^\\[Alpha]*Sqrt[Pi]*Gamma[\\[Alpha]+Divide[3,2]]]Subscript[, 1]*Subscript[F, 2][1 ,Divide[3,2], \\[Alpha]+Divide[3,2], -Divide[(z)^(2),4]]" ],
        "freeVariables" : [ "\\[Alpha]", "z" ],
        "tokenTranslations" : {
          "\\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",
          "\\cpi" : "Pi was translated to: Pi",
          "\\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",
          "F" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "SymPy" : {
      "translation" : "",
      "translationInformation" : {
        "tokenTranslations" : {
          "Error" : "(LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \\StruveH [\\StruveH]"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "Maple" : {
      "translation" : "StruveH(alpha, z) = ((z)^(alpha + 1))/((2)^(alpha)*sqrt(Pi)*GAMMA(alpha +(3)/(2)))[1]*F[2](1 ,(3)/(2), alpha +(3)/(2), -((z)^(2))/(4))",
      "translationInformation" : {
        "subEquations" : [ "StruveH(alpha, z) = ((z)^(alpha + 1))/((2)^(alpha)*sqrt(Pi)*GAMMA(alpha +(3)/(2)))[1]*F[2](1 ,(3)/(2), alpha +(3)/(2), -((z)^(2))/(4))" ],
        "freeVariables" : [ "alpha", "z" ],
        "tokenTranslations" : {
          "\\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",
          "\\cpi" : "Pi was translated to: Pi",
          "\\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",
          "F" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    }
  },
  "positions" : [ {
    "section" : 6,
    "sentence" : 2,
    "word" : 31
  } ],
  "includes" : [ "_{1}F_{2}", "\\mathbf{K}_\\alpha(x)", "\\alpha", "\\Gamma(z)", "\\mathbf{H}_{\\alpha}(x)", "\\mathbf{L}_{\\alpha}(x)", "\\mathbf{H}_{\\alpha}(z)", "Y_{\\alpha}(x)", "\\mathbf{M}_\\alpha(x)" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "hypergeometric function",
    "score" : 0.8692920440198258
  }, {
    "definition" : "Gauss",
    "score" : 0.6954080343007951
  }, {
    "definition" : "term",
    "score" : 0.6288842031023242
  }, {
    "definition" : "order",
    "score" : 0.48771694939097315
  }, {
    "definition" : "Struve",
    "score" : 0.48771694939097315
  } ]
}

Specify your own input