MathGroup Archive 2008

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

Search the Archive

Re: the graphic of a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92092] Re: the graphic of a function
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 20 Sep 2008 04:56:10 -0400 (EDT)
  • References: <gavt0r$g5a$1@smc.vnet.net>

Let's first define the function (instead of putting the full expression 
inside each plot statement). Note that we use square brackets and a pattern 
variable on the left hand side.

f[x_] := x^2/(x + 1)^2

Then you can just plot as follows:

Plot[f[x], {x, -10, 10}]

However, much depends on precisely what domain you wish to include and what 
aspect of the function you wish to show. You will often need to use options 
in the plot statement. For example, Mathematica automatically picks what it 
thinks is the 'most interesting' PlotRange for a function and this will 
often not be what you desire. So if you only wanted to show the function for 
positive x you would have to specify the PlotRange to obtain a reasonable 
plot.

Plot[f[x], {x, 0, 100},
 PlotRange -> {0, 1}]

If you wanted a domain that contained negative x values, you might prefer to 
use a Frame to get the y axes and its tick values off of the curve. 
(Technical publication almost always use Frame plots instead of Axes plots.) 
Here is one possible plot.

Plot[f[x], {x, -10, 10},
 Frame -> True,
 Axes -> False,
 PlotRange -> {0, 10},
 PlotRangePadding -> {{Automatic, Automatic}, {1, .1}}]

The point here is that Options are very important for plotting, although 
they may at first be difficult for new users. You can find out about 
graphics options by going to the Documentation Center, Visualization and 
Graphics, Options & Styling.

It is also possible to find all the options for a function, say for Plot, by 
evaluating:

Options[Plot] // Column

Then you can find out about any particular option by putting the cursor 
after the symbol and pressing F1,

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Serg" <edy13ro20000 at yahoo.com> wrote in message 
news:gavt0r$g5a$1 at smc.vnet.net...
>i think i've asked this before. anyway, i am new in mathematica and i want 
>how can I create the graphic of an exact function the same as I do for 
>Sin[].
>
> for example f(x)=x^2/(x+1)^2
> can anyone help?
> 



  • Prev by Date: Re: NDSolve and Piecewise
  • Next by Date: Re: Debracketing array symbols
  • Previous by thread: Re: the graphic of a function
  • Next by thread: Re: the graphic of a function