• Support PF! Buy your school textbooks, materials and every day products Here!

Strange partial derivative

  • #1
AwesomeTrains
Gold Member
116
3

Homework Statement


I want to find the partial derivatives in the point [itex](0,0)[/itex] of the function [itex]f:\mathbb R^2\rightarrow\mathbb R[/itex] [itex]
f(x,y):=
\begin{cases}
0 & \text{if } (x,y) = (0,0) \\
\frac{y^5}{2x^4+y^4} & otherwise
\end{cases}
[/itex]

Homework Equations


Our definition of the partial derivatives in the direction [itex]\vec v = (v_1,v_2)[/itex] with [itex]\|\vec v \|_2 = 1[/itex] at the point [itex](0,0)[/itex]
[itex]D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}[/itex]

The Attempt at a Solution


Straight forward:
[itex]D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}=\lim_{h\rightarrow 0} {\frac{f(h(v_1,v_2))}{h}}=\lim_{h\rightarrow 0} {\frac{\frac{h^5v_2^5}{2h^4v_1^4+h^4v_2^4}}{h}}= \frac{v_2^5}{2v_1^4+v_2^4}[/itex] Then in the direction [itex]\vec v = (0,1),(y-direction)[/itex] the tangent slope should be [itex]\frac{1^5}{2*0^4+1^4}=1[/itex]
Here's my problem: When I evaluate the same thing in maple I get 0. Where's my error?
(I've attached a picture of maple)
md2ngy.png

Also I can't see from the graph that the tangent slope in the y-direction should be 0, I think.

Any feedback is very appreciated :)
Alex
 

Answers and Replies

  • #2
HallsofIvy
Science Advisor
Homework Helper
41,808
933
I am puzzled as to why you are trying to find the general directional derivative when you are asked only to find the partial derivatives.
(It is quite possible for a function to have partial derivatives at a point and not be differentiable there- in which case, it would not have directional derivatives I all directions.)

Here, the partial derivative, at (0, 0), with respect to x is given by [tex]\lim_{h\to 0}\frac{f(h, 0)- f(0,0)}{h}[/tex] and the derivative with respect to y is given by [tex]\lim_{h\to 0}\frac{f(0,h)- f(0,0)}{h}[/tex][/B]
 
  • #3
Dick
Science Advisor
Homework Helper
26,258
618

Homework Statement


I want to find the partial derivatives in the point [itex](0,0)[/itex] of the function [itex]f:\mathbb R^2\rightarrow\mathbb R[/itex] [itex]
f(x,y):=
\begin{cases}
0 & \text{if } (x,y) = (0,0) \\
\frac{y^5}{2x^4+y^4} & otherwise
\end{cases}
[/itex]

Homework Equations


Our definition of the partial derivatives in the direction [itex]\vec v = (v_1,v_2)[/itex] with [itex]\|\vec v \|_2 = 1[/itex] at the point [itex](0,0)[/itex]
[itex]D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}[/itex]

The Attempt at a Solution


Straight forward:
[itex]D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}=\lim_{h\rightarrow 0} {\frac{f(h(v_1,v_2))}{h}}=\lim_{h\rightarrow 0} {\frac{\frac{h^5v_2^5}{2h^4v_1^4+h^4v_2^4}}{h}}= \frac{v_2^5}{2v_1^4+v_2^4}[/itex] Then in the direction [itex]\vec v = (0,1),(y-direction)[/itex] the tangent slope should be [itex]\frac{1^5}{2*0^4+1^4}=1[/itex]
Here's my problem: When I evaluate the same thing in maple I get 0. Where's my error?

Any feedback is very appreciated :)
Alex
You didn't make any mistake. It looks like Maple is being sloppy about how it takes the limit.
 
  • #4
AwesomeTrains
Gold Member
116
3
Thanks for the replies.
I am puzzled as to why you are trying to find the general directional derivative when you are asked only to find the partial derivatives.
(It is quite possible for a function to have partial derivatives at a point and not be differentiable there- in which case, it would not have directional derivatives I all directions.)

Here, the partial derivative, at (0, 0), with respect to x is given by [tex]\lim_{h\to 0}\frac{f(h, 0)- f(0,0)}{h}[/tex] and the derivative with respect to y is given by [tex]\lim_{h\to 0}\frac{f(0,h)- f(0,0)}{h}[/tex][/B]
Ah okay, I meant the general directional derivatives and not the partial ones. I just used the partial in y-direction to test my result and was wondering why it was differing from maple. Is it true that is differentiable? I used the argument that all partial derivatives exists and are continuous. Since that quotient exists for all [tex]\vec v[/tex] with norm 1.

You didn't make any mistake. It looks like Maple is being sloppy about how it takes the limit.
Okay thanks. This was my question :)
Do you know how I then get the correct result from maple?
 
  • #5
Dick
Science Advisor
Homework Helper
26,258
618
Thanks for the replies.

Ah okay, I meant the general directional derivatives and not the partial ones. I just used the partial in y-direction to test my result and was wondering why it was differing from maple. Is it true that is differentiable? I used the argument that all partial derivatives exists and are continuous. Since that quotient exists for all [tex]\vec v[/tex] with norm 1.


Okay thanks. This was my question :)
Do you know how I then get the correct result from maple?
Just get maple to do what you did. Don't trust it to be magic on this one. More importantly, your function is NOT differentiable at (0,0). It has directional derivatives in all directions - but it doesn't have a tangent plane. The partials exist everywhere but they are NOT continuous at (0,0). Write down the y-partial derivative at a general point (x,y) using quotient rule, etc. Now approach (0,0) by setting x=0 and letting y->0. You get limit 1, just as you worked out. Then approach (0,0) by setting y=0 and letting x->0. You get 0. That's not the way a continuous partial is supposed to work.
 
  • #6
AwesomeTrains
Gold Member
116
3
Just get maple to do what you did. Don't trust it to be magic on this one. More importantly, your function is NOT differentiable at (0,0). It has directional derivatives in all directions - but it doesn't have a tangent plane. The partials exist everywhere but they are NOT continuous at (0,0). Write down the y-partial derivative at a general point (x,y) using quotient rule, etc. Now approach (0,0) by setting x=0 and letting y->0. You get limit 1, just as you worked out. Then approach (0,0) by setting y=0 and letting x->0. You get 0. That's not the way a continuous partial is supposed to work.
Ah okay great thank you very much :) I understand now. I was sloppy when checking for continuity at (0,0), took it for granted :)
 
  • #7
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728

Homework Statement


I want to find the partial derivatives in the point [itex](0,0)[/itex] of the function [itex]f:\mathbb R^2\rightarrow\mathbb R[/itex] [itex]
f(x,y):=
\begin{cases}
0 & \text{if } (x,y) = (0,0) \\
\frac{y^5}{2x^4+y^4} & otherwise
\end{cases}
[/itex]

Homework Equations


Our definition of the partial derivatives in the direction [itex]\vec v = (v_1,v_2)[/itex] with [itex]\|\vec v \|_2 = 1[/itex] at the point [itex](0,0)[/itex]
[itex]D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}[/itex]

The Attempt at a Solution


Straight forward:
[itex]D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}=\lim_{h\rightarrow 0} {\frac{f(h(v_1,v_2))}{h}}=\lim_{h\rightarrow 0} {\frac{\frac{h^5v_2^5}{2h^4v_1^4+h^4v_2^4}}{h}}= \frac{v_2^5}{2v_1^4+v_2^4}[/itex] Then in the direction [itex]\vec v = (0,1),(y-direction)[/itex] the tangent slope should be [itex]\frac{1^5}{2*0^4+1^4}=1[/itex]
Here's my problem: When I evaluate the same thing in maple I get 0. Where's my error?
(I've attached a picture of maple)
md2ngy.png

Also I can't see from the graph that the tangent slope in the y-direction should be 0, I think.

Any feedback is very appreciated :)
Alex
You are mis-using Maple. Your first statement gives a formula for a variable with the strange name "f(x,y)"; it is NOT a function! To make it a function you need to use the arrow assignment "->", so you need to say
f:=(x,y)-> piecewise(x = 0 and y =0,0,y^5/(2*x^4+y^4));

That works like a charm.
 
  • #8
AwesomeTrains
Gold Member
116
3
Ah I see, thanks for the tip. I'll do that in the future
 
  • #9
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
Ah I see, thanks for the tip. I'll do that in the future
Just so you know: sometimes f:x-> ... gives a usable function f(x), but sometimes if does not. For example, if you say f:=x->diff(x^2,x), the inputs f(y) and f(a) give 2y and 2a, as they should; however, f(2) fails, because Maple does not know how to interpret diff(1^2,1) = d(1^2)/d1. So, what you need to do is make sure Maple refers to the result of diff(x^2,x), not to the original formula. You might think that saying fx:=diff(x^2,x); f:=x->fx will do it, but it does not: it gives f(y) = 2x and f(1) = 2x. So: what to do? In the presence of operations (such as "diff" and "int") when defining a function, I always use the "unapply" method. For example, f:=unapply(diff(x^2,x),x) gives f(x) = 2x, f(a) = 2a and f(1) = 2, exactly as it should. The alternative fx:=diff(x^2,x); f:=unapply(fx,x); gives the same correct behaviour.

Strangely, in your case, unapply does not work, but the direct definition does! When I try
f:=unapply(piecewise(...), (x,y)) or fxy = piecewise(...), f:=unapply(fxy,(x,y)) it fails: it just defines f(x,y) as the part where (x,y) =/= (0,0), and declares a "division by 0" error for f(0,0). (However, this odd behavour does not seem to occur for 1-variable piecewise function, and not even for all two-variable piecewise functions--only for yours!)

Note: further checking seems to indicate it has something to do with the nature of the excluded region, which is a single point in your case. The alternative example
fxy:=piecewise(x > 0 and y > 0, g(x,y),0); f:=unapply(fxy, (x,y))
works as it should. Here, the "excluded" region is two-dimensional--quadrants 2,3,4-- rather than a single point.

So, the bottom line is: most of the time the "unapply" method is best, as it works almost always; but on rare examples you need to fall back on the arrow assignment method. Whenever I define piecewise functions, I always check them first, to make sure they are doing what I want.
 
Last edited:
  • #10
AwesomeTrains
Gold Member
116
3
Thanks for the help Ray. In cases with single point exclusions I use the arrow and otherwise unapply, did I get it right?
 
  • #11
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
Thanks for the help Ray. In cases with single point exclusions I use the arrow and otherwise unapply, did I get it right?
Sort of, but the real message is: always check it before doing further calculations with it.
 

Related Threads on Strange partial derivative

  • Last Post
Replies
4
Views
752
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
3
Views
1K
Replies
4
Views
858
  • Last Post
Replies
2
Views
839
  • Last Post
Replies
6
Views
922
  • Last Post
Replies
6
Views
2K
Top