MathGroup Archive 2003

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

Search the Archive

RE: How do I make graphs of (easy) functions like those in textbooks?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40430] RE: [mg40411] How do I make graphs of (easy) functions like those in textbooks?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 5 Apr 2003 03:58:31 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

For anyone who has the most recent DrawGraphics, cdj's plot may be made with
the following code.

Needs["DrawGraphics`DrawingMaster`"]

f[x_] := (x - 3)^2 - 1

I want to plot only over the domain that gives the displayed range. That
makes it easier to attach arrows at both ends of the curve.

Solve[f[x] == 10]
{{x -> 3 - Sqrt[11]}, {x -> 3 + Sqrt[11]}}

xygrid := CustomGridLines[Identity, {-10, 10, 1}, {LightBlue}];
xyticks := CustomTicks[Identity, {-10, 10, 1, 1}]

plot1 =
    Module[{g, greverse},
      g = Draw[f[x], {x, 3 - Sqrt[11], 3 + Sqrt[11]}];
      greverse = g /. Line[a_] :> Line[Reverse[a]];
      Draw2D[
        {VenetianRed,
          g,
          ArrowCurve[g, 1, HeadCenter -> 1/2, HeadLength -> 0.03],
          ArrowCurve[greverse, 1, HeadCenter -> 1/2, HeadLength -> 0.03],
          Black, AbsoluteThickness[1],

          Arrow[{0, 0}, #, HeadCenter -> 1/2, HeadLength -> 0.03] & /@ {{0,
                10}, {0, -10}, {10, 0}, {-10, 0}},

          CirclePoint[#, 4, Black, White] & /@ {{0, 8}, {2, 0}, {3, -1}, {4,
                0}, {6, 8}}},

        AspectRatio -> Automatic,
        PlotRange -> {{-1, 1}, {-1, 1}}10.02,
        Axes -> True,
        AxesStyle -> White,
        AxesLabel -> {x, y},
        Ticks -> {xyticks, xyticks},
        GridLines -> {xygrid, xygrid},
        PlotLabel -> "Book Plot\n\n",
        ImageSize -> 600]];





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

From: cdj [mailto:a_cjones at hotmail.com]
To: mathgroup at smc.vnet.net

Hi,

I'm sure that questions like this have been asked/answered before, but
I'm not sure what keywords to search on to find them... some obvious
candidates didn't get me anywhere...

Take, for example, f(x)= (x-3)^2 - 1

I'd greatly appreciate seeing the Mathematica code that does the
following:

(a) Plots the parabola itself (duh).
(b) Does so on a a gridded piece of "graph paper", with the axes
substantially darker than the rest of the grid.
(c) Both x and y axes are numbered at the units: 0, +-1, ..., +-10.
The numbers should be to the left of the y axis, and below the x axis.
The origin doesn't have to be labelled, if it's ugly, or too hard.
(d) The y axis is labelled "y" at the top of the graph, x axis is
labelled "x" on the right.
(e) Puts little arrows on the 4 tips of the axes (signifying that they
continue arbitrarily far).
(f) The following points are explicitly represented with
reasonable-sized dots: (0,8), (2, 0), (3,-1), (4,0), and (6,8).
(g) It would be nice, but not essential, if the tips of the parabola
itself had little arrows (again signifying that it continues upward
with increasing abs(x) values.

Sorry for all the conditions - just trying to be somewhat precise
about what I meant by graphs "like those in textbooks". Once I get the
code for this, I'm sure I can modify it to other similar tasks...

Can all these desiderata be obtained in *one* Mathematica graph? Or is
there another graphics/graphing program that is better-suited to such
tasks?

Thanks a bunch for any help,

cdj



  • Prev by Date: RE: Defining function in loop
  • Next by Date: Re: Parallel Kit Question: ParallelDot is much more slow than Dot
  • Previous by thread: Re: How do I make graphs of (easy) functions like those in textbooks?
  • Next by thread: Re: How do I make graphs of (easy) functions like those in textbooks?