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 P_1^{(\lambda)}(x;\phi)=2(\lambda\cos\phi + x\sin\phi)}
... is translated to the CAS output ...
Semantic latex: P_1^{(\lambda)}(x;\phi)=2(\lambda\cos\phi + x\sin\phi)
Confidence: 0
Mathematica
Translation: (Subscript[P, 1])^(\[Lambda])[x ; \[Phi]] == 2*(\[Lambda]*Cos[\[Phi]]+ x*Sin[\[Phi]])
Information
Sub Equations
- (Subscript[P, 1])^(\[Lambda])[x ; \[Phi]] = 2*(\[Lambda]*Cos[\[Phi]]+ x*Sin[\[Phi]])
Free variables
- \[Lambda]
- \[Phi]
- x
Symbol info
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
- 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
- Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.
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
Numeric
SymPy
Translation: (Symbol('{P}_{1}'))**(Symbol('lambda'))(x ; Symbol('phi')) == 2*(Symbol('lambda')*cos(Symbol('phi'))+ x*sin(Symbol('phi')))
Information
Sub Equations
- (Symbol('{P}_{1}'))**(Symbol('lambda'))(x ; Symbol('phi')) = 2*(Symbol('lambda')*cos(Symbol('phi'))+ x*sin(Symbol('phi')))
Free variables
- Symbol('lambda')
- Symbol('phi')
- x
Symbol info
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
- 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
- Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.
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: (P[1])^(lambda)(x ; phi) = 2*(lambda*cos(phi)+ x*sin(phi))
Information
Sub Equations
- (P[1])^(lambda)(x ; phi) = 2*(lambda*cos(phi)+ x*sin(phi))
Free variables
- lambda
- phi
- x
Symbol info
- Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
- 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
- Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.
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
- Failed to parse (syntax error): {\displaystyle 1^{(}
Description
- phi
- lambda
- x
- TeX Source
- Formula
- Gold ID
- cos
- link
- p
- sin
Complete translation information:
{
"id" : "FORMULA_96d19b4b504f801548c69064d662043b",
"formula" : "P_1^{(\\lambda)}(x;\\phi)=2(\\lambda\\cos\\phi + x\\sin\\phi)",
"semanticFormula" : "P_1^{(\\lambda)}(x;\\phi)=2(\\lambda\\cos\\phi + x\\sin\\phi)",
"confidence" : 0.0,
"translations" : {
"Mathematica" : {
"translation" : "(Subscript[P, 1])^(\\[Lambda])[x ; \\[Phi]] == 2*(\\[Lambda]*Cos[\\[Phi]]+ x*Sin[\\[Phi]])",
"translationInformation" : {
"subEquations" : [ "(Subscript[P, 1])^(\\[Lambda])[x ; \\[Phi]] = 2*(\\[Lambda]*Cos[\\[Phi]]+ x*Sin[\\[Phi]])" ],
"freeVariables" : [ "\\[Lambda]", "\\[Phi]", "x" ],
"tokenTranslations" : {
"P" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\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",
"\\phi" : "Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.\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" : "SKIPPED",
"numberOfTests" : 0,
"numberOfFailedTests" : 0,
"numberOfSuccessfulTests" : 0,
"numberOfSkippedTests" : 0,
"numberOfErrorTests" : 0,
"crashed" : false,
"testCalculationsGroup" : [ ]
}
},
"SymPy" : {
"translation" : "(Symbol('{P}_{1}'))**(Symbol('lambda'))(x ; Symbol('phi')) == 2*(Symbol('lambda')*cos(Symbol('phi'))+ x*sin(Symbol('phi')))",
"translationInformation" : {
"subEquations" : [ "(Symbol('{P}_{1}'))**(Symbol('lambda'))(x ; Symbol('phi')) = 2*(Symbol('lambda')*cos(Symbol('phi'))+ x*sin(Symbol('phi')))" ],
"freeVariables" : [ "Symbol('lambda')", "Symbol('phi')", "x" ],
"tokenTranslations" : {
"P" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\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",
"\\phi" : "Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.\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"
}
},
"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" : "(P[1])^(lambda)(x ; phi) = 2*(lambda*cos(phi)+ x*sin(phi))",
"translationInformation" : {
"subEquations" : [ "(P[1])^(lambda)(x ; phi) = 2*(lambda*cos(phi)+ x*sin(phi))" ],
"freeVariables" : [ "lambda", "phi", "x" ],
"tokenTranslations" : {
"P" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
"\\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",
"\\phi" : "Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.\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"
}
},
"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" : [ "1^{(", ")=2(" ],
"isPartOf" : [ ],
"definiens" : [ {
"definition" : "phi",
"score" : 0.8536099109960977
}, {
"definition" : "lambda",
"score" : 0.7795898934682262
}, {
"definition" : "x",
"score" : 0.7795898934682262
}, {
"definition" : "TeX Source",
"score" : 0.722
}, {
"definition" : "Formula",
"score" : 0.6896778755706364
}, {
"definition" : "Gold ID",
"score" : 0.6629879847031728
}, {
"definition" : "cos",
"score" : 0.6231540443721655
}, {
"definition" : "link",
"score" : 0.6231540443721655
}, {
"definition" : "p",
"score" : 0.6231540443721655
}, {
"definition" : "sin",
"score" : 0.6231540443721655
} ]
}