Mathematica question - Beginner.

In summary: Thanks so much for your help!In summary, when you run the commands in Mathematica: y[x_,A_]:=Sin[x]+A+5; z[x_]:=D[y,x]; Plot[{y[x,5],z[x]},{x,0,5}] always produces an error, but when you try to plot the derivative of y[x,5] with respect to x, it works now.
  • #1
plinius
4
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 allready 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
  • #2
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.
 
  • #3
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:
 
  • #4
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.
 
  • #5
Thanks a lot.

Now it works indeed!
 

What is Mathematica?

Mathematica is a software program used for mathematical and scientific computations. It is commonly used by scientists, engineers, and mathematicians for data analysis, visualization, and solving complex equations.

How do I get started with Mathematica?

To get started with Mathematica, you can download the software from the official website and install it on your computer. There are also many online tutorials and resources available to help you learn the basics of using Mathematica.

What are the main features of Mathematica?

Mathematica has a wide range of features including advanced mathematical functions, data analysis tools, 2D and 3D visualization, and the ability to create interactive documents and presentations. It also has a user-friendly interface and supports various programming languages.

Can I use Mathematica for my research or work?

Yes, Mathematica is commonly used for research and work in various fields such as physics, engineering, economics, and more. It is a powerful tool for data analysis, modeling, and simulation.

Do I need to have a strong math background to use Mathematica?

While a strong math background can be helpful, it is not necessary to use Mathematica. The software has a user-friendly interface and many built-in functions, making it accessible to beginners. However, a basic understanding of mathematical concepts can help you use Mathematica more effectively.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
238
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
394
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top