Re: implcit plot with undefined expression
- To: mathgroup at smc.vnet.net
- Subject: [mg18863] Re: implcit plot with undefined expression
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sun, 25 Jul 1999 03:30:04 -0400
- Organization: University of Western Australia
- References: <7n13kb$bf2@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
zoominzero at hotmail.com wrote:
> Hi,
> I've spent 4 days to try to use ImplicitPlot on an equation, without
> success:
> The Equation I try to plot has 2 nested square roots, ans 2 variables :
> something like Sqrt[2*Sqrt[2X^2 -Y^2] - 2*Y +X^2]==0
> (it's not exactly this one: it's just to give you an idea )
>
> Of course this equation is not defined everywhere, and the domain where
> it's defined is complex. When i try to "ImplicitPlot" this equation,
> i've an answer :
> "The contour is attempting to traverse a cell in which some of the
> points have not evaluated to numbers, and it will be dropped"
> followed by
> "Further output of ContourGraphics::"ctpnt" will be suppressed during
> this calculation."
>
> So i don't have any answers ( and there are answers of course :)
>
> Is there some options or another solution to draw this implicit equation?
The following Notebook highlights the problem and indicates one approach to
solving it.
Notebook[{
Cell["\<\
Modify the function so that if the result is complex, a specific \
numerical value (here 1) is returned.\
\>", "Text"],
Cell[BoxData[
\(TraditionalForm\`f[x_?NumericQ, y_?NumericQ] :=
With[{t = N[\ at \(x\^2 - 2\ y + 2\ \ at \(2\ x\^2 - y\^2\)\)]},
If[Head[t] === Complex, 1, t]]\)], "Input"],
Cell[TextData[{
"To get an idea of the behavior, we make a plot for fixed ",
Cell[BoxData[
\(TraditionalForm\`y\)]],
"."
}], "Text"],
Cell[BoxData[
\(TraditionalForm\`\(Plot[f[x, 1.5], {x, \(-2\), 2},
PlotPoints -> 100];\)\)], "Input"],
Cell[TextData[{
"We see that the zero contour will be exceedingly sharp\[LongDash]and \
difficult for a non-adaptive plotting routine such as ",
Cell[BoxData[
FormBox[
StyleBox[\(\(ContourPlot\)\(\ \)\),
"Input"], TraditionalForm]]],
" to find. Here we plot the 0.3 contour."
}], "Text"],
Cell[BoxData[
\(TraditionalForm\`\(cp =
ContourPlot[f[x, y], \ {x, \(-2\), 2}, {y, \(-1\), 3},
PlotPoints -> 140, Contours -> {0.3}];\)\)], "Input"],
Cell["In this example, we can attempt direct solution", "Text"],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`Solve[\ at \(x\^2 - 2\ y + 2\ \ at \(2\ x\^2 - y\^2\)\) ==
0, y]\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`{{y ->
1\/4\ \((x\^2 - \ at \(16\ x\^2 - x\^4\))\)}, {y ->
1\/4\ \((x\^2 + \ at \(16\ x\^2 - x\^4\))\)}}\)], "Output"]
}, Open ]],
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{"pl", "=",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"Evaluate", "[",
FormBox[\(y /. %\),
"TraditionalForm"], "]"}], ",", \({x, \(-2\), 2}\),
",", \(PlotStyle -> Hue[1]\)}], "]"}]}], ";"}],
TraditionalForm]], "Input"],
Cell[BoxData[
\(TraditionalForm\`\(Show[cp, pl];\)\)], "Input"],
Cell[TextData[{
"The agreement is quite good and you can show that the curves with ",
Cell[BoxData[
\(TraditionalForm\`y < 0\)]],
" are spurious solutions."
}], "Text"]
}
]
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA 6907 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________