<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks, I see it, but if I create a derivatrion "diff" the sign is important:<div>If I run formula.diff(a, 1):<br><div><br></div><div>[0.5*(t-ax^3)^2]' =&gt;&nbsp;-(t-a*x^3)*x^3</div><div>[0.5*(ax^3-t)^2]' =&gt;&nbsp;(a*x^3-t)*x^3</div><div><br></div><div>On my code I parse the formula (0.5)*(t -(formula)^2 and substitute formula with</div><div>another formula.&nbsp;I do not understand why the minus sign is not interpreted correctly.</div><div><br></div><div>I think GiNaC does create a pattern matching and not evaluate the correct&nbsp;expression.</div><div>In my opinion the first&nbsp;expression is the correct one, GiNaC creates the second. Why?</div><div>How can I tell GiNaC that it interpret the expression arithmetically correct?</div><div><br></div><div>Thanks</div><div><br></div><div>Phil</div><div dir="ltr"><div id="tts_button" title="Übersetzung anhören"></div></div><div>&nbsp;<br><div><div><br></div><div><br><div><div>Am 06.08.2010 um 22:41 schrieb Doug:</div><br class="Apple-interchange-newline"><blockquote type="cite"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font: inherit;">(-1)^2 == 1^2<br>therefore<br>(-expr)^2 == expr^2<br>therefore<br>(t-exp(x))^2 == (-(t-exp(x))^2 == (exp(x) - t)^2<br><br>Do you see it now?<br><br><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; position: static; z-index: auto; "><div class="plainMail"><br>I'm now a little bit confused, cause I'm working for a long time with this problem and I don't see my "thinking error".<br>If I have an expression eg exp(x), so (t-exp(x))^2 is not the same (exp(x)-t)^2. Sorry I don't see it<br><br>Thanks<br><br>Phil<br>_______________________________________________<br>GiNaC-list mailing list<br><a ymailto="mailto:GiNaC-list@ginac.de" href="/mc/compose?to=GiNaC-list@ginac.de">GiNaC-list@ginac.de</a><br><a href="https://www.cebix.net/mailman/listinfo/ginac-list" target="_blank">https://www.cebix.net/mailman/listinfo/ginac-list</a><br></div></blockquote></td></tr></tbody></table><br>       _______________________________________________<br>GiNaC-list mailing list<br><a href="mailto:GiNaC-list@ginac.de">GiNaC-list@ginac.de</a><br><a href="https://www.cebix.net/mailman/listinfo/ginac-list">https://www.cebix.net/mailman/listinfo/ginac-list</a><br></blockquote></div><br></div></div></div></div></body></html>