Skip to content
Snippets Groups Projects
Commit c07a08e2 authored by Jan Snellman's avatar Jan Snellman
Browse files

sagemath

parent 5313d4b0
No related branches found
No related tags found
No related merge requests found
Pipeline #126614 passed
%% Cell type:code id:a0564571-faf2-47f7-80b8-6b93da370de6 tags:
%% Cell type:markdown id:84d0f462 tags:
# Rosen kap 12.3
%% Cell type:markdown id:82be3b57 tags:
## 12.3.1c
%% Cell type:code id:c1cc2bbd tags:
``` sage
# 12.3.1c
```
%% Cell type:code id:97f1a9eb-89f3-493e-a564-9ceed016b7ba tags:
``` sage
N=6
N=10
alpha = vector(QQbar,[0 for _ in range(N)])
a = vector(QQbar,[0 for _ in range(N)])
t = vector(QQbar,[0 for _ in range(N)])
```
%% Cell type:code id:43236aea-32a2-4b2e-ad87-674ea0443341 tags:
``` sage
```
%% Cell type:code id:4c58f2d2-829b-4e8e-8b41-e18241a04c39 tags:
``` sage
alpha[0] = sqrt(5)
```
%% Cell type:code id:6a2f74bb tags:
``` sage
alpha[0]
```
%% Output
2.236067977499790?
%% Cell type:code id:48a2ac86 tags:
``` sage
alpha[0].minpoly()
```
%% Output
x^2 - 5
%% Cell type:code id:3355ee27 tags:
``` sage
```
%% Cell type:code id:1d1f5708 tags:
``` sage
alpha[0].radical_expression()
```
%% Output
sqrt(5)
%% Cell type:code id:d239123d-8f1d-4c2a-8723-e488035f4882 tags:
``` sage
alpha[0] = sqrt(5)
for k in range(N-1):
a[k], t[k] = floor(alpha[k]), alpha[k] - floor(alpha[k])
alpha[k+1] = 1 / t[k]
print(k,alpha[k], a[k], t[k])
print(f"{k : >5} {alpha[k] } {alpha[k].radical_expression()} {a[k] } {t[k] } {t[k].radical_expression()}")
```
%% Output
0 2.236067977499790? sqrt(5) 2 0.2360679774997897? sqrt(5) - 2
1 4.236067977499789? sqrt(5) + 2 4 0.2360679774997897? sqrt(5) - 2
2 4.236067977499789? sqrt(5) + 2 4 0.2360679774997897? sqrt(5) - 2
3 4.23606797749979? sqrt(5) + 2 4 0.23606797749979? sqrt(5) - 2
4 4.2360679774998? sqrt(5) + 2 4 0.2360679774998? sqrt(5) - 2
5 4.236067977500? sqrt(5) + 2 4 0.236067977500? sqrt(5) - 2
6 4.23606797750? sqrt(5) + 2 4 0.23606797750? sqrt(5) - 2
7 4.236067978? sqrt(5) + 2 4 0.236067978? sqrt(5) - 2
8 4.236067977499789? sqrt(5) + 2 4 0.2360679774997897? sqrt(5) - 2
%% Cell type:code id:8bca7737 tags:
``` sage
alpha[3]
```
%% Output
0 2.236067977499790? 2 0.2360679774997897?
1 4.236067977499789? 4 0.2360679774997897?
2 4.236067977499789? 4 0.2360679774997897?
3 4.23606797749979? 4 0.23606797749979?
4 4.2360679774998? 4 0.2360679774998?
4.236067977499789?
%% Cell type:code id:8688c62b tags:
``` sage
alpha[3].minpoly()
```
%% Output
x^2 - 4*x - 1
%% Cell type:code id:f64ad389 tags:
``` sage
```
%% Cell type:code id:900adcfb tags:
``` sage
```
%% Cell type:code id:91e64dfc-7d82-41da-97a3-907b70fb04cf tags:
``` sage
continued_fraction(alpha[0])
```
%% Output
[2; 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...]
%% Cell type:code id:23bc6e7f tags:
``` sage
continued_fraction(t[0])
```
%% Output
[0; 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...]
%% Cell type:code id:4805e461-de3a-4ad1-b68b-0ac1254a9fa2 tags:
``` sage
continued_fraction(alpha[1])
```
%% Output
[4; 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...]
%% Cell type:code id:74e5c6b5-4141-48a2-9ed0-5145ec962206 tags:
``` sage
continued_fraction(t[1])
```
%% Output
[0; 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...]
%% Cell type:code id:ce40fb53-525d-4778-ab65-d3b9de12fd0a tags:
``` sage
```
%% Cell type:code id:5069fea6 tags:
``` sage
```
%% Cell type:code id:48ef12c1 tags:
``` sage
```
%% Cell type:code id:727be0d3 tags:
``` sage
```
%% Cell type:code id:1e494570 tags:
``` sage
# annat exempel med periodisk kb
```
%% Cell type:code id:5f179ca2-6fe2-4acf-8ee5-efc16c9f92d7 tags:
``` sage
alpha[0] = sqrt(19)-1
for k in range(N-1):
a[k], t[k] = floor(alpha[k]), alpha[k] - floor(alpha[k])
alpha[k+1] = 1 / t[k]
print(k,alpha[k], a[k], t[k])
print(k,alpha[k],alpha[k].radical_expression(), a[k], t[k], t[k].radical_expression())
```
%% Output
0 3.358898943540674? 3 0.3588989435406736?
1 2.786299647846891? 2 0.7862996478468912?
2 1.271779788708135? 1 0.2717797887081347?
3 3.679449471770337? 3 0.679449471770337?
4 1.471779788708135? 1 0.471779788708135?
0 3.358898943540674? sqrt(19) - 1 3 0.3588989435406736? sqrt(19) - 4
1 2.786299647846891? 1/3*sqrt(19) + 4/3 2 0.7862996478468912? 1/3*sqrt(19) - 2/3
2 1.271779788708135? 1/5*sqrt(19) + 2/5 1 0.2717797887081347? 1/5*sqrt(19) - 3/5
3 3.679449471770337? 1/2*sqrt(19) + 3/2 3 0.6794494717703368? 1/2*sqrt(19) - 3/2
4 1.471779788708135? 1/5*sqrt(19) + 3/5 1 0.4717797887081347? 1/5*sqrt(19) - 2/5
5 2.119632981180225? 1/3*sqrt(19) + 2/3 2 0.11963298118022452? 1/3*sqrt(19) - 4/3
6 8.358898943540674? sqrt(19) + 4 8 0.3588989435406736? sqrt(19) - 4
7 2.786299647846891? 1/3*sqrt(19) + 4/3 2 0.7862996478468912? 1/3*sqrt(19) - 2/3
8 1.271779788708135? 1/5*sqrt(19) + 2/5 1 0.2717797887081347? 1/5*sqrt(19) - 3/5
%% Cell type:code id:befb67c1-8720-4d6f-88da-1920b91edfab tags:
``` sage
continued_fraction(alpha[0])
```
%% Output
[3; 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, ...]
%% Cell type:code id:73ca37dd-732c-4614-87e5-f546b69ff166 tags:
``` sage
continued_fraction(t[0])
```
%% Output
[0; 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, ...]
%% Cell type:code id:3e32ecf1-bb17-4e8c-88cc-ab86cb26c262 tags:
``` sage
continued_fraction(1/t[0])
```
%% Output
[2; 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, ...]
%% Cell type:code id:ad4f7e53-2f82-4592-b1b1-ce52cc96373f tags:
``` sage
continued_fraction(a[0] + t[0])
```
%% Output
[3; 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, ...]
%% Cell type:code id:2a3daa68-23ea-4292-b642-b9b293468494 tags:
``` sage
continued_fraction(a[0] + 1/(a[1] +t[1]))
```
%% Output
[3; 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, ...]
%% Cell type:code id:e33f1445-ebf7-4ad9-8441-093613207188 tags:
``` sage
```
%% Cell type:code id:1c92946d-cb2e-458f-967e-c10cc12be1aa tags:
``` sage
```
%% Cell type:code id:e5b2db5f-d125-43eb-837f-27896ceabd02 tags:
``` sage
```
%% Cell type:code id:44991d26-ebed-44ad-9883-e49b90842e8e tags:
%% Cell type:markdown id:f9d5feb9 tags:
``` sage
#12.3.2.a
```
## 12.3.2.a
%% Cell type:code id:a05c12c9-9df9-464d-b932-62a81a1d4429 tags:
``` sage
R.<x> = QQbar[]
f0 = x^3-2
d=3
```
%% Cell type:code id:7ffc1d57-0784-4119-825f-32f5459cc945 tags:
``` sage
[(j,f0(j)) for j in range(8)]
```
%% Output
[(0, -2), (1, -1), (2, 6), (3, 25), (4, 62), (5, 123), (6, 214), (7, 341)]
%% Cell type:code id:1f050106-4454-441f-ab17-869bb1e7deb9 tags:
``` sage
f0.roots()
```
%% Output
[(1.259921049894873?, 1),
(-0.6299605249474365? - 1.091123635971722?*I, 1),
(-0.6299605249474365? + 1.091123635971722?*I, 1)]
%% Cell type:code id:3327b8b5-8e8e-4f34-97d0-8b24e06410e2 tags:
``` sage
alfa0=f0.roots()[0][0]
alfa0
```
%% Output
1.259921049894873?
%% Cell type:code id:4ddb6330-657c-4387-b902-6e055b0097b0 tags:
``` sage
continued_fraction(alfa0)
```
%% Output
[1; 3, 1, 5, 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, ...]
%% Cell type:raw id:d800b558-13db-47be-be2c-a1a878594129 tags:
%% Cell type:code id:78e5e15c-0cc0-4dff-a8a2-5693f4b4a339 tags:
``` sage
a0 = 1
f1 = (-x)^d*f0(a0 + 1/x)
f1 =R(f1)
f1
```
%% Output
x^3 - 3*x^2 - 3*x - 1
%% Cell type:code id:d2cae2a9 tags:
``` sage
f0(a0 + 1/x)
```
%% Output
(-x^3 + 3*x^2 + 3*x + 1)/x^3
%% Cell type:code id:3d7595ea tags:
``` sage
[(j,f1(j)) for j in range(8)]
```
%% Output
[(0, -1), (1, -6), (2, -11), (3, -10), (4, 3), (5, 34), (6, 89), (7, 174)]
%% Cell type:code id:5d9d0f98-5ecc-4e6a-b074-813c329fdbf1 tags:
``` sage
f1.roots()
```
%% Output
[(3.847322101863073?, 1),
(-0.4236610509315363? - 0.2836060010268813?*I, 1),
(-0.4236610509315363? + 0.2836060010268813?*I, 1)]
%% Cell type:code id:c54abfa7-4930-4a3f-9c2c-3bf05d5b32a0 tags:
``` sage
alfa1=f1.roots()[0][0]
continued_fraction(alfa1)
```
%% Output
[3; 1, 5, 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, 2, ...]
%% Cell type:code id:5801d40e-a2a8-46e9-bdd9-39b33d52f83f tags:
``` sage
a1 = 3
f2 = (-x)^d*f1(a1 + 1/x)
f2 =R(f2)
f2
```
%% Output
10*x^3 - 6*x^2 - 6*x - 1
%% Cell type:code id:b0a535b5 tags:
``` sage
[(j,f2(j)) for j in range(8)]
```
%% Output
[(0, -1),
(1, -3),
(2, 43),
(3, 197),
(4, 519),
(5, 1069),
(6, 1907),
(7, 3093)]
%% Cell type:code id:c4c0bc9d-9bbf-4d8d-b063-d1dc78245ff6 tags:
``` sage
f2.roots()
```
%% Output
[(1.180188735548410?, 1),
(-0.2900943677742046? - 0.02403056328910778?*I, 1),
(-0.2900943677742046? + 0.02403056328910778?*I, 1)]
%% Cell type:code id:c049c466-ebf9-4853-9ebf-2be2a169b069 tags:
``` sage
alfa2=f2.roots()[0][0]
continued_fraction(alfa2)
```
%% Output
[1; 5, 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, 2, 1, ...]
%% Cell type:code id:47f04c9b tags:
``` sage
alfa2
```
%% Output
1.180188735548410?
%% Cell type:code id:a988ae62 tags:
``` sage
plot(SR(f2),(x,0,3))
```
%% Output
Graphics object consisting of 1 graphics primitive
%% Cell type:code id:46ca4963 tags:
``` sage
```
%% Cell type:code id:9953eae5-e5d1-48f6-bda3-e464b1a6c6c1 tags:
``` sage
a2 = 1
f3 = (-x)^d*f2(a2 + 1/x)
f3 =R(f3)
f3
```
%% Output
3*x^3 - 12*x^2 - 24*x - 10
%% Cell type:code id:0a66ff0f-dc17-42ae-b8ee-6535c8541aac tags:
``` sage
f3.roots()
```
%% Output
[(5.549736485782388?, 1),
(-0.7748682428911940? - 0.01443345604526783?*I, 1),
(-0.7748682428911940? + 0.01443345604526783?*I, 1)]
%% Cell type:code id:b4fc68d2-c006-43ce-945d-f809360adb11 tags:
``` sage
alfa3=f3.roots()[0][0]
continued_fraction(alfa3)
```
%% Output
[5; 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, 2, 1, 3, ...]
%% Cell type:code id:0c50aa3c-5f4c-4d34-bc2f-a5de911952b9 tags:
``` sage
a3 = 5
f4 = (-x)^d*f3(a3 + 1/x)
f4 =R(f4)
f4
```
%% Output
55*x^3 - 81*x^2 - 33*x - 3
%% Cell type:code id:d99ecd1d-0a85-4ebb-a69b-546456037c87 tags:
``` sage
f4.roots()
```
%% Output
[(1.819053357131272?, 1),
(-0.1731630422019992? - 0.00043279622203746?*I, 1),
(-0.1731630422019992? + 0.00043279622203746?*I, 1)]
%% Cell type:code id:c72bd901-5e62-4abf-ab21-758fc8a6d91d tags:
``` sage
alfa4=f4.roots()[0][0]
continued_fraction(alfa4)
```
%% Output
[1; 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, 2, 1, 3, 4, ...]
%% Cell type:code id:468aa920-5d96-4aba-af0d-906c8823f6c4 tags:
``` sage
continued_fraction(2^(1/3))
```
%% Output
[1; 3, 1, 5, 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, ...]
%% Cell type:code id:73ee5ba0-8a57-4afc-a637-3ef24d89ad58 tags:
``` sage
```
%% Cell type:code id:c9930f4b-758a-4edd-b462-827914d8f867 tags:
``` sage
```
%% Cell type:code id:d742e1d1-7935-46ee-bd91-3037e9791149 tags:
%% Cell type:code id:01c2df55 tags:
``` sage
```
%% Cell type:markdown id:b300d674 tags:
## 12.3.4
%% Cell type:code id:fd9f44d8 tags:
``` sage
ec=continued_fraction(exp(1))
ec
```
%% Output
[2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, ...]
%% Cell type:code id:6e09c672 tags:
``` sage
ec[:3]
```
%% Output
[2; 1, 2]
%% Cell type:code id:25a8b5f3 tags:
``` sage
#12.3.4
```
%% Cell type:code id:cd9a0eb9-823a-46cf-a3ce-ce344d55ceb4 tags:
``` sage
a=vector([2,1,2,1,1,4])
a=ec[:12]
N=len(a)
v=[]
v.append(vector([1,0]))
v.append(vector([0,1]))
```
%% Cell type:code id:22b9d3bd-d905-4ecc-a841-0469335e7707 tags:
``` sage
v
```
%% Output
[(1, 0), (0, 1)]
%% Cell type:code id:a89b77b0-93bf-4c2a-82db-f1f1a7d99938 tags:
``` sage
for k in range(N):
v.append(a[k]*v[-1] + v[-2])
```
%% Cell type:code id:5f5c0c05-47f0-4538-8046-1a75fe629b55 tags:
``` sage
v
```
%% Output
[(1, 0), (0, 1), (1, 2), (1, 3), (3, 8), (4, 11), (7, 19), (32, 87)]
[(1, 0),
(0, 1),
(1, 2),
(1, 3),
(3, 8),
(4, 11),
(7, 19),
(32, 87),
(39, 106),
(71, 193),
(465, 1264),
(536, 1457),
(1001, 2721),
(8544, 23225)]
%% Cell type:code id:b8feab8b-f3ed-477c-8ee2-9f88a8728ea2 tags:
``` sage
conve =[c[1]/c[0] for c in v[2:]]
conve
```
%% Output
[2, 3, 8/3, 11/4, 19/7, 87/32]
[2,
3,
8/3,
11/4,
19/7,
87/32,
106/39,
193/71,
1264/465,
1457/536,
2721/1001,
23225/8544]
%% Cell type:code id:a560f987-04f8-40a1-8b1e-366949e8464e tags:
``` sage
conve[5] - conve[4]
```
%% Output
1/224
%% Cell type:code id:dcbebe47-9e94-4540-8f4d-99f1217ca1b0 tags:
``` sage
list_plot(conve)
```
%% Output
Graphics object consisting of 1 graphics primitive
%% Cell type:code id:70755b4a tags:
``` sage
list_plot(v,aspect_ratio=1)
```
%% Output
Graphics object consisting of 1 graphics primitive
%% Cell type:code id:bc21d88d tags:
``` sage
```
%% Cell type:code id:de8187ff tags:
``` sage
```
%% Cell type:code id:91a54c73 tags:
``` sage
```
%% Cell type:code id:d6da924d tags:
``` sage
```
%% Cell type:code id:a945b6b8 tags:
``` sage
# Periodiska KB
```
%% Cell type:code id:1ea536b5 tags:
``` sage
#initialisering
N=20
alpha = vector(SR,[0 for _ in range(N)])
a = vector([0 for _ in range(N)])
t = vector(SR,[0 for _ in range(N)])
P = vector([0 for _ in range(N)])
Q = vector([0 for _ in range(N)])
d=7
P[0] = 3
Q[0] = 5
c = Q[0]
P[0], Q[0], d = c*P[0], c*Q[0], d*c^2
sqrtd = sqrt(d)
P[0], Q[0], d, sqrtd
```
%% Output
(15, 25, 175, 5*sqrt(7))
%% Cell type:code id:60fbe63e tags:
``` sage
```
%% Cell type:code id:2b2044c7 tags:
``` sage
```
%% Cell type:code id:e8d81086 tags:
``` sage
for k in range(N-1):
alpha[k] = (P[k] + sqrtd)/Q[k]
a[k] = floor(alpha[k])
t[k] = alpha[k] - a[k]
P[k+1] = a[k]*Q[k] - P[k]
Q[k+1] = (d-P[k+1]^2)/Q[k]
print(f"{k : >3} ({P[k]} +sqrt({d}))/{Q[k]} = { alpha[k]} = {a[k]} + ({t[k]})")
```
%% Output
0 (15 +sqrt(175))/25 = 1/5*sqrt(7) + 3/5 = 1 + (1/5*sqrt(7) - 2/5)
1 (10 +sqrt(175))/3 = 5/3*sqrt(7) + 10/3 = 7 + (5/3*sqrt(7) - 11/3)
2 (11 +sqrt(175))/18 = 5/18*sqrt(7) + 11/18 = 1 + (5/18*sqrt(7) - 7/18)
3 (7 +sqrt(175))/7 = 5/7*sqrt(7) + 1 = 2 + (5/7*sqrt(7) - 1)
4 (7 +sqrt(175))/18 = 5/18*sqrt(7) + 7/18 = 1 + (5/18*sqrt(7) - 11/18)
5 (11 +sqrt(175))/3 = 5/3*sqrt(7) + 11/3 = 8 + (5/3*sqrt(7) - 13/3)
6 (13 +sqrt(175))/2 = 5/2*sqrt(7) + 13/2 = 13 + (5/2*sqrt(7) - 13/2)
7 (13 +sqrt(175))/3 = 5/3*sqrt(7) + 13/3 = 8 + (5/3*sqrt(7) - 11/3)
8 (11 +sqrt(175))/18 = 5/18*sqrt(7) + 11/18 = 1 + (5/18*sqrt(7) - 7/18)
9 (7 +sqrt(175))/7 = 5/7*sqrt(7) + 1 = 2 + (5/7*sqrt(7) - 1)
10 (7 +sqrt(175))/18 = 5/18*sqrt(7) + 7/18 = 1 + (5/18*sqrt(7) - 11/18)
11 (11 +sqrt(175))/3 = 5/3*sqrt(7) + 11/3 = 8 + (5/3*sqrt(7) - 13/3)
12 (13 +sqrt(175))/2 = 5/2*sqrt(7) + 13/2 = 13 + (5/2*sqrt(7) - 13/2)
13 (13 +sqrt(175))/3 = 5/3*sqrt(7) + 13/3 = 8 + (5/3*sqrt(7) - 11/3)
14 (11 +sqrt(175))/18 = 5/18*sqrt(7) + 11/18 = 1 + (5/18*sqrt(7) - 7/18)
15 (7 +sqrt(175))/7 = 5/7*sqrt(7) + 1 = 2 + (5/7*sqrt(7) - 1)
16 (7 +sqrt(175))/18 = 5/18*sqrt(7) + 7/18 = 1 + (5/18*sqrt(7) - 11/18)
17 (11 +sqrt(175))/3 = 5/3*sqrt(7) + 11/3 = 8 + (5/3*sqrt(7) - 13/3)
18 (13 +sqrt(175))/2 = 5/2*sqrt(7) + 13/2 = 13 + (5/2*sqrt(7) - 13/2)
%% Cell type:code id:a32e4b8a tags:
``` sage
continued_fraction(alpha[0])
```
%% Output
[1; 7, 1, 2, 1, 8, 13, 8, 1, 2, 1, 8, 13, 8, 1, 2, 1, 8, 13, 8, ...]
%% Cell type:code id:eb8056ec tags:
``` sage
t[0]
```
%% Output
1/5*sqrt(7) - 2/5
%% Cell type:code id:e5f91d32 tags:
``` sage
1/t[0]
```
%% Output
5/(sqrt(7) - 2)
%% Cell type:code id:2f142363 tags:
``` sage
alpha[1]
```
%% Output
5/3*sqrt(7) + 10/3
%% Cell type:code id:b80c955d tags:
``` sage
P[1], Q[1]
```
%% Output
(10, 3)
%% Cell type:code id:b8271bda tags:
``` sage
```
%% Cell type:code id:3b01a838 tags:
``` sage
```
%% Cell type:code id:74450347 tags:
``` sage
```
%% Cell type:code id:32a6f9f4 tags:
``` sage
c1=(3*sqrt(5)-5)/2
c1
```
%% Output
3/2*sqrt(5) - 5/2
%% Cell type:code id:27b5b213 tags:
``` sage
continued_fraction(c1)
```
%% Output
[0; 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, ...]
%% Cell type:code id:d05d9322 tags:
``` sage
continued_fraction(1/c1)
```
%% Output
[1; 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, ...]
%% Cell type:code id:c890c08e tags:
``` sage
numerical_approx(1/c1)
```
%% Output
1.17082039324994
%% Cell type:code id:d91e2d39 tags:
``` sage
1/c1
```
%% Output
2/(3*sqrt(5) - 5)
%% Cell type:code id:a3e5b318 tags:
``` sage
d1=1/c1
```
%% Cell type:code id:d99006ca tags:
``` sage
d1.minpoly().change_ring(QQbar).factor()
```
%% Output
(x - 1.170820393249937?) * (x + 0.1708203932499369?)
%% Cell type:code id:96dd6c78 tags:
``` sage
```
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment