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{erfc}(x) = \frac{e^{-x^2}}{x\sqrt{\pi}}\left[1 + \sum_{n=1}^\infty (-1)^n \frac{1\cdot3\cdot5\cdots(2n - 1)}{(2x^2)^n}\right] = \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n - 1)!!}{(2x^2)^n},}

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

Semantic latex: \erfc@{x} = \frac{\expe^{-x^2}}{x \sqrt{\cpi}} [1 + \sum_{n=1}^\infty(- 1)^n \frac{1\cdot3\cdot5\cdots(2n - 1)}{(2x^2)^n}] = \frac{\expe^{-x^2}}{x \sqrt{\cpi}} \sum_{n=0}^\infty(- 1)^n \frac{(2n - 1)!!}{(2x^2)^n}

Confidence: 0.65849363980235

Mathematica

Translation: Erfc[x] == Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]) == Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 0, Infinity}, GenerateConditions->None]

Information

Sub Equations

  • Erfc[x] = Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None])
  • Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]) = Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 0, Infinity}, GenerateConditions->None]

Free variables

  • x

Symbol info

  • Pi was translated to: Pi
  • was translated to: *
  • Recognizes e with power as the exponential function. It was translated as a function.
  • Complementary error function; Example: \erfc@@{z}

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

Tests

Symbolic

Test expression: (Erfc[x])-(Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]))

ERROR:

{
    "result": "ERROR",
    "testTitle": "Simple",
    "testExpression": null,
    "resultExpression": null,
    "wasAborted": false,
    "conditionallySuccessful": false
}

Test expression: (Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]))-(Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 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: \erfc [\erfc]

Tests

Symbolic
Numeric

Maple

Translation: erfc(x) = (exp(- (x)^(2)))/(x*sqrt(Pi))*(1 + sum((- 1)^(n)*(1 * 3 * 5 .. (2*n - 1))/((2*(x)^(2))^(n)), n = 1..infinity)) = (exp(- (x)^(2)))/(x*sqrt(Pi))*sum((- 1)^(n)*(doublefactorial(2*n - 1))/((2*(x)^(2))^(n)), n = 0..infinity)

Information

Sub Equations

  • erfc(x) = (exp(- (x)^(2)))/(x*sqrt(Pi))*(1 + sum((- 1)^(n)*(1 * 3 * 5 .. (2*n - 1))/((2*(x)^(2))^(n)), n = 1..infinity))
  • (exp(- (x)^(2)))/(x*sqrt(Pi))*(1 + sum((- 1)^(n)*(1 * 3 * 5 .. (2*n - 1))/((2*(x)^(2))^(n)), n = 1..infinity)) = (exp(- (x)^(2)))/(x*sqrt(Pi))*sum((- 1)^(n)*(doublefactorial(2*n - 1))/((2*(x)^(2))^(n)), n = 0..infinity)

Free variables

  • x

Symbol info

  • Pi was translated to: Pi
  • was translated to: *
  • Recognizes e with power as the exponential function. It was translated as a function.
  • Complementary error function; Example: \erfc@@{z}

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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • useful asymptotic expansion of the complementary error function
  • error function

Complete translation information:

{
  "id" : "FORMULA_d3d2612c5eaf19804e4653cc2b2085ec",
  "formula" : "\\operatorname{erfc}(x) = \\frac{e^{-x^2}}{x\\sqrt{\\pi}}\\left[1 + \\sum_{n=1}^\\infty (-1)^n \\frac{1\\cdot3\\cdot5\\cdots(2n - 1)}{(2x^2)^n}\\right] = \\frac{e^{-x^2}}{x\\sqrt{\\pi}}\\sum_{n=0}^\\infty (-1)^n \\frac{(2n - 1)!!}{(2x^2)^n}",
  "semanticFormula" : "\\erfc@{x} = \\frac{\\expe^{-x^2}}{x \\sqrt{\\cpi}} [1 + \\sum_{n=1}^\\infty(- 1)^n \\frac{1\\cdot3\\cdot5\\cdots(2n - 1)}{(2x^2)^n}] = \\frac{\\expe^{-x^2}}{x \\sqrt{\\cpi}} \\sum_{n=0}^\\infty(- 1)^n \\frac{(2n - 1)!!}{(2x^2)^n}",
  "confidence" : 0.6584936398023523,
  "translations" : {
    "Mathematica" : {
      "translation" : "Erfc[x] == Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]) == Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 0, Infinity}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "Erfc[x] = Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None])", "Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]) = Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 0, Infinity}, GenerateConditions->None]" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "\\cdot" : "was translated to: *",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
          "\\erfc" : "Complementary error function; Example: \\erfc@@{z}\nWill be translated to: Erfc[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/7.2#E2\nMathematica:  https://reference.wolfram.com/language/ref/Erfc.html"
        }
      },
      "numericResults" : {
        "overallResult" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "wasAborted" : false,
        "crashed" : false,
        "testCalculationsGroups" : [ ]
      },
      "symbolicResults" : {
        "overallResult" : "ERROR",
        "numberOfTests" : 2,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 2,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "Erfc[x]",
          "rhs" : "Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None])",
          "testExpression" : "(Erfc[x])-(Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]))",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        }, {
          "lhs" : "Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None])",
          "rhs" : "Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 0, Infinity}, GenerateConditions->None]",
          "testExpression" : "(Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*(1 + Sum[(- 1)^(n)*Divide[1 * 3 * 5 \\[Ellipsis](2*n - 1),(2*(x)^(2))^(n)], {n, 1, Infinity}, GenerateConditions->None]))-(Divide[Exp[- (x)^(2)],x*Sqrt[Pi]]*Sum[(- 1)^(n)*Divide[(2*n - 1)!!,(2*(x)^(2))^(n)], {n, 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: \\erfc [\\erfc]"
        }
      }
    },
    "Maple" : {
      "translation" : "erfc(x) = (exp(- (x)^(2)))/(x*sqrt(Pi))*(1 + sum((- 1)^(n)*(1 * 3 * 5 .. (2*n - 1))/((2*(x)^(2))^(n)), n = 1..infinity)) = (exp(- (x)^(2)))/(x*sqrt(Pi))*sum((- 1)^(n)*(doublefactorial(2*n - 1))/((2*(x)^(2))^(n)), n = 0..infinity)",
      "translationInformation" : {
        "subEquations" : [ "erfc(x) = (exp(- (x)^(2)))/(x*sqrt(Pi))*(1 + sum((- 1)^(n)*(1 * 3 * 5 .. (2*n - 1))/((2*(x)^(2))^(n)), n = 1..infinity))", "(exp(- (x)^(2)))/(x*sqrt(Pi))*(1 + sum((- 1)^(n)*(1 * 3 * 5 .. (2*n - 1))/((2*(x)^(2))^(n)), n = 1..infinity)) = (exp(- (x)^(2)))/(x*sqrt(Pi))*sum((- 1)^(n)*(doublefactorial(2*n - 1))/((2*(x)^(2))^(n)), n = 0..infinity)" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "\\cdot" : "was translated to: *",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
          "\\erfc" : "Complementary error function; Example: \\erfc@@{z}\nWill be translated to: erfc($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/7.2#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=erfc"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 8,
    "sentence" : 0,
    "word" : 23
  } ],
  "includes" : [ "e^{-t^2}", "-1", "x", "e", "n- 1)!", "n- 1)", "x)", "z^{\\bar{n}}", "x) =", "\\operatorname{erfc}(x)", "n" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "useful asymptotic expansion of the complementary error function",
    "score" : 0.6954080343007951
  }, {
    "definition" : "error function",
    "score" : 0.6687181434333315
  } ]
}

Specify your own input