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 S_{\mu,\nu}(z) = s_{\mu,\nu}(z) + 2^{\mu-1} \Gamma\left(\frac{\mu + \nu + 1}{2}\right) \Gamma\left(\frac{\mu - \nu + 1}{2}\right)\left(\sin \left[(\mu - \nu)\frac{\pi}{2}\right] J_\nu(z) - \cos \left[(\mu - \nu)\frac{\pi}{2}\right] Y_\nu(z)\right)}

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

Semantic latex: S_{\mu,\nu}(z) = s_{\mu,\nu}(z) + 2^{\mu-1} \Gamma(\frac{\mu + \nu + 1}{2}) \Gamma(\frac{\mu - \nu + 1}{2})(\sin [(\mu - \nu) \frac{\cpi}{2}] J_\nu(z) - \cos [(\mu - \nu) \frac{\cpi}{2}] Y_\nu(z))

Confidence: 0

Mathematica

Translation: Subscript[S, \[Mu], \[Nu]][z] == Subscript[s, \[Mu], \[Nu]][z]+ (2)^(\[Mu]- 1)* \[CapitalGamma][Divide[\[Mu]+ \[Nu]+ 1,2]]* \[CapitalGamma][Divide[\[Mu]- \[Nu]+ 1,2]]*(Sin[(\[Mu]- \[Nu])*Divide[Pi,2]]*Subscript[J, \[Nu]][z]- Cos[(\[Mu]- \[Nu])*Divide[Pi,2]]*Subscript[Y, \[Nu]][z])

Information

Sub Equations

  • Subscript[S, \[Mu], \[Nu]][z] = Subscript[s, \[Mu], \[Nu]][z]+ (2)^(\[Mu]- 1)* \[CapitalGamma][Divide[\[Mu]+ \[Nu]+ 1,2]]* \[CapitalGamma][Divide[\[Mu]- \[Nu]+ 1,2]]*(Sin[(\[Mu]- \[Nu])*Divide[Pi,2]]*Subscript[J, \[Nu]][z]- Cos[(\[Mu]- \[Nu])*Divide[Pi,2]]*Subscript[Y, \[Nu]][z])

Free variables

  • \[CapitalGamma]
  • \[Mu]
  • \[Nu]
  • z

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • 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

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

Tests

Symbolic
Numeric

SymPy

Translation: Symbol('{S}_{Symbol('mu'), Symbol('nu')}')(z) == Symbol('{s}_{Symbol('mu'), Symbol('nu')}')(z)+ (2)**(Symbol('mu')- 1)* Symbol('Gamma')((Symbol('mu')+ Symbol('nu')+ 1)/(2))* Symbol('Gamma')((Symbol('mu')- Symbol('nu')+ 1)/(2))*(sin((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{J}_{Symbol('nu')}')(z)- cos((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{Y}_{Symbol('nu')}')(z))

Information

Sub Equations

  • Symbol('{S}_{Symbol('mu'), Symbol('nu')}')(z) = Symbol('{s}_{Symbol('mu'), Symbol('nu')}')(z)+ (2)**(Symbol('mu')- 1)* Symbol('Gamma')((Symbol('mu')+ Symbol('nu')+ 1)/(2))* Symbol('Gamma')((Symbol('mu')- Symbol('nu')+ 1)/(2))*(sin((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{J}_{Symbol('nu')}')(z)- cos((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{Y}_{Symbol('nu')}')(z))

Free variables

  • Symbol('Gamma')
  • Symbol('mu')
  • Symbol('nu')
  • z

Symbol info

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

Will be translated to: cos($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Sine; Example: \sin@@{z}

Will be translated to: sin($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E1 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#sin

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Pi was translated to: pi
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Maple

Translation: S[mu , nu](z) = s[mu , nu](z)+ (2)^(mu - 1)* Gamma((mu + nu + 1)/(2))* Gamma((mu - nu + 1)/(2))*(sin((mu - nu)*(Pi)/(2))*J[nu](z)- cos((mu - nu)*(Pi)/(2))*Y[nu](z))

Information

Sub Equations

  • S[mu , nu](z) = s[mu , nu](z)+ (2)^(mu - 1)* Gamma((mu + nu + 1)/(2))* Gamma((mu - nu + 1)/(2))*(sin((mu - nu)*(Pi)/(2))*J[nu](z)- cos((mu - nu)*(Pi)/(2))*Y[nu](z))

Free variables

  • Gamma
  • mu
  • nu
  • z

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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • 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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Pi was translated to: Pi
  • 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}{2}}
  • Failed to parse (syntax error): {\displaystyle + 1}{2})}
  • Failed to parse (syntax error): {\displaystyle + 1}{2})(}
  • Failed to parse (syntax error): {\displaystyle + 1}{2}}}
  • Failed to parse (syntax error): {\displaystyle + 1}{2}}(}

Description

  • nu
  • right
  • frac
  • mu
  • z
  • Gamma
  • mu - \ nu
  • pi
  • TeX Source
  • cos
  • Formula
  • Gold ID
  • j
  • left
  • link
  • mu-1
  • s
  • sin
  • y

Complete translation information:

{
  "id" : "FORMULA_03f5cb50caaedb9f0a4ada231fd61c58",
  "formula" : "S_{\\mu,\\nu}(z) = s_{\\mu,\\nu}(z) + 2^{\\mu-1} \\Gamma\\left(\\frac{\\mu + \\nu + 1}{2}\\right) \\Gamma\\left(\\frac{\\mu - \\nu + 1}{2}\\right)\\left(\\sin \\left[(\\mu - \\nu)\\frac{\\pi}{2}\\right] J_\\nu(z) - \\cos \\left[(\\mu - \\nu)\\frac{\\pi}{2}\\right] Y_\\nu(z)\\right)",
  "semanticFormula" : "S_{\\mu,\\nu}(z) = s_{\\mu,\\nu}(z) + 2^{\\mu-1} \\Gamma(\\frac{\\mu + \\nu + 1}{2}) \\Gamma(\\frac{\\mu - \\nu + 1}{2})(\\sin [(\\mu - \\nu) \\frac{\\cpi}{2}] J_\\nu(z) - \\cos [(\\mu - \\nu) \\frac{\\cpi}{2}] Y_\\nu(z))",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "Subscript[S, \\[Mu], \\[Nu]][z] == Subscript[s, \\[Mu], \\[Nu]][z]+ (2)^(\\[Mu]- 1)* \\[CapitalGamma][Divide[\\[Mu]+ \\[Nu]+ 1,2]]* \\[CapitalGamma][Divide[\\[Mu]- \\[Nu]+ 1,2]]*(Sin[(\\[Mu]- \\[Nu])*Divide[Pi,2]]*Subscript[J, \\[Nu]][z]- Cos[(\\[Mu]- \\[Nu])*Divide[Pi,2]]*Subscript[Y, \\[Nu]][z])",
      "translationInformation" : {
        "subEquations" : [ "Subscript[S, \\[Mu], \\[Nu]][z] = Subscript[s, \\[Mu], \\[Nu]][z]+ (2)^(\\[Mu]- 1)* \\[CapitalGamma][Divide[\\[Mu]+ \\[Nu]+ 1,2]]* \\[CapitalGamma][Divide[\\[Mu]- \\[Nu]+ 1,2]]*(Sin[(\\[Mu]- \\[Nu])*Divide[Pi,2]]*Subscript[J, \\[Nu]][z]- Cos[(\\[Mu]- \\[Nu])*Divide[Pi,2]]*Subscript[Y, \\[Nu]][z])" ],
        "freeVariables" : [ "\\[CapitalGamma]", "\\[Mu]", "\\[Nu]", "z" ],
        "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",
          "S" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "s" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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",
          "Y" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "J" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\cpi" : "Pi was translated to: Pi",
          "\\Gamma" : "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" : "Symbol('{S}_{Symbol('mu'), Symbol('nu')}')(z) == Symbol('{s}_{Symbol('mu'), Symbol('nu')}')(z)+ (2)**(Symbol('mu')- 1)* Symbol('Gamma')((Symbol('mu')+ Symbol('nu')+ 1)/(2))* Symbol('Gamma')((Symbol('mu')- Symbol('nu')+ 1)/(2))*(sin((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{J}_{Symbol('nu')}')(z)- cos((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{Y}_{Symbol('nu')}')(z))",
      "translationInformation" : {
        "subEquations" : [ "Symbol('{S}_{Symbol('mu'), Symbol('nu')}')(z) = Symbol('{s}_{Symbol('mu'), Symbol('nu')}')(z)+ (2)**(Symbol('mu')- 1)* Symbol('Gamma')((Symbol('mu')+ Symbol('nu')+ 1)/(2))* Symbol('Gamma')((Symbol('mu')- Symbol('nu')+ 1)/(2))*(sin((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{J}_{Symbol('nu')}')(z)- cos((Symbol('mu')- Symbol('nu'))*(pi)/(2))*Symbol('{Y}_{Symbol('nu')}')(z))" ],
        "freeVariables" : [ "Symbol('Gamma')", "Symbol('mu')", "Symbol('nu')", "z" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos",
          "S" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "s" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: sin($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E1\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#sin",
          "Y" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "J" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\cpi" : "Pi was translated to: pi",
          "\\Gamma" : "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" : "S[mu , nu](z) = s[mu , nu](z)+ (2)^(mu - 1)* Gamma((mu + nu + 1)/(2))* Gamma((mu - nu + 1)/(2))*(sin((mu - nu)*(Pi)/(2))*J[nu](z)- cos((mu - nu)*(Pi)/(2))*Y[nu](z))",
      "translationInformation" : {
        "subEquations" : [ "S[mu , nu](z) = s[mu , nu](z)+ (2)^(mu - 1)* Gamma((mu + nu + 1)/(2))* Gamma((mu - nu + 1)/(2))*(sin((mu - nu)*(Pi)/(2))*J[nu](z)- cos((mu - nu)*(Pi)/(2))*Y[nu](z))" ],
        "freeVariables" : [ "Gamma", "mu", "nu", "z" ],
        "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",
          "S" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "s" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\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",
          "Y" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "J" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\cpi" : "Pi was translated to: Pi",
          "\\Gamma" : "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^{", "+ 1}{2}", "+ 1}{2})", "+ 1}{2})(", "+ 1}{2}}", "+ 1}{2}}(" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "nu",
    "score" : 0.9215820777458384
  }, {
    "definition" : "right",
    "score" : 0.9215820777458384
  }, {
    "definition" : "frac",
    "score" : 0.9061285022494507
  }, {
    "definition" : "mu",
    "score" : 0.9061285022494507
  }, {
    "definition" : "z",
    "score" : 0.9061285022494507
  }, {
    "definition" : "Gamma",
    "score" : 0.8097525794913764
  }, {
    "definition" : "mu - \\ nu",
    "score" : 0.8097525794913764
  }, {
    "definition" : "pi",
    "score" : 0.8097525794913764
  }, {
    "definition" : "TeX Source",
    "score" : 0.722
  }, {
    "definition" : "cos",
    "score" : 0.655347773062961
  }, {
    "definition" : "Formula",
    "score" : 0.655347773062961
  }, {
    "definition" : "Gold ID",
    "score" : 0.655347773062961
  }, {
    "definition" : "j",
    "score" : 0.655347773062961
  }, {
    "definition" : "left",
    "score" : 0.655347773062961
  }, {
    "definition" : "link",
    "score" : 0.655347773062961
  }, {
    "definition" : "mu-1",
    "score" : 0.655347773062961
  }, {
    "definition" : "s",
    "score" : 0.655347773062961
  }, {
    "definition" : "sin",
    "score" : 0.655347773062961
  }, {
    "definition" : "y",
    "score" : 0.655347773062961
  } ]
}

Specify your own input