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{ber}_n(x) = \left(\frac{x}{2}\right)^n \sum_{k \geq 0} \frac{\cos\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: \Kelvinber{n}@@{(x)} =(\frac{x}{2})^n \sum_{k \geq 0} \frac{\cos [(\frac{3n}{4} + \frac{k}{2}) \cpi]}{k! \EulerGamma@{n + k + 1}}(\frac{x^2}{4})^k

Confidence: 0.74684072381563

Mathematica

Translation: KelvinBer[n, x] == (Divide[x,2])^(n)* Sum[Divide[Cos[(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

  • KelvinBer[n, x] = (Divide[x,2])^(n)* Sum[Divide[Cos[(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

  • Cosine; Example: \cos@@{z}

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

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

Will be translated to: KelvinBer[$0, $1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/10.61#E1 Mathematica: https://reference.wolfram.com/language/ref/KelvinBer.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: (KelvinBer[n, x])-((Divide[x,2])^(n)* Sum[Divide[Cos[(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: \Kelvinber [\Kelvinber]

Tests

Symbolic
Numeric

Maple

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

Information

Sub Equations

  • KelvinBer(n, x) = ((x)/(2))^(n)* sum((cos(((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

  • Cosine; Example: \cos@@{z}

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

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

Will be translated to: KelvinBer($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=KelvinBer

  • 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
  • ber
  • gamma function
  • integer

Complete translation information:

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

Specify your own input