Message Boards Message Boards

2 Replies
3 Total Likes
View groups...
Share this post:

Why won't my 3D plot work?

Posted 10 years ago

Some people said the p should be capitalized; however, it did not work also.
POSTED BY: feng jue
2 Replies
Posted 10 years ago
As has been expressed by David Reiss there are a number of syntax errors. Please note that N is a special symbol in Mathematica and in general it is advisable not to capitalize your own functions to avoid such conflicts.

The following is your code rewritten (unfortunately I had to type as your post was an image so apologies for transcription errors):
a[n_] := (2 (-2 (Pi - 2) n^2 - 1) Sin[n Pi] +

     Pi n)/(Sinh[n Pi] Pi^2 n^2 (4 n^2 - 1));

u[x_, y_, num_] :=

Sum[a[j] Sinh[j Pi x] Sin[j Pi y] + x - x y, {j, 1, num}]
Plot3D[Evaluate@u[x, y, 100], {x, 0, 1}, {y, 0, 1}]
POSTED BY: Mark Dooris
None of your functions, sin, sinh, sum, and pi are defined.  In Mathematica these are  Sin, Sinh, Sum, and Pi .  Also note that N is reserved in Mathematica for the function that numerically evaluates its argument.

You posted your code as a gif and so I'd need to retype everything to fix it. But if you make the changes above it should work.  However, to make it faster you shold wrap the Evaluate function around the first argument fo the Plot function.

Take a bit of time to read the Mathematica docunentaiton to learn a bit more about how internal function names are defined in terms of CamelCase.
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract