# HP Forums

Full Version: diff() function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.)
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.
(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-
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :