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 \operatorname{li}(x) = \int_0^x \frac{dt}{\ln t}. }

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

Semantic latex: \logint@{x} = \int_0^x \frac{\diff{t}}{\ln t}

Confidence: 0.89530287320794

Mathematica

Translation: LogIntegral[x] == Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None]

Information

Sub Equations

  • LogIntegral[x] = Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None]

Free variables

  • x

Symbol info

  • Logarithmic integral; Example: \logint@{x}

Will be translated to: LogIntegral[$0] Constraints: x > 1 Mathematica uses other branch cuts: (-\inf, 1) Relevant links to definitions: DLMF: http://dlmf.nist.gov/6.2#E8 Mathematica: https://reference.wolfram.com/language/ref/LogIntegral.html

  • Natural logarithm; Example: \ln@@{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

Tests

Symbolic

Test expression: (LogIntegral[x])-(Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None])

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

Tests

Symbolic
Numeric

Maple

Translation: Li(x) = int((1)/(ln(t)), t = 0..x)

Information

Sub Equations

  • Li(x) = int((1)/(ln(t)), t = 0..x)

Free variables

  • x

Symbol info

  • Logarithmic integral; Example: \logint@{x}

Will be translated to: Li($0) Constraints: x > 1 Relevant links to definitions: DLMF: http://dlmf.nist.gov/6.2#E8 Maple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Li

  • Natural logarithm; Example: \ln@@{z}

Will be translated to: ln($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=ln

Tests

Symbolic
Numeric

Dependency Graph Information

Includes

Description

  • integral representation
  • positive real number
  • logarithmic integral

Complete translation information:

{
  "id" : "FORMULA_0dcdda66ab1f2d188cebaab11ddd8c9b",
  "formula" : "\\operatorname{li}(x) = \\int_0^x \\frac{dt}{\\ln t}",
  "semanticFormula" : "\\logint@{x} = \\int_0^x \\frac{\\diff{t}}{\\ln t}",
  "confidence" : 0.8953028732079359,
  "translations" : {
    "Mathematica" : {
      "translation" : "LogIntegral[x] == Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None]",
      "translationInformation" : {
        "subEquations" : [ "LogIntegral[x] = Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None]" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\logint" : "Logarithmic integral; Example: \\logint@{x}\nWill be translated to: LogIntegral[$0]\nConstraints: x > 1\nMathematica uses other branch cuts: (-\\inf, 1)\nRelevant links to definitions:\nDLMF:         http://dlmf.nist.gov/6.2#E8\nMathematica:  https://reference.wolfram.com/language/ref/LogIntegral.html",
          "\\ln" : "Natural logarithm; Example: \\ln@@{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"
        }
      },
      "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" : "LogIntegral[x]",
          "rhs" : "Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None]",
          "testExpression" : "(LogIntegral[x])-(Integrate[Divide[1,Log[t]], {t, 0, x}, GenerateConditions->None])",
          "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: \\logint [\\logint]"
        }
      }
    },
    "Maple" : {
      "translation" : "Li(x) = int((1)/(ln(t)), t = 0..x)",
      "translationInformation" : {
        "subEquations" : [ "Li(x) = int((1)/(ln(t)), t = 0..x)" ],
        "freeVariables" : [ "x" ],
        "tokenTranslations" : {
          "\\logint" : "Logarithmic integral; Example: \\logint@{x}\nWill be translated to: Li($0)\nConstraints: x > 1\nRelevant links to definitions:\nDLMF:  http://dlmf.nist.gov/6.2#E8\nMaple: https://www.maplesoft.com/support/help/maple/view.aspx?path=Li",
          "\\ln" : "Natural logarithm; Example: \\ln@@{z}\nWill be translated to: ln($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=ln"
        }
      }
    }
  },
  "positions" : [ {
    "section" : 1,
    "sentence" : 0,
    "word" : 19
  } ],
  "includes" : [ "x", "x)" ],
  "isPartOf" : [ ],
  "definiens" : [ {
    "definition" : "integral representation",
    "score" : 0.6859086196238077
  }, {
    "definition" : "positive real number",
    "score" : 0.6859086196238077
  }, {
    "definition" : "logarithmic integral",
    "score" : 0.5988174995334326
  } ]
}

Specify your own input