My Projects

Moisés Solorio

 

3D Visualization of ODE´s  & solution curves

This worksheet helps visualizing the value of the derivative of a function as a 3d surface. It works only for ode´s of the form:

         y(x)' = f (x,y)

being y the dependent variable, & x the independent var.

 

> with(plottools):with(DEtools): with(plots):

eq:=diff(y(x), x)=-y(x)*cos(x);  #----enter the ODE (it's displyed)

limx:=-5..5:  # ---------------the limits for x

limy:=-5..5:  # ----------------the limits for y

sol:=dsolve(eq, y(x)); # ----------------displays the solution

p1:=plot3d(rhs(eq), x=limx, y=limy,lightmodel= 'light4',projection=.5,shading=ZHUE,axes=BOXED):

p3:=[seq(subs(_C1=i*.2,rhs(sol)), i=-10..10)]:

p4:=plot(p3,x=limx, color=black, thickness=2):

f := transform((x,y) -> [x,y,0]):

display({p1,f(p4)});

 

3D Visualization of Vectors

This worksheet helps visualize the interaction between time-dependent angular velocity, acceleration, tangential vel., accel. and the position vector ...as long as the angular acceleration is constant.

 

> with(VectorCalculus):

BasisFormat(true);

w:=<2*sin(t),cos(t),-sin(2*t)>;

r:=<cos(t),2*sin(t),t>;

CrossProduct( w, r ):

v:=simplify(%);

diff( v, t ):

a:=simplify(%);

 

 vector w :  Angular velocity ( )

vector r : Position vector

vector v  : Linear velocity vector   

vector a  :  Linear acceleration  vector 

> with(plots):

r1:=convert(w,list):

r2:=convert(r,list):

r3:=convert(v,list):

r4:=convert(a,list):

p1:=animate(spacecurve,[r1,t=0..A, color=blue,labels=[x,y,z]], A=0..4*Pi, frames=50 ):

p2:=animate(spacecurve,[r2,t=0..A, color=red,labels=[x,y,z]], A=0..4*Pi, frames=50  ):

p3:=animate(spacecurve,[r3+r2,t=0..A, color=green,labels=[x,y,z]], A=0..4*Pi, frames=50 ):

p30:=animate(spacecurve,[r4+r2,t=0..A, color=black,labels=[x,y,z]], A=0..4*Pi, frames=50 ):

p4:=animate(arrow,[r1, color=blue,labels=[x,y,z], width=1], t=0..4*Pi,frames=50 ):

p5:=animate(arrow,[r2, color=red,labels=[x,y,z]], t=0..4*Pi, frames=50 ):

p6:=animate(arrow,[r2,r3, color=green,labels=[x,y,z]], t=0..4*Pi, frames=50 ):

p60:=animate(arrow,[r2,r4, color=black,labels=[x,y,z]], t=0..4*Pi, frames=50 ):

display([p1,p2,p3,p30,p4,p5,p6,p60],labels=[x,y,z] ,title=`V = w x r`,axes=boxed,scaling=constrained, projection=0.5);

 

r1:  vector function  w : Angular velocity ( )

r2:  vector function  r : Position vector

r3:  vector function v  : Linear velocity vector  

r4:  vector function a  :  Linear acceleration  vector

 

 

 

 

Home

Hosted by www.Geocities.ws

1