From: David Carlisle <davidc@nag.co.uk>

Date: Thu, 15 Mar 2012 12:30:33 +0000

Message-ID: <4F61E0E9.3000009@nag.co.uk>

To: Peter Murray-Rust <pm286@cam.ac.uk>

CC: www-math@w3.org

Date: Thu, 15 Mar 2012 12:30:33 +0000

Message-ID: <4F61E0E9.3000009@nag.co.uk>

To: Peter Murray-Rust <pm286@cam.ac.uk>

CC: www-math@w3.org

On 15/03/2012 08:41, Peter Murray-Rust wrote: > This describes how the (anonymous) energy varies as a function of R. > Although k and req are "constants", they vary with different types of > atoms so shouldn't be hardcoded as numbers (cn). > > I have built a computation engine that is able to manipulate this > MathML but I am unclear of the right way to bind it. How, for > example, do I add the semantics: k = 0.1, req=1.5 > > and get them substituted in the equation? can I write the whole > problem (including the algorithm) in MathML? Is there a convention > or does everyone hack their own? MathML is designed to encode the math fragments in a larger document (html, docbook, ....) as such it isn't particularly good at expressing global definitions as it doesn't really "control" the global scope. If you are feeling formal you could look at document formats like omdoc that fill in this gap, but otherwise you need to express that k = 0.1 in another expression either just using <apply><eq/>... perhaps with a distinguishing type or class attribute to denote a definition, or you could use an explicit definition constructor rather than <eq/> something like <apply><csymbol>defeq</csymbol><ci>k</ci><cn>0.1.... You get the same problem in any field really, where you want global definitions such as "let p be an odd prime...." then use p in the rest of the document. Within a single expression you could use lambda binding to abstract the k and then bind it to 0.1 (and same for req,) so given an expression exp in <ci>k</ci> lambda k . exp is the function with k as a variable so apply (lambda k . exp) 0.1 applies that function to 0.1, so evaluates the original expression at k=0.1. but... <apply> <apply><lambda/>...</apply> ... original mathml... <cn>0.1</cn> </apply> is a level of formalism that may put people off if they are not familiar with the lambda calculus, and more importantly it doesn't really do what you want as it just binds k to 0.1 for this one instance (so it's equivalent to just replacing k by 0.1 in that instance). > > I now see content-MathML as having immense power for declarative > programming in this area. It will raise the quality of code, allow > validation, allow parallelisation and other optimisation, and also > make algorithms more accessible to users. It also allows symbol > manipulation (e.g. we often want analytical derivatives). > That is the plan, yes! > Is it correct to say: you can't actually write executable programs > in MathML but you can add binding to make them executable. Possibly, although given a large enough subset of mathml that your binding covers, the difference between binding mathml (or anything) to an executable language and just viewing that as a compilation stage and viewing the original mathml as executable is mainly one of emphasis rather than substance. DavidReceived on Thursday, 15 March 2012 12:31:04 UTC

*
This archive was generated by hypermail 2.3.1
: Tuesday, 6 January 2015 21:27:44 UTC
*