Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168730
Image: ubuntu2004

Start with a parametric look at a unit semicircle using xx as a parameter.

n = 10 L1=[[x/n,sqrt(1-(x/n)^2)] for x in xrange(-n,n+1)] G1=list_plot(L1, aspect_ratio=1,color="blue") show(G1)
L2=[[cos(pi*t/(2*n)),sin(pi*t/(2*n))] for t in xrange(0,2*n+1)] G2=list_plot(L2, aspect_ratio=1,color="red") show(G2)

How does a cycloid differ from an ellipse?  The cycloid is shown in red, while the ellipse is blue.

reset() n=20 def theta(t,n=n): return 2*pi*(t/n) cycloid = [[theta(t)-sin(theta(t)),1-cos(theta(t))] for t in xrange(0,n+1)] Gcycloid=list_plot(cycloid, aspect_ratio=1,color="red") ellipse = [[pi*cos(theta(t/2))+pi,2*sin(theta(t/2))] for t in xrange(0,n+1)] Gellipse=list_plot(ellipse, aspect_ratio=1,color="blue") show(Gellipse+Gcycloid)

This is a 3d parametric example

var('t') p=parametric_plot3d((cos(t), 2*sin(t), t/5), (t, 0, 25), aspect_ratio=[1,1,1], rgbcolor=(0,0,0)) xaxis=line3d([(-1,0,0),(1,0,0)],rgbcolor=(1,0,0),arrow_head=True) yaxis=line3d([(0,-2,0),(0,2,0)],rgbcolor=(0,1,0),arrow_head=True) zaxis=line3d([(0,0,0),(0,0,5)],rgbcolor=(0,0,1),arrow_head=True) show(p+xaxis+yaxis+zaxis, frame=False)

Intersecting Cylinders

Two orthogonal cylinders with the same radii intersect.

r=1 l=3 var('u,v') cylz=parametric_plot3d((r*cos(u),r*sin(u),v), (u,0,2*pi), (v,-l,l), rgbcolor=(0,0,1), opacity=.5) cyly=parametric_plot3d((r*cos(u),v,r*sin(u)), (u,0,2*pi), (v,-l,l), rgbcolor=(0,1,0),opacity=.5) cylx=parametric_plot3d((v,r*cos(u),r*sin(u)), (u,0,2*pi), (v,-l,l), rgbcolor=(1,0,0),opacity=.5) xaxis=line3d([(-l,0,0),(l,0,0)],rgbcolor=(1,0,0),arrow_head=True, thickness=3) intersect2=parametric_plot3d((-r*cos(u),-r*cos(u),r*sin(u)), (u,0,2*pi), color='black',thickness=3) intersect3=parametric_plot3d((-r*cos(u),r*cos(u),r*sin(u)), (u,0,2*pi), color='black',thickness=3) intersects=intersect3+intersect2+cylx+cyly+xaxis intersects.show(frame=False, aspect_ratio=1)