[Maxima] how to get rid of 'abs(x) = ' in abs return value?

Raymond Toy toy.raymond at gmail.com
Tue Nov 3 13:40:59 CST 2009

```Hiisi wrote:
> Dear list!
> I need to solve an equation and display roots only if they're less
> than 1.0 by absolute value. But if I'm trying to calculate absolute
> value of roots the result is string like 'abs(x) = ...' Here's an
> example:
> (%i1) eqn: (1 + 2*x)^3 = 13.5*(1 + x^5);
>                                    3          5
> (%o1)                     (2 x + 1)  = 13.5 (x  + 1)
> (%i2) soln: allroots (eqn);
> (%o2) [x = .8296749902129361, x = - 1.015755543828121,
> x = .9659625152196369 %i - .4069597231924075,
> x = - .9659625152196369 %i - .4069597231924075, x = 1.0]
> (%i3) for x in soln do if abs(x) <= 1.0 then print(abs(x));
> (%o3)                                done
>
Try this:

for x in soln do if is(abs(rhs(x))<=1) then print(abs(x));

abs(x) = .8296749902129361
abs(x) = 1.0

If you only want the absolute value printed, use print(abs(rhs(x)))

Ray

```