Dear Chris,<br>you&#39;ve given me exactly what I needed! Many thanks<br>-Gerry<br><br><div><span class="gmail_quote">On 01/06/07, <b class="gmail_sendername"><a href="mailto:Chris.Dams@mi.infn.it">Chris.Dams@mi.infn.it</a>
</b> &lt;<a href="mailto:Chris.Dams@mi.infn.it">Chris.Dams@mi.infn.it</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Dear Gerry,
<br><br>&gt; I&#39;ve not managed to make the expand() &amp; collect() functions do this, it<br>&gt; seems to not want to perform something like:<br>&gt;<br>&gt; e^t*e^(1-t)=e^1<br><br>Yes, this is not included in the automatic simplifications, so you will
<br>have to do it yourself. In cases like this I usually use a function that I<br>call simplify and that is defined as<br><br>ex simplify(const ex&amp;x,const exmap &amp;m)<br>{&nbsp;&nbsp;if (is_a&lt;mul&gt;(x))<br>&nbsp;&nbsp; {&nbsp;&nbsp;ex y=x;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ex xprev;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;xprev = y;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y = y.subs(m, subs_options::subs_algebraic).expand();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} while(xprev != y);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return y;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; if (is_a&lt;add&gt;(x))<br>&nbsp;&nbsp; {&nbsp;&nbsp;exvector ev;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(size_t i=0;i&lt;x.nops();++i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ev.push_back(simplify(x.op(i), m));<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return add(ev);<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; return x;<br>}<br><br>This can be used by doing<br>exmap m;<br>m[power(e,wild(0))*power(e,wild(1))] = power(e, wild(0)+wild(1));
<br>f = simplify(f, m)<br><br>Good luck,<br>Chris<br><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>