Only real roots (basic)



Maybe you can improve your code to handle:

  (%i3) eq : x^4-39*x^2+x+21$

  (%i4) solver(solve(eq,x));
  (%o4) []

I think all four zeros are real:

  (%i5) bfallroots(eq);
  (%o5) [x=7.523062361878836b-1,x=-7.25925930810255b1,x=6.187887129111267b0,x=-6.214267434488896b0]

Another test is x^3-39*x^2+x+21.



--Barton


________________________________
From: maxima-bounces at math.utexas.edu <maxima-bounces at math.utexas.edu> on behalf of Ricardo JF <rcrdjf at hotmail.com>
Sent: Sunday, December 8, 2013 18:04
To: maxima at math.utexas.edu
Subject: Re: [Maxima] Only real roots (basic)

thank you all !

it's how i did:

f(x):=x^3-x^2+x+1;

solver(u):=block (
[q:length(u),m],
m:makelist(0,n,1,q),
for i:1 thru q do (if imagpart(u[i]) then m[i]:u[i] else m[i]:IROOT),
m:delete(IROOT,m),
return(m));

solver(   solve(f(x))   );



________________________________
From: rcrdjf at hotmail.com
To: maxima at math.utexas.edu
Date: Sun, 8 Dec 2013 16:26:43 +0300
Subject: Only real roots (basic)

hi friends,

why this doesn't give only real roots:

f(x):=x^3-x^2+x+1;
declare(x,real);
solve(f(x));

i just want [x=(sqrt(11)/...)]

thanks.

_______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima