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 \begin{align} C_0^\alpha(x) & = 1 \\ C_1^\alpha(x) & = 2 \alpha x \\ C_n^\alpha(x) & = \frac{1}{n}[2x(n+\alpha-1)C_{n-1}^\alpha(x) - (n+2\alpha-2)C_{n-2}^\alpha(x)]. \end{align} }

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

Semantic latex: \begin{align} C_0^\alpha(x) & = 1 \\ C_1^\alpha(x) & = 2 \alpha x \\ C_n^\alpha(x) & = \frac{1}{n}[2x(n+\alpha-1)C_{n-1}^\alpha(x) - (n+2\alpha-2)C_{n-2}^\alpha(x)]. \end{align}

Confidence: 0

Mathematica

Translation: (Subscript[C, 0])^\[Alpha][x] == 1 (Subscript[C, 1])^\[Alpha][x] == 2*\[Alpha]*x (Subscript[C, n])^\[Alpha][x] == Divide[1,n]*(2*x*(n + \[Alpha]- 1)*(Subscript[C, n - 1])^\[Alpha][x]-(n + 2*\[Alpha]- 2)*(Subscript[C, n - 2])^\[Alpha][x])

Information

Sub Equations

  • (Subscript[C, 0])^\[Alpha][x] = 1
  • (Subscript[C, 1])^\[Alpha][x] = 2*\[Alpha]*x
  • (Subscript[C, n])^\[Alpha][x] = Divide[1,n]*(2*x*(n + \[Alpha]- 1)*(Subscript[C, n - 1])^\[Alpha][x]-(n + 2*\[Alpha]- 2)*(Subscript[C, n - 2])^\[Alpha][x])

Free variables

  • \[Alpha]
  • n
  • x

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.

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

Tests

Symbolic
Numeric

SymPy

Translation: (Symbol('{C}_{0}'))**(Symbol('alpha'))(x) == 1 (Symbol('{C}_{1}'))**(Symbol('alpha'))(x) == 2*Symbol('alpha')*x (Symbol('{C}_{n}'))**(Symbol('alpha'))(x) == (1)/(n)*(2*x*(n + Symbol('alpha')- 1)*(Symbol('{C}_{n - 1}'))**(Symbol('alpha'))(x)-(n + 2*Symbol('alpha')- 2)*(Symbol('{C}_{n - 2}'))**(Symbol('alpha'))(x))

Information

Sub Equations

  • (Symbol('{C}_{0}'))**(Symbol('alpha'))(x) = 1
  • (Symbol('{C}_{1}'))**(Symbol('alpha'))(x) = 2*Symbol('alpha')*x
  • (Symbol('{C}_{n}'))**(Symbol('alpha'))(x) = (1)/(n)*(2*x*(n + Symbol('alpha')- 1)*(Symbol('{C}_{n - 1}'))**(Symbol('alpha'))(x)-(n + 2*Symbol('alpha')- 2)*(Symbol('{C}_{n - 2}'))**(Symbol('alpha'))(x))

Free variables

  • Symbol('alpha')
  • n
  • x

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.

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

Tests

Symbolic
Numeric

Maple

Translation: (C[0])^(alpha)(x) = 1; (C[1])^(alpha)(x) = 2*alpha*x; (C[n])^(alpha)(x) = (1)/(n)*(2*x*(n + alpha - 1)*(C[n - 1])^(alpha)(x)-(n + 2*alpha - 2)*(C[n - 2])^(alpha)(x))

Information

Sub Equations

  • (C[0])^(alpha)(x) = 1
  • (C[1])^(alpha)(x) = 2*alpha*x
  • (C[n])^(alpha)(x) = (1)/(n)*(2*x*(n + alpha - 1)*(C[n - 1])^(alpha)(x)-(n + 2*alpha - 2)*(C[n - 2])^(alpha)(x))

Free variables

  • alpha
  • n
  • x

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.

  • 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_0b7f6b1e6d5c1f0d12a9de0b565bddd3",
  "formula" : "\\begin{align}\nC_0^\\alpha(x) & = 1 \\\\\nC_1^\\alpha(x) & = 2 \\alpha x \\\\\nC_n^\\alpha(x) & = \\frac{1}{n}[2x(n+\\alpha-1)C_{n-1}^\\alpha(x) - (n+2\\alpha-2)C_{n-2}^\\alpha(x)].\n\\end{align}",
  "semanticFormula" : "\\begin{align}\nC_0^\\alpha(x) & = 1 \\\\\nC_1^\\alpha(x) & = 2 \\alpha x \\\\\nC_n^\\alpha(x) & = \\frac{1}{n}[2x(n+\\alpha-1)C_{n-1}^\\alpha(x) - (n+2\\alpha-2)C_{n-2}^\\alpha(x)].\n\\end{align}",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "(Subscript[C, 0])^\\[Alpha][x] == 1\n(Subscript[C, 1])^\\[Alpha][x] == 2*\\[Alpha]*x\n(Subscript[C, n])^\\[Alpha][x] == Divide[1,n]*(2*x*(n + \\[Alpha]- 1)*(Subscript[C, n - 1])^\\[Alpha][x]-(n + 2*\\[Alpha]- 2)*(Subscript[C, n - 2])^\\[Alpha][x])",
      "translationInformation" : {
        "subEquations" : [ "(Subscript[C, 0])^\\[Alpha][x] = 1", "(Subscript[C, 1])^\\[Alpha][x] = 2*\\[Alpha]*x", "(Subscript[C, n])^\\[Alpha][x] = Divide[1,n]*(2*x*(n + \\[Alpha]- 1)*(Subscript[C, n - 1])^\\[Alpha][x]-(n + 2*\\[Alpha]- 2)*(Subscript[C, n - 2])^\\[Alpha][x])" ],
        "freeVariables" : [ "\\[Alpha]", "n", "x" ],
        "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",
          "C" : "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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "SymPy" : {
      "translation" : "(Symbol('{C}_{0}'))**(Symbol('alpha'))(x) == 1\n(Symbol('{C}_{1}'))**(Symbol('alpha'))(x) == 2*Symbol('alpha')*x\n(Symbol('{C}_{n}'))**(Symbol('alpha'))(x) == (1)/(n)*(2*x*(n + Symbol('alpha')- 1)*(Symbol('{C}_{n - 1}'))**(Symbol('alpha'))(x)-(n + 2*Symbol('alpha')- 2)*(Symbol('{C}_{n - 2}'))**(Symbol('alpha'))(x))",
      "translationInformation" : {
        "subEquations" : [ "(Symbol('{C}_{0}'))**(Symbol('alpha'))(x) = 1", "(Symbol('{C}_{1}'))**(Symbol('alpha'))(x) = 2*Symbol('alpha')*x", "(Symbol('{C}_{n}'))**(Symbol('alpha'))(x) = (1)/(n)*(2*x*(n + Symbol('alpha')- 1)*(Symbol('{C}_{n - 1}'))**(Symbol('alpha'))(x)-(n + 2*Symbol('alpha')- 2)*(Symbol('{C}_{n - 2}'))**(Symbol('alpha'))(x))" ],
        "freeVariables" : [ "Symbol('alpha')", "n", "x" ],
        "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",
          "C" : "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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    },
    "Maple" : {
      "translation" : "(C[0])^(alpha)(x) = 1; (C[1])^(alpha)(x) = 2*alpha*x; (C[n])^(alpha)(x) = (1)/(n)*(2*x*(n + alpha - 1)*(C[n - 1])^(alpha)(x)-(n + 2*alpha - 2)*(C[n - 2])^(alpha)(x))",
      "translationInformation" : {
        "subEquations" : [ "(C[0])^(alpha)(x) = 1", "(C[1])^(alpha)(x) = 2*alpha*x", "(C[n])^(alpha)(x) = (1)/(n)*(2*x*(n + alpha - 1)*(C[n - 1])^(alpha)(x)-(n + 2*alpha - 2)*(C[n - 2])^(alpha)(x))" ],
        "freeVariables" : [ "alpha", "n", "x" ],
        "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",
          "C" : "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" : "SKIPPED",
        "numberOfTests" : 0,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 0,
        "crashed" : false,
        "testCalculationsGroup" : [ ]
      }
    }
  },
  "positions" : [ ],
  "includes" : [ "\\alpha", "n", "\\begin{align}C_0^\\alpha(x) & = 1 \\\\C_1^\\alpha(x) & = 2 \\alpha x \\\\C_n^\\alpha(x) & = \\frac{1}{n}[2x(n+\\alpha-1)C_{n-1}^\\alpha(x) - (n+2\\alpha-2)C_{n-2}^\\alpha(x)].\\end{align}", "=2", "=1" ],
  "isPartOf" : [ "\\begin{align}C_0^\\alpha(x) & = 1 \\\\C_1^\\alpha(x) & = 2 \\alpha x \\\\C_n^\\alpha(x) & = \\frac{1}{n}[2x(n+\\alpha-1)C_{n-1}^\\alpha(x) - (n+2\\alpha-2)C_{n-2}^\\alpha(x)].\\end{align}" ],
  "definiens" : [ ]
}

Specify your own input