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 T_n(x) = \frac{\Gamma(1/2)\sqrt{1-x^2}}{(-2)^n\,\Gamma(n+1/2)} \ \frac{d^n}{dx^n}\left([1-x^2]^{n-1/2}\right)}

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

Semantic latex: T_n(x) = \frac{\EulerGamma@{1 / 2} \sqrt{1-x^2}}{(- 2)^n \EulerGamma@{n + 1 / 2}} \deriv [n]{ }{x}([1 - x^2]^{n-1/2})

Confidence: 0.64401426937134

Mathematica

Translation: Subscript[T, n][x] == Divide[Gamma[1/2]*Sqrt[1 - (x)^(2)],(- 2)^(n)* Gamma[n + 1/2]]*D[(1 - (x)^(2))^(n - 1/2), {x, n}]

Information

Sub Equations

  • Subscript[T, n][x] = Divide[Gamma[1/2]*Sqrt[1 - (x)^(2)],(- 2)^(n)* Gamma[n + 1/2]]*D[(1 - (x)^(2))^(n - 1/2), {x, n}]

Free variables

  • n
  • x

Symbol info

  • 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

  • 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
Numeric

SymPy

Translation:

Information

Symbol info

  • (LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \EulerGamma [\EulerGamma]

Tests

Symbolic
Numeric

Maple

Translation: T[n](x) = (GAMMA(1/2)*sqrt(1 - (x)^(2)))/((- 2)^(n)* GAMMA(n + 1/2))*diff((1 - (x)^(2))^(n - 1/2), [x$(n)])

Information

Sub Equations

  • T[n](x) = (GAMMA(1/2)*sqrt(1 - (x)^(2)))/((- 2)^(n)* GAMMA(n + 1/2))*diff((1 - (x)^(2))^(n - 1/2), [x$(n)])

Free variables

  • n
  • x

Symbol info

  • 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

  • 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

  • Failed to parse (syntax error): {\displaystyle +1/2}}}
  • Failed to parse (syntax error): {\displaystyle +1/2)}}
  • Failed to parse (syntax error): {\displaystyle ^2]^}
  • Failed to parse (syntax error): {\displaystyle -1/2}}
  • Failed to parse (syntax error): {\displaystyle +1/2)}}
  • Failed to parse (syntax error): {\displaystyle ^2}}{(-2)}
  • Failed to parse (syntax error): {\displaystyle -1/2})}

Is part of

Complete translation information:

{
  "id" : "FORMULA_c0f913c37212e702cf7691640f407090",
  "formula" : "T_n(x) = \\frac{\\Gamma(1/2)\\sqrt{1-x^2}}{(-2)^n\\Gamma(n+1/2)}  \\frac{d^n}{dx^n}\\left([1-x^2]^{n-1/2}\\right)",
  "semanticFormula" : "T_n(x) = \\frac{\\EulerGamma@{1 / 2} \\sqrt{1-x^2}}{(- 2)^n \\EulerGamma@{n + 1 / 2}} \\deriv [n]{ }{x}([1 - x^2]^{n-1/2})",
  "confidence" : 0.6440142693713441,
  "translations" : {
    "Mathematica" : {
      "translation" : "Subscript[T, n][x] == Divide[Gamma[1/2]*Sqrt[1 - (x)^(2)],(- 2)^(n)* Gamma[n + 1/2]]*D[(1 - (x)^(2))^(n - 1/2), {x, n}]",
      "translationInformation" : {
        "subEquations" : [ "Subscript[T, n][x] = Divide[Gamma[1/2]*Sqrt[1 - (x)^(2)],(- 2)^(n)* Gamma[n + 1/2]]*D[(1 - (x)^(2))^(n - 1/2), {x, n}]" ],
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "T" : "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",
          "\\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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "SymPy" : {
      "translation" : "",
      "translationInformation" : {
        "tokenTranslations" : {
          "Error" : "(LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \\EulerGamma [\\EulerGamma]"
        }
      },
      "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" : "T[n](x) = (GAMMA(1/2)*sqrt(1 - (x)^(2)))/((- 2)^(n)* GAMMA(n + 1/2))*diff((1 - (x)^(2))^(n - 1/2), [x$(n)])",
      "translationInformation" : {
        "subEquations" : [ "T[n](x) = (GAMMA(1/2)*sqrt(1 - (x)^(2)))/((- 2)^(n)* GAMMA(n + 1/2))*diff((1 - (x)^(2))^(n - 1/2), [x$(n)])" ],
        "freeVariables" : [ "n", "x" ],
        "tokenTranslations" : {
          "T" : "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",
          "\\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"
        }
      },
      "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" : [ ],
  "includes" : [ "T_n(x) = \\frac{\\Gamma(1/2)\\sqrt{1-x^2}}{(-2)^n\\,\\Gamma(n+1/2)} \\  \\frac{d^n}{dx^n}\\left([1-x^2]^{n-1/2}\\right)", "+1/2}}", "+1/2)}", "^2]^", "{1/2}", "-1/2}", "+1/2)}", "(1/2)", "^2}}{(-2)", "-1/2})" ],
  "isPartOf" : [ "T_n(x) = \\frac{\\Gamma(1/2)\\sqrt{1-x^2}}{(-2)^n\\,\\Gamma(n+1/2)} \\  \\frac{d^n}{dx^n}\\left([1-x^2]^{n-1/2}\\right)" ],
  "definiens" : [ ]
}

Specify your own input