Example 3 - A bit exotic (for me at least), but very useful in visualizing the math

#Problem: Use a line integral to find the work done by the force F=(xy,3z,1) on the vector-parametric curve s=(2cos(t),3sin(t),1)
#This plot "shows" the work is 0 (which we also showed with math).

var ('t'); s=vector((2*cos(t),3*sin(t),1)); t1=0; t2=2*pi
C=parametric_plot3d(s,(t,t1,t2),color='yellow',thickness=5)

vs=2 #regulates the size of the arrows
num=40 #regulates the number arrows
# the start of each arrow is s, the end of the arrow is s+F/vs

vf=sum([arrow3d((2*cos(j),3*sin(j),1),(2*cos(j)+2*cos(j)*3*sin(j)/vs,3*sin(j)+3*1/vs,1+1/vs), color=hue((j+8)/8), width=0.8)
for j in [t1..t2,step=(t2-t1)/num]])

Home > Commands -> Plot Options ->

show## EXAMPLES ON MY SAGE PAGES: plot - Options and plot3d - Options

Syntax:show(graphics objects,2d or 3d plot options)are objects created by 2d or 3d commands.graphics objectsin a single plot boxone or more graphics objects.+ signs, not commas.ex.3below)Example 1- plot y=2x and the point (2,1)P=point((3,1), size=20, color='red')

show(F+P, figsize=3)

Example 2 -plot a bunch of 2d stuff - lineL1=line( [ (0, 0), (2, 1) ], color="red", thickness=2 )

L2=line( [ (-1, -2), (1, 2) ], color="purple", thickness=2, linestyle="-.")

PL1=line( [ (3, -2), (0, 0), (3, 2) ], thickness=2, alpha=0.5)

show(P1+L1+L2+PL1, figsize=4)

Example 3Example 3 -A bit exotic (for me at least), but very useful in visualizing the math#This plot "shows" the work is 0 (which we also showed with math).

var ('t'); s=vector((2*cos(t),3*sin(t),1)); t1=0; t2=2*pi

vs=2 #regulates the size of the arrowsC=parametric_plot3d(s,(t,t1,t2),color='yellow',thickness=5)

num=40 #regulates the number arrows

# the start of each arrow is s, the end of the arrow is s+F/vs

vf=sum([arrow3d((2*cos(j),3*sin(j),1),(2*cos(j)+2*cos(j)*3*sin(j)/vs,3*sin(j)+3*1/vs,1+1/vs), color=hue((j+8)/8), width=0.8)

for j in [t1..t2,step=(t2-t1)/num]])

show(C+vf,aspect_ratio=(1,1,pi), figsize=5, frame=False)

Extras2d3dKeywords:show, plot, plot3d, 2d commands, 3d commands