MathGroup Archive 2002

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

Search the Archive

RE: RE: plotting with boundary conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34555] RE: [mg34512] RE: [mg34482] plotting with boundary conditions
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Mon, 27 May 2002 01:17:07 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Very nice!

I'm definitely learning to use DrawGraphics, Dave.

You should charge big bucks for this.  Let me know what I owe you.

Bobby Treat

-----Original Message-----
From: David Park [mailto:djmp at earthlink.net] 
To: mathgroup at smc.vnet.net
Subject: [mg34555] [mg34512] RE: [mg34482] plotting with boundary conditions

Tayade,

You will probably receive a number of replies that make a plot with
ragged
edges or walls at the boundary. But with my DrawGraphics package
(available
at my web site) it is possible to make a nice smooth plot with the
boundary.
I am attaching a .gif image of the plot so you can see what it looks
like
without using DrawGraphics. (MathGroup won't post attachments so others
can
contact me for the image.)

For those who have DrawGraphics, this is what the code looks like.

Needs["DrawGraphics`DrawingMaster`"]

c[a_, b_] := 0.1*(a - 1)^2 + 0.1*(b - 1)^2 - 0.01
f[a_, b_] = a^2 - 2*c[a, b] + b^2;

This creates a 20 by 20 rectangular grid of Polygons in the ab-plane.

grid = MakePolyGrid[{20, 20}, {{0, 0}, {2, 2}}];

This trims the polygons in the grid so that only Polygons for which 0 <=
c[a,b] <= Infinity remain. Polygons that straddle the boundary are
trimmed
and the others are either all in or all out.

fgrid = grid // TrimPolygons[c, {0, Infinity}];

The following plots the surface. There is a smooth missing round hold in
the
middle. I used a shaded colored surface. I subdued the polygon outlines
and
matched them to the color of the surface. I used neutral lighting so the
regular Mathematica lights wouldn't overwhelm the color of the surface.

plot1 =
    Draw3DItems[
      {SurfaceColor[Burlywood],
        EdgeForm[ColorMix[Burlywood, Black][0.5]],
        fgrid // RaiseTo3D[f]},
      NeutralLighting[0.3, 0.5, 0],
      Axes -> True,
      AxesLabel -> {x, y, f},
      Background -> ColorMix[CornflowerBlue, White][0.8],
      BoxRatios -> {1, 1, 1},
      ImageSize -> 600];

In the above I used the following DrawGraphics routines.
Draw3DItems is a shortcut for Show[Graphics[{]]...]
ColorMix will mix two colors in proportion.
RaiseTo3D raises 2D graphics items to 3D items according to the function
f
on x and y.
NeutralLighting inserts Lighting options that control the saturation,
brightness and ambient lighting of the 3D lighting. You can also rotate
the
lights.

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

> From: Tayade Rajeshwary Gunwant [mailto:rajeshwary at neo.tamu.edu]
To: mathgroup at smc.vnet.net
>
>
> Hi all,
>   I need to plot a surface
>   f(a,b) = a^2-2*c(a,b)+b^2; given the boundary conditions c(a,b)< ab
>
>   Here c(a,b) is another function of (a,b) given by
>   c(a,b) = 0.1*(a-1)^2+0.1*(b-1)^2-0.01
>
> Is there a direct command to set these boundary conditions...?? If i
give
>
> f[a_, b_] := If[c[a, b] < a*b, a^2 + b^2 - 2*c[a, b],];
>
> Plot3D[f[a, b], {a, 0, 2}, {b, 0, 2}, AxesLabel -> {"a", "b", "f"},
>   ViewPoint -> {2, 2, 2}]
>
> I get error messages for the values of a and b for which f(a,b)
> doesnot exist.
>
> Can anybody please tell me how i can get this plot?
>
> Thanks
> raj
>
>





  • Prev by Date: Re: Re: Re: Help! How to calculate additive partitions?
  • Next by Date: RE: RE: Why do parentheses spuriously appear when I type in a formula?
  • Previous by thread: RE: plotting with boundary conditions
  • Next by thread: Reversed axis on log-linear plot