I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

User:Realazthat/Projects wishlist/MathML2X

From Rosetta Code

Write an XSLT transform to convert a function written in a subset of MathML to <some language>. This will allow one to specify an algorithm mathematically and not worry about the programming details, while a programmer can use the algorithm without knowing the math behind it. It also allows one to specify the algorithm in the universal language of math. Many algorithms are best described in different types of math, and MathML can be used to semantically express these algorithms. In particular, I find many functions I write easily expressible in discrete math, and would love to do just that, and generate the code automatically.

Features[edit]

  • Ability to store algorithms as calculus+set theory etc., and realize that to code, both in arbitrary precision, or, depending on input constraints to native types etc
    • A generic (arbitrary type) algorithm to code converter
    • Arbitrary precision
    • Ability to limit precision for transformation, so that generated code uses native types
  • Program in LaTeX

Languages[edit]

Possible backend languages:

Imperative:

Declarative:

Examples[edit]

These aren't concrete, as my ideas of how things *should* work are not concrete.

Factorial[edit]

can be mapped to arbitrary precision numbers, or the native (unsigned?) integer etc. This function would be implemented with recursion.

Another way of expressing factorial:


Notes:

  • The types here are implicit, perhaps it can be inferred as well
  • It would be nice if we could automatically detect the equivalence between these two formulas
    • It would be nice if we could convert the implementation to the optimal solution
  • It would be nice if we could generate an inverse of any formula (if possible)
    Probably requires a CAS
  • It would be nice if we can compute the complexity of these functions
  • It would be nice if we could compute the recurrence relation of these functions
  • I'm not a math guru, how would we handle string operations?
  • It would be nice if we could allow infinite sequences, test for convergence, return infinity if not
    • Optimize with convergence acceleration?
  • Sequences are pretty parallel too

Related[edit]