<html><head><style type="text/css">.style1 {font-family: "Times New Roman";}</style></head><body>On 22/02/2019 01:57, Phu Nguyen wrote:<BR>
> im actually interested in comparing two OpenMath-Objects with each other <BR>
> in terms of equality (despite being build a bit differently in XML) by <BR>
> using Java.<BR>
> <BR>
> For example I want "x^2+2x-35=0" to be equal to "-35+2x+x^2=0".<BR>
> <BR>
> So im wondering if there is a way to achieve this. I at least understand <BR>
> OpenMath as some sort of tree structure and thought there might be a way <BR>
> to compare them.<BR>
> <BR>
> I already tried writing the expressions for those two equations, but <BR>
> ended up with no luck or good idea.<BR>
> <BR>
> *|Equation 1: x^2+2x-35=0|*/|<OMOBJ xmlns='http://www.openmath.org/OpenMath' version='2.0' <BR>
> cdbase='http://www.openmath.org/cd'> <OMA> <OMS cd='relation1' <BR>
> name='eq'/> <OMA> <OMS cd='arith1' name='minus'/> <OMA> <OMS cd='arith1' <BR>
> name='plus'/> <OMA> <OMS cd='arith1' name='power'/> <OMV name='x'/> <BR>
> <OMI> 2 </OMI> </OMA> <OMA style='invisible'> <OMS cd='arith1' <BR>
> name='times'/> <OMI> 2 </OMI> <OMV name='x'/> </OMA> </OMA> <OMI> 35 <BR>
> </OMI> </OMA> <OMI> 0 </OMI> </OMA> </OMOBJ> |/*|Equation 2: -35+2x+x^2|*/|<OMOBJ xmlns='http://www.openmath.org/OpenMath' version='2.0' <BR>
> cdbase='http://www.openmath.org/cd'> <OMA> <OMS cd='relation1' <BR>
> name='eq'/> <OMA> <OMS cd='arith1' name='plus'/> <OMA> <OMS cd='arith1' <BR>
> name='unary_minus'/> <OMI> 35 </OMI> </OMA> <OMA style='invisible'> <OMS <BR>
> cd='arith1' name='times'/> <OMI> 2 </OMI> <OMV name='x'/> </OMA> <OMA> <BR>
> <OMS cd='arith1' name='power'/> <OMV name='x'/> <OMI> 2 </OMI> </OMA> <BR>
> </OMA> <OMI> 0 </OMI> </OMA> </OMOBJ>|/<BR>
> <BR>
> Thank you for your time<BR>
> <BR>
> Sincerely<BR>
> <BR>
> Phu<BR>
> <BR>
<BR>
The usual OpenMath model is that it encodes the data in a system-neutral <BR>
way, but reasoning about that data happens in the application, so <BR>
typically you'd import the two OpenMath polynomials into a computer <BR>
algebra system test for equality and write out an OpenMath boolean.<BR>
<BR>
If writing custom code it would be easier to check for equality if using <BR>
a specific more constrained polynomial constructor rather than generic <BR>
symbolic arith1 expressions.<BR>
unfortunately there are several possible formulations so all are classed <BR>
as experimental but in for example<BR>
<BR>
<a href="https://www.openmath.org/cd/polyr.html" target="_blank">https://www.openmath.org/cd/polyr.html</a><BR>
<BR>
such a polynomial is just modelled as a sequence of the coefficients in <BR>
order of exponent on the variable, and so the two forms you show would<BR>
be normalized to the same thing while creating the OpenMath (which may <BR>
or may not be a good thing, depending on the use case)<BR>
<BR>
David<BR>

<br /><br /><p style="font-family: Verdana; font-size:10pt; color:#666666;"><b>Disclaimer</b></p><p style="font-family: Verdana; font-size:8pt; color:#666666;">The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.  Please see our <A href="https://www.nag.co.uk/content/privacy-notice">Privacy Notice</A> for information on how we process personal data and for details of how to stop or limit communications from us.<br /><br />This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.</p>

</body></html>