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 x^2 \frac{d^2 y}{dx^2} + x \frac{dy}{dx} - \left (x^2 + \alpha^2 \right )y = \frac{4\left (\frac{x}{2}\right)^{\alpha+1}}{\sqrt{\pi}\Gamma \left (\alpha+\frac{1}{2} \right )}}
... is translated to the CAS output ...
Semantic latex: x^2 \deriv [2]{y}{x} + x \frac{dy}{dx} -(x^2 + \alpha^2) y = \frac{4(\frac{x}{2})^{\alpha+1}}{\sqrt{\cpi} \EulerGamma@{\alpha + \frac{1}{2}}}
Confidence: 0.62884815014109
Mathematica
Translation: (x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \[Alpha]^(2))*y == Divide[4*(Divide[x,2])^(\[Alpha]+ 1),Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]
Information
Sub Equations
- (x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \[Alpha]^(2))*y = Divide[4*(Divide[x,2])^(\[Alpha]+ 1),Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]
Free variables
- \[Alpha]
- d
- x
- y
Symbol info
- 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
- Pi was translated to: Pi
- 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.
- 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: ((x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \[Alpha]^(2))*y)-(Divide[4*(Divide[x,2])^(\[Alpha]+ 1),Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]])
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: \EulerGamma [\EulerGamma]
Tests
Symbolic
Numeric
Maple
Translation: (x)^(2)* diff(y, [x$(2)])+ x*(d*y)/(d*x)-((x)^(2)+ (alpha)^(2))*y = (4*((x)/(2))^(alpha + 1))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))
Information
Sub Equations
- (x)^(2)* diff(y, [x$(2)])+ x*(d*y)/(d*x)-((x)^(2)+ (alpha)^(2))*y = (4*((x)/(2))^(alpha + 1))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))
Free variables
- alpha
- d
- x
- y
Symbol info
- 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
- Pi was translated to: Pi
- 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.
- 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
- solution
- non-homogeneous Bessel 's differential equation
- second-kind version
- modified Struve function
Complete translation information:
{
"id" : "FORMULA_8c66ab59cb0c6152495dee589c6ca071",
"formula" : "x^2 \\frac{d^2 y}{dx^2} + x \\frac{dy}{dx} - \\left (x^2 + \\alpha^2 \\right )y = \\frac{4\\left (\\frac{x}{2}\\right)^{\\alpha+1}}{\\sqrt{\\pi}\\Gamma \\left (\\alpha+\\frac{1}{2} \\right )}",
"semanticFormula" : "x^2 \\deriv [2]{y}{x} + x \\frac{dy}{dx} -(x^2 + \\alpha^2) y = \\frac{4(\\frac{x}{2})^{\\alpha+1}}{\\sqrt{\\cpi} \\EulerGamma@{\\alpha + \\frac{1}{2}}}",
"confidence" : 0.6288481501410905,
"translations" : {
"Mathematica" : {
"translation" : "(x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \\[Alpha]^(2))*y == Divide[4*(Divide[x,2])^(\\[Alpha]+ 1),Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]",
"translationInformation" : {
"subEquations" : [ "(x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \\[Alpha]^(2))*y = Divide[4*(Divide[x,2])^(\\[Alpha]+ 1),Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]" ],
"freeVariables" : [ "\\[Alpha]", "d", "x", "y" ],
"tokenTranslations" : {
"\\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",
"\\cpi" : "Pi was translated to: Pi",
"\\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",
"\\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" : "(x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \\[Alpha]^(2))*y",
"rhs" : "Divide[4*(Divide[x,2])^(\\[Alpha]+ 1),Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]",
"testExpression" : "((x)^(2)* D[y, {x, 2}]+ x*Divide[d*y,d*x]-((x)^(2)+ \\[Alpha]^(2))*y)-(Divide[4*(Divide[x,2])^(\\[Alpha]+ 1),Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]])",
"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: \\EulerGamma [\\EulerGamma]"
}
}
},
"Maple" : {
"translation" : "(x)^(2)* diff(y, [x$(2)])+ x*(d*y)/(d*x)-((x)^(2)+ (alpha)^(2))*y = (4*((x)/(2))^(alpha + 1))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))",
"translationInformation" : {
"subEquations" : [ "(x)^(2)* diff(y, [x$(2)])+ x*(d*y)/(d*x)-((x)^(2)+ (alpha)^(2))*y = (4*((x)/(2))^(alpha + 1))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))" ],
"freeVariables" : [ "alpha", "d", "x", "y" ],
"tokenTranslations" : {
"\\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",
"\\cpi" : "Pi was translated to: Pi",
"\\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",
"\\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" : 0,
"sentence" : 3,
"word" : 23
} ],
"includes" : [ "\\alpha", "\\Gamma(z)", "x" ],
"isPartOf" : [ ],
"definiens" : [ {
"definition" : "solution",
"score" : 0.7125985104912714
}, {
"definition" : "non-homogeneous Bessel 's differential equation",
"score" : 0.6460746792928004
}, {
"definition" : "second-kind version",
"score" : 0.5988174995334326
}, {
"definition" : "modified Struve function",
"score" : 0.5500952380952381
} ]
}