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{erf}^{(k)}(z) = \frac{2 (-1)^{k-1}}{\sqrt{\pi}} \mathit{H}_{k-1}(z) e^{-z^2} = \frac{2}{\sqrt{\pi}} \frac{d^{k-1}}{dz^{k-1}} \left(e^{-z^2}\right),\qquad k=1, 2, \dots}

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

Semantic latex: \operatorname{erf}(z)^{(k)} = \frac{2 (-1)^{k-1}}{\sqrt{\cpi}} \mathit{H}_{k-1}(z) \expe^{-z^2} = \frac{2}{\sqrt{\cpi}} \deriv [{k-1}]{ }{z}(\expe^{-z^2}) , \qquad k = 1 , 2 , \dots

Confidence: 0

Mathematica

Translation: (erf[z])^(k) == Divide[2*(- 1)^(k - 1),Sqrt[Pi]]*Subscript[H, k - 1][z]* Exp[- (z)^(2)] == Divide[2,Sqrt[Pi]]*D[Exp[- (z)^(2)], {z, k - 1}]

Information

Sub Equations

  • (erf[z])^(k) = Divide[2*(- 1)^(k - 1),Sqrt[Pi]]*Subscript[H, k - 1][z]* Exp[- (z)^(2)]
  • Divide[2*(- 1)^(k - 1),Sqrt[Pi]]*Subscript[H, k - 1][z]* Exp[- (z)^(2)] = Divide[2,Sqrt[Pi]]*D[Exp[- (z)^(2)], {z, k - 1}]

Free variables

  • k
  • z

Constraints

  • k == 1 , 2 , \[Ellipsis]

Symbol info

  • Was interpreted as a function call because of a leading \operatorname.
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: D[$1, {$2, $0}] Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 Mathematica: https://reference.wolfram.com/language/ref/D.html

  • Pi was translated to: Pi
  • Recognizes e with power as the exponential function. It was translated as a function.

Tests

Symbolic
Numeric

SymPy

Translation: (erf(z))**(k) == (2*(- 1)**(k - 1))/(sqrt(pi))*Symbol('{H}_{k - 1}')(z)* exp(- (z)**(2)) == (2)/(sqrt(pi))*diff(exp(- (z)**(2)), z, k - 1)

Information

Sub Equations

  • (erf(z))**(k) = (2*(- 1)**(k - 1))/(sqrt(pi))*Symbol('{H}_{k - 1}')(z)* exp(- (z)**(2))
  • (2*(- 1)**(k - 1))/(sqrt(pi))*Symbol('{H}_{k - 1}')(z)* exp(- (z)**(2)) = (2)/(sqrt(pi))*diff(exp(- (z)**(2)), z, k - 1)

Free variables

  • k
  • z

Constraints

  • k == 1 , 2 , null

Symbol info

  • Was interpreted as a function call because of a leading \operatorname.
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: diff($1, $2, $0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 SymPy: https://docs.sympy.org/latest/tutorial/calculus.html#derivatives

  • Pi was translated to: pi
  • Recognizes e with power as the exponential function. It was translated as a function.

Tests

Symbolic
Numeric

Maple

Translation: (erf(z))^(k) = (2*(- 1)^(k - 1))/(sqrt(Pi))*H[k - 1](z)* exp(- (z)^(2)) = (2)/(sqrt(Pi))*diff(exp(- (z)^(2)), [z$(k - 1)])

Information

Sub Equations

  • (erf(z))^(k) = (2*(- 1)^(k - 1))/(sqrt(Pi))*H[k - 1](z)* exp(- (z)^(2))
  • (2*(- 1)^(k - 1))/(sqrt(Pi))*H[k - 1](z)* exp(- (z)^(2)) = (2)/(sqrt(Pi))*diff(exp(- (z)^(2)), [z$(k - 1)])

Free variables

  • k
  • z

Constraints

  • k = 1 , 2 , ..

Symbol info

  • Was interpreted as a function call because of a leading \operatorname.
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: diff($1, [$2$($0)]) Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 Maple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=diff

  • Pi was translated to: Pi
  • Recognizes e with power as the exponential function. It was translated as a function.

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

  • Failed to parse (syntax error): {\displaystyle ^2} =}
  • Failed to parse (syntax error): {\displaystyle ^2}}
  • Failed to parse (syntax error): {\displaystyle ^2})}

Description

  • z
  • k-1
  • e
  • frac
  • pi
  • sqrt
  • TeX Source
  • dot
  • d
  • dz
  • erf
  • Formula
  • Gold ID
  • h
  • k
  • link
  • mathit
  • operatorname
  • qquad k
  • right

Complete translation information:

{
  "id" : "FORMULA_523ec091d0929f0fa69ae7e0d563a72b",
  "formula" : "\\operatorname{erf}^{(k)}(z) = \\frac{2 (-1)^{k-1}}{\\sqrt{\\pi}} \\mathit{H}_{k-1}(z) e^{-z^2} = \\frac{2}{\\sqrt{\\pi}}  \\frac{d^{k-1}}{dz^{k-1}} \\left(e^{-z^2}\\right),\\qquad k=1, 2, \\dots",
  "semanticFormula" : "\\operatorname{erf}(z)^{(k)} = \\frac{2 (-1)^{k-1}}{\\sqrt{\\cpi}} \\mathit{H}_{k-1}(z) \\expe^{-z^2} = \\frac{2}{\\sqrt{\\cpi}} \\deriv [{k-1}]{ }{z}(\\expe^{-z^2}) , \\qquad k = 1 , 2 , \\dots",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "(erf[z])^(k) == Divide[2*(- 1)^(k - 1),Sqrt[Pi]]*Subscript[H, k - 1][z]* Exp[- (z)^(2)] == Divide[2,Sqrt[Pi]]*D[Exp[- (z)^(2)], {z, k - 1}]",
      "translationInformation" : {
        "subEquations" : [ "(erf[z])^(k) = Divide[2*(- 1)^(k - 1),Sqrt[Pi]]*Subscript[H, k - 1][z]* Exp[- (z)^(2)]", "Divide[2*(- 1)^(k - 1),Sqrt[Pi]]*Subscript[H, k - 1][z]* Exp[- (z)^(2)] = Divide[2,Sqrt[Pi]]*D[Exp[- (z)^(2)], {z, k - 1}]" ],
        "freeVariables" : [ "k", "z" ],
        "constraints" : [ "k == 1 , 2 , \\[Ellipsis]" ],
        "tokenTranslations" : {
          "erf" : "Was interpreted as a function call because of a leading \\operatorname.",
          "H" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: D[$1, {$2, $0}]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/1.4#E4\nMathematica:  https://reference.wolfram.com/language/ref/D.html",
          "\\cpi" : "Pi was translated to: Pi",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function."
        }
      },
      "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" : "(erf(z))**(k) == (2*(- 1)**(k - 1))/(sqrt(pi))*Symbol('{H}_{k - 1}')(z)* exp(- (z)**(2)) == (2)/(sqrt(pi))*diff(exp(- (z)**(2)), z, k - 1)",
      "translationInformation" : {
        "subEquations" : [ "(erf(z))**(k) = (2*(- 1)**(k - 1))/(sqrt(pi))*Symbol('{H}_{k - 1}')(z)* exp(- (z)**(2))", "(2*(- 1)**(k - 1))/(sqrt(pi))*Symbol('{H}_{k - 1}')(z)* exp(- (z)**(2)) = (2)/(sqrt(pi))*diff(exp(- (z)**(2)), z, k - 1)" ],
        "freeVariables" : [ "k", "z" ],
        "constraints" : [ "k == 1 , 2 , null" ],
        "tokenTranslations" : {
          "erf" : "Was interpreted as a function call because of a leading \\operatorname.",
          "H" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: diff($1, $2, $0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/1.4#E4\nSymPy: https://docs.sympy.org/latest/tutorial/calculus.html#derivatives",
          "\\cpi" : "Pi was translated to: pi",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function."
        }
      },
      "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" : "(erf(z))^(k) = (2*(- 1)^(k - 1))/(sqrt(Pi))*H[k - 1](z)* exp(- (z)^(2)) = (2)/(sqrt(Pi))*diff(exp(- (z)^(2)), [z$(k - 1)])",
      "translationInformation" : {
        "subEquations" : [ "(erf(z))^(k) = (2*(- 1)^(k - 1))/(sqrt(Pi))*H[k - 1](z)* exp(- (z)^(2))", "(2*(- 1)^(k - 1))/(sqrt(Pi))*H[k - 1](z)* exp(- (z)^(2)) = (2)/(sqrt(Pi))*diff(exp(- (z)^(2)), [z$(k - 1)])" ],
        "freeVariables" : [ "k", "z" ],
        "constraints" : [ "k = 1 , 2 , .." ],
        "tokenTranslations" : {
          "erf" : "Was interpreted as a function call because of a leading \\operatorname.",
          "H" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: diff($1, [$2$($0)])\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/1.4#E4\nMaple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=diff",
          "\\cpi" : "Pi was translated to: Pi",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function."
        }
      },
      "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" : [ "^2} =", "^2}", "=1, 2", "^2})", "= 1 , 2" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "z",
    "score" : 0.8978226479818687
  }, {
    "definition" : "k-1",
    "score" : 0.8698995277174995
  }, {
    "definition" : "e",
    "score" : 0.8059983425015494
  }, {
    "definition" : "frac",
    "score" : 0.8059983425015494
  }, {
    "definition" : "pi",
    "score" : 0.8059983425015494
  }, {
    "definition" : "sqrt",
    "score" : 0.8059983425015494
  }, {
    "definition" : "TeX Source",
    "score" : 0.722
  }, {
    "definition" : "dot",
    "score" : 0.6805096216023825
  }, {
    "definition" : "d",
    "score" : 0.6538197307349187
  }, {
    "definition" : "dz",
    "score" : 0.6538197307349187
  }, {
    "definition" : "erf",
    "score" : 0.6538197307349187
  }, {
    "definition" : "Formula",
    "score" : 0.6538197307349187
  }, {
    "definition" : "Gold ID",
    "score" : 0.6538197307349187
  }, {
    "definition" : "h",
    "score" : 0.6538197307349187
  }, {
    "definition" : "k",
    "score" : 0.6538197307349187
  }, {
    "definition" : "link",
    "score" : 0.6538197307349187
  }, {
    "definition" : "mathit",
    "score" : 0.6538197307349187
  }, {
    "definition" : "operatorname",
    "score" : 0.6538197307349187
  }, {
    "definition" : "qquad k",
    "score" : 0.6538197307349187
  }, {
    "definition" : "right",
    "score" : 0.6538197307349187
  } ]
}

Specify your own input