(* Content of the Help Window *)
tab1HelpWindowContent = Column[{
Style["Ziel der Visualisierung: ",{textStyle,Bold}],
Style["Demonstration der partiellen Ableitung einer Funktion in einem Punkt \n als Tangentensteigung und damit als Grenzwert einer Folge \n von Sekantensteigungen.",{textStyle,Plain}],
Style["\nManipulation: ",{textStyle,Bold}],
Style["Lassen Sie die jeweilige x- oder y-Koordinate des zweiten Punktes der \n Sekante mit dem Regler gegen die x- bzw. y-Koordinate des  \n Tangenten-Punktes wandern. Die 'Grenzsekante' (grün) entspricht \n der Tangente und deren Steigung ist die partielle Ableitung von f bzgl. \n dieser Koordinate im betreffenden Punkt.\n",{textStyle,Plain}]
},{Left,Top}];

(* Styles *)
titleStyle={FontFamily->"Liberation Sans",14,Bold,RGBColor[0.35,0.35,0.35],Background->RGBColor[1,1,1,0]};
textStyle={FontFamily->"Liberation Sans",12,Bold,RGBColor[0.35,0.35,0.35],Background->RGBColor[1,1,1,0]};
plotLabelStyle={FontFamily->"Times",14,Plain,RGBColor[0.35,0.35,0.35],Background->RGBColor[1,1,1,0]};

(* Generate random numbers, used to parametrize the visualisation *)
rand1=RandomInteger[{1,3}];  (* random number to generate fraction of first coefficient *)
rand2=RandomInteger[{1,3}];  (* " *)
rand3 = RandomInteger[{1,30}];   (* random number to generate fraction of third coefficient *)
rand4 = RandomInteger[{1,30}];   (* " *)
a1=Min[{rand1,rand2}];    (* Choose nominator and ... *)
a2=Max[{rand1,rand2}];    (* ... denominator in such a way, that the coefficient becomes ≤ 1 *)
b=RandomInteger[{1,3}];   (* random second coefficient *)
c1=Max[{rand3,rand4}];  (* Choose nominator and ... *)
c2 = Min[{rand3,rand4}];  (* ... denominator so that coefficient is ≥ 1 *)

(* Map of the surface under consideration *)
 f[x_,y_]:=-(a1/a2)*x^2 - b*y^2+(c1/c2) ;

(* Initialize *)
maxXOfZeroPointInRelevantQuadrant = Max[t/.Solve[f[t,0]==0,t]];
maxYOfZeroPointInRelevantQuadrant= Max[t/.Solve[f[0,t]==0,t]];
xRightBound=1.1*maxXOfZeroPointInRelevantQuadrant; (* Bound for plot range *)
yRightBound=1.1*maxYOfZeroPointInRelevantQuadrant; (* Bound for plot range *)

x0=1/2;   (* Generate point at which derivative of f will be considered *)
y0=1/2;  (* " *)
p0={x0,y0,f[x0,y0]}; (* Point of derivative to be considered *)
geodesicXDirection[x_]:={x,y0,f[x,y0]};   (* Generate parametric curve of f[x,y0] *)
geodesicXZeroX =Max[x/. Solve[f[x,y0]==0,x]];
geodesicYDirection[y_]:= {x0,y,f[x0,y]};(* Generate parametric curve of f[x0,y] *)
geodesicYZeroY = Max[y/.Solve[f[x0,y]==0,y]];

p1[x_]:={x,y0,f[x,y0]};  (* Moving point of secant in x direction *)
p2[y_]:={x0,y,f[x0,y]};  (* Moving point of secant in y direction *)

fx[x_]:=D[f[x,y],x]
fy[y_]:=D[f[x,y],y]
secantColor=RGBColor[1,0,0];
tangentColor=RGBColor[0,1,0];

Manipulate[
Column[{
Row[{Text[Style[" Visualisierung / geometrische Interpretation der partiellen Ableitung ",titleStyle]],
Text[Style["     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",textStyle, Plain,8]],
PopupWindow[Button[Style["Hilfe",9],ImageSize->Medium, Background->RGBColor[0.9,0.9,0.9]],tab1HelpWindowContent,WindowTitle->"Hilfe", WindowSize->All]}
],
Labeled[Show[
Plot3D[f[x,y], {x,0,xRightBound}, {y,0,yRightBound}, 
PlotRange ->{All,All,{0,f[0,0]}} , PlotStyle -> {Opacity[0.5]}, AxesLabel -> Automatic,AspectRatio -> 1,
ViewPoint->{Pi,Pi/2,2}
], 
ListPointPlot3D[{p0,p1[x1],p2[y2]},PlotStyle -> {{Red,PointSize[0.02]},{Red,PointSize[0.02]},{Red,PointSize[0.02]}}],
ParametricPlot3D[geodesicXDirection[x],{x,0,geodesicXZeroX},PlotStyle -> {Blue,Thickness[0.004]}],
ParametricPlot3D[geodesicYDirection[y],{y,0,geodesicYZeroY},PlotStyle -> {Blue,Thickness[0.004]}],		ParametricPlot3D[{x,y0,If[x0==x1,(fx[val]/.val->x0)*x-x0*(fx[val]/.val->x0)  +f[x1,y0],((f[x0,y0]-f[x1,y0])/(x0-x1))*x-((f[x0,y0])-f[x1,y0])/(x0-x1)*x1 +f[x1,y0]]},
	{x,0,geodesicXZeroX},PlotStyle -> {If[x0==x1,tangentColor,secantColor],Thickness[0.004]}], (* secant/tangent wrt x *)
ParametricPlot3D[{x0,y,If[y0==y2,(fy[val]/.val->y0)*y-y0*(fy[val]/.val->y0)  +f[x0,y2],((f[x0,y0]-f[x0,y2])/(y0-y2))*y-((f[x0,y0])-f[x0,y2])/(y0-y2)*y2 +f[x0,y2]]},
	{y,0,geodesicYZeroY},PlotStyle -> {If[y0==y2,tangentColor,secantColor],Thickness[0.004]}], (* secant/tangent wrt y *)
 ImageSize -> {800,550},
 PlotRange->{{0,xRightBound},{0,yRightBound},{0,f[0,0]}}
],{Style["f(x,y) = "
<> ToString[TraditionalForm[f[x,y]]] 
<> "\n\n (∂/(∂x))f(x,y) = " 
<> ToString[TraditionalForm[fx[x]]]
<> "      ,     (∂/(∂y))f(x,y) = " 
<> ToString[TraditionalForm[fy[y]]],
16,FontFamily->Times]},{Bottom}]
},Top],
{{x1,,Style[ "x-Koordinate des \nvariablen Punkts der \nSekante in x-Richtung\n",textStyle]},geodesicXZeroX,x0},{{y2,,Style[ "y-Koordinate des \nvariablen Punkts der \nSekante in y-Richtung\n",textStyle]},geodesicYZeroY,y0},SaveDefinitions->True,ControlPlacement->Left
]

© 2008 Projekt LEMUREN, ETH Zürich