> with(plots):

Warning, the name changecoords has been redefined

> a := 1; b := 6; c := 1; d :=5; x0 := 3; y0 := 3; H := 7; Xakse := 7; Yakse := 6; Zakse := 8;

a := 1

b := 6

c := 1

d := 5

x0 := 3

y0 := 3

H := 7

Xakse := 7

Yakse := 6

Zakse := 8

> f := (x,y) -> 6-((x-1)^2+2*(y-2)^2)/10;

f := proc (x, y) 
options operator, arrow; 6-1/10*(x-1)^2-1/5*(y-2)^2 end proc

> f1 := D[1](f);
f2 := D[2](f);

f1 := proc (x, y) 
options operator, arrow; 1/5-1/5*x end proc

f2 := proc (x, y) 
options operator, arrow; 4/5-2/5*y end proc

> Flate := plot3d([x,y,f(x,y)], x=a..b, y=c..d, grid=[12,12]):

> zLinje := proc(x,y,z0,z1)
 if z0 < z1 then spacecurve([x,y,t], t=z0..z1, color=black, linestyle=DASH, thickness=1)

 else if z1 < z0 then spacecurve([x,y,t], t=z1..z0, color=black, linestyle=DASH, thickness=1)

   end if;

 end if;

end proc:

> xPlan := x -> plot3d([x,y,z],y=c..d, z=0..H, color=green, style=patchnogrid, transparency=0.5):

> yPlan := y -> plot3d([x,y,z],x=a..b,z=0..H, color=magenta, style=patchnogrid, transparency=0.5):

> zPlan := z -> plot3d([x,y,z],x=a..b,y=c..d, color=blue, style=patchnogrid):

> xKurve := x -> spacecurve([x,y,f(x,y)],y=c..d, thickness=2, color=blue):

> yKurve := y -> spacecurve([x,y,f(x,y)],x=a..b, thickness=2, color=magenta):

> xTangent := spacecurve( [x0,y0+t,f(x0,y0)+f2(x0,y0)*t], t=c-y0..d-y0, color=yellow, thickness=2):
yTangent := spacecurve( [x0+s,y0,f(x0,y0)+f1(x0,y0)*s], s=a-x0..b-x0, color=red, thickness=2):

> Tangentplan := plot3d( [x0+s,y0+t,f(x0,y0)+s*f1(x0,y0)+t*f2(x0,y0)], s=a-x0..b-x0, t=c-y0..d-y0, style=patchnogrid, transparency=0.5, color=blue):

> Normalvektor := arrow([x0,y0,f(x0,y0)],[-f1(x0,y0),-f2(x0,y0),1],length=4,color=blue, width=0.07,head_length=0.5,head_width=0.5):

> xyProjeksjon := plot3d([x,y,0], x=a..b, y=c..d, color=grey, transparency=.5, grid=[12,12]):

> Bakgrunnsbilde := display(Flate, xyProjeksjon, zLinje(a,c,0,f(a,c)), zLinje(a,d,0,f(a,d)), zLinje(b,c,0,f(b,c)), zLinje(b,d,0,f(b,d)),
textplot3d([0.5,0.5,Zakse+2,'z'],font=[helvetica,14],color=black),

textplot3d([Xakse+2,0.5,0,'x'],font=[helvetica,14],color=black),

textplot3d([0.5,Yakse+2,0,'y'],font=[helvetica,14],color=black),

arrow([0,0,0],[1,0,0],length=Xakse,color=black,width=0.05,head_length=0.3,head_width=0.1),

arrow([0,0,0],[0,1,0],length=Yakse,color=black,width=0.05,head_length=0.3,head_width=0.1),

arrow([0,0,0],[0,0,1],length=Zakse,color=black,width=0.05,head_length=0.3,head_width=0.1), projection=0.85 ):

> display(Bakgrunnsbilde,projection=0.9);

[Plot]

> A1 := display(Bakgrunnsbilde,yPlan(3),yKurve(3)):
A2 := display(Bakgrunnsbilde,xPlan(3),xKurve(3)):

A3 := display(Bakgrunnsbilde,xPlan(3),xKurve(3),yPlan(3),yKurve(3),zLinje(3,3,0,H)):

> display(Bakgrunnsbilde,A1,A2,A3, insequence=true, projection=0.9);

[Plot]

> B1 := display(Bakgrunnsbilde,yPlan(3),yKurve(3),yTangent):
B2 := display(Bakgrunnsbilde,xPlan(3),xKurve(3),xTangent):

B3 := display(Bakgrunnsbilde,xPlan(3),xKurve(3),xTangent,yTangent, yPlan(3),yKurve(3),zLinje(3,3,0,H)):

B4 := display(Bakgrunnsbilde,xPlan(3),xKurve(3),xTangent,yTangent, yPlan(3),yKurve(3), Tangentplan):

B5 := display(Bakgrunnsbilde, Tangentplan, Normalvektor):

> display(Bakgrunnsbilde,B1,B2,B3,B4,B5, insequence=true, projection=0.9, scaling=constrained);

[Plot]

>