13-tec-1.mws

tecne roviny

> restart:

> with(plots):

upravena cast knihovny mvcalp

> ParamTan:= proc (f,srange,trange,pt)
#Define local variables
local
planefunc,s0,t0,smin,smax,tmin,tmax,pama,dfs,dft,z0,pamb,pamc,tanpt,optio;
#Allow us to use (display) and (pointplot) commands
with(plots,pointplot):
with(plots,display):
#Extract specific variables we need from the larger variables define as input from user
s0:= op (2,pt)[1]:
t0:= op (2,pt)[2]:
smin := op(1,op(2,srange)):smax := op(2,op(2,srange)):
tmin := op(1,op(2,trange)):
tmax := op(2,op(2,trange)):
optio:= args[5..nargs];
#Plot the parametric surface. Note: f is a 3-vector as defined by user
pama:= plot3d(f,srange,trange,style=patch,axes=BOXED, lightmodel=light4):
# Find the tanget vectors by taking partials with respect to s and then to t
dfs := subs(s=s0,t=t0,diff(f,s)):
dft := subs(s=s0,t=t0,diff(f,t)):
#Find the point of tangency
z0 := subs (s=s0,t=t0,f);
#Plot point of tangency under variable name tanpt
tanpt := pointplot3d ({z0},color=blue,symbol=diamond):
# Parameterize plane using tangent vectors and k,l as parameters, add z0 to give proper translation
planefunc := evalm (k*dfs+l*dft+z0):
#Plot the tangent plane under variable name pamb, limit parameters so as not to obstruct viewing
pamb:=plot3d(planefunc,k=-(smax-smin)/6..(smax-smin)/6,l=-(tmax-tmin)/4..(tmax-tmin)/4,style=wireframe,color=red,grid=[20,35],thickness=2):
#Display the plots
display ([pama,pamb,tanpt],optio);
end:

zobrazeni sekvence zobrazeni funkce f(x,y) a jeji tecne roviny v bode

> pom:=seq(ParamTan([(3+cos(s))*cos(t), (3+cos(s))*sin(t), sin(s)], s=0..2*Pi, t=0..2*Pi, point=[(an+2)/2,an], labels=[x,y,'z']),an=-8..8):

zobrazeni celkove animace

> display(pom,insequence=true);

[Maple Plot]

> fce:=(x,y)->sqrt(cos(x)^2+cos(y)^2);

> body:=[[1,1],[1/2,1],[0,1],[-1/2,1],[-1,1],[-1,1/2],[-1,0],[-1,-1/2],[-1,-1],[-1/2,-1],[0,-1],[1/2,-1],[1,-1],[1,-1/2],[1,0],[1,1/2]]:

> body_z:=seq(eval(eval(fce(x,y),x=body[k][1]),y=body[k][2]),k=1..16):

> body_vse:=seq([body[k][1],body[k][2],body_z[k]],k=1..16):

> d_fce:=plot3d(fce(x,y),x=-2*Pi/3..2*Pi/3,y=-2*Pi/3..2*Pi/3,lightmodel=light2, axes=box, style=patch,labels=[x,y,'z']):

> p_body:=seq(pointplot3d([body_vse[k][1],body_vse[k][2],body_vse[k][3]],color=black,symbol=diamond,symbolsize=10),k=1..16):

> d_body:=display(p_body,insequence=true):

> fx:=seq(subs(x=body_vse[k][1],y=body_vse[k][2],diff(fce(x,y),x)),k=1..16):

> fy:=seq(subs(x=body_vse[k][1],y=body_vse[k][2],diff(fce(x,y),y)),k=1..16):

> rovina:=seq(eval(eval(fce(x,y),x=body_vse[k][1]),y=body_vse[k][2])+fx[k]*(x-body_vse[k][1])+fy[k]*(y-body_vse[k][2]),k=1..16):

> p_rovina:=seq(plot3d(rovina[k],x=(body_vse[k][1]-1)..(body_vse[k][1]+1), y=(body_vse[k][2]-1)..(body_vse[k][2]+1),style=wireframe,color=red,grid=[20,20],thickness=2),k=1..16):

> d_rovina:=display(p_rovina,insequence=true):

> display(d_fce,d_body,d_rovina);

fce := proc (x, y) options operator, arrow; sqrt(co...

[Maple Plot]

>