How Do You Calculate Partial Derivatives at a Singular Point?

Click For Summary
The discussion focuses on calculating partial derivatives of a function defined piecewise at the point (0,0). The user initially attempts to find directional derivatives but encounters discrepancies when using Maple, which returns different results. It is clarified that while the function has partial derivatives at (0,0), it is not differentiable there due to the lack of continuity in the partial derivatives. The conversation emphasizes the importance of correctly defining functions in Maple, particularly when dealing with piecewise definitions, and suggests verifying results before proceeding with further calculations. The conclusion highlights that the function's behavior at singular points requires careful handling to avoid errors in computation.
AwesomeTrains
Messages
115
Reaction score
3

Homework Statement


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

Homework Equations


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

The Attempt at a Solution


Straight forward:
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} Then in the direction \vec v = (0,1),(y-direction) the tangent slope should be \frac{1^5}{2*0^4+1^4}=1
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
 
Physics news on Phys.org
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 \lim_{h\to 0}\frac{f(h, 0)- f(0,0)}{h} and the derivative with respect to y is given by \lim_{h\to 0}\frac{f(0,h)- f(0,0)}{h}[/B]
 
AwesomeTrains said:

Homework Statement


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

Homework Equations


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

The Attempt at a Solution


Straight forward:
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} Then in the direction \vec v = (0,1),(y-direction) the tangent slope should be \frac{1^5}{2*0^4+1^4}=1
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.
 
Thanks for the replies.
HallsofIvy said:
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 \lim_{h\to 0}\frac{f(h, 0)- f(0,0)}{h} and the derivative with respect to y is given by \lim_{h\to 0}\frac{f(0,h)- f(0,0)}{h}[/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 \vec v with norm 1.

Dick said:
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?
 
AwesomeTrains said:
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 \vec v 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.
 
Dick said:
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 :)
 
AwesomeTrains said:

Homework Statement


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

Homework Equations


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

The Attempt at a Solution


Straight forward:
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} Then in the direction \vec v = (0,1),(y-direction) the tangent slope should be \frac{1^5}{2*0^4+1^4}=1
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.
 
Ah I see, thanks for the tip. I'll do that in the future
 
AwesomeTrains said:
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:
  • Like
Likes AwesomeTrains
  • #10
Thanks for the help Ray. In cases with single point exclusions I use the arrow and otherwise unapply, did I get it right?
 
  • #11
AwesomeTrains said:
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
9
Views
2K
Replies
5
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K