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 \frac{d^2 S}{dz^2}+\left(\sum _{j=1}^N \frac{\gamma _j}{z - a_j} \right) \frac{dS}{dz} + \frac{V(z)}{\prod _{j=1}^N (z - a_j)}S = 0}

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

Semantic latex: \deriv [2]{S}{z} +(\sum_{j=1}^N \frac{\gamma _j}{z - a_j}) \frac{dS}{dz} + \frac{V(z)}{\prod _{j=1}^N (z - a_j)} S = 0

Confidence: 0

Mathematica

Translation: D[S, {z, 2}]+(Sum[Divide[Subscript[\[Gamma], j],z - Subscript[a, j]], {j, 1, N}, GenerateConditions->None])*Divide[d*S,d*z]+Divide[V[z],Product[z - Subscript[a, j], {j, 1, N}, GenerateConditions->None]]*S == 0

Information

Sub Equations

  • D[S, {z, 2}]+(Sum[Divide[Subscript[\[Gamma], j],z - Subscript[a, j]], {j, 1, N}, GenerateConditions->None])*Divide[d*S,d*z]+Divide[V[z],Product[z - Subscript[a, j], {j, 1, N}, GenerateConditions->None]]*S = 0

Free variables

  • N
  • S
  • Subscript[\[Gamma], j]
  • Subscript[a, j]
  • d
  • z

Symbol info

  • Could be the Euler-Mascheroni constant.

But it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant! Use the DLMF-Macro \EulerConstant to translate \gamma as a constant.

  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

SymPy

Translation: diff(S, z, 2)+(Sum((Symbol('{Symbol('gamma')}_{j}'))/(z - Symbol('{a}_{j}')), (j, 1, N)))*(d*S)/(d*z)+(V(z))/(Product(z - Symbol('{a}_{j}'), (j, 1, N)))*S == 0

Information

Sub Equations

  • diff(S, z, 2)+(Sum((Symbol('{Symbol('gamma')}_{j}'))/(z - Symbol('{a}_{j}')), (j, 1, N)))*(d*S)/(d*z)+(V(z))/(Product(z - Symbol('{a}_{j}'), (j, 1, N)))*S = 0

Free variables

  • N
  • S
  • Symbol('{Symbol('gamma')}_{j}')
  • Symbol('{a}_{j}')
  • d
  • z

Symbol info

  • Could be the Euler-Mascheroni constant.

But it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant! Use the DLMF-Macro \EulerConstant to translate \gamma as a constant.

  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Maple

Translation: diff(S, [z$(2)])+(sum((gamma[j])/(z - a[j]), j = 1..N))*(d*S)/(d*z)+(V(z))/(product(z - a[j], j = 1..N))*S = 0

Information

Sub Equations

  • diff(S, [z$(2)])+(sum((gamma[j])/(z - a[j]), j = 1..N))*(d*S)/(d*z)+(V(z))/(product(z - a[j], j = 1..N))*S = 0

Free variables

  • N
  • S
  • a[j]
  • d
  • gamma[j]
  • z

Symbol info

  • Could be the Euler-Mascheroni constant.

But it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant! Use the DLMF-Macro \EulerConstant to translate \gamma as a constant.

  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

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

Description

  • frac
  • j
  • dz
  • n
  • s
  • z - a_j
  • TeX Source
  • d
  • ds
  • Formula
  • gamma
  • Gold ID
  • link
  • prod
  • right
  • sum
  • z

Complete translation information:

{
  "id" : "FORMULA_d673cd2334542e8f83f099798c4027b3",
  "formula" : "\\frac{d^2 S}{dz^2}+\\left(\\sum _{j=1}^N \\frac{\\gamma _j}{z - a_j} \\right) \\frac{dS}{dz} + \\frac{V(z)}{\\prod _{j=1}^N (z - a_j)}S = 0",
  "semanticFormula" : "\\deriv [2]{S}{z} +(\\sum_{j=1}^N \\frac{\\gamma _j}{z - a_j}) \\frac{dS}{dz} + \\frac{V(z)}{\\prod _{j=1}^N (z - a_j)} S = 0",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "D[S, {z, 2}]+(Sum[Divide[Subscript[\\[Gamma], j],z - Subscript[a, j]], {j, 1, N}, GenerateConditions->None])*Divide[d*S,d*z]+Divide[V[z],Product[z - Subscript[a, j], {j, 1, N}, GenerateConditions->None]]*S == 0",
      "translationInformation" : {
        "subEquations" : [ "D[S, {z, 2}]+(Sum[Divide[Subscript[\\[Gamma], j],z - Subscript[a, j]], {j, 1, N}, GenerateConditions->None])*Divide[d*S,d*z]+Divide[V[z],Product[z - Subscript[a, j], {j, 1, N}, GenerateConditions->None]]*S = 0" ],
        "freeVariables" : [ "N", "S", "Subscript[\\[Gamma], j]", "Subscript[a, j]", "d", "z" ],
        "tokenTranslations" : {
          "\\gamma" : "Could be the Euler-Mascheroni constant.\nBut it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant!\nUse the DLMF-Macro \\EulerConstant to translate \\gamma as a constant.\n",
          "\\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",
          "V" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      },
      "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" : "diff(S, z, 2)+(Sum((Symbol('{Symbol('gamma')}_{j}'))/(z - Symbol('{a}_{j}')), (j, 1, N)))*(d*S)/(d*z)+(V(z))/(Product(z - Symbol('{a}_{j}'), (j, 1, N)))*S == 0",
      "translationInformation" : {
        "subEquations" : [ "diff(S, z, 2)+(Sum((Symbol('{Symbol('gamma')}_{j}'))/(z - Symbol('{a}_{j}')), (j, 1, N)))*(d*S)/(d*z)+(V(z))/(Product(z - Symbol('{a}_{j}'), (j, 1, N)))*S = 0" ],
        "freeVariables" : [ "N", "S", "Symbol('{Symbol('gamma')}_{j}')", "Symbol('{a}_{j}')", "d", "z" ],
        "tokenTranslations" : {
          "\\gamma" : "Could be the Euler-Mascheroni constant.\nBut it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant!\nUse the DLMF-Macro \\EulerConstant to translate \\gamma as a constant.\n",
          "\\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",
          "V" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      },
      "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" : "diff(S, [z$(2)])+(sum((gamma[j])/(z - a[j]), j = 1..N))*(d*S)/(d*z)+(V(z))/(product(z - a[j], j = 1..N))*S = 0",
      "translationInformation" : {
        "subEquations" : [ "diff(S, [z$(2)])+(sum((gamma[j])/(z - a[j]), j = 1..N))*(d*S)/(d*z)+(V(z))/(product(z - a[j], j = 1..N))*S = 0" ],
        "freeVariables" : [ "N", "S", "a[j]", "d", "gamma[j]", "z" ],
        "tokenTranslations" : {
          "\\gamma" : "Could be the Euler-Mascheroni constant.\nBut it is also a Greek letter. Be aware, that this program translated the letter as a normal Greek letter and not as a constant!\nUse the DLMF-Macro \\EulerConstant to translate \\gamma as a constant.\n",
          "\\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",
          "V" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      },
      "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}", "= 0", "= 1" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "frac",
    "score" : 0.8835270181497158
  }, {
    "definition" : "j",
    "score" : 0.8835270181497158
  }, {
    "definition" : "dz",
    "score" : 0.8144453757286602
  }, {
    "definition" : "n",
    "score" : 0.8144453757286602
  }, {
    "definition" : "s",
    "score" : 0.8144453757286602
  }, {
    "definition" : "z - a_j",
    "score" : 0.8144453757286602
  }, {
    "definition" : "TeX Source",
    "score" : 0.722
  }, {
    "definition" : "d",
    "score" : 0.657257825973014
  }, {
    "definition" : "ds",
    "score" : 0.657257825973014
  }, {
    "definition" : "Formula",
    "score" : 0.657257825973014
  }, {
    "definition" : "gamma",
    "score" : 0.657257825973014
  }, {
    "definition" : "Gold ID",
    "score" : 0.657257825973014
  }, {
    "definition" : "link",
    "score" : 0.657257825973014
  }, {
    "definition" : "prod",
    "score" : 0.657257825973014
  }, {
    "definition" : "right",
    "score" : 0.657257825973014
  }, {
    "definition" : "sum",
    "score" : 0.657257825973014
  }, {
    "definition" : "z",
    "score" : 0.657257825973014
  } ]
}

Specify your own input