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 \frac{d^2y}{dt^2}+\left(\theta_0+2\sum_{n=1}^\infty \theta_n \cos(2nt)+\sum_{m=1}^\infty \phi_m \sin(2mt) \right ) y=0. }

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

Semantic latex: \deriv [2]{y}{t} +(\theta_0 + 2 \sum_{n=1}^\infty \theta_n \cos(2 nt) + \sum_{m=1}^\infty \phi_m \sin(2 mt)) y = 0

Confidence: 0

Mathematica

Translation: D[y, {t, 2}]+(Subscript[\[Theta], 0]+ 2*Sum[Subscript[\[Theta], n]*Cos[2*n*t], {n, 1, Infinity}, GenerateConditions->None]+ Sum[Subscript[\[Phi], m]*Sin[2*m*t], {m, 1, Infinity}, GenerateConditions->None])*y == 0

Information

Sub Equations

  • D[y, {t, 2}]+(Subscript[\[Theta], 0]+ 2*Sum[Subscript[\[Theta], n]*Cos[2*n*t], {n, 1, Infinity}, GenerateConditions->None]+ Sum[Subscript[\[Phi], m]*Sin[2*m*t], {m, 1, Infinity}, GenerateConditions->None])*y = 0

Free variables

  • Subscript[\[Phi], m]
  • Subscript[\[Theta], 0]
  • Subscript[\[Theta], n]
  • t
  • y

Symbol info

  • Cosine; Example: \cos@@{z}

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

  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: D[$1, {$2, $0}] Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 Mathematica: https://reference.wolfram.com/language/ref/D.html

  • Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Sine; Example: \sin@@{z}

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

Tests

Symbolic
Numeric

SymPy

Translation: diff(y, t, 2)+(Symbol('{Symbol('theta')}_{0}')+ 2*Sum(Symbol('{Symbol('theta')}_{n}')*cos(2*n*t), (n, 1, oo))+ Sum(Symbol('{Symbol('phi')}_{m}')*sin(2*m*t), (m, 1, oo)))*y == 0

Information

Sub Equations

  • diff(y, t, 2)+(Symbol('{Symbol('theta')}_{0}')+ 2*Sum(Symbol('{Symbol('theta')}_{n}')*cos(2*n*t), (n, 1, oo))+ Sum(Symbol('{Symbol('phi')}_{m}')*sin(2*m*t), (m, 1, oo)))*y = 0

Free variables

  • Symbol('{Symbol('phi')}_{m}')
  • Symbol('{Symbol('theta')}_{0}')
  • Symbol('{Symbol('theta')}_{n}')
  • t
  • y

Symbol info

  • Cosine; Example: \cos@@{z}

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

  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: diff($1, $2, $0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 SymPy: https://docs.sympy.org/latest/tutorial/calculus.html#derivatives

  • Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Sine; Example: \sin@@{z}

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

Tests

Symbolic
Numeric

Maple

Translation: diff(y, [t$(2)])+(theta[0]+ 2*sum(theta[n]*cos(2*n*t), n = 1..infinity)+ sum(phi[m]*sin(2*m*t), m = 1..infinity))*y = 0

Information

Sub Equations

  • diff(y, [t$(2)])+(theta[0]+ 2*sum(theta[n]*cos(2*n*t), n = 1..infinity)+ sum(phi[m]*sin(2*m*t), m = 1..infinity))*y = 0

Free variables

  • phi[m]
  • t
  • theta[0]
  • theta[n]
  • y

Symbol info

  • Cosine; Example: \cos@@{z}

Will be translated to: cos($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E2 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cos

  • Derivative; Example: \deriv[n]{f}{x}

Will be translated to: diff($1, [$2$($0)]) Relevant links to definitions: DLMF: http://dlmf.nist.gov/1.4#E4 Maple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=diff

  • Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.

But this system doesn't know how to translate it as a constant. It was translated as a general letter.

  • Sine; Example: \sin@@{z}

Will be translated to: sin($0) Relevant links to definitions: DLMF: http://dlmf.nist.gov/4.14#E1 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=sin

Tests

Symbolic
Numeric

Dependency Graph Information

Description

  • Fourier series
  • Hill equation
  • period

Complete translation information:

{
  "id" : "FORMULA_7574d7bc0a017916651bfdab751f34f5",
  "formula" : "\\frac{d^2y}{dt^2}+\\left(\\theta_0+2\\sum_{n=1}^\\infty \\theta_n \\cos(2nt)+\\sum_{m=1}^\\infty \\phi_m \\sin(2mt) \\right ) y=0",
  "semanticFormula" : "\\deriv [2]{y}{t} +(\\theta_0 + 2 \\sum_{n=1}^\\infty \\theta_n \\cos(2 nt) + \\sum_{m=1}^\\infty \\phi_m \\sin(2 mt)) y = 0",
  "confidence" : 0.0,
  "translations" : {
    "Mathematica" : {
      "translation" : "D[y, {t, 2}]+(Subscript[\\[Theta], 0]+ 2*Sum[Subscript[\\[Theta], n]*Cos[2*n*t], {n, 1, Infinity}, GenerateConditions->None]+ Sum[Subscript[\\[Phi], m]*Sin[2*m*t], {m, 1, Infinity}, GenerateConditions->None])*y == 0",
      "translationInformation" : {
        "subEquations" : [ "D[y, {t, 2}]+(Subscript[\\[Theta], 0]+ 2*Sum[Subscript[\\[Theta], n]*Cos[2*n*t], {n, 1, Infinity}, GenerateConditions->None]+ Sum[Subscript[\\[Phi], m]*Sin[2*m*t], {m, 1, Infinity}, GenerateConditions->None])*y = 0" ],
        "freeVariables" : [ "Subscript[\\[Phi], m]", "Subscript[\\[Theta], 0]", "Subscript[\\[Theta], n]", "t", "y" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: Cos[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E2\nMathematica:  https://reference.wolfram.com/language/ref/Cos.html",
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: D[$1, {$2, $0}]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/1.4#E4\nMathematica:  https://reference.wolfram.com/language/ref/D.html",
          "\\phi" : "Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: Sin[$0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/4.14#E1\nMathematica:  https://reference.wolfram.com/language/ref/Sin.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" : "diff(y, t, 2)+(Symbol('{Symbol('theta')}_{0}')+ 2*Sum(Symbol('{Symbol('theta')}_{n}')*cos(2*n*t), (n, 1, oo))+ Sum(Symbol('{Symbol('phi')}_{m}')*sin(2*m*t), (m, 1, oo)))*y == 0",
      "translationInformation" : {
        "subEquations" : [ "diff(y, t, 2)+(Symbol('{Symbol('theta')}_{0}')+ 2*Sum(Symbol('{Symbol('theta')}_{n}')*cos(2*n*t), (n, 1, oo))+ Sum(Symbol('{Symbol('phi')}_{m}')*sin(2*m*t), (m, 1, oo)))*y = 0" ],
        "freeVariables" : [ "Symbol('{Symbol('phi')}_{m}')", "Symbol('{Symbol('theta')}_{0}')", "Symbol('{Symbol('theta')}_{n}')", "t", "y" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#cos",
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: diff($1, $2, $0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/1.4#E4\nSymPy: https://docs.sympy.org/latest/tutorial/calculus.html#derivatives",
          "\\phi" : "Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: sin($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E1\nSymPy: https://docs.sympy.org/latest/modules/functions/elementary.html#sin"
        }
      },
      "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" : "diff(y, [t$(2)])+(theta[0]+ 2*sum(theta[n]*cos(2*n*t), n = 1..infinity)+ sum(phi[m]*sin(2*m*t), m = 1..infinity))*y = 0",
      "translationInformation" : {
        "subEquations" : [ "diff(y, [t$(2)])+(theta[0]+ 2*sum(theta[n]*cos(2*n*t), n = 1..infinity)+ sum(phi[m]*sin(2*m*t), m = 1..infinity))*y = 0" ],
        "freeVariables" : [ "phi[m]", "t", "theta[0]", "theta[n]", "y" ],
        "tokenTranslations" : {
          "\\cos" : "Cosine; Example: \\cos@@{z}\nWill be translated to: cos($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E2\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=cos",
          "\\deriv1" : "Derivative; Example: \\deriv[n]{f}{x}\nWill be translated to: diff($1, [$2$($0)])\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/1.4#E4\nMaple: https://www.maplesoft.com/support/help/Maple/view.aspx?path=diff",
          "\\phi" : "Could be the golden ratio == golden mean == golden section == extreme and mean ratio == medial section == divine proportion == divine section == golden proportion == golden cut == golden number.\nBut this system doesn't know how to translate it as a constant. It was translated as a general letter.\n",
          "\\sin" : "Sine; Example: \\sin@@{z}\nWill be translated to: sin($0)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/4.14#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=sin"
        }
      },
      "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" : [ {
    "section" : 0,
    "sentence" : 3,
    "word" : 19
  } ],
  "includes" : [ ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "Fourier series",
    "score" : 0.7125985104912714
  }, {
    "definition" : "Hill equation",
    "score" : 0.5988174995334326
  }, {
    "definition" : "period",
    "score" : 0.5500952380952381
  } ]
}

Specify your own input