MathGroup Archive 2003

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

Search the Archive

Re: How to evaulate a function and graph it

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43225] Re: How to evaulate a function and graph it
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 20 Aug 2003 22:25:22 -0400 (EDT)
  • References: <bht3hi$n22$1@smc.vnet.net>
  • Reply-to: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Sender: owner-wri-mathgroup at wolfram.com

"Rebeca Choy" <rchoy at ula.ve> wrote in message
news:bht3hi$n22$1 at smc.vnet.net...
> Hi everyone,
>
> How can I evaluate a function of 2 variables, say:
>
> f(x,y) = x^4 + 3 x^2 + 5 y^2 + x + y
>
> in an interval of [-3.0,4.0] and[-3.0,4.3] for x and y?
>
> I need all the points between these two ranges to plot it
>
>
> Thanks
>
> Rebeca
>

Rebeca,

First, you  need to use the correct syntax for defining a function:

f[x_,y_] = x^4 + 3 x^2 + 5 y^2 + x + y

Then we can calculate some (not all!) points in the range that you
stipulate;

vals = Table[ f[x, y], {x, -3.0, 4.0, .2}, {y, -0.0, 2, .2}];

and plot them:
ListPlot3D[vals, MeshRange -> {{0, 2}, {-3, 4}} ]

(MeshRange give the right ticks on the axes)

though it the following is easier
Plot3D[f[x, y], {x, 0, 2}, {y, -3, 4}]

and we can do without defining the function

Plot3D[x^4 + 3 x^2 + 5 y^2 + x + y, {x, 0, 2}, {y, -3, 4}]


-- 
Allan
---------------
Allan Hayes
hay at haystack.demon.co.uk
Voice: +44 (0)116 241 8747
Fax: +44 (0)870 164 0565



  • Prev by Date: MATHGROUP MESSAGE Re: Comprehensive Clear ?
  • Next by Date: M5.0 keyboard shortcuts with linux
  • Previous by thread: Re: How to evaulate a function and graph it
  • Next by thread: RE: How to evaulate a function and graph it