Bill Hart wrote:
> sage: R.<x>=RDF['t']
> sage: s=1.0e1*t^3+1.0e-100*t^2+1.01234e-100*t+1.0e1
> sage: u=1.0e1*t^3-1.0e1*t^2+1.0e1*t-1.0e1
> sage: s*u
> 100.0*t^6 - 100.0*t^5 + 100.0*t^4 - 100.0*t^2 + 100.0*t - 100.0
> 
> What happened to the t^3 term?


Isn't it zero in RDF?

sage: a0=RDF(1.0e1)
sage: a1=RDF(1.01234e-100)
sage: a2=RDF(1.0e-100)
sage: a3=RDF(1.0e1)
sage: b0=RDF(-1.0e1)
sage: b1=RDF(1.0e1)
sage: b2=RDF(-1.0e1)
sage: b3=RDF(1.0e1)
sage: # the coefficient of t^3
sage: a0*b3 + a1*b2 + a2*b1 + a3*b0
0.0

Note that a0*b3+a3*b0 is zero (both are 100 in magnitude).  However,

sage: a2*b1 - a1*b2
2.01234e-99
sage: a2*b1 - a1*b2 +1 -1
0.0

My guess is that adding 100 and subtracting 100 wipes out the precision 
and makes the resulting expression close enough to zero that it is 
considered zero.

Are you sure that RDF provides enough precision to carry out your 
computation?

Jason



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to