Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Continued fraction of pi by hand

Hello, I'm a newbie in Sage. I tried to compute (sagenb.org) the continued fraction of pi by hand with the following commands

n=15 x=range(n+1);a=range(n) x[0]=pi for i in range(n): a[i] = int(x[i]) x[i+1]=1/(x[i]-a[i]) print(a[i])

the answer (14 terms) is correct, but then I get

Traceback (click to the left of this block for traceback) ... ValueError: Calling floor() on infinity or NaN

Am I doing something wrong?

Cheers

Continued fraction of pi by hand

Hello, I'm a newbie in Sage. I tried to compute (sagenb.org) the continued fraction of pi by hand with the following commands

n=15
x=range(n+1);a=range(n)
x[0]=pi
for i in range(n):
    a[i] = int(x[i])
    x[i+1]=1/(x[i]-a[i])
    print(a[i])

print(a[i])

the answer (14 terms) is correct, but then I get

Traceback (click to the left of this block for traceback)
...
ValueError: Calling floor() on infinity or NaN

Am I doing something wrong?

Cheers

Continued fraction of pi by hand

Hello, I'm a newbie in Sage. I tried to compute (sagenb.org) the continued fraction of pi by hand with the following commands

n=15
x=range(n+1);a=range(n)
x[0]=pi
for i in range(n):
    a[i] = int(x[i])
    x[i+1]=1/(x[i]-a[i])
    print(a[i])

the answer (14 terms) is correct, but then I get

Traceback (click to the left of this block for traceback)
...
ValueError: Calling floor() on infinity or NaN

Am I doing something wrong?

Cheers

Continued fraction of pi by hand

Hello, I'm a newbie in Sage. I tried to compute (sagenb.org) the continued fraction of pi by hand with the following commands

n=15
x=range(n+1);a=range(n)
x[0]=pi
for i in range(n):
    a[i] = int(x[i])
    x[i+1]=1/(x[i]-a[i])
    print(a[i])

the answer (14 terms) is correct, but then I get

Traceback (click to the left of this block for traceback)
...
ValueError: Calling floor() on infinity or NaN

Am I doing something wrong?

Cheers

Continued fraction of pi by hand

Hello, I'm a newbie in Sage. I tried to compute (sagenb.org) the continued fraction of pi by hand with the following commands

n=15
x=range(n+1);a=range(n)
x[0]=pi
for i in range(n):
    a[i] = int(x[i])
    x[i+1]=1/(x[i]-a[i])
    print(a[i])

the answer (14 terms) is correct, but then I get

Traceback (click to the left of this block for traceback)
...
ValueError: Calling floor() on infinity or NaN

Am I doing something wrong?

Cheers