jason.t.stein wrote: > I am a high school teacher in Turtleford, SK Canada and am thinking > about using sage in some of my teaching. The one problem I have right > now is all of the complex roots found when solving an equation. Is > there a way to restrict the returned solutions to the Reals? >
You can take all of the returned solutions and test them to see if they are real. Then you can just return the real ones. sage: all_roots=solve((x^2+1)*(x-1)==0,x,solution_dict=True) sage: all_roots [{x: -I}, {x: I}, {x: 1}] sage: real_roots=[root[x] for root in all_roots if imag(root[x])==0] sage: real_roots [1] Jason -- You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to sage-...@googlegroups.com. To unsubscribe from this group, send email to sage-edu+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en.