replacement of coefficients in a polynomial by absolutevalues?



f(x):= if numberp(x) then abs(x) else x;
scanmap(f, ratexpand(p));

should do it.

 

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of S. Newhouse
> Sent: Sunday, April 27, 2008 9:30 AM
> To: maxima at math.utexas.edu
> Subject: replacement of coefficients in a polynomial 
> by absolutevalues?
> 
> Hello,
>  Given a polynomial p(x) = sum(a_j x^j) in which j = (j_1, . 
> . . , j_n) 
> is a multi-index,  is there a simple way to obtain the polynomial
>                                 q(x) = sum(abs(a_j) x^j)            ?
> 
> Following some previous discussion, one could first extract the 
> coefficients, replace them by their absolute values, and then 
> get q, but 
> I wondered if there are some special tools to make this easier.
> 
> TIA,
>  -sen
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>