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 \mathrm{bei}_n(x) = \left(\frac{x}{2}\right)^n \sum_{k \geq 0} \frac{\sin\left[\left(\frac{3n}{4} + \frac{k}{2}\right)\pi\right]}{k! \Gamma(n + k + 1)} \left(\frac{x^2}{4}\right)^k .}

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

Semantic latex: \Kelvinbei{n}@@{(x)} =(\frac{x}{2})^n \sum_{k \geq 0} \frac{\sin [(\frac{3n}{4} + \frac{k}{2}) \cpi]}{k! \EulerGamma@{n + k + 1}}(\frac{x^2}{4})^k

Confidence: 0.66866523996064

Mathematica

Translation: KelvinBei[n, x] == (Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 0, Infinity}, GenerateConditions->None]

Information

Sub Equations

  • KelvinBei[n, x] = (Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 0, Infinity}, GenerateConditions->None]

Free variables

  • n
  • x

Symbol info

  • Pi was translated to: Pi
  • Kelvin Function BEI; Example: \Kelvinbei{\nu}@@{x}

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

  • Sine; Example: \sin@@{z}

Will be translated to: Sin[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E1 Mathematica: https://reference.wolfram.com/language/ref/Sin.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: (KelvinBei[n, x])-((Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 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: \Kelvinbei [\Kelvinbei]

Tests

Symbolic
Numeric

Maple

Translation: KelvinBei(n, x) = ((x)/(2))^(n)* sum((sin(((3*n)/(4)+(k)/(2))*Pi))/(factorial(k)*GAMMA(n + k + 1))*(((x)^(2))/(4))^(k), k = 0..infinity)

Information

Sub Equations

  • KelvinBei(n, x) = ((x)/(2))^(n)* sum((sin(((3*n)/(4)+(k)/(2))*Pi))/(factorial(k)*GAMMA(n + k + 1))*(((x)^(2))/(4))^(k), k = 0..infinity)

Free variables

  • n
  • x

Symbol info

  • Pi was translated to: Pi
  • Kelvin Function BEI; Example: \Kelvinbei{\nu}@@{x}

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

  • Sine; Example: \sin@@{z}

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

  • 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

  • series expansion
  • integer

Complete translation information:

{
  "id" : "FORMULA_eaeb48a91ce81d0193ab3b9c4dec9892",
  "formula" : "\\mathrm{bei}_n(x) = \\left(\\frac{x}{2}\\right)^n \\sum_{k \\geq 0} \\frac{\\sin\\left[\\left(\\frac{3n}{4} + \\frac{k}{2}\\right)\\pi\\right]}{k! \\Gamma(n + k + 1)} \\left(\\frac{x^2}{4}\\right)^k",
  "semanticFormula" : "\\Kelvinbei{n}@@{(x)} =(\\frac{x}{2})^n \\sum_{k \\geq 0} \\frac{\\sin [(\\frac{3n}{4} + \\frac{k}{2}) \\cpi]}{k! \\EulerGamma@{n + k + 1}}(\\frac{x^2}{4})^k",
  "confidence" : 0.6686652399606361,
  "translations" : {
    "Mathematica" : {
      "translation" : "KelvinBei[n, x] == (Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 0, Infinity}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "KelvinBei[n, x] = (Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 0, Infinity}, GenerateConditions->None]" ],
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "\\Kelvinbei" : "Kelvin Function BEI; Example: \\Kelvinbei{\\nu}@@{x}\nWill be translated to: KelvinBei[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/10.61#E1\nMathematica:  https://reference.wolfram.com/language/ref/KelvinBei.html",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: Sin[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E1\nMathematica:  https://reference.wolfram.com/language/ref/Sin.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" : "KelvinBei[n, x]",
          "rhs" : "(Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 0, Infinity}, GenerateConditions->None]",
          "testExpression" : "(KelvinBei[n, x])-((Divide[x,2])^(n)* Sum[Divide[Sin[(Divide[3*n,4]+Divide[k,2])*Pi],(k)!*Gamma[n + k + 1]]*(Divide[(x)^(2),4])^(k), {k, 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: \\Kelvinbei [\\Kelvinbei]"
        }
      }
    },
    "Maple" : {
      "translation" : "KelvinBei(n, x) = ((x)/(2))^(n)* sum((sin(((3*n)/(4)+(k)/(2))*Pi))/(factorial(k)*GAMMA(n + k + 1))*(((x)^(2))/(4))^(k), k = 0..infinity)",
      "translationInformation" : {
        "subEquations" : [ "KelvinBei(n, x) = ((x)/(2))^(n)* sum((sin(((3*n)/(4)+(k)/(2))*Pi))/(factorial(k)*GAMMA(n + k + 1))*(((x)^(2))/(4))^(k), k = 0..infinity)" ],
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "\\Kelvinbei" : "Kelvin Function BEI; Example: \\Kelvinbei{\\nu}@@{x}\nWill be translated to: KelvinBei($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/10.61#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=KelvinBei",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: sin($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=sin",
          "\\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" : 10
  } ],
  "includes" : [ "x", "\\Gamma(z)", "x)", "n", "_{n}(x)" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "series expansion",
    "score" : 0.722
  }, {
    "definition" : "integer",
    "score" : 0.6460746792928004
  } ]
}

Specify your own input