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 \mathrm{kei}(x) = -\ln\left(\frac{x}{2}\right) \mathrm{bei}(x) - \frac{\pi}{4}\mathrm{ber}(x) + \sum_{k \geq 0} (-1)^k \frac{\psi(2k + 2)}{[(2k+1)!]^2} \left(\frac{x^2}{4}\right)^{2k+1}}

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

Semantic latex: \mathrm{kei}(x) = - \ln(\frac{x}{2}) \mathrm{bei}(x) - \frac{\cpi}{4} \mathrm{ber}(x) + \sum_{k \geq 0}(- 1)^k \frac{\digamma@{2 k + 2}}{[(2k+1)!]^2}(\frac{x^2}{4})^{2k+1}

Confidence: 0.6805

Mathematica

Translation: kei[x] == - Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 0, Infinity}, GenerateConditions->None]

Information

Sub Equations

  • kei[x] = - Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 0, Infinity}, GenerateConditions->None]

Free variables

  • x

Symbol info

  • Pi was translated to: Pi
  • 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).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Digamma / Psi function; Example: \digamma@{z}

Will be translated to: PolyGamma[$0] Constraints: z not element of {0, -1, -2, ...} Relevant links to definitions: DLMF: http://dlmf.nist.gov/5.2#E2 Mathematica: https://reference.wolfram.com/language/ref/PolyGamma.html

  • Natural logarithm; Example: \ln@@{z}

Will be translated to: Log[$0] Constraints: z != 0 Branch Cuts: (-\infty, 0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E2 Mathematica: https://reference.wolfram.com/language/ref/Log.html

Tests

Symbolic

Test expression: (kei[x])-(- Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 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: \digamma [\digamma]

Tests

Symbolic
Numeric

Maple

Translation: kei(x) = - ln((x)/(2))*bei(x)-(Pi)/(4)*ber(x)+ sum((- 1)^(k)*(Psi(2*k + 2))/((factorial(2*k + 1))^(2))*(((x)^(2))/(4))^(2*k + 1), k = 0..infinity)

Information

Sub Equations

  • kei(x) = - ln((x)/(2))*bei(x)-(Pi)/(4)*ber(x)+ sum((- 1)^(k)*(Psi(2*k + 2))/((factorial(2*k + 1))^(2))*(((x)^(2))/(4))^(2*k + 1), k = 0..infinity)

Free variables

  • x

Symbol info

  • Pi was translated to: Pi
  • 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).
  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).
  • Digamma / Psi function; Example: \digamma@{z}

Will be translated to: Psi($0) Constraints: z not element of {0, -1, -2, ...} Relevant links to definitions: DLMF: http://dlmf.nist.gov/5.2#E2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Psi

  • Natural logarithm; Example: \ln@@{z}

Will be translated to: ln($0) Constraints: z != 0 Branch Cuts: (-\infty, 0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=ln

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • series expansion
  • kei
  • asymptotic series
  • integer
  • special case kei
  • ker

Complete translation information:

{
  "id" : "FORMULA_4a08ce875ebda0e2c6e50935dbd7ba9e",
  "formula" : "\\mathrm{kei}(x) = -\\ln\\left(\\frac{x}{2}\\right) \\mathrm{bei}(x) - \\frac{\\pi}{4}\\mathrm{ber}(x) + \\sum_{k \\geq 0} (-1)^k \\frac{\\psi(2k + 2)}{[(2k+1)!]^2} \\left(\\frac{x^2}{4}\\right)^{2k+1}",
  "semanticFormula" : "\\mathrm{kei}(x) = - \\ln(\\frac{x}{2}) \\mathrm{bei}(x) - \\frac{\\cpi}{4} \\mathrm{ber}(x) + \\sum_{k \\geq 0}(- 1)^k \\frac{\\digamma@{2 k + 2}}{[(2k+1)!]^2}(\\frac{x^2}{4})^{2k+1}",
  "confidence" : 0.6805,
  "translations" : {
    "Mathematica" : {
      "translation" : "kei[x] == - Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 0, Infinity}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "kei[x] = - Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 0, Infinity}, GenerateConditions->None]" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "kei" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "ber" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "bei" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\digamma" : "Digamma / Psi function; Example: \\digamma@{z}\nWill be translated to: PolyGamma[$0]\nConstraints: z not element of {0, -1, -2, ...}\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/5.2#E2\nMathematica:  https://reference.wolfram.com/language/ref/PolyGamma.html",
          "\\ln" : "Natural logarithm; Example: \\ln@@{z}\nWill be translated to: Log[$0]\nConstraints: z != 0\nBranch Cuts: (-\\infty, 0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.2#E2\nMathematica:  https://reference.wolfram.com/language/ref/Log.html"
        }
      },
      "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" : "kei[x]",
          "rhs" : "- Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 0, Infinity}, GenerateConditions->None]",
          "testExpression" : "(kei[x])-(- Log[Divide[x,2]]*bei[x]-Divide[Pi,4]*ber[x]+ Sum[(- 1)^(k)*Divide[PolyGamma[2*k + 2],((2*k + 1)!)^(2)]*(Divide[(x)^(2),4])^(2*k + 1), {k, 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: \\digamma [\\digamma]"
        }
      }
    },
    "Maple" : {
      "translation" : "kei(x) = - ln((x)/(2))*bei(x)-(Pi)/(4)*ber(x)+ sum((- 1)^(k)*(Psi(2*k + 2))/((factorial(2*k + 1))^(2))*(((x)^(2))/(4))^(2*k + 1), k = 0..infinity)",
      "translationInformation" : {
        "subEquations" : [ "kei(x) = - ln((x)/(2))*bei(x)-(Pi)/(4)*ber(x)+ sum((- 1)^(k)*(Psi(2*k + 2))/((factorial(2*k + 1))^(2))*(((x)^(2))/(4))^(2*k + 1), k = 0..infinity)" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\cpi" : "Pi was translated to: Pi",
          "kei" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "ber" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "bei" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary).",
          "\\digamma" : "Digamma / Psi function; Example: \\digamma@{z}\nWill be translated to: Psi($0)\nConstraints: z not element of {0, -1, -2, ...}\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/5.2#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Psi",
          "\\ln" : "Natural logarithm; Example: \\ln@@{z}\nWill be translated to: ln($0)\nConstraints: z != 0\nBranch Cuts: (-\\infty, 0]\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.2#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=ln"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 4,
    "sentence" : 0,
    "word" : 29
  } ],
  "includes" : [ "\\psi(z)", "x)", "x" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "series expansion",
    "score" : 0.8869384888466118
  }, {
    "definition" : "kei",
    "score" : 0.7936682821800771
  }, {
    "definition" : "asymptotic series",
    "score" : 0.6954080343007951
  }, {
    "definition" : "integer",
    "score" : 0.6288842031023242
  }, {
    "definition" : "special case kei",
    "score" : 0.6288842031023242
  }, {
    "definition" : "ker",
    "score" : 0.5816270233429564
  } ]
}

Specify your own input