Message Boards Message Boards

0
|
6310 Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Why does ContourPlot3D disqualify my function citing "norest"?

Posted 11 years ago
I have a complicated function called potential[x, y, z].  If I evaluate it at any specific point, it gives a numerical answer.  The explicit formula used depends on the location of {x, y, z}. 
In[56]:= potential[3.5, 5.4, 0]

Out[56]= 16.3617
If I use it to make a density plot, the plot is executed correctly.
But if I use it in ContourPlot3D, execution immediately fails.  ContourPlot3D is apparently trying to take Rest[{}]. 
ContourPlot3D[
potential[x, y, z] == 10000, {x, -.5, 6}, {y, -.5,  5.4}, {z, -.7,
  0.7}]
Rest::norest: Cannot take the rest of expression {} with length zero. >>
How can I plot my contour without triggering this error? 
Why would ContourPlot3D fail to accept a function argument that evaluates to a well-behaved function for all values of the plotting variables?
POSTED BY: Tom Witten
3 Replies
Posted 11 years ago
It'll probably be best to go ahead and post the body of the 'potential' function. (Also post any supporting definitions it needs to work correctly.)

In a case like this, I'd turn on the debugger (in the Evaluation menu), select "Break at Messages", re-evaluate the ContourPlot3D expression, and check the stack to see exactly where and hopefully why that message is being emitted. If the problem's in your own code, the cause will be more or less clear by examining the debugger stack. Depending on what top-level code ContourPlot3D is using, you may even see something from there.
POSTED BY: William Rummler
What happens if you call potential[x, y, z] with undefined symbols as arguments?
For example, an If that assumed numerical arguments could give a meaningless result.

If undefined arguments might be a problem, see http://support.wolfram.com/kb/3820 .
POSTED BY: Bruce Miller
Posted 11 years ago
the support article says that some mathematica functions need to be forced to do numeric evaluation of their arguments by using NumericQ.  I'll try this. 
Thanks Bruce Miller
POSTED BY: Tom Witten
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract