Dear Chris,<br>you'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> <<a href="mailto:Chris.Dams@mi.infn.it">Chris.Dams@mi.infn.it</a>> 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>> I've not managed to make the expand() & collect() functions do this, it<br>> seems to not want to perform something like:<br>><br>> 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&x,const exmap &m)<br>{ if (is_a<mul>(x))<br> { ex y=x;<br>
ex xprev;<br> do<br> { xprev = y;<br> y = y.subs(m, subs_options::subs_algebraic).expand();<br> } while(xprev != y);<br> return y;<br> }<br> if (is_a<add>(x))<br> { exvector ev;
<br> for(size_t i=0;i<x.nops();++i)<br> ev.push_back(simplify(x.op(i), m));<br><br> return add(ev);<br> }<br> 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>