Re: [sage-support] Strange behavior with RealField(n)

2016-02-21 Thread Thierry Dumont

Le 21/02/2016 20:40, John Cremona a écrit :

Try RealField(500).pi() and similar.

Yes, it works... but my small piece of code should also give correct 
results...

thanks.
t.


On 21 Feb 2016 18:10, "Thierry Dumont" > wrote:

I have students who want to compute decimals of pi...so, what can we
do with RealField(n) ?
I make the following script (pi.sage):


for p in [2..10]:
 R=RealField(10^p)
 pii=4*atan(R(1))
 print p,R,pii


Then, using sage 7.0 or 7.1.beta4:

attach("pi.sage")

This produces a lot of seemingly correct output, but, as it takes a
too long time to finish :-), I interrupt the computation (Ctrl-c).

So, lets try again; replace 10 by 5 in the for statement (I do not
leave sage). I get NaNs:


2 Real Field with 100 bits of precision NaN
3 Real Field with 1000 bits of precision NaN
4 Real Field with 1 bits of precision NaN
5 Real Field with 10 bits of precision NaN
.

Strange.

Yours
t.d.


--
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 sage-support+unsubscr...@googlegroups.com
.
To post to this group, send email to sage-support@googlegroups.com
.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

--
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 sage-support+unsubscr...@googlegroups.com
.
To post to this group, send email to sage-support@googlegroups.com
.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


--
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
<>

Re: [sage-support] Strange behavior with RealField(n)

2016-02-21 Thread John Cremona
Try RealField(500).pi() and similar.
On 21 Feb 2016 18:10, "Thierry Dumont"  wrote:

> I have students who want to compute decimals of pi...so, what can we do
> with RealField(n) ?
> I make the following script (pi.sage):
>
> 
> for p in [2..10]:
> R=RealField(10^p)
> pii=4*atan(R(1))
> print p,R,pii
> 
>
> Then, using sage 7.0 or 7.1.beta4:
>
> attach("pi.sage")
>
> This produces a lot of seemingly correct output, but, as it takes a too
> long time to finish :-), I interrupt the computation (Ctrl-c).
>
> So, lets try again; replace 10 by 5 in the for statement (I do not leave
> sage). I get NaNs:
>
>
> 2 Real Field with 100 bits of precision NaN
> 3 Real Field with 1000 bits of precision NaN
> 4 Real Field with 1 bits of precision NaN
> 5 Real Field with 10 bits of precision NaN
> .
>
> Strange.
>
> Yours
> t.d.
>
>
> --
> 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 sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange behavior with RealField(n)

2016-02-21 Thread Thierry Dumont
I have students who want to compute decimals of pi...so, what can we do 
with RealField(n) ?

I make the following script (pi.sage):


for p in [2..10]:
R=RealField(10^p)
pii=4*atan(R(1))
print p,R,pii


Then, using sage 7.0 or 7.1.beta4:

attach("pi.sage")

This produces a lot of seemingly correct output, but, as it takes a too 
long time to finish :-), I interrupt the computation (Ctrl-c).


So, lets try again; replace 10 by 5 in the for statement (I do not leave 
sage). I get NaNs:



2 Real Field with 100 bits of precision NaN
3 Real Field with 1000 bits of precision NaN
4 Real Field with 1 bits of precision NaN
5 Real Field with 10 bits of precision NaN
.

Strange.

Yours
t.d.


--
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
<>