Re: Implicit Plot with parameter
- To: mathgroup at smc.vnet.net
- Subject: [mg118838] Re: Implicit Plot with parameter
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 13 May 2011 06:24:14 -0400 (EDT)
victorphy wrote:
> Hi,
>
> I have a system of two implicit equations, say f[x,y,z] =0 &&
> g[x,y,z] =0 (think of z as a parameter) and I would like to plot the
> solutions as 'y as a function of z'; that is, I don't car about the
> value that x takes for a given z.
>
>
> Is there a way to do it with Mathematica ? I tried using ContourPlot
> but I couldn't find the way.
>
> Any help would be very appreciated.
>
>
> Best Regards
>
> Victor
Depends on the functions. If they are amenable to using Solve, could do
as below.
f[x_, y_, z_] := Sin[x*y/5 + z]
g[x_, y_, z_] := Cos[y*z/5 + x + y^2]
h[z_?NumericQ] :=
y /. Quiet[Solve[{f[x, y, z] == 0, g[x, y, z] == 0}, {x, y}]]
Plot[h[z], {z, -2, 2}, PlotPoints -> 10, MaxRecursion -> 1]
Another possibility might be to minimize a sum of squares given values
for y and z, and then attempt a contour plot of that minimizing function.
h2[y_?NumericQ, z_?NumericQ] :=
First[FindMinimum[f[x, y, z]^2 + g[x, y, z]^2, {x, -1, 1}]]
ContourPlot[h2[y, z], {y, -2, 2}, {z, -2, 2}, ContourShading -> False,
Contours -> {.0001}, PlotPoints -> 80]
Daniel Lichtblau
Wolfram Research