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 z\mathbf{J}_{\nu-1}(z)+z\mathbf{J}_{\nu+1}(z)=2\nu\mathbf{J}_\nu(z)-\frac{2\sin\pi\nu}{\pi}}

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

Semantic latex: z \AngerJ{\nu-1}@{z} + z \AngerJ{\nu+1}@{z} = 2 \nu \AngerJ{\nu}@{z} - \frac{2 \sin \cpi \nu}{\cpi}

Confidence: 0.88957271447778

Mathematica

Translation: z*AngerJ[\[Nu]- 1, z]+ z*AngerJ[\[Nu]+ 1, z] == 2*\[Nu]*AngerJ[\[Nu], z]-Divide[2*Sin[Pi]*\[Nu],Pi]

Information

Sub Equations

  • z*AngerJ[\[Nu]- 1, z]+ z*AngerJ[\[Nu]+ 1, z] = 2*\[Nu]*AngerJ[\[Nu], z]-Divide[2*Sin[Pi]*\[Nu],Pi]

Free variables

  • \[Nu]
  • z

Symbol info

  • Anger function; Example: \AngerJ{v}@{z}

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

  • Pi was translated to: Pi
  • 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

Test expression: (z*AngerJ[\[Nu]- 1, z]+ z*AngerJ[\[Nu]+ 1, z])-(2*\[Nu]*AngerJ[\[Nu], z]-Divide[2*Sin[Pi]*\[Nu],Pi])

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

Tests

Symbolic
Numeric

Maple

Translation: z*AngerJ(nu - 1, z)+ z*AngerJ(nu + 1, z) = 2*nu*AngerJ(nu, z)-(2*sin(Pi)*nu)/(Pi)

Information

Sub Equations

  • z*AngerJ(nu - 1, z)+ z*AngerJ(nu + 1, z) = 2*nu*AngerJ(nu, z)-(2*sin(Pi)*nu)/(Pi)

Free variables

  • nu
  • z

Symbol info

  • Anger function; Example: \AngerJ{v}@{z}

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

  • Pi was translated to: Pi
  • 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

Includes

Description

  • inhomogeneous form of recurrence relation
  • Anger function
  • Weber function

Complete translation information:

{
  "id" : "FORMULA_d78016f4287d5d2c9cfb77ef07bc67f9",
  "formula" : "z\\mathbf{J}_{\\nu-1}(z)+z\\mathbf{J}_{\\nu+1}(z)=2\\nu\\mathbf{J}_\\nu(z)-\\frac{2\\sin\\pi\\nu}{\\pi}",
  "semanticFormula" : "z \\AngerJ{\\nu-1}@{z} + z \\AngerJ{\\nu+1}@{z} = 2 \\nu \\AngerJ{\\nu}@{z} - \\frac{2 \\sin \\cpi \\nu}{\\cpi}",
  "confidence" : 0.8895727144777772,
  "translations" : {
    "Mathematica" : {
      "translation" : "z*AngerJ[\\[Nu]- 1, z]+ z*AngerJ[\\[Nu]+ 1, z] == 2*\\[Nu]*AngerJ[\\[Nu], z]-Divide[2*Sin[Pi]*\\[Nu],Pi]",
      "translationInformation" : {
        "subEquations" : [ "z*AngerJ[\\[Nu]- 1, z]+ z*AngerJ[\\[Nu]+ 1, z] = 2*\\[Nu]*AngerJ[\\[Nu], z]-Divide[2*Sin[Pi]*\\[Nu],Pi]" ],
        "freeVariables" : [ "\\[Nu]", "z" ],
        "tokenTranslations" : {
          "\\AngerJ" : "Anger function; Example: \\AngerJ{v}@{z}\nWill be translated to: AngerJ[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/11.10#E1\nMathematica:  https://reference.wolfram.com/language/ref/AngerJ.html",
          "\\cpi" : "Pi was translated to: Pi",
          "\\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" : "ERROR",
        "numberOfTests" : 1,
        "numberOfFailedTests" : 0,
        "numberOfSuccessfulTests" : 0,
        "numberOfSkippedTests" : 0,
        "numberOfErrorTests" : 1,
        "crashed" : false,
        "testCalculationsGroup" : [ {
          "lhs" : "z*AngerJ[\\[Nu]- 1, z]+ z*AngerJ[\\[Nu]+ 1, z]",
          "rhs" : "2*\\[Nu]*AngerJ[\\[Nu], z]-Divide[2*Sin[Pi]*\\[Nu],Pi]",
          "testExpression" : "(z*AngerJ[\\[Nu]- 1, z]+ z*AngerJ[\\[Nu]+ 1, z])-(2*\\[Nu]*AngerJ[\\[Nu], z]-Divide[2*Sin[Pi]*\\[Nu],Pi])",
          "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: \\AngerJ [\\AngerJ]"
        }
      }
    },
    "Maple" : {
      "translation" : "z*AngerJ(nu - 1, z)+ z*AngerJ(nu + 1, z) = 2*nu*AngerJ(nu, z)-(2*sin(Pi)*nu)/(Pi)",
      "translationInformation" : {
        "subEquations" : [ "z*AngerJ(nu - 1, z)+ z*AngerJ(nu + 1, z) = 2*nu*AngerJ(nu, z)-(2*sin(Pi)*nu)/(Pi)" ],
        "freeVariables" : [ "nu", "z" ],
        "tokenTranslations" : {
          "\\AngerJ" : "Anger function; Example: \\AngerJ{v}@{z}\nWill be translated to: AngerJ($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/11.10#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=AngerJ",
          "\\cpi" : "Pi was translated to: Pi",
          "\\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"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 4,
    "sentence" : 0,
    "word" : 10
  } ],
  "includes" : [ "J_{\\nu}", "\\mathbf{J}_{\\nu}", "\\nu" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "inhomogeneous form of recurrence relation",
    "score" : 0.8869384888466118
  }, {
    "definition" : "Anger function",
    "score" : 0.6687181434333315
  }, {
    "definition" : "Weber function",
    "score" : 0.6687181434333315
  } ]
}

Specify your own input