1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Strange partial derivative

  1. Dec 23, 2014 #1
    1. The problem statement, all variables and given/known data
    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]
    0 & \text{if } (x,y) = (0,0) \\
    \frac{y^5}{2x^4+y^4} & otherwise

    2. Relevant 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]
    3. 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 :)
  2. jcsd
  3. Dec 23, 2014 #2


    User Avatar
    Staff Emeritus
    Science Advisor

    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]
  4. Dec 23, 2014 #3


    User Avatar
    Science Advisor
    Homework Helper

    You didn't make any mistake. It looks like Maple is being sloppy about how it takes the limit.
  5. Dec 23, 2014 #4
    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?
  6. Dec 23, 2014 #5


    User Avatar
    Science Advisor
    Homework Helper

    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.
  7. Dec 23, 2014 #6
    Ah okay great thank you very much :) I understand now. I was sloppy when checking for continuity at (0,0), took it for granted :)
  8. Dec 23, 2014 #7

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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.
  9. Dec 23, 2014 #8
    Ah I see, thanks for the tip. I'll do that in the future
  10. Dec 23, 2014 #9

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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: Dec 23, 2014
  11. Dec 24, 2014 #10
    Thanks for the help Ray. In cases with single point exclusions I use the arrow and otherwise unapply, did I get it right?
  12. Dec 24, 2014 #11

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    Sort of, but the real message is: always check it before doing further calculations with it.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Strange partial derivative
  1. Strange Derivative (Replies: 6)

  2. Partial derivative (Replies: 21)

  3. The partial derivative (Replies: 2)

  4. Partial derivatives (Replies: 11)

  5. Partial Derivatives (Replies: 4)