Re: Q: Plot3D bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg22794] Re: [mg22727] Q: Plot3D bug?
- From: Bojan Bistrovic <bojanb at python.physics.odu.edu>
- Date: Sat, 25 Mar 2000 03:58:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
> howdy,
>
> i have to make a 3D-plot.
>
> The function evaluatetd will take about 15 sec for one Plotpoint.
> Setting ab the 3D Plot
>
> Plot3D[f[x,y],{x,0,10},{y,0,10}, PlotPoints->{2,2}]
>
> will take about 5 minutes and then it filled up my memory (128MB +
> 128MB Swap) and still has no result.
>
>
> System: NT4SP5 Mathematica 3.01
>
>
> Any Hints?
>
> Christoph
>
> --
> the adress is valid
> for faster reply use handel at the same host
>
Yes. Calculate the function values at a grid of points and either add them to
a list or export them to a file (depending on your requirements). You have to
do it just once. Then you import the data and interpolate. Here's an example:
In[1]:= f[x_,y_]:=Sin[x*y]
In[2]:= temp={};
In[3]:= Do[AppendTo[temp,{x,y,f[x,y]}],{x,0,6},{y,0,6}];
In[4]:= f2=Interpolation[temp];
In[5]:= Plot3D[f2[x,y],{x,0,6},{y,0,6},PlotPoints->{20,20}]
You have to be careful with the number of points; in the example above not
enough points are taken so the result isn't even close to the real one:
In[6]:= temp={};
In[7]:= Do[AppendTo[temp,{x,y,f[x,y]}],{x,0,6,0.25},{y,0,6,0.25}]
In[8]:= f3=Interpolation[temp];
In[9]:= Plot3D[f3[x,y],{x,0,6},{y,0,6},PlotPoints->{20,20}]
Bye, Bojan
--
---------------------------------------------------------------------
Bojan Bistrovic, bojanb at jlab.org
Old Dominion University, Norfolk VA & Jefferson Lab, Newport News, VA
---------------------------------------------------------------------