Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168730
Image: ubuntu2004

Plotting points and lines in Sage.

A=[0,0] B=[1,0] C=[1,1] D=[0,1] show(line([A,B,C,D])+point(C, color="red", pointsize=50), axes=False, aspect_ratio=1)
show(polygon([A,B,C,D], color="green")+point(C, color="red", pointsize=50), axes=False, aspect_ratio=1)

An example of using Sage for 3D plotting.

c11 = [1,1,1] c12 = [-1,1,1] c13 = [-1,-1,1] c14 = [1,-1,1] c21 = [1,1,-1] c22 = [-1,1,-1] c23 = [-1,-1,-1] c24 = [1,-1,-1] cf1=[c11,c12,c13,c14] cf2=[c21,c22,c23,c24] show(sum([polygon(cf1, color="red"), polygon(cf2), line([c11,c21], color="black", thickness=3), line([c12,c22]), line([c13,c23]), line([c14,c24]), point([2,2,2], color="green"), # these points are to enlarge the viewing area point([-2,-2,-2], color="green"), point([0,0,0]) ]), frame=False, center=[0,0,0])
show(icosahedron(center=(0,1,0), color='yellow'), frame=False)