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 E[h(y)] = \int_{-\infty}^{+\infty} \frac{1}{\sqrt{\pi}} \exp(-x^2) h(\sqrt{2} \sigma x + \mu) dx}
... is translated to the CAS output ...
Semantic latex: E [h(y)] = \int_{-\infty}^{+\infty} \frac{1}{\sqrt{\cpi}} \exp(- x^2) h(\sqrt{2} \sigma x + \mu) \diff{x}
Confidence: 0
Mathematica
Translation: E[h[y]] == Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h[Sqrt[2]*\[Sigma]*x + \[Mu]], {x, - Infinity, + Infinity}, GenerateConditions->None]
Information
Sub Equations
- E[h[y]] = Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h[Sqrt[2]*\[Sigma]*x + \[Mu]], {x, - Infinity, + Infinity}, GenerateConditions->None]
Free variables
- \[Mu]
- \[Sigma]
- y
Symbol info
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
- Exponential function; Example: \exp@@{z}
Will be translated to: Exp[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E19 Mathematica: https://reference.wolfram.com/language/ref/Exp.html
- Pi was translated to: Pi
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
Tests
Symbolic
Test expression: (E*(h*(y)))-(Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h*(Sqrt[2]*\[Sigma]*x + \[Mu]), {x, - Infinity, + Infinity}, GenerateConditions->None])
ERROR:
{
"result": "ERROR",
"testTitle": "Simple",
"testExpression": null,
"resultExpression": null,
"wasAborted": false,
"conditionallySuccessful": false
}
Numeric
SymPy
Translation: E(h(y)) == integrate((1)/(sqrt(pi))*exp(- (x)**(2))*h(sqrt(2)*Symbol('sigma')*x + Symbol('mu')), (x, - oo, + oo))
Information
Sub Equations
- E(h(y)) = integrate((1)/(sqrt(pi))*exp(- (x)**(2))*h(sqrt(2)*Symbol('sigma')*x + Symbol('mu')), (x, - oo, + oo))
Free variables
- Symbol('mu')
- Symbol('sigma')
- y
Symbol info
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
- Exponential function; Example: \exp@@{z}
Will be translated to: exp($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E19 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#exp
- 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: E(h(y)) = int((1)/(sqrt(Pi))*exp(- (x)^(2))*h(sqrt(2)*sigma*x + mu), x = - infinity..+ infinity)
Information
Sub Equations
- E(h(y)) = int((1)/(sqrt(Pi))*exp(- (x)^(2))*h(sqrt(2)*sigma*x + mu), x = - infinity..+ infinity)
Free variables
- mu
- sigma
- y
Symbol info
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
- Exponential function; Example: \exp@@{z}
Will be translated to: exp($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E19 Maple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/Trace
- 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
Description
- expectation
- integral
- integration by substitution
- variable
- Hermite polynomial
Complete translation information:
{
"id" : "FORMULA_2733f6cd7314219f0318616ed8166651",
"formula" : "E[h(y)] = \\int_{-\\infty}^{+\\infty} \\frac{1}{\\sqrt{\\pi}} \\exp(-x^2) h(\\sqrt{2} \\sigma x + \\mu) dx",
"semanticFormula" : "E [h(y)] = \\int_{-\\infty}^{+\\infty} \\frac{1}{\\sqrt{\\cpi}} \\exp(- x^2) h(\\sqrt{2} \\sigma x + \\mu) \\diff{x}",
"confidence" : 0.0,
"translations" : {
"Mathematica" : {
"translation" : "E[h[y]] == Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h[Sqrt[2]*\\[Sigma]*x + \\[Mu]], {x, - Infinity, + Infinity}, GenerateConditions->None]",
"translationInformation" : {
"subEquations" : [ "E[h[y]] = Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h[Sqrt[2]*\\[Sigma]*x + \\[Mu]], {x, - Infinity, + Infinity}, GenerateConditions->None]" ],
"freeVariables" : [ "\\[Mu]", "\\[Sigma]", "y" ],
"tokenTranslations" : {
"h" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: Exp[$0]\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.2#E19\nMathematica: https://reference.wolfram.com/language/ref/Exp.html",
"\\cpi" : "Pi was translated to: Pi",
"E" : "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" : "ERROR",
"numberOfTests" : 1,
"numberOfFailedTests" : 0,
"numberOfSuccessfulTests" : 0,
"numberOfSkippedTests" : 0,
"numberOfErrorTests" : 1,
"crashed" : false,
"testCalculationsGroup" : [ {
"lhs" : "E*(h*(y))",
"rhs" : "Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h*(Sqrt[2]*\\[Sigma]*x + \\[Mu]), {x, - Infinity, + Infinity}, GenerateConditions->None]",
"testExpression" : "(E*(h*(y)))-(Integrate[Divide[1,Sqrt[Pi]]*Exp[- (x)^(2)]*h*(Sqrt[2]*\\[Sigma]*x + \\[Mu]), {x, - Infinity, + Infinity}, GenerateConditions->None])",
"testCalculations" : [ {
"result" : "ERROR",
"testTitle" : "Simple",
"testExpression" : null,
"resultExpression" : null,
"wasAborted" : false,
"conditionallySuccessful" : false
} ]
} ]
}
},
"SymPy" : {
"translation" : "E(h(y)) == integrate((1)/(sqrt(pi))*exp(- (x)**(2))*h(sqrt(2)*Symbol('sigma')*x + Symbol('mu')), (x, - oo, + oo))",
"translationInformation" : {
"subEquations" : [ "E(h(y)) = integrate((1)/(sqrt(pi))*exp(- (x)**(2))*h(sqrt(2)*Symbol('sigma')*x + Symbol('mu')), (x, - oo, + oo))" ],
"freeVariables" : [ "Symbol('mu')", "Symbol('sigma')", "y" ],
"tokenTranslations" : {
"h" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: exp($0)\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.2#E19\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#exp",
"\\cpi" : "Pi was translated to: pi",
"E" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
}
}
},
"Maple" : {
"translation" : "E(h(y)) = int((1)/(sqrt(Pi))*exp(- (x)^(2))*h(sqrt(2)*sigma*x + mu), x = - infinity..+ infinity)",
"translationInformation" : {
"subEquations" : [ "E(h(y)) = int((1)/(sqrt(Pi))*exp(- (x)^(2))*h(sqrt(2)*sigma*x + mu), x = - infinity..+ infinity)" ],
"freeVariables" : [ "mu", "sigma", "y" ],
"tokenTranslations" : {
"h" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: exp($0)\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.2#E19\nMaple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/Trace",
"\\cpi" : "Pi was translated to: Pi",
"E" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
}
}
}
},
"positions" : [ {
"section" : 1,
"sentence" : 1,
"word" : 39
} ],
"includes" : [ "y", "h" ],
"isPartOf" : [ ],
"definiens" : [ {
"definition" : "expectation",
"score" : 0.6460746792928004
}, {
"definition" : "integral",
"score" : 0.6460746792928004
}, {
"definition" : "integration by substitution",
"score" : 0.5049074255814494
}, {
"definition" : "variable",
"score" : 0.46655930748162855
}, {
"definition" : "Hermite polynomial",
"score" : 0.4364921621676916
} ]
}