Re: A slow summation

"Bill Page" <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.user
Message-ID <[email protected]>
Of course these also make some sense :-)

(1) -> sum(1/x,x=1.0..20000.0)

   (1)  10.4807282172 29327571
                                  Type: Union(Expression Float,...)
 Time: 0.02 (IN) + 3.10 (EV) + 0.02 (OT) + 0.32 (GC) = 3.45 sec

(2) -> sum(1/x,x=(1.0..20000.0)$Segment DoubleFloat)

   (2)  10.480728217229315
                         Type: Union(Expression DoubleFloat,...)
                          Time: 1.77 (EV) + 0.23 (GC) = 2.00 sec

(3) -> sum(1/x,x=1..20000)::Float

   (3)  10.4807282172 29327573
                                                                  Type: Float
                         Time: 5.02 (EV) + 1.22 (GC) = 6.23 sec

----------

Float is the domain of finite precision floating point numbers and
DoubleFloat is the domain of hardware support floating point numbers.
The last computes an exact fraction (rational number) with a final
conversion to Float.

Maybe they provide good examples for your students?

Regards,
Bill Page.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.