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 \int_{-1}^1 C_n^{(\alpha)}(x)C_m^{(\alpha)}(x)(1-x^2)^{\alpha-\frac{1}{2}}\,dx = 0.}

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

Semantic latex: \int_{-1}^1 \ultrasphpoly{\alpha}{n}@{x} \ultrasphpoly{\alpha}{m}@{x}(1 - x^2)^{\alpha-\frac{1}{2}} \diff{x} = 0

Confidence: 0.6805

Mathematica

Translation: Integrate[GegenbauerC[n, \[Alpha], x]*GegenbauerC[m, \[Alpha], x]*(1 - (x)^(2))^(\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None] == 0

Information

Sub Equations

  • Integrate[GegenbauerC[n, \[Alpha], x]*GegenbauerC[m, \[Alpha], x]*(1 - (x)^(2))^(\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None] = 0

Free variables

  • \[Alpha]
  • m
  • n

Symbol info

  • 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.

  • Ultraspherical Gegenbauer polynomial; Example: \ultrasphpoly{\lambda}{n}@{x}

Will be translated to: GegenbauerC[$1, $0, $2] Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r3 Mathematica: https://reference.wolfram.com/language/ref/GegenbauerC.html

Tests

Symbolic

Test expression: (Integrate[GegenbauerC[n, \[Alpha], x]*GegenbauerC[m, \[Alpha], x]*(1 - (x)^(2))^(\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None])-(0)

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: \ultrasphpoly [\ultrasphpoly]

Tests

Symbolic
Numeric

Maple

Translation: int(GegenbauerC(n, alpha, x)*GegenbauerC(m, alpha, x)*(1 - (x)^(2))^(alpha -(1)/(2)), x = - 1..1) = 0

Information

Sub Equations

  • int(GegenbauerC(n, alpha, x)*GegenbauerC(m, alpha, x)*(1 - (x)^(2))^(alpha -(1)/(2)), x = - 1..1) = 0

Free variables

  • alpha
  • m
  • n

Symbol info

  • 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.

  • Ultraspherical Gegenbauer polynomial; Example: \ultrasphpoly{\lambda}{n}@{x}

Will be translated to: GegenbauerC($1, $0, $2) Relevant links to definitions: DLMF: http://dlmf.nist.gov/18.3#T1.t1.r3 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=GegenbauerC

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Is part of

Complete translation information:

{
  "id" : "FORMULA_c56fcf7fc822203dddf9d40517ab1c1e",
  "formula" : "\\int_{-1}^1 C_n^{(\\alpha)}(x)C_m^{(\\alpha)}(x)(1-x^2)^{\\alpha-\\frac{1}{2}}dx = 0",
  "semanticFormula" : "\\int_{-1}^1 \\ultrasphpoly{\\alpha}{n}@{x} \\ultrasphpoly{\\alpha}{m}@{x}(1 - x^2)^{\\alpha-\\frac{1}{2}} \\diff{x} = 0",
  "confidence" : 0.6805,
  "translations" : {
    "Mathematica" : {
      "translation" : "Integrate[GegenbauerC[n, \\[Alpha], x]*GegenbauerC[m, \\[Alpha], x]*(1 - (x)^(2))^(\\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None] == 0",
      "translationInformation" : {
        "subEquations" : [ "Integrate[GegenbauerC[n, \\[Alpha], x]*GegenbauerC[m, \\[Alpha], x]*(1 - (x)^(2))^(\\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None] = 0" ],
        "freeVariables" : [ "\\[Alpha]", "m", "n" ],
        "tokenTranslations" : {
          "\\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",
          "\\ultrasphpoly" : "Ultraspherical Gegenbauer polynomial; Example: \\ultrasphpoly{\\lambda}{n}@{x}\nWill be translated to: GegenbauerC[$1, $0, $2]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/18.3#T1.t1.r3\nMathematica:  https://reference.wolfram.com/language/ref/GegenbauerC.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" : "Integrate[GegenbauerC[n, \\[Alpha], x]*GegenbauerC[m, \\[Alpha], x]*(1 - (x)^(2))^(\\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None]",
          "rhs" : "0",
          "testExpression" : "(Integrate[GegenbauerC[n, \\[Alpha], x]*GegenbauerC[m, \\[Alpha], x]*(1 - (x)^(2))^(\\[Alpha]-Divide[1,2]), {x, - 1, 1}, GenerateConditions->None])-(0)",
          "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: \\ultrasphpoly [\\ultrasphpoly]"
        }
      }
    },
    "Maple" : {
      "translation" : "int(GegenbauerC(n, alpha, x)*GegenbauerC(m, alpha, x)*(1 - (x)^(2))^(alpha -(1)/(2)), x = - 1..1) = 0",
      "translationInformation" : {
        "subEquations" : [ "int(GegenbauerC(n, alpha, x)*GegenbauerC(m, alpha, x)*(1 - (x)^(2))^(alpha -(1)/(2)), x = - 1..1) = 0" ],
        "freeVariables" : [ "alpha", "m", "n" ],
        "tokenTranslations" : {
          "\\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",
          "\\ultrasphpoly" : "Ultraspherical Gegenbauer polynomial; Example: \\ultrasphpoly{\\lambda}{n}@{x}\nWill be translated to: GegenbauerC($1, $0, $2)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/18.3#T1.t1.r3\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=GegenbauerC"
        }
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "C_{n}^{(\\alpha)}(x)", "\\alpha", "n", "\\int_{-1}^1 C_n^{(\\alpha)}(x)C_m^{(\\alpha)}(x)(1-x^2)^{\\alpha-\\frac{1}{2}}\\,dx = 0" ],
  "isPartOf" : [ "\\int_{-1}^1 C_n^{(\\alpha)}(x)C_m^{(\\alpha)}(x)(1-x^2)^{\\alpha-\\frac{1}{2}}\\,dx = 0" ],
  "definiens" : [ ]
}

Specify your own input