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 \mathbf{K}_\alpha(x)=\mathbf{H}_\alpha(x)-Y_\alpha(x)}

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

Semantic latex: \StruveK{\alpha}@{x} = \StruveH{\alpha}@{x} - \BesselY{\alpha}@{x}

Confidence: 0.81134869108681

Mathematica

Translation: StruveH[\[Alpha], x] - BesselY[\[Alpha], x] == StruveH[\[Alpha], x]- BesselY[\[Alpha], x]

Information

Sub Equations

  • StruveH[\[Alpha], x] - BesselY[\[Alpha], x] = StruveH[\[Alpha], x]- BesselY[\[Alpha], x]

Free variables

  • \[Alpha]
  • x

Symbol info

  • Bessel function second kind; Example: \BesselY{v}@{z}

Will be translated to: BesselY[$0, $1] Branch Cuts: (-\infty, 0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/10.2#E3 Mathematica: https://reference.wolfram.com/language/ref/BesselY.html

  • Struve function; Example: \StruveH{\nu}@{z}

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

  • Associated Struve funtion; Example: \StruveK{\nu}@{z}

Will be translated to: StruveH[$0, $1] - BesselY[$0, $1] Relevant links to definitions: DLMF: http://dlmf.nist.gov/11.2#E5 Mathematica: https://reference.wolfram.com/language/ref/StruveH.html

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

Tests

Symbolic

Test expression: (StruveH[\[Alpha], x] - BesselY[\[Alpha], x])-(StruveH[\[Alpha], x]- BesselY[\[Alpha], x])

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

Tests

Symbolic
Numeric

Maple

Translation: StruveH(alpha, x) - BesselY(alpha, x) = StruveH(alpha, x)- BesselY(alpha, x)

Information

Sub Equations

  • StruveH(alpha, x) - BesselY(alpha, x) = StruveH(alpha, x)- BesselY(alpha, x)

Free variables

  • alpha
  • x

Symbol info

  • Bessel function second kind; Example: \BesselY{v}@{z}

Will be translated to: BesselY($0, $1) Branch Cuts: (-\infty, 0] Relevant links to definitions: DLMF: http://dlmf.nist.gov/10.2#E3 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Bessel

  • Struve function; Example: \StruveH{\nu}@{z}

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

  • Associated Struve funtion; Example: \StruveK{\nu}@{z}

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

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

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Is part of

Description

  • second-kind version
  • solution
  • modified Struve function
  • non-homogeneous Bessel 's differential equation

Complete translation information:

{
  "id" : "FORMULA_33505baab24ec94930d2671275d06c33",
  "formula" : "\\mathbf{K}_\\alpha(x)=\\mathbf{H}_\\alpha(x)-Y_\\alpha(x)",
  "semanticFormula" : "\\StruveK{\\alpha}@{x} = \\StruveH{\\alpha}@{x} - \\BesselY{\\alpha}@{x}",
  "confidence" : 0.8113486910868101,
  "translations" : {
    "Mathematica" : {
      "translation" : "StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x] == StruveH[\\[Alpha], x]- BesselY[\\[Alpha], x]",
      "translationInformation" : {
        "subEquations" : [ "StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x] = StruveH[\\[Alpha], x]- BesselY[\\[Alpha], x]" ],
        "freeVariables" : [ "\\[Alpha]", "x" ],
        "tokenTranslations" : {
          "\\BesselY" : "Bessel function second kind; Example: \\BesselY{v}@{z}\nWill be translated to: BesselY[$0, $1]\nBranch Cuts: (-\\infty, 0]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/10.2#E3\nMathematica:  https://reference.wolfram.com/language/ref/BesselY.html",
          "\\StruveH" : "Struve function; Example: \\StruveH{\\nu}@{z}\nWill be translated to: StruveH[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/11.2#E1\nMathematica:  https://reference.wolfram.com/language/ref/StruveH.html",
          "\\StruveK" : "Associated Struve funtion; Example: \\StruveK{\\nu}@{z}\nWill be translated to: StruveH[$0, $1] - BesselY[$0, $1]\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/11.2#E5\nMathematica:  https://reference.wolfram.com/language/ref/StruveH.html",
          "\\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"
        }
      },
      "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" : "StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x]",
          "rhs" : "StruveH[\\[Alpha], x]- BesselY[\\[Alpha], x]",
          "testExpression" : "(StruveH[\\[Alpha], x] - BesselY[\\[Alpha], x])-(StruveH[\\[Alpha], x]- BesselY[\\[Alpha], x])",
          "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: \\StruveK [\\StruveK]"
        }
      }
    },
    "Maple" : {
      "translation" : "StruveH(alpha, x) - BesselY(alpha, x) = StruveH(alpha, x)- BesselY(alpha, x)",
      "translationInformation" : {
        "subEquations" : [ "StruveH(alpha, x) - BesselY(alpha, x) = StruveH(alpha, x)- BesselY(alpha, x)" ],
        "freeVariables" : [ "alpha", "x" ],
        "tokenTranslations" : {
          "\\BesselY" : "Bessel function second kind; Example: \\BesselY{v}@{z}\nWill be translated to: BesselY($0, $1)\nBranch Cuts: (-\\infty, 0]\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/10.2#E3\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Bessel",
          "\\StruveH" : "Struve function; Example: \\StruveH{\\nu}@{z}\nWill be translated to: StruveH($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/11.2#E1\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=StruveH",
          "\\StruveK" : "Associated Struve funtion; Example: \\StruveK{\\nu}@{z}\nWill be translated to: StruveH($0, $1) - BesselY($0, $1)\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/11.2#E5\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=StruveH",
          "\\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"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 0,
    "sentence" : 2,
    "word" : 8
  } ],
  "includes" : [ "\\mathbf{K}_\\alpha(x)", "\\alpha", "\\mathbf{H}_{\\alpha}(x)", "\\mathbf{L}_{\\alpha}(x)", "\\mathbf{M}_\\alpha(x)", "\\mathbf{M}_\\alpha(x)=\\mathbf{L}_\\alpha(x)-I_\\alpha(x)", "\\mathbf{H}_{\\alpha}(z)", "x", "Y_{\\alpha}(x)" ],
  "isPartOf" : [ "\\mathbf{M}_\\alpha(x)=\\mathbf{L}_\\alpha(x)-I_\\alpha(x)" ],
  "definiens" : [ {
    "definition" : "second-kind version",
    "score" : 0.8080172426403338
  }, {
    "definition" : "solution",
    "score" : 0.6033992232315736
  }, {
    "definition" : "modified Struve function",
    "score" : 0.5074197820340112
  }, {
    "definition" : "non-homogeneous Bessel 's differential equation",
    "score" : 0.5074197820340112
  } ]
}

Specify your own input