Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.9K Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:

Using the "D" command to take derivatives and then apply variable values

Posted 5 years ago

Hello;

While taking partial derivatives of a previously defined function (f[x, y] := 4 - x^2 - y^2), I would like to load x and y with specific values of x = 1 and y = 1 with the resulting Mathematica commands of:

D[f[1, 1], x]
D[f[1, 1], y]

My intention was for the "D" command to first take the partial derivatives and then apply the values of x=1 and y=1 to the derived functions. However it appears that the command is doing just the opposite by applying the values of [1,1] to the function before taking the derivative - see attached.

Am I using the Mathematica command correctly and if so, is there a way that I can override the processing sequence of the command forcing the command to first take the derivative of the function and then apply the values to the derived function.

Thanks,

Mitch Sandlin

Attachments:
POSTED BY: Mitchell Sandlin
3 Replies

Mathematica has two different ways to make derivatives. The operator D makes derivatives of expressions, and outputs other expressions. The operator Derivative makes derivatives of functions and outputs functions. The syntax of Derivative is like this:

f[x_, y_] := 4 - x^2 - y^2;
Derivative[1, 0][f][x, y]
Derivative[1, 0][f][1, 1]

as you can see, you can calculate the derivative in a given point just by giving the coordinates. For functions of one variable, there is the much more convenient shorthand f'[x], which is equivalent to Derivative[1][f][x]. You can find documentation in the page defining derivatives

POSTED BY: Gianluca Gorni

If I evaluate D[f[1, 1], x] the output is zero, as it should, because f[1,1] does not depend on x. The D operator acts on expressions that contain variables with symbolic names such as x,y etc. With D you take the derivative of the expression with respect to a variable.

The Derivative operator acts on functions, which are constructs that have numbered slots: slot number 1, slot number 2 etc. With Derivative you take the derivative with respect to a slot, which we identify with its number, not with a variable name. The function f[x_,y_]=x^2y has two slots, forget about the variables which are used to define f. Then Derivative[1,0][f][x,y] is the first derivative with respect to the first slot and zeroeth derivative with respect to the second slot. Then the slots are filled in with whatever is x and y.

When we call Derivative[0,1][f][whatever arguments] the f object must be something for which f[x,y] makes sense. It does not make sense to call Derivative[0,1][x^2y], because (x^2y)[3,2] has no meaning.

What you call Subscript[f, yx] would correspond to Derivative[1,1][f][whatever arguments].

POSTED BY: Gianluca Gorni
POSTED BY: Mitchell Sandlin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard