LaTeX to CAS translator

Jump to navigation Jump to search

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 \Phi(e^{i\varphi},s,a)=L\big(\tfrac{\varphi}{2\pi},a,s\big)= \frac{1}{a^s} + \frac{1}{2\Gamma(s)}\int_{0}^{\infty}\frac{t^{s-1}e^{-at}\big(e^{i\varphi}-e^{-t}\big)}{\cosh{t}-\cos{\varphi}}\,dt, }

... is translated to the CAS output ...

Semantic latex: \Phi(\expe^{\iunit \varphi} , s , a) = L(\tfrac{\varphi}{2 \cpi} , a , s) = \frac{1}{a^s} + \frac{1}{2\Gamma(s)} \int_{0}^{\infty} \frac{t^{s-1} \expe^{-at}(\expe^{\iunit \varphi} - \expe^{-t})}{\cosh{t}-\cos{\varphi}} \diff{t}

Confidence: 0

Mathematica

Translation: \[CapitalPhi][Exp[I*\[CurlyPhi]], s , a] == L[Divide[\[CurlyPhi],2*Pi], a , s] == Divide[1,(a)^(s)]+Divide[1,2*\[CapitalGamma][s]]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None]

Information

Sub Equations

  • \[CapitalPhi][Exp[I*\[CurlyPhi]], s , a] = L[Divide[\[CurlyPhi],2*Pi], a , s]
  • L[Divide[\[CurlyPhi],2*Pi], a , s] = Divide[1,(a)^(s)]+Divide[1,2*\[CapitalGamma][s]]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None]

Free variables

  • \[CapitalGamma]
  • \[CapitalPhi]
  • \[CurlyPhi]
  • a
  • s

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

  • 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.
  • Pi was translated to: Pi
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Imaginary unit was translated to: I
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic

Test expression: (\[CapitalPhi]*(Exp[I*\[CurlyPhi]], s , a))-(L*(Divide[\[CurlyPhi],2*Pi], a , s))

ERROR:

{
    "result": "ERROR",
    "testTitle": "Simple",
    "testExpression": null,
    "resultExpression": null,
    "wasAborted": false,
    "conditionallySuccessful": false
}

Test expression: (L*(Divide[\[CurlyPhi],2*Pi], a , s))-(Divide[1,(a)^(s)]+Divide[1,2*\[CapitalGamma]*(s)]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None])

ERROR:

{
    "result": "ERROR",
    "testTitle": "Simple",
    "testExpression": null,
    "resultExpression": null,
    "wasAborted": false,
    "conditionallySuccessful": false
}
Numeric

SymPy

Translation: Symbol('Phi')(exp(I*Symbol(r'\varphi')), s , a) == L((Symbol(r'\varphi'))/(2*pi), a , s) == (1)/((a)**(s))+(1)/(2*Symbol('Gamma')(s))*integrate(((t)**(s - 1)* exp(- a*t)*(exp(I*Symbol(r'\varphi'))- exp(- t)))/(cosh(t)- cos(Symbol(r'\varphi'))), (t, 0, oo))

Information

Sub Equations

  • Symbol('Phi')(exp(I*Symbol(r'\varphi')), s , a) = L((Symbol(r'\varphi'))/(2*pi), a , s)
  • L((Symbol(r'\varphi'))/(2*pi), a , s) = (1)/((a)**(s))+(1)/(2*Symbol('Gamma')(s))*integrate(((t)**(s - 1)* exp(- a*t)*(exp(I*Symbol(r'\varphi'))- exp(- t)))/(cosh(t)- cos(Symbol(r'\varphi'))), (t, 0, oo))

Free variables

  • Symbol('Gamma')
  • Symbol('Phi')
  • Symbol(r'\varphi')
  • a
  • s

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

  • Hyperbolic cosine; Example: \cosh@@{z}

Will be translated to: cosh($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.28#E2 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cosh

  • Recognizes e with power as the exponential function. It was translated as a function.
  • Pi was translated to: pi
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Imaginary unit was translated to: I
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Maple

Translation: Phi(exp(I*varphi), s , a) = L((varphi)/(2*Pi), a , s) = (1)/((a)^(s))+(1)/(2*Gamma(s))*int(((t)^(s - 1)* exp(- a*t)*(exp(I*varphi)- exp(- t)))/(cosh(t)- cos(varphi)), t = 0..infinity)

Information

Sub Equations

  • Phi(exp(I*varphi), s , a) = L((varphi)/(2*Pi), a , s)
  • L((varphi)/(2*Pi), a , s) = (1)/((a)^(s))+(1)/(2*Gamma(s))*int(((t)^(s - 1)* exp(- a*t)*(exp(I*varphi)- exp(- t)))/(cosh(t)- cos(varphi)), t = 0..infinity)

Free variables

  • Gamma
  • Phi
  • a
  • s
  • varphi

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

  • 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.
  • Pi was translated to: Pi
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Imaginary unit was translated to: I
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Is part of

Complete translation information:

{
  "id" : "FORMULA_398a38c6530a3e7df8b1a5dcd9f4a747",
  "formula" : "\\Phi(e^{i\\varphi},s,a)=L(\\tfrac{\\varphi}{2\\pi},a,s)= \\frac{1}{a^s} + \\frac{1}{2\\Gamma(s)}\\int_{0}^{\\infty}\\frac{t^{s-1}e^{-at}(e^{i\\varphi}-e^{-t})}{\\cosh{t}-\\cos{\\varphi}}dt",
  "semanticFormula" : "\\Phi(\\expe^{\\iunit \\varphi} , s , a) = L(\\tfrac{\\varphi}{2 \\cpi} , a , s) = \\frac{1}{a^s} + \\frac{1}{2\\Gamma(s)} \\int_{0}^{\\infty} \\frac{t^{s-1} \\expe^{-at}(\\expe^{\\iunit \\varphi} - \\expe^{-t})}{\\cosh{t}-\\cos{\\varphi}} \\diff{t}",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "\\[CapitalPhi][Exp[I*\\[CurlyPhi]], s , a] == L[Divide[\\[CurlyPhi],2*Pi], a , s] == Divide[1,(a)^(s)]+Divide[1,2*\\[CapitalGamma][s]]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "\\[CapitalPhi][Exp[I*\\[CurlyPhi]], s , a] = L[Divide[\\[CurlyPhi],2*Pi], a , s]", "L[Divide[\\[CurlyPhi],2*Pi], a , s] = Divide[1,(a)^(s)]+Divide[1,2*\\[CapitalGamma][s]]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None]" ],
        "freeVariables" : [ "\\[CapitalGamma]", "\\[CapitalPhi]", "\\[CurlyPhi]", "a", "s" ],
        "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",
          "\\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.",
          "\\cpi" : "Pi was translated to: Pi",
          "L" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\iunit" : "Imaginary unit was translated to: I",
          "\\Phi" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\Gamma" : "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" : 2,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 2,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "\\[CapitalPhi]*(Exp[I*\\[CurlyPhi]], s , a)",
          "rhs" : "L*(Divide[\\[CurlyPhi],2*Pi], a , s)",
          "testExpression" : "(\\[CapitalPhi]*(Exp[I*\\[CurlyPhi]], s , a))-(L*(Divide[\\[CurlyPhi],2*Pi], a , s))",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        }, {
          "lhs" : "L*(Divide[\\[CurlyPhi],2*Pi], a , s)",
          "rhs" : "Divide[1,(a)^(s)]+Divide[1,2*\\[CapitalGamma]*(s)]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None]",
          "testExpression" : "(L*(Divide[\\[CurlyPhi],2*Pi], a , s))-(Divide[1,(a)^(s)]+Divide[1,2*\\[CapitalGamma]*(s)]*Integrate[Divide[(t)^(s - 1)* Exp[- a*t]*(Exp[I*\\[CurlyPhi]]- Exp[- t]),Cosh[t]- Cos[\\[CurlyPhi]]], {t, 0, Infinity}, GenerateConditions->None])",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "Symbol('Phi')(exp(I*Symbol(r'\\varphi')), s , a) == L((Symbol(r'\\varphi'))/(2*pi), a , s) == (1)/((a)**(s))+(1)/(2*Symbol('Gamma')(s))*integrate(((t)**(s - 1)* exp(- a*t)*(exp(I*Symbol(r'\\varphi'))- exp(- t)))/(cosh(t)- cos(Symbol(r'\\varphi'))), (t, 0, oo))",
      "translationInformation" : {
        "subEquations" : [ "Symbol('Phi')(exp(I*Symbol(r'\\varphi')), s , a) = L((Symbol(r'\\varphi'))/(2*pi), a , s)", "L((Symbol(r'\\varphi'))/(2*pi), a , s) = (1)/((a)**(s))+(1)/(2*Symbol('Gamma')(s))*integrate(((t)**(s - 1)* exp(- a*t)*(exp(I*Symbol(r'\\varphi'))- exp(- t)))/(cosh(t)- cos(Symbol(r'\\varphi'))), (t, 0, oo))" ],
        "freeVariables" : [ "Symbol('Gamma')", "Symbol('Phi')", "Symbol(r'\\varphi')", "a", "s" ],
        "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",
          "\\cosh" : "Hyperbolic cosine; Example: \\cosh@@{z}\nWill be translated to: cosh($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.28#E2\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cosh",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
          "\\cpi" : "Pi was translated to: pi",
          "L" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\iunit" : "Imaginary unit was translated to: I",
          "\\Phi" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\Gamma" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      }
    },
    "Maple" : {
      "translation" : "Phi(exp(I*varphi), s , a) = L((varphi)/(2*Pi), a , s) = (1)/((a)^(s))+(1)/(2*Gamma(s))*int(((t)^(s - 1)* exp(- a*t)*(exp(I*varphi)- exp(- t)))/(cosh(t)- cos(varphi)), t = 0..infinity)",
      "translationInformation" : {
        "subEquations" : [ "Phi(exp(I*varphi), s , a) = L((varphi)/(2*Pi), a , s)", "L((varphi)/(2*Pi), a , s) = (1)/((a)^(s))+(1)/(2*Gamma(s))*int(((t)^(s - 1)* exp(- a*t)*(exp(I*varphi)- exp(- t)))/(cosh(t)- cos(varphi)), t = 0..infinity)" ],
        "freeVariables" : [ "Gamma", "Phi", "a", "s", "varphi" ],
        "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",
          "\\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.",
          "\\cpi" : "Pi was translated to: Pi",
          "L" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\iunit" : "Imaginary unit was translated to: I",
          "\\Phi" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\Gamma" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "a", "\\Phi(z,s,a)", "L(\\lambda, \\alpha, s)", "s", "\\Phi(e^{i\\varphi},s,a)=L\\big(\\tfrac{\\varphi}{2\\pi},a,s\\big)= \\frac{1}{a^s} + \\frac{1}{2\\Gamma(s)}\\int_{0}^{\\infty}\\frac{t^{s-1}e^{-at}\\big(e^{i\\varphi}-e^{-t}\\big)}{\\cosh{t}-\\cos{\\varphi}}\\,dt" ],
  "isPartOf" : [ "\\Phi(e^{i\\varphi},s,a)=L\\big(\\tfrac{\\varphi}{2\\pi},a,s\\big)= \\frac{1}{a^s} + \\frac{1}{2\\Gamma(s)}\\int_{0}^{\\infty}\\frac{t^{s-1}e^{-at}\\big(e^{i\\varphi}-e^{-t}\\big)}{\\cosh{t}-\\cos{\\varphi}}\\,dt" ],
  "definiens" : [ ]
}

Specify your own input