Hi, I don't understand some answer about the method collect(). If it is able to collect with 'sin($1)' the polynomial 'a' why not the polynomials 'b' or 'c' with '2^$1' or '$1^n'?
a=d*p*sin(x)+p*sin(x)+q*sin(y)+q*d*sin(y)+sin(y)+d*sin(y)+q*sin(x); q*sin(y)+sin(x)*p+d*sin(y)+sin(y)+d*q*sin(y)+sin(x)*q+sin(x)*d*p collect(a,find(a,sin($1))); sin(y)*(1+d+q+d*q)+sin(x)*(q+p+d*p)
b=q*2^y+2^x*p+d*2^y+2^y+d*q*2^y+2^x*q+2^x*d*p; q*2^y+d*2^y+2^x*d*p+2^x*p+2^y+d*q*2^y+2^x*q collect(b,find(b,2^($1))); q*2^y+d*2^y+2^x*d*p+2^x*p+2^y+d*q*2^y+2^x*q
c=n*2^n+n-3+3^n-n^2*2^n; -3+2^n*n-2^n*n^2+3^n+n collect(c,find(c,$1^n)); -3+2^n*n-2^n*n^2+3^n+n
Thanks in advance, Tatiana Zolo
Hi! On Thu, Jan 24, 2002 at 11:36:41PM +0100, tatiana wrote:
If it is able to collect with 'sin($1)' the polynomial 'a' why not the polynomials 'b' or 'c' with '2^$1' or '$1^n'? [...]
Because degree()/coeff() (which are used by collect()) were only implemented for functions, constants, symbols and indexed objects in this "treat the entire expression as the object" mode. I've changed GiNaC in CVS now to make this mode the default for all classes (except for add/mul/numeric) so your examples will work. Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
tatiana