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 \mathbf{K}_\alpha(x)=\frac{2\left(\frac{x}{2}\right)^\alpha}{\sqrt\pi\Gamma\left(\alpha+\frac{1}{2}\right)}\int_0^\infty(1+t^2)^{\alpha-\frac{1}{2}}e^{-xt}~dt=\frac{2\left(\frac{x}{2}\right)^\alpha}{\sqrt\pi\Gamma\left(\alpha+\frac{1}{2}\right)}\int_0^\infty e^{-x\sinh\tau}\cosh^{2\alpha}\tau~d\tau}
... is translated to the CAS output ...
Semantic latex: \StruveK{\alpha}@{x} = \frac{2(\frac{x}{2})^\alpha}{\sqrt{\cpi} \EulerGamma@{\alpha + \frac{1}{2}}} \int_0^\infty(1 + t^2)^{\alpha-\frac{1}{2}} \expe^{-xt} \diff{t} = \frac{2(\frac{x}{2})^\alpha}{\sqrt{\cpi} \EulerGamma@{\alpha + \frac{1}{2}}} \int_0^\infty \expe^{-x\sinh\tau} \cosh^{2\alpha} \tau \diff{\tau}
Confidence: 0.66012076646182
Mathematica
Translation: StruveH[\[Alpha], x] - BesselY[\[Alpha], x] == Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None] == Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\[Tau]]]*(Cosh[\[Tau]])^(2*\[Alpha]), {\[Tau], 0, Infinity}, GenerateConditions->None]
Information
Sub Equations
- StruveH[\[Alpha], x] - BesselY[\[Alpha], x] = Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None]
- Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None] = Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\[Tau]]]*(Cosh[\[Tau]])^(2*\[Alpha]), {\[Tau], 0, Infinity}, GenerateConditions->None]
Free variables
- \[Alpha]
- x
Symbol info
- Hyperbolic cosine; Example: \cosh@@{z}
Will be translated to: Cosh[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.28#E2 Mathematica: https://reference.wolfram.com/language/ref/Cosh.html
- Recognizes e with power as the exponential function. It was translated as a function.
- 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.
- Hyperbolic sine; Example: \sinh@@{z}
Will be translated to: Sinh[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.28#E1 Mathematica: https://reference.wolfram.com/language/ref/Sinh.html
- Pi was translated to: Pi
- Associated Struve funtion; Example: \StruveK{\nu}@{z}
Will be translated to: StruveH[$0, $1] - BesselY[$0, $1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/11.2#E5 Mathematica: https://reference.wolfram.com/language/ref/StruveH.html
- 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: (StruveH[\[Alpha], x] - BesselY[\[Alpha], x])-(Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None])
ERROR:
{
"result": "ERROR",
"testTitle": "Simple",
"testExpression": null,
"resultExpression": null,
"wasAborted": false,
"conditionallySuccessful": false
}
Test expression: (Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None])-(Divide[2*(Divide[x,2])^\[Alpha],Sqrt[Pi]*Gamma[\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\[Tau]]]*(Cosh[\[Tau]])^(2*\[Alpha]), {\[Tau], 0, Infinity}, GenerateConditions->None])
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: \StruveK [\StruveK]
Tests
Symbolic
Numeric
Maple
Translation: StruveH(alpha, x) - BesselY(alpha, x) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int((1 + (t)^(2))^(alpha -(1)/(2))* exp(- x*t), t = 0..infinity) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int(exp(- x*sinh(tau))*(cosh(tau))^(2*alpha), tau = 0..infinity)
Information
Sub Equations
- StruveH(alpha, x) - BesselY(alpha, x) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int((1 + (t)^(2))^(alpha -(1)/(2))* exp(- x*t), t = 0..infinity)
- (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int((1 + (t)^(2))^(alpha -(1)/(2))* exp(- x*t), t = 0..infinity) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int(exp(- x*sinh(tau))*(cosh(tau))^(2*alpha), tau = 0..infinity)
Free variables
- alpha
- x
Symbol info
- Hyperbolic cosine; Example: \cosh@@{z}
Will be translated to: cosh($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.28#E2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cosh
- Recognizes e with power as the exponential function. It was translated as a function.
- 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.
- Hyperbolic sine; Example: \sinh@@{z}
Will be translated to: sinh($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.28#E1 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=sinh
- Pi was translated to: Pi
- Associated Struve funtion; Example: \StruveK{\nu}@{z}
Will be translated to: StruveH($0, $1) - BesselY($0, $1) Relevant links to definitions: DLMF: http://dlmf.nist.gov/11.2#E5 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=StruveH
- 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
Complete translation information:
{
"id" : "FORMULA_d2fc4be5ffba03d935418dd9d3f2e5fc",
"formula" : "\\mathbf{K}_\\alpha(x)=\\frac{2\\left(\\frac{x}{2}\\right)^\\alpha}{\\sqrt\\pi\\Gamma\\left(\\alpha+\\frac{1}{2}\\right)}\\int_0^\\infty(1+t^2)^{\\alpha-\\frac{1}{2}}e^{-xt}~dt=\\frac{2\\left(\\frac{x}{2}\\right)^\\alpha}{\\sqrt\\pi\\Gamma\\left(\\alpha+\\frac{1}{2}\\right)}\\int_0^\\infty e^{-x\\sinh\\tau}\\cosh^{2\\alpha}\\tau~d\\tau",
"semanticFormula" : "\\StruveK{\\alpha}@{x} = \\frac{2(\\frac{x}{2})^\\alpha}{\\sqrt{\\cpi} \\EulerGamma@{\\alpha + \\frac{1}{2}}} \\int_0^\\infty(1 + t^2)^{\\alpha-\\frac{1}{2}} \\expe^{-xt} \\diff{t} = \\frac{2(\\frac{x}{2})^\\alpha}{\\sqrt{\\cpi} \\EulerGamma@{\\alpha + \\frac{1}{2}}} \\int_0^\\infty \\expe^{-x\\sinh\\tau} \\cosh^{2\\alpha} \\tau \\diff{\\tau}",
"confidence" : 0.6601207664618238,
"translations" : {
"Mathematica" : {
"translation" : "StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x] == Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None] == Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\\[Tau]]]*(Cosh[\\[Tau]])^(2*\\[Alpha]), {\\[Tau], 0, Infinity}, GenerateConditions->None]",
"translationInformation" : {
"subEquations" : [ "StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x] = Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None]", "Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None] = Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\\[Tau]]]*(Cosh[\\[Tau]])^(2*\\[Alpha]), {\\[Tau], 0, Infinity}, GenerateConditions->None]" ],
"freeVariables" : [ "\\[Alpha]", "x" ],
"tokenTranslations" : {
"\\cosh" : "Hyperbolic cosine; Example: \\cosh@@{z}\nWill be translated to: Cosh[$0]\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.28#E2\nMathematica: https://reference.wolfram.com/language/ref/Cosh.html",
"\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
"\\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",
"\\sinh" : "Hyperbolic sine; Example: \\sinh@@{z}\nWill be translated to: Sinh[$0]\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.28#E1\nMathematica: https://reference.wolfram.com/language/ref/Sinh.html",
"\\cpi" : "Pi was translated to: Pi",
"\\StruveK" : "Associated Struve funtion; Example: \\StruveK{\\nu}@{z}\nWill be translated to: StruveH[$0, $1] - BesselY[$0, $1]\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/11.2#E5\nMathematica: https://reference.wolfram.com/language/ref/StruveH.html",
"\\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" : 2,
"numberOfFailedTests" : 0,
"numberOfSuccessfulTests" : 0,
"numberOfSkippedTests" : 0,
"numberOfErrorTests" : 2,
"crashed" : false,
"testCalculationsGroup" : [ {
"lhs" : "StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x]",
"rhs" : "Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None]",
"testExpression" : "(StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x])-(Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None])",
"testCalculations" : [ {
"result" : "ERROR",
"testTitle" : "Simple",
"testExpression" : null,
"resultExpression" : null,
"wasAborted" : false,
"conditionallySuccessful" : false
} ]
}, {
"lhs" : "Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None]",
"rhs" : "Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\\[Tau]]]*(Cosh[\\[Tau]])^(2*\\[Alpha]), {\\[Tau], 0, Infinity}, GenerateConditions->None]",
"testExpression" : "(Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[(1 + (t)^(2))^(\\[Alpha]-Divide[1,2])* Exp[- x*t], {t, 0, Infinity}, GenerateConditions->None])-(Divide[2*(Divide[x,2])^\\[Alpha],Sqrt[Pi]*Gamma[\\[Alpha]+Divide[1,2]]]*Integrate[Exp[- x*Sinh[\\[Tau]]]*(Cosh[\\[Tau]])^(2*\\[Alpha]), {\\[Tau], 0, Infinity}, GenerateConditions->None])",
"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: \\StruveK [\\StruveK]"
}
}
},
"Maple" : {
"translation" : "StruveH(alpha, x) - BesselY(alpha, x) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int((1 + (t)^(2))^(alpha -(1)/(2))* exp(- x*t), t = 0..infinity) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int(exp(- x*sinh(tau))*(cosh(tau))^(2*alpha), tau = 0..infinity)",
"translationInformation" : {
"subEquations" : [ "StruveH(alpha, x) - BesselY(alpha, x) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int((1 + (t)^(2))^(alpha -(1)/(2))* exp(- x*t), t = 0..infinity)", "(2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int((1 + (t)^(2))^(alpha -(1)/(2))* exp(- x*t), t = 0..infinity) = (2*((x)/(2))^(alpha))/(sqrt(Pi)*GAMMA(alpha +(1)/(2)))*int(exp(- x*sinh(tau))*(cosh(tau))^(2*alpha), tau = 0..infinity)" ],
"freeVariables" : [ "alpha", "x" ],
"tokenTranslations" : {
"\\cosh" : "Hyperbolic cosine; Example: \\cosh@@{z}\nWill be translated to: cosh($0)\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.28#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cosh",
"\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
"\\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",
"\\sinh" : "Hyperbolic sine; Example: \\sinh@@{z}\nWill be translated to: sinh($0)\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/4.28#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=sinh",
"\\cpi" : "Pi was translated to: Pi",
"\\StruveK" : "Associated Struve funtion; Example: \\StruveK{\\nu}@{z}\nWill be translated to: StruveH($0, $1) - BesselY($0, $1)\nRelevant links to definitions:\nDLMF: http://dlmf.nist.gov/11.2#E5\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=StruveH",
"\\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" : [ ],
"includes" : [ "\\mathbf{K}_\\alpha(x)", "\\alpha", "\\Gamma(z)", "\\mathbf{H}_{\\alpha}(x)", "\\mathbf{L}_{\\alpha}(x)", "x", "\\mathbf{H}_{\\alpha}(z)", "Y_{\\alpha}(x)", "\\mathbf{M}_\\alpha(x)" ],
"isPartOf" : [ ],
"definiens" : [ ]
}