Mathematica question - Beginner.

  • Context: Mathematica 
  • Thread starter Thread starter plinius
  • Start date Start date
  • Tags Tags
    Beginner Mathematica
Click For Summary

Discussion Overview

The discussion revolves around a user's attempt to plot a function and its derivative in Mathematica, encountering errors in the process. The scope includes technical explanations and troubleshooting related to function definitions and derivatives in Mathematica.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes their issue with plotting the derivative of a function defined in Mathematica, specifically encountering an error related to machine-size real numbers.
  • Another participant suggests that the user is incorrectly defining the function and its derivative, questioning the meaning of the variable 'y' and the function 'z'.
  • A different participant clarifies that the derivative should be taken with respect to a specific variable and discusses the syntax for obtaining higher-order derivatives.
  • One participant confirms that they were able to resolve the issue after receiving help.

Areas of Agreement / Disagreement

The discussion includes some disagreement regarding the correct interpretation of function definitions and derivative syntax in Mathematica. However, one participant ultimately reports a successful resolution to their issue.

Contextual Notes

There are unresolved aspects regarding the proper definition of functions and the parameters used in derivative calculations, which may affect the clarity of the discussion.

plinius
Messages
4
Reaction score
0
Hi,
when I run those commands in mathematica:
y[x_,A_]:=Sin[x]+A+5
Plot[{y[x,5],y[x,6]},{x,0,5}]
z[x_]:=D[y,x]

Everything seems to go well.
But when I trie to plot the derivative:

Plot[{y[x,5],z[x]},{x,0,5}]

I allways have these errors:
Plot::plnrz[x] is not a machine-size real number at x= 2.0833333333333333`*^-7
...

What am I doing wrong ?
I already tried to change the arguments of z[] to z[x,4], z[x,A] etc...
There's nothing about plotting derivatives on the quick tutorial.
Any help is really appreciated.
I uploaded my mathematica file here http://s47.yousendit.com/d.aspx?id=0LG6F35A7OTY2SVEC7L1T6GXA

Thanks in advance
 
Physics news on Phys.org
You take the derivative of y but y has no meaning as y is just an empty variable, y[x,a] does have meaning however, also why is z[x_] a function? if you do D[y[x,a],x] you are taking the derivative of y[x,a] with respect to x, correct, I believe its the 3'rd parameter to have it take the n'th derivative? I will be at work in an hour or so and can check it out, as I'm pretty new to Mathematica myself and don't have a copy here to check myself.
 
mewmew said:
You take the derivative of y but y has no meaning as y is just an empty variable, y[x,a] does have meaning however, also why is z[x_] a function? if you do D[y[x,a],x] you are taking the derivative of y[x,a] with respect to x, correct, I believe its the 3'rd parameter to have it take the n'th derivative? I will be at work in an hour or so and can check it out, as I'm pretty new to Mathematica myself and don't have a copy here to check myself.
I'm afraid it's not correct. I've just tried what you said and it didn't worked either :confused:
 
z[n_] = D[y[x, 10], {x, n}]; is saying you want a function of the nth derivative of y[x,10] with respect to x. Plot[{z[2]}, {x, 0, 5}] is a plot of the 2nd derivative of x from 0 to 5.
 
Thanks a lot.

Now it works indeed!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K