MathGroup Archive 2000

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

Search the Archive

Re: pure functions (or not?)

  • To: mathgroup at
  • Subject: [mg22239] Re: [mg22217] pure functions (or not?)
  • From: Hartmut Wolf <hwolf at>
  • Date: Sat, 19 Feb 2000 01:33:38 -0500 (EST)
  • Organization: debis Systemhaus
  • References: <>
  • Sender: owner-wri-mathgroup at

Dr Sebastien NEUKIRCH schrieb:
> Hi there,
> I have a problem with functions.
> Why is the following not working :
> In[1]:=
> function[{x_,y_,z_}]:=
> Module[{a,fr},fr=FindRoot[z+x*Sin[a]-y*a,{a,1.1}];fr[[1,2]]]
> In[2]:=
> function[{-1,-2,3}]
> Out[2]=
> -1.96219
> In[3]:=
> ContourPlot[function[{x,y,3}],{x,-2,2},{y,0,2},Contours->{0}]
> In[4]:=
> <<Graphics`ContourPlot3D`
> In[5]:=
> ContourPlot3D[function[{x,y,z}],{x,-2,2}, {y,0,2}, {z,-2,2}]
> ---------------------------
> The contourplot3d doest NOT work. Even if I add

Dear Sebastien,

the problem you have has nothing to do with ContourPlot, although that
sharpens it. When I do it -- sauf the error messages -- a plot is
produceed indeed, but obviously there are grid points with extremely low
or high values.

If you make a one-dimensional Plot

Plot[function[{1.5, y, 3}], {y, 0.5, 1}]

you see a terrible numerical instability. Finally if you look at the
equation to be solved for a ...

g = Block[{x = 1.5, y, z = 3, color}, 
   Table[color = 2*(y - -2.)/(2. - -2.); 
     Plot[z + x*Sin[a] - y*a, {a, -10., 10.}, 
      PlotStyle -> Hue[color], DisplayFunction -> 
       Identity], {y, -2., 2., 0.08}]]

Show[g, DisplayFunction -> $DisplayFunction]

... you'll see why this is so.

I think your problem is with the computational model (of your research
question). Either that is outwright wrong, or you are going to use it
outside of its region of applicability.

However, in case that your want to force your model, then I propose to
set up a Table of function values, whilst for each point carefully
controlling the convergence of FindRoot; e.g. do similar plots like
above and supply individual starting values for the critical points, and
better give 2 values: the secant method _might_ behave better in this

You finally can ListContourPlot that table.

I hope to have helped somewhat,
kind regards,

  • Prev by Date: Re: Selecting numbers with all odd digits
  • Next by Date: Re: Mathematica bug in Graphics3D ??
  • Previous by thread: pure functions (or not?)
  • Next by thread: Re: pure functions (or not?)