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: \mathbf{H}_{\alpha}(z) = \frac{z^{\alpha+1}}{2^{\alpha} \sqrt{\cpi} \Gamma(\alpha + \tfrac{3}{2})}{}_1 F_2(1 , \tfrac{3}{2} , \alpha + \tfrac{3}{2} , - \tfrac{z^2}{4})

Confidence: 0

Mathematica

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

Information

Sub Equations

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

Free variables

  • \[Alpha]
  • \[CapitalGamma]
  • z

Symbol info

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

Tests

Symbolic
Numeric

SymPy

Translation: Symbol('{H}_{Symbol('alpha')}')(z) == ((z)**(Symbol('alpha')+ 1))/((2)**(Symbol('alpha'))*sqrt(pi)*Symbol('Gamma')*(Symbol('alpha')+(3)/(2)))Symbol('{}_{1}')*Symbol('{F}_{2}')(1 ,(3)/(2), Symbol('alpha')+(3)/(2), -((z)**(2))/(4))

Information

Sub Equations

  • Symbol('{H}_{Symbol('alpha')}')(z) = ((z)**(Symbol('alpha')+ 1))/((2)**(Symbol('alpha'))*sqrt(pi)*Symbol('Gamma')*(Symbol('alpha')+(3)/(2)))Symbol('{}_{1}')*Symbol('{F}_{2}')(1 ,(3)/(2), Symbol('alpha')+(3)/(2), -((z)**(2))/(4))

Free variables

  • Symbol('Gamma')
  • Symbol('alpha')
  • z

Symbol info

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

Tests

Symbolic
Numeric

Maple

Translation: H[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

  • H[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

  • Gamma
  • alpha
  • z

Symbol info

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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

  • Failed to parse (syntax error): {\displaystyle +1}}{2^{}
  • Failed to parse (syntax error): {\displaystyle ^2}{4}}
  • Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle {3}{2}}}{}1}
  • Failed to parse (syntax error): {\displaystyle ^2}{4})}
  • Failed to parse (syntax error): {\displaystyle {3}{2}}}}
  • Failed to parse (syntax error): {\displaystyle ^2}{4}}}

Description

  • alpha
  • z
  • right
  • tfrac
  • TeX Source
  • 1f_2
  • Formula
  • frac
  • Gamma
  • Gold ID
  • h
  • link
  • mathbf
  • pi
  • sqrt

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" : "\\mathbf{H}_{\\alpha}(z) = \\frac{z^{\\alpha+1}}{2^{\\alpha} \\sqrt{\\cpi} \\Gamma(\\alpha + \\tfrac{3}{2})}{}_1 F_2(1 , \\tfrac{3}{2} , \\alpha + \\tfrac{3}{2} , - \\tfrac{z^2}{4})",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "Subscript[H, \\[Alpha]][z] == Divide[(z)^(\\[Alpha]+ 1),(2)^\\[Alpha]*Sqrt[Pi]*\\[CapitalGamma]*(\\[Alpha]+Divide[3,2])]Subscript[, 1]*Subscript[F, 2][1 ,Divide[3,2], \\[Alpha]+Divide[3,2], -Divide[(z)^(2),4]]",
      "translationInformation" : {
        "subEquations" : [ "Subscript[H, \\[Alpha]][z] = Divide[(z)^(\\[Alpha]+ 1),(2)^\\[Alpha]*Sqrt[Pi]*\\[CapitalGamma]*(\\[Alpha]+Divide[3,2])]Subscript[, 1]*Subscript[F, 2][1 ,Divide[3,2], \\[Alpha]+Divide[3,2], -Divide[(z)^(2),4]]" ],
        "freeVariables" : [ "\\[Alpha]", "\\[CapitalGamma]", "z" ],
        "tokenTranslations" : {
          "H" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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)."
        }
      },
      "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" : "Symbol('{H}_{Symbol('alpha')}')(z) == ((z)**(Symbol('alpha')+ 1))/((2)**(Symbol('alpha'))*sqrt(pi)*Symbol('Gamma')*(Symbol('alpha')+(3)/(2)))Symbol('{}_{1}')*Symbol('{F}_{2}')(1 ,(3)/(2), Symbol('alpha')+(3)/(2), -((z)**(2))/(4))",
      "translationInformation" : {
        "subEquations" : [ "Symbol('{H}_{Symbol('alpha')}')(z) = ((z)**(Symbol('alpha')+ 1))/((2)**(Symbol('alpha'))*sqrt(pi)*Symbol('Gamma')*(Symbol('alpha')+(3)/(2)))Symbol('{}_{1}')*Symbol('{F}_{2}')(1 ,(3)/(2), Symbol('alpha')+(3)/(2), -((z)**(2))/(4))" ],
        "freeVariables" : [ "Symbol('Gamma')", "Symbol('alpha')", "z" ],
        "tokenTranslations" : {
          "H" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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)."
        }
      },
      "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" : "H[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" : [ "H[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" : [ "Gamma", "alpha", "z" ],
        "tokenTranslations" : {
          "H" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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)."
        }
      },
      "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" : 1,
    "sentence" : 0,
    "word" : 8
  } ],
  "includes" : [ "+1}}{2^{", "{3}{2}", "^2}{4}", "{3}{2}}}{}1", "^2}{4})", "{3}{2}}}", "{3}{2}}{-", "^2}{4}}" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "alpha",
    "score" : 0.934706119793645
  }, {
    "definition" : "z",
    "score" : 0.8835270181497158
  }, {
    "definition" : "right",
    "score" : 0.8144453757286602
  }, {
    "definition" : "tfrac",
    "score" : 0.8144453757286602
  }, {
    "definition" : "TeX Source",
    "score" : 0.722
  }, {
    "definition" : "1f_2",
    "score" : 0.657257825973014
  }, {
    "definition" : "Formula",
    "score" : 0.657257825973014
  }, {
    "definition" : "frac",
    "score" : 0.657257825973014
  }, {
    "definition" : "Gamma",
    "score" : 0.657257825973014
  }, {
    "definition" : "Gold ID",
    "score" : 0.657257825973014
  }, {
    "definition" : "h",
    "score" : 0.657257825973014
  }, {
    "definition" : "link",
    "score" : 0.657257825973014
  }, {
    "definition" : "mathbf",
    "score" : 0.657257825973014
  }, {
    "definition" : "pi",
    "score" : 0.657257825973014
  }, {
    "definition" : "sqrt",
    "score" : 0.657257825973014
  } ]
}

Specify your own input