W3C home > Mailing lists > Public > www-math@w3.org > March 2012

RE: Using content-MathML for computation and analysis in Science and Engineering

From: Daniel Marques <dani@wiris.com>
Date: Thu, 15 Mar 2012 11:01:32 +0100
Message-ID: <1d94b2414ce1b97974de86814e384a7b@mail.gmail.com>
To: Peter Murray-Rust <pm286@cam.ac.uk>, www-math@w3.org
Hi Peter,



With content MathML you can express mathematics in a semantic way. What it
seems you need is some kind of formalization of an algorism witch is
outside the scope of content MathML if you consider the “structured
programing” paradigm. In case you want to follow a fully “functional
programming” approach:

(k,req)à(R à k(R-reg)^2 )

or a logical approach:

            k=0.1 /\ req=1.5 /\ (E=Ràk(R-reg)^2)

Whatever model you chose, content MathML can still be useful to express
some pieces of the whole system. For example, if you want to consider the
algorism as a sequence of declaration statements, the right part of each
statement can be encoded with content MathML. In your case, you would need
three statements:

k=*0.1*

req=*1.5*

E=*R **à** k(R-req)^2*

where only the right part of the statements is encoded as content MathML.



Daniel Marques

CTO at www.wiris.com





*From:* peter.murray.rust@googlemail.com [mailto:
peter.murray.rust@googlemail.com] *On Behalf Of *Peter Murray-Rust
*Sent:* jueves, 15 de marzo de 2012 9:42
*To:* www-math@w3.org
*Subject:* Using content-MathML for computation and analysis in Science and
Engineering



I hope this is the right list for my topic.

I am building a semantic system for physical science (primarily chemistry
at the moment), based on XML and want to embed content-MathML to support
equations, and computation. I haven't been able to find good examples of
this and if they exist I'd appreciate pointers. If not I'd like to discuss
my requirements on this list.

As a typical example, the energy of a bonded pair of atoms in a molecule
can be expressed as a quadratic relationship relating the Energy (E) to the
distance (r):
       E = k(R-req)^2
Here k and req are constants that depend on the atoms.
and in MathML I can write this as a lambda expression

<m:math xmlns:m='http://www.w3.org/1998/Math/MathML'>
    <m:lambda>
        <m:bvar>
            <ci>R</ci>
        </m:bvar>
        <m:ci>
            <m:apply>
                <m:times />
                <m:ci>k</m:ci>
                <m:apply>
                    <m:power/>
                    <m:apply>
                        <m:minus />
                        <m:ci>R</m:ci>
                        <m:ci>req</m:ci>
                    </m:apply>
                    <m:cn>2</m:cn>
                </m:apply>
            </m:apply>
        </m:ci>
    </m:lambda>
</m:math>

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?

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

P.

-- 
Peter Murray-Rust
Reader in Molecular Informatics
Unilever Centre, Dep. Of Chemistry
University of Cambridge
CB2 1EW, UK
+44-1223-763069
Received on Thursday, 15 March 2012 10:00:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 15 March 2012 10:00:31 GMT