Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: ContourPlot and finite approximation to level sets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68657] RE: [mg68629] ContourPlot and finite approximation to level sets
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 14 Aug 2006 06:44:42 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

James,

You can do this by extracting the data points from the plot and then using
SplineFit on the points. Here I will extract a single contour for an
ellipse.

f[x_, y_] := x^2 + 2y^2
plot1 = ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Contours -> {1},
      ContourShading -> False, PlotPoints -> {30, 30}];

Convert the ContourGraphics to Graphics and then extract the first part and
you will see how Mathematica represents the contours.

contour = First@Graphics@plot1
(output omitted)

Extract the points from contour.

cdata = First@Cases[contour, Line[pts_] -> pts, \[Infinity]]
(output omitted)

Now load the SplinFit package.

Needs["NumericalMath`SplineFit`"]

cfunction = SplineFit[cdata, Cubic]
SplineFunction["Cubic", "{0., 48.}", <>]

The domain of the parameter for the function is 0 <= t <= 48. You can get a
point on the contour by, for example,

cfunction[7]
{0.482759, -0.619284}

and as a check we could plot it using ParametricPlot.

ParametricPlot[cfunction[t], {t, 0, 48},
    AspectRatio -> Automatic];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: dkjk at bigpond.net.au [mailto:dkjk at bigpond.net.au]
To: mathgroup at smc.vnet.net


Hi all,

Given a real-valued function f(x,y) over {(x,y) | xmin < x < xmax, ymin
< y < ymax}, ContourPlot can be used to generate the graph of the level
set { (x,y) | f(x,y) = c } using

ContourPlot[f[x,y],{x,xmin,xmax},{y,ymin,ymax},Contours->{c},ContourShading-
>False].

Is there any way to access the coordinates used by Mathematica to paint
the contour line of height c? If not, can anyone suggest an algorithm,
such as the one used by Mathematica, to finitely approximate a level
set?

Thanks very much in advance,

James



  • Prev by Date: Re: Hyperlink to *.pdf File
  • Next by Date: Re: a Quaternion quadratic level Pisot polynomial
  • Previous by thread: Re: ContourPlot and finite approximation to level sets
  • Next by thread: Re: ContourPlot and finite approximation to level sets