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 Q_{\lambda}^{\mu}(z) = \frac{\sqrt{\pi}\ \Gamma(\lambda+\mu+1)}{2^{\lambda+1}\Gamma(\lambda+3/2)}\frac{e^{i\mu\pi}(z^2-1)^{\mu/2}}{z^{\lambda+\mu+1}} \,_2F_1 \left(\frac{\lambda+\mu+1}{2}, \frac{\lambda+\mu+2}{2}; \lambda+\frac{3}{2}; \frac{1}{z^2}\right),\qquad \text{for}\ \ |z|>1.}

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

Semantic latex: \FerrersQ[\mu]{\lambda}@{z} = \frac{\sqrt{\cpi} \EulerGamma@{\lambda + \mu + 1}}{2^{\lambda+1} \EulerGamma@{\lambda + 3 / 2}} \frac{\expe^{\iunit \mu \cpi}(z^2 - 1)^{\mu/2}}{z^{\lambda+\mu+1}}_2 F_1(\frac{\lambda+\mu+1}{2} , \frac{\lambda+\mu+2}{2} ; \lambda + \frac{3}{2} ; \frac{1}{z^2}) , \qquad{for}|z|> 1

Confidence: 0.60864552565258

Mathematica

Translation: LegendreQ[\[Lambda], \[Mu], z] == Divide[Sqrt[Pi]*Gamma[\[Lambda]+ \[Mu]+ 1],(2)^(\[Lambda]+ 1)* Gamma[\[Lambda]+ 3/2]]*Subscript[Divide[Exp[I*\[Mu]*Pi]*((z)^(2)- 1)^(\[Mu]/2),(z)^(\[Lambda]+ \[Mu]+ 1)], 2]*Subscript[F, 1][Divide[\[Lambda]+ \[Mu]+ 1,2],Divide[\[Lambda]+ \[Mu]+ 2,2]; \[Lambda]+Divide[3,2];Divide[1,(z)^(2)]]

Information

Sub Equations

  • LegendreQ[\[Lambda], \[Mu], z] = Divide[Sqrt[Pi]*Gamma[\[Lambda]+ \[Mu]+ 1],(2)^(\[Lambda]+ 1)* Gamma[\[Lambda]+ 3/2]]*Subscript[Divide[Exp[I*\[Mu]*Pi]*((z)^(2)- 1)^(\[Mu]/2),(z)^(\[Lambda]+ \[Mu]+ 1)], 2]*Subscript[F, 1][Divide[\[Lambda]+ \[Mu]+ 1,2],Divide[\[Lambda]+ \[Mu]+ 2,2]; \[Lambda]+Divide[3,2];Divide[1,(z)^(2)]]

Free variables

  • \[Lambda]
  • \[Mu]
  • f
  • o
  • r
  • z

Constraints

  • f*o*r*Abs[z] > 1

Symbol info

  • Pi was translated to: Pi
  • Recognizes e with power as the exponential function. It was translated as a function.
  • Imaginary unit was translated to: I
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Ferrers function of second kind; Example: \FerrersQ[\mu]{\nu}@{x}

Will be translated to: LegendreQ[$1, $0, $2] Constraints: -1 < x < 1, \mu, \nu \in \Reals Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.3#E2 Mathematica: https://reference.wolfram.com/language/ref/LegendreQ.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
Numeric

SymPy

Translation:

Information

Symbol info

  • (LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \FerrersQ [\FerrersQ]

Tests

Symbolic
Numeric

Maple

Translation: LegendreQ(lambda, mu, z) = (sqrt(Pi)*GAMMA(lambda + mu + 1))/((2)^(lambda + 1)* GAMMA(lambda + 3/2))*(exp(I*mu*Pi)*((z)^(2)- 1)^(mu/2))/((z)^(lambda + mu + 1))[2]*F[1]((lambda + mu + 1)/(2),(lambda + mu + 2)/(2); lambda +(3)/(2);(1)/((z)^(2)))

Information

Sub Equations

  • LegendreQ(lambda, mu, z) = (sqrt(Pi)*GAMMA(lambda + mu + 1))/((2)^(lambda + 1)* GAMMA(lambda + 3/2))*(exp(I*mu*Pi)*((z)^(2)- 1)^(mu/2))/((z)^(lambda + mu + 1))[2]*F[1]((lambda + mu + 1)/(2),(lambda + mu + 2)/(2); lambda +(3)/(2);(1)/((z)^(2)))

Free variables

  • f
  • lambda
  • mu
  • o
  • r
  • z

Constraints

  • f*o*r*abs(z) > 1

Symbol info

  • Pi was translated to: Pi
  • Recognizes e with power as the exponential function. It was translated as a function.
  • Imaginary unit was translated to: I
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Ferrers function of second kind; Example: \FerrersQ[\mu]{\nu}@{x}

Will be translated to: LegendreQ($1, $0, $2) Constraints: -1 < x < 1, \mu, \nu \in \Reals Relevant links to definitions: DLMF: http://dlmf.nist.gov/14.3#E2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreQ

  • 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

Is part of

Complete translation information:

{
  "id" : "FORMULA_ed591c8fb30b7866b1d1e61d397f00a5",
  "formula" : "Q_{\\lambda}^{\\mu}(z) = \\frac{\\sqrt{\\pi}\\Gamma(\\lambda+\\mu+1)}{2^{\\lambda+1}\\Gamma(\\lambda+3/2)}\\frac{e^{i\\mu\\pi}(z^2-1)^{\\mu/2}}{z^{\\lambda+\\mu+1}} _2F_1 \\left(\\frac{\\lambda+\\mu+1}{2}, \\frac{\\lambda+\\mu+2}{2}; \\lambda+\\frac{3}{2}; \\frac{1}{z^2}\\right),\\qquad \\text{for}|z|>1",
  "semanticFormula" : "\\FerrersQ[\\mu]{\\lambda}@{z} = \\frac{\\sqrt{\\cpi} \\EulerGamma@{\\lambda + \\mu + 1}}{2^{\\lambda+1} \\EulerGamma@{\\lambda + 3 / 2}} \\frac{\\expe^{\\iunit \\mu \\cpi}(z^2 - 1)^{\\mu/2}}{z^{\\lambda+\\mu+1}}_2 F_1(\\frac{\\lambda+\\mu+1}{2} , \\frac{\\lambda+\\mu+2}{2} ; \\lambda + \\frac{3}{2} ; \\frac{1}{z^2}) , \\qquad{for}|z|> 1",
  "confidence" : 0.6086455256525842,
  "translations" : {
    "Mathematica" : {
      "translation" : "LegendreQ[\\[Lambda], \\[Mu], z] == Divide[Sqrt[Pi]*Gamma[\\[Lambda]+ \\[Mu]+ 1],(2)^(\\[Lambda]+ 1)* Gamma[\\[Lambda]+ 3/2]]*Subscript[Divide[Exp[I*\\[Mu]*Pi]*((z)^(2)- 1)^(\\[Mu]/2),(z)^(\\[Lambda]+ \\[Mu]+ 1)], 2]*Subscript[F, 1][Divide[\\[Lambda]+ \\[Mu]+ 1,2],Divide[\\[Lambda]+ \\[Mu]+ 2,2]; \\[Lambda]+Divide[3,2];Divide[1,(z)^(2)]]",
      "translationInformation" : {
        "subEquations" : [ "LegendreQ[\\[Lambda], \\[Mu], z] = Divide[Sqrt[Pi]*Gamma[\\[Lambda]+ \\[Mu]+ 1],(2)^(\\[Lambda]+ 1)* Gamma[\\[Lambda]+ 3/2]]*Subscript[Divide[Exp[I*\\[Mu]*Pi]*((z)^(2)- 1)^(\\[Mu]/2),(z)^(\\[Lambda]+ \\[Mu]+ 1)], 2]*Subscript[F, 1][Divide[\\[Lambda]+ \\[Mu]+ 1,2],Divide[\\[Lambda]+ \\[Mu]+ 2,2]; \\[Lambda]+Divide[3,2];Divide[1,(z)^(2)]]" ],
        "freeVariables" : [ "\\[Lambda]", "\\[Mu]", "f", "o", "r", "z" ],
        "constraints" : [ "f*o*r*Abs[z] > 1" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
          "\\iunit" : "Imaginary unit was translated to: I",
          "F" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\FerrersQ1" : "Ferrers function of second kind; Example: \\FerrersQ[\\mu]{\\nu}@{x}\nWill be translated to: LegendreQ[$1, $0, $2]\nConstraints: -1 < x < 1, \\mu, \\nu \\in \\Reals\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/14.3#E2\nMathematica:  https://reference.wolfram.com/language/ref/LegendreQ.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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "SymPy" : {
      "translation" : "",
      "translationInformation" : {
        "tokenTranslations" : {
          "Error" : "(LaTeX -> SymPy) No translation possible for given token: Cannot extract information from feature set: \\FerrersQ [\\FerrersQ]"
        }
      },
      "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" : "LegendreQ(lambda, mu, z) = (sqrt(Pi)*GAMMA(lambda + mu + 1))/((2)^(lambda + 1)* GAMMA(lambda + 3/2))*(exp(I*mu*Pi)*((z)^(2)- 1)^(mu/2))/((z)^(lambda + mu + 1))[2]*F[1]((lambda + mu + 1)/(2),(lambda + mu + 2)/(2); lambda +(3)/(2);(1)/((z)^(2)))",
      "translationInformation" : {
        "subEquations" : [ "LegendreQ(lambda, mu, z) = (sqrt(Pi)*GAMMA(lambda + mu + 1))/((2)^(lambda + 1)* GAMMA(lambda + 3/2))*(exp(I*mu*Pi)*((z)^(2)- 1)^(mu/2))/((z)^(lambda + mu + 1))[2]*F[1]((lambda + mu + 1)/(2),(lambda + mu + 2)/(2); lambda +(3)/(2);(1)/((z)^(2)))" ],
        "freeVariables" : [ "f", "lambda", "mu", "o", "r", "z" ],
        "constraints" : [ "f*o*r*abs(z) > 1" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "\\expe" : "Recognizes e with power as the exponential function. It was translated as a function.",
          "\\iunit" : "Imaginary unit was translated to: I",
          "F" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\FerrersQ1" : "Ferrers function of second kind; Example: \\FerrersQ[\\mu]{\\nu}@{x}\nWill be translated to: LegendreQ($1, $0, $2)\nConstraints: -1 < x < 1, \\mu, \\nu \\in \\Reals\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/14.3#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=LegendreQ",
          "\\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"
        }
      },
      "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" : [ ],
  "includes" : [ "Q_{\\lambda}^{\\mu}(z) = \\frac{\\sqrt{\\pi}\\ \\Gamma(\\lambda+\\mu+1)}{2^{\\lambda+1}\\Gamma(\\lambda+3/2)}\\frac{e^{i\\mu\\pi}(z^2-1)^{\\mu/2}}{z^{\\lambda+\\mu+1}} \\,_2F_1 \\left(\\frac{\\lambda+\\mu+1}{2}, \\frac{\\lambda+\\mu+2}{2}; \\lambda+\\frac{3}{2}; \\frac{1}{z^2}\\right),\\qquad \\text{for}\\ \\ |z|>1", "z", "Q", "\\lambda", "\\Gamma", "\\mu", "_2F_1", "-1" ],
  "isPartOf" : [ "Q_{\\lambda}^{\\mu}(z) = \\frac{\\sqrt{\\pi}\\ \\Gamma(\\lambda+\\mu+1)}{2^{\\lambda+1}\\Gamma(\\lambda+3/2)}\\frac{e^{i\\mu\\pi}(z^2-1)^{\\mu/2}}{z^{\\lambda+\\mu+1}} \\,_2F_1 \\left(\\frac{\\lambda+\\mu+1}{2}, \\frac{\\lambda+\\mu+2}{2}; \\lambda+\\frac{3}{2}; \\frac{1}{z^2}\\right),\\qquad \\text{for}\\ \\ |z|>1" ],
  "definiens" : [ ]
}

Specify your own input