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 w(x) = \frac{k}{\sqrt{\pi}} x^{-1/2} \exp(-k^2\log^2 x)}

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

Semantic latex: w(x) = \frac{k}{\sqrt{\cpi}} x^{-1/2} \exp(- k^2 \log^2 x)

Confidence: 0

Mathematica

Translation: w[x] == Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)]

Information

Sub Equations

  • w[x] = Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)]

Free variables

  • k
  • x

Symbol info

  • Exponential function; Example: \exp@@{z}

Will be translated to: Exp[$0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E19 Mathematica: https://reference.wolfram.com/language/ref/Exp.html

  • Pi was translated to: Pi
  • Logarithm; Example: \log@@{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

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic

Test expression: (w*(x))-(Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)])

ERROR:

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

SymPy

Translation: w(x) == (k)/(sqrt(pi))*(x)**(- 1/2)* exp(- (k)**(2)* (log(x))**(2))

Information

Sub Equations

  • w(x) = (k)/(sqrt(pi))*(x)**(- 1/2)* exp(- (k)**(2)* (log(x))**(2))

Free variables

  • k
  • x

Symbol info

  • Exponential function; Example: \exp@@{z}

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

  • Pi was translated to: pi
  • Logarithm; Example: \log@@{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 SymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#log

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Maple

Translation: w(x) = (k)/(sqrt(Pi))*(x)^(- 1/2)* exp(- (k)^(2)* (log(x))^(2))

Information

Sub Equations

  • w(x) = (k)/(sqrt(Pi))*(x)^(- 1/2)* exp(- (k)^(2)* (log(x))^(2))

Free variables

  • k
  • x

Symbol info

  • Exponential function; Example: \exp@@{z}

Will be translated to: exp($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.2#E19 Maple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/Trace

  • Pi was translated to: Pi
  • Logarithm; Example: \log@@{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 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=log

  • Function without DLMF-Definition. We keep it like it is (but delete prefix \ if necessary).

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • weight function
  • positive real line
  • basic Askey scheme
  • family of basic hypergeometric orthogonal polynomial
  • mathematics
  • Stieltjes -- Wigert polynomial
  • Thomas Jan Stieltjes
  • Carl Severin Wigert

Complete translation information:

{
  "id" : "FORMULA_583d3b9e00bbd73091b01f368d1a82c7",
  "formula" : "w(x) = \\frac{k}{\\sqrt{\\pi}} x^{-1/2} \\exp(-k^2\\log^2 x)",
  "semanticFormula" : "w(x) = \\frac{k}{\\sqrt{\\cpi}} x^{-1/2} \\exp(- k^2 \\log^2 x)",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "w[x] == Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)]",
      "translationInformation" : {
        "subEquations" : [ "w[x] = Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)]" ],
        "freeVariables" : [ "k", "x" ],
        "tokenTranslations" : {
          "\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: Exp[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.2#E19\nMathematica:  https://reference.wolfram.com/language/ref/Exp.html",
          "\\cpi" : "Pi was translated to: Pi",
          "\\log" : "Logarithm; Example: \\log@@{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",
          "w" : "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" : 1,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 1,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "w*(x)",
          "rhs" : "Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)]",
          "testExpression" : "(w*(x))-(Divide[k,Sqrt[Pi]]*(x)^(- 1/2)* Exp[- (k)^(2)* (Log[x])^(2)])",
          "testCalculations" : [ {
            "result" : "ERROR",
            "testTitle" : "Simple",
            "testExpression" : null,
            "resultExpression" : null,
            "wasAborted" : false,
            "conditionallySuccessful" : false
          } ]
        } ]
      }
    },
    "SymPy" : {
      "translation" : "w(x) == (k)/(sqrt(pi))*(x)**(- 1/2)* exp(- (k)**(2)* (log(x))**(2))",
      "translationInformation" : {
        "subEquations" : [ "w(x) = (k)/(sqrt(pi))*(x)**(- 1/2)* exp(- (k)**(2)* (log(x))**(2))" ],
        "freeVariables" : [ "k", "x" ],
        "tokenTranslations" : {
          "\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: exp($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.2#E19\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#exp",
          "\\cpi" : "Pi was translated to: pi",
          "\\log" : "Logarithm; Example: \\log@@{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\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#log",
          "w" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      }
    },
    "Maple" : {
      "translation" : "w(x) = (k)/(sqrt(Pi))*(x)^(- 1/2)* exp(- (k)^(2)* (log(x))^(2))",
      "translationInformation" : {
        "subEquations" : [ "w(x) = (k)/(sqrt(Pi))*(x)^(- 1/2)* exp(- (k)^(2)* (log(x))^(2))" ],
        "freeVariables" : [ "k", "x" ],
        "tokenTranslations" : {
          "\\exp" : "Exponential function; Example: \\exp@@{z}\nWill be translated to: exp($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.2#E19\nMaple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/Trace",
          "\\cpi" : "Pi was translated to: Pi",
          "\\log" : "Logarithm; Example: \\log@@{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\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=log",
          "w" : "Function without DLMF-Definition. We keep it like it is (but delete prefix \\ if necessary)."
        }
      }
    }
  },
  "positions" : [ {
    "section" : 0,
    "sentence" : 0,
    "word" : 38
  } ],
  "includes" : [ "\\frac{k}{\\sqrt{\\pi}} x^{-1/2} \\exp \\left(-k^2 \\log^2 x \\right)" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "weight function",
    "score" : 0.722
  }, {
    "definition" : "positive real line",
    "score" : 0.7125985104912714
  }, {
    "definition" : "basic Askey scheme",
    "score" : 0.6859086196238077
  }, {
    "definition" : "family of basic hypergeometric orthogonal polynomial",
    "score" : 0.6859086196238077
  }, {
    "definition" : "mathematics",
    "score" : 0.6460746792928004
  }, {
    "definition" : "Stieltjes -- Wigert polynomial",
    "score" : 0.6460746792928004
  }, {
    "definition" : "Thomas Jan Stieltjes",
    "score" : 0.5500952380952381
  }, {
    "definition" : "Carl Severin Wigert",
    "score" : 0.5049074255814494
  } ]
}

Specify your own input