Re: Dynamic tangential plane - how?
- To: mathgroup at smc.vnet.net
- Subject: [mg92916] Re: Dynamic tangential plane - how?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sun, 19 Oct 2008 05:40:44 -0400 (EDT)
- References: <gdcdh5$fkf$1@smc.vnet.net>
Hi,
f[x_, y_] := (1 - x^2) (2 x - y^3)
DynamicModule[{plt, plane, z, t1, t2},
plt = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}];
t1 = {1, 0, D[f[x, y], x]};
t2 = {0, 1, D[f[x, y], y]};
Manipulate[
z = Append[p, (f @@ p) + 0.1];
plane =
ParametricPlot3D[(z + t1*u + t2*v /.
Thread[{x, y} -> p]), {u, -0.5, 0.5}, {v, -0.5, 0.5},
Evaluated -> True, Mesh -> False];
Graphics3D[{plt[[1]], {Opacity[1], plane[[1]]}, {RGBColor[1, 0, 0],
Sphere[z, 0.1]}}, BoxRatios -> {1, 1, 1}],
{{p, {0, 0}}, {-2, -2}, {2, 2}, Slider2D}]
]
??
Regards
Jens
m.g. wrote:
> Hello Group,
>
> I=B4m trying to visualize the tangential plane to a function f(x,y). I
> =B4ve done various attemps - none of them was successfull. Here an
> extract of my attempts:
>
> f[x_, y_] := (1 - x^2) (2 x - y^3)
> grad[x_, y_] := {2 (1 - x^2) - 2 x (2 x - y^3), -3 (1 - x^2) y^2}
>
> DynamicModule[{a = 1, b = 1, p, q, punkt},
> {Slider2D[Dynamic[{a, b}], {{-2, -2}, {2, 2}}],
> p = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}],
> punkt = Dynamic @ Graphics3D[{PointSize[Large], Red, Point[{a, b,
> f[a, b]}]}],
> q = Dynamic @ Plot3D[f[a, b] + grad[a, b].{x - a, y - b}, {x, -2,
> 2}, {y, -2, 2}]
> }
> ]
>
> Here the three parts I need (the surface of f, the tangential plane
> and the point "punkt" where the plane touches the surface) are shown,
> side by side.How can I manage it, that this three graphics are put
> together in ONE Graphics.
>
> The attempt
>
> DynamicModule[{a = 1, b = 1, p, q, punkt},
> {Slider2D[Dynamic[{a, b}], {{-2, -2}, {2, 2}}],
> punkt = Dynamic @ Graphics3D[{PointSize[Large], Red, Point[{a, b,
> f[a, b]}]}],
> q = Dynamic @ Plot3D[{f[x, y], f[a, b] + grad[a, b].{x - a, y - b}},
> {x, -2, 2}, {y, -2, 2}]
> }
> ]
>
> Changes f[x,y] (!!!), but only a and b are dynamically changing. How
> could this happen??
>
> Any hints appreciated.
>
> Greeting from Germany
>
> Mike
>