Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004
def image_sequence( seq, iterations, label): p=Graphics() v=[] for j in range(1, iterations+1): list_of_points= [(seq(n), 0) for n in range(1,j)] p = point( list_of_points ,size=30,color='red')+text(label, (0.5, 0.5), vertical_alignment="top") p.set_axes_range(-0.1, 1.1, -1, 1) v.append(p) anim = Graphics() anim = animate( v, xmin=-0.1, xmax=1.1 ) return anim def a(n): return (n*0.4).frac() pic_a=image_sequence( a, 10, "(0.4 times n) mod 1 for n=1..10") pic_a.show(delay=70)
def b(n): return (n*sqrt(2.0)).frac() pic_b=image_sequence( b, 100, "(sqrt(2) times n) mod 1 for n=1..100") pic_b.show()
q=(1+sqrt(5.0))/2 def c(n): return (q^n).frac() pic_c=image_sequence( c, 50, "(1 +sqrt(5))/2 to power n) mod 1 for n=1..50") pic_c.show()