LaTeX to CAS translator
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 \begin{align} k(\theta) &= \pi^{-\frac{1}{2}} \sin^{-\alpha-\frac{1}{2}} \tfrac{\theta}{2} \cos^{-\beta-\frac{1}{2}} \tfrac{\theta}{2},\\ N &= n + \tfrac{1}{2} (\alpha+\beta+1),\\ \gamma &= - \tfrac{\pi}{2} \left (\alpha + \tfrac{1}{2} \right ), \end{align} }
... is translated to the CAS output ...
Semantic latex: \begin{align}k(\theta) &= \cpi^{-\frac{1}{2}} \sin^{-\alpha-\frac{1}{2}} \tfrac{\theta}{2} \cos^{-\beta-\frac{1}{2}} \tfrac{\theta}{2} , \\ N &= n + \tfrac{1}{2} (\alpha+\beta+1), \\ \gamma &= - \tfrac{\cpi}{2}(\alpha + \tfrac{1}{2}) ,\end{align}
Confidence: 0
Mathematica
Translation: k[\[Theta]] == (Pi)^(-Divide[1,2])* (Sin[Divide[\[Theta],2]])^(- \[Alpha]-Divide[1,2])* (Cos[Divide[\[Theta],2]])^(- \[Beta]-Divide[1,2]) N == n +Divide[1,2]*(\[Alpha]+ \[Beta]+ 1) \[Gamma] == -Divide[Pi,2]*(\[Alpha]+Divide[1,2])
Information
Sub Equations
- k[\[Theta]] = (Pi)^(-Divide[1,2])* (Sin[Divide[\[Theta],2]])^(- \[Alpha]-Divide[1,2])* (Cos[Divide[\[Theta],2]])^(- \[Beta]-Divide[1,2])
- N = n +Divide[1,2]*(\[Alpha]+ \[Beta]+ 1)
- \[Gamma] = -Divide[Pi,2]*(\[Alpha]+Divide[1,2])
Free variables
- N
- \[Alpha]
- \[Beta]
- \[Gamma]
- \[Theta]
- n
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).
- Pi was translated to: Pi
- 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.
- Could be the second Feigenbaum constant.
But this system doesn't know how to translate it as a constant. It was translated as a general letter.
- 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
Tests
Symbolic
Test expression: (k*(\[Theta]))-((Pi)^(-Divide[1,2])* (Sin[Divide[\[Theta],2]])^(- \[Alpha]-Divide[1,2])* (Cos[Divide[\[Theta],2]])^(- \[Beta]-Divide[1,2]))
ERROR:
{
"result": "ERROR",
"testTitle": "Simple",
"testExpression": null,
"resultExpression": null,
"wasAborted": false,
"conditionallySuccessful": false
}
Test expression: (N)-(n +Divide[1,2]*(\[Alpha]+ \[Beta]+ 1))
ERROR:
{
"result": "ERROR",
"testTitle": "Simple",
"testExpression": null,
"resultExpression": null,
"wasAborted": false,
"conditionallySuccessful": false
}
Test expression: (\[Gamma])-(-Divide[Pi,2]*(\[Alpha]+Divide[1,2]))
ERROR:
{
"result": "ERROR",
"testTitle": "Simple",
"testExpression": null,
"resultExpression": null,
"wasAborted": false,
"conditionallySuccessful": false
}
Numeric
SymPy
Translation: k(Symbol('theta')) == (pi)**(-(1)/(2))* (sin((Symbol('theta'))/(2)))**(- Symbol('alpha')-(1)/(2))* (cos((Symbol('theta'))/(2)))**(- Symbol('beta')-(1)/(2)) N == n +(1)/(2)*(Symbol('alpha')+ Symbol('beta')+ 1) Symbol('gamma') == -(pi)/(2)*(Symbol('alpha')+(1)/(2))
Information
Sub Equations
- k(Symbol('theta')) = (pi)**(-(1)/(2))* (sin((Symbol('theta'))/(2)))**(- Symbol('alpha')-(1)/(2))* (cos((Symbol('theta'))/(2)))**(- Symbol('beta')-(1)/(2))
- N = n +(1)/(2)*(Symbol('alpha')+ Symbol('beta')+ 1)
- Symbol('gamma') = -(pi)/(2)*(Symbol('alpha')+(1)/(2))
Free variables
- N
- Symbol('alpha')
- Symbol('beta')
- Symbol('gamma')
- Symbol('theta')
- n
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).
- Pi was translated to: pi
- 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.
- Could be the second Feigenbaum constant.
But this system doesn't know how to translate it as a constant. It was translated as a general letter.
- 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
Tests
Symbolic
Numeric
Maple
Translation: k(theta) = (Pi)^(-(1)/(2))* (sin((theta)/(2)))^(- alpha -(1)/(2))* (cos((theta)/(2)))^(- beta -(1)/(2)); N = n +(1)/(2)*(alpha + beta + 1); gamma = -(Pi)/(2)*(alpha +(1)/(2))
Information
Sub Equations
- k(theta) = (Pi)^(-(1)/(2))* (sin((theta)/(2)))^(- alpha -(1)/(2))* (cos((theta)/(2)))^(- beta -(1)/(2))
- N = n +(1)/(2)*(alpha + beta + 1)
- gamma = -(Pi)/(2)*(alpha +(1)/(2))
Free variables
- N
- alpha
- beta
- gamma
- n
- theta
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).
- Pi was translated to: Pi
- 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.
- Could be the second Feigenbaum constant.
But this system doesn't know how to translate it as a constant. It was translated as a general letter.
- 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
Tests
Symbolic
Numeric
Dependency Graph Information
Includes
Is part of
Complete translation information:
{
"id" : "FORMULA_6b3d79ce0548525e04dceb2fef4db79b",
"formula" : "\\begin{align}\nk(\\theta) &= \\pi^{-\\frac{1}{2}} \\sin^{-\\alpha-\\frac{1}{2}} \\tfrac{\\theta}{2} \\cos^{-\\beta-\\frac{1}{2}} \\tfrac{\\theta}{2},\\\\\nN &= n + \\tfrac{1}{2} (\\alpha+\\beta+1),\\\\\n\\gamma &= - \\tfrac{\\pi}{2} \\left (\\alpha + \\tfrac{1}{2} \\right ),\n\\end{align}",
"semanticFormula" : "\\begin{align}k(\\theta) &= \\cpi^{-\\frac{1}{2}} \\sin^{-\\alpha-\\frac{1}{2}} \\tfrac{\\theta}{2} \\cos^{-\\beta-\\frac{1}{2}} \\tfrac{\\theta}{2} , \\\\ N &= n + \\tfrac{1}{2} (\\alpha+\\beta+1), \\\\ \\gamma &= - \\tfrac{\\cpi}{2}(\\alpha + \\tfrac{1}{2}) ,\\end{align}",
"confidence" : 0.0,
"translations" : {
"Mathematica" : {
"translation" : "k[\\[Theta]] == (Pi)^(-Divide[1,2])* (Sin[Divide[\\[Theta],2]])^(- \\[Alpha]-Divide[1,2])* (Cos[Divide[\\[Theta],2]])^(- \\[Beta]-Divide[1,2])\nN == n +Divide[1,2]*(\\[Alpha]+ \\[Beta]+ 1)\n\\[Gamma] == -Divide[Pi,2]*(\\[Alpha]+Divide[1,2])",
"translationInformation" : {
"subEquations" : [ "k[\\[Theta]] = (Pi)^(-Divide[1,2])* (Sin[Divide[\\[Theta],2]])^(- \\[Alpha]-Divide[1,2])* (Cos[Divide[\\[Theta],2]])^(- \\[Beta]-Divide[1,2])", "N = n +Divide[1,2]*(\\[Alpha]+ \\[Beta]+ 1)", "\\[Gamma] = -Divide[Pi,2]*(\\[Alpha]+Divide[1,2])" ],
"freeVariables" : [ "N", "\\[Alpha]", "\\[Beta]", "\\[Gamma]", "\\[Theta]", "n" ],
"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",
"k" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\cpi" : "Pi was translated to: Pi",
"\\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",
"\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
"\\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"
}
},
"numericResults" : {
"overallResult" : "SKIPPED",
"numberOfTests" : 0,
"numberOfFailedTests" : 0,
"numberOfSuccessfulTests" : 0,
"numberOfSkippedTests" : 0,
"numberOfErrorTests" : 0,
"wasAborted" : false,
"crashed" : false,
"testCalculationsGroups" : [ ]
},
"symbolicResults" : {
"overallResult" : "ERROR",
"numberOfTests" : 3,
"numberOfFailedTests" : 0,
"numberOfSuccessfulTests" : 0,
"numberOfSkippedTests" : 0,
"numberOfErrorTests" : 3,
"crashed" : false,
"testCalculationsGroup" : [ {
"lhs" : "k*(\\[Theta])",
"rhs" : "(Pi)^(-Divide[1,2])* (Sin[Divide[\\[Theta],2]])^(- \\[Alpha]-Divide[1,2])* (Cos[Divide[\\[Theta],2]])^(- \\[Beta]-Divide[1,2])",
"testExpression" : "(k*(\\[Theta]))-((Pi)^(-Divide[1,2])* (Sin[Divide[\\[Theta],2]])^(- \\[Alpha]-Divide[1,2])* (Cos[Divide[\\[Theta],2]])^(- \\[Beta]-Divide[1,2]))",
"testCalculations" : [ {
"result" : "ERROR",
"testTitle" : "Simple",
"testExpression" : null,
"resultExpression" : null,
"wasAborted" : false,
"conditionallySuccessful" : false
} ]
}, {
"lhs" : "N",
"rhs" : "n +Divide[1,2]*(\\[Alpha]+ \\[Beta]+ 1)",
"testExpression" : "(N)-(n +Divide[1,2]*(\\[Alpha]+ \\[Beta]+ 1))",
"testCalculations" : [ {
"result" : "ERROR",
"testTitle" : "Simple",
"testExpression" : null,
"resultExpression" : null,
"wasAborted" : false,
"conditionallySuccessful" : false
} ]
}, {
"lhs" : "\\[Gamma]",
"rhs" : "-Divide[Pi,2]*(\\[Alpha]+Divide[1,2])",
"testExpression" : "(\\[Gamma])-(-Divide[Pi,2]*(\\[Alpha]+Divide[1,2]))",
"testCalculations" : [ {
"result" : "ERROR",
"testTitle" : "Simple",
"testExpression" : null,
"resultExpression" : null,
"wasAborted" : false,
"conditionallySuccessful" : false
} ]
} ]
}
},
"SymPy" : {
"translation" : "k(Symbol('theta')) == (pi)**(-(1)/(2))* (sin((Symbol('theta'))/(2)))**(- Symbol('alpha')-(1)/(2))* (cos((Symbol('theta'))/(2)))**(- Symbol('beta')-(1)/(2))\nN == n +(1)/(2)*(Symbol('alpha')+ Symbol('beta')+ 1)\nSymbol('gamma') == -(pi)/(2)*(Symbol('alpha')+(1)/(2))",
"translationInformation" : {
"subEquations" : [ "k(Symbol('theta')) = (pi)**(-(1)/(2))* (sin((Symbol('theta'))/(2)))**(- Symbol('alpha')-(1)/(2))* (cos((Symbol('theta'))/(2)))**(- Symbol('beta')-(1)/(2))", "N = n +(1)/(2)*(Symbol('alpha')+ Symbol('beta')+ 1)", "Symbol('gamma') = -(pi)/(2)*(Symbol('alpha')+(1)/(2))" ],
"freeVariables" : [ "N", "Symbol('alpha')", "Symbol('beta')", "Symbol('gamma')", "Symbol('theta')", "n" ],
"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",
"k" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\cpi" : "Pi was translated to: pi",
"\\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",
"\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
"\\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"
}
}
},
"Maple" : {
"translation" : "k(theta) = (Pi)^(-(1)/(2))* (sin((theta)/(2)))^(- alpha -(1)/(2))* (cos((theta)/(2)))^(- beta -(1)/(2)); N = n +(1)/(2)*(alpha + beta + 1); gamma = -(Pi)/(2)*(alpha +(1)/(2))",
"translationInformation" : {
"subEquations" : [ "k(theta) = (Pi)^(-(1)/(2))* (sin((theta)/(2)))^(- alpha -(1)/(2))* (cos((theta)/(2)))^(- beta -(1)/(2))", "N = n +(1)/(2)*(alpha + beta + 1)", "gamma = -(Pi)/(2)*(alpha +(1)/(2))" ],
"freeVariables" : [ "N", "alpha", "beta", "gamma", "n", "theta" ],
"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",
"k" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\cpi" : "Pi was translated to: Pi",
"\\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",
"\\alpha" : "Could be the second Feigenbaum constant.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
"\\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"
}
}
}
},
"positions" : [ ],
"includes" : [ "\\begin{align}k(\\theta) &= \\pi^{-\\frac{1}{2}} \\sin^{-\\alpha-\\frac{1}{2}} \\tfrac{\\theta}{2} \\cos^{-\\beta-\\frac{1}{2}} \\tfrac{\\theta}{2},\\\\N &= n + \\tfrac{1}{2} (\\alpha+\\beta+1),\\\\\\gamma &= - \\tfrac{\\pi}{2} \\left (\\alpha + \\tfrac{1}{2} \\right ),\\end{align}", "n", "k" ],
"isPartOf" : [ "\\begin{align}k(\\theta) &= \\pi^{-\\frac{1}{2}} \\sin^{-\\alpha-\\frac{1}{2}} \\tfrac{\\theta}{2} \\cos^{-\\beta-\\frac{1}{2}} \\tfrac{\\theta}{2},\\\\N &= n + \\tfrac{1}{2} (\\alpha+\\beta+1),\\\\\\gamma &= - \\tfrac{\\pi}{2} \\left (\\alpha + \\tfrac{1}{2} \\right ),\\end{align}" ],
"definiens" : [ ]
}