RE: Lines in ContourPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg41691] RE: [mg41673] Lines in ContourPlot
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 31 May 2003 06:07:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Friedrich, Make a ContourPlot with only the single 0 value contour, convert to Graphics and extract the lines. plot1 = ContourPlot[a(a - 1)(a - 2) - 2b(b - 1)(b - 2), {a, 2, 20}, {b, 2, 20}, Contours -> {0}, PlotPoints -> 100] lines = Cases[First[Graphics[plot1]], _Line, Infinity]; lines = lines /. Line[{a_, a_}] -> Sequence[]; Maathematica generated a spurious single point Line, Line[{{2., 2.}, {2., 2.}}], which the second statement eliminates. Checking it out... Show[Graphics[{lines}], AspectRatio -> Automatic, Frame -> True]; You could also use ImplicitPlot... Needs["Graphics`ImplicitPlot`"] plot2 = ImplicitPlot[ a(a - 1)(a - 2) - 2b(b - 1)(b - 2) == 0, {a, 2, 20}, {b, 2, 20}, PlotPoints -> 100] lines = Cases[First[Graphics[plot2]], _Line, Infinity]; lines = lines /. Line[{a_, a_}] -> Sequence[]; Show[Graphics[{lines}], AspectRatio -> Automatic, Frame -> True]; You could also solve the equation for b in terms of a. It is the second solution that is real in your domain. Solve[a(a - 1)(a - 2) - 2b(b - 1)(b - 2) == 0, b][[2, 1]] f[a_] = b /. % Plot[f[a], {a, 2, 20}] David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Friedrich Laher [mailto:mathefritz at schmieder-laher.de] To: mathgroup at smc.vnet.net would it be possible to get a "line" for the zerovalues in the following? ContourPlot[a(a - 1)(a - 2) - 2b(b - 1)(b - 2), {a, 2, 20}, {b, 2, 20}, PlotPoints -> 100]