On 02/12/2013 06:23 PM, Jori Mantysalo wrote:
I'm writing about resolvents and want to show some numerical results,
kind of simulating hand-made calculations.

I can do this manually:

def n4(x): return x.n(digits=4);
f=x^4 - x^3 - 3*x^2 + x + 1;
map(n4, f.roots(ring = CC, multiplicities=false));

--> [-1.356, -0.4773, 0.7376, 2.095]

-1.356*0.7376+-0.4773*2.095

--> -2.00012910000000

However, if I say r[0]*r[2]+r[1]*r[3] I got exactly -2.000. This time
Sage is too good for me... Is there easy way to do this? There is CDF
and CC, but how to calculate and/or show results with given presicion?


Check these pages out:

http://www.sagemath.org/doc/reference/sage/rings/real_mpfr.html

http://www.sagemath.org/doc/reference/sage/rings/complex_number.html


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to