[Om] Tutorial or example collection for OpenMath?
Alberto González Palomo
Alberto.Gonzalez at matracas.org
Wed Feb 26 12:01:02 CET 2014
Konrad Hinsen wrote: (25/02/14 10:07)
>[...]
> For the particular case of "sum", I find the definition in arith1 a
> bit vague:
>
> An operator taking two arguments, the first being the range of
> summation, e.g. an integral interval, ...
>
> There is no definition of "range of summation", just an example. You use a
> set in your example, which is fine, but there's nothing in the definition
> of "sum" that tells me that sets are a valid specification for a "range of
> summation".
>
> Which leads to another question: is there any validation tool for
> OpenMath that checks the semantics? The XML schemas and the XSLT
> stylesheet from the OpenMath Web site only check syntactical aspects,
> they won't stop me from using transc1/sin as a summation range, for
> example.
I'm not aware of any validation tool, but you can check the Simple
Type System (STS) used for symbol signatures in the OM CDs.
http://www.openmath.org/cd/sts.xhtml
For instance, arith1:sum has:
http://www.openmath.org/sts/arith1.xhtml#sum
I always used integer intervals for it in all the OM software I wrote.
For instance in Yacas, $\sigma_{i=1}^3 i^2$ is:
http://yacas.sourceforge.net/refchapter6.html#Sum
In> OMForm(Sum(i, 1, 3, i^2));
<OMOBJ>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMI>1</OMI>
<OMI>3</OMI>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="i"/>
</OMBVAR>
<OMA>
<OMS cd="arith1" name="power"/>
<OMV name="i"/>
<OMI>2</OMI>
</OMA>
</OMBIND>
</OMA>
</OMOBJ>
Out> True
In> N(Sum(i, 1, 3, i^2));
Out> 14
For the double sum you mentioned, that would be nested:
In> OMForm(Sum(j, -2, 5, Sum(i, 1, 3, j+i^2)));
<OMOBJ>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMI>2</OMI>
</OMA>
<OMI>5</OMI>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="j"/>
</OMBVAR>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMI>1</OMI>
<OMI>3</OMI>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="i"/>
</OMBVAR>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMV name="j"/>
<OMA>
<OMS cd="arith1" name="power"/>
<OMV name="i"/>
<OMI>2</OMI>
</OMA>
</OMA>
</OMBIND>
</OMA>
</OMBIND>
</OMA>
</OMOBJ>
Out> True
In> N(Sum(j, -2, 5, Sum(i, 1, 3, j+i^2)));
Out> 148
In my editor that would be as follows:
http://matracas.org/sentido/demo/index.xhtml#%E2%88%91%28-2..5,%CE%BBj.%E2%88%91%281..3,%CE%BBi.j+i^2%29%29
You can click twice on the sum button (the palettes will scroll
down because of the variables added to the expression) to get a
nested sum, then rename the variables by hand.
It is possible to enter it in the form described by Lars,
using a set, but my MathML stylesheets don't support it so far:
http://matracas.org/sentido/demo/index.xhtml#%E2%88%91%28cartesian_product%28X,Y%29,%CE%BB[i,j].i*j%29
Cheers,
--
Alberto González Palomo
Toledo, España / Saarbrücken, Deutschland
http://www.matracas.org
More information about the Om
mailing list