Post Reply 
diff() function
11-09-2014, 02:29 PM
Post: #1
diff() function
A diff() problem:

Example: f(x,y):+x²-2*x*y+3*y²+2*x-2*y

1.) diff(f(x,y),x) ---> 2.*x-2.*y+2.
2.) diff(f(x,y),y) ---> -2*x+6*y-2

x - direction:
3.) diff(diff(f(x,y),x)) ---> 2
4.) diff( 2.*x-2.*y+2,x) ---> 2
5.) diff(f(x,y),x$2) ---> 2

y - direction:
6.) diff(diff(f(x,y),y)) ---> -2
7.) diff(-2*x+6*y-2,y) ---> 6
8.) diff(f(x,y),y$2) ---> 6

The second derivative in the x-direction worked properly.
The second derivative in the y-direction worked improperly in the red highlighted case(??)

(The template key entry method worked properly for these examples.)
Find all posts by this user
Quote this message in a reply
11-09-2014, 02:51 PM
Post: #2
RE: diff() function
Since you didn't put in a second variable of differentiation, it defaults to 'x'. So -2 is the correct answer as it is the mixed partial derivative.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
11-09-2014, 05:53 PM
Post: #3
RE: diff() function
(11-09-2014 02:29 PM)DrD Wrote:  6.) diff(diff(f(x,y),y)) ---> -2
7.) diff(-2*x+6*y-2,y) ---> 6
8.) diff(f(x,y),y$2) ---> 6

Modifying step (6.) thus: diff(f(x,y),y,y) works. In step (8.) (given by the y$2), y is sufficiently specified as the variable to use for each following derivative?

-[or]-

In the case: ∂(diff(f(x,hpdiffx),hpdiffx),y) ---> 6 The variable of differentiation is specified only once.

That's a lot to remember. The user guide description for the diff() topic could be expanded for more clarity. I think that about wraps up my interest in this function. Thanks Han, for taking all the time explaining details!

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)