Message Boards Message Boards

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

What is the difference between variable "t" and variable "y" ?

Posted 10 years ago

I am trying to define a function of variables "x" and "t" and take partial derivatives with respect to each. The function is as follows:

f[x_,t_]=Cos[x-t]

When defining the function using variable "t" the output becomes:

Cos[t-x]

Then taking the partial derivative w.r.t "t" using D[f,t] returns 0 (zero).

Substituting variable "y" for "t" returns a different (correct in my eyes) result.

So my question is; What is the difference in the eyes of mathematica, to the variables "t" and "y" (or really any other variable that I could define)?

I've posted screenshots to show exactly what my inputs were. Thank you so much in helping me better understand this.

Attachments:
POSTED BY: Tyler Perkins
3 Replies

Look at your two examples carefully. In the first case you computed

D[f,t]

rather than

D[f[x,t],t]

By the way, you should define your functions using delayed evaluation (:=) rather than immediate evaluation (=)

POSTED BY: David Reiss
Posted 10 years ago

Thank you, I thought I had tried that before moving on to using variable "y". I guess I didn't though as D[f[x,t],t] works just fine. My mistake.

Why is using delayed evaluation advantageous over immediate evaluation?

POSTED BY: Tyler Perkins

You can read up on some of the differences between = and := here:

http://reference.wolfram.com/language/tutorial/ImmediateAndDelayedDefinitions.html

POSTED BY: David Reiss
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