8
$\begingroup$

I have the following function:

f[0, 0] = 0 f[x_, y_] := Exp[-(x^2 + y^2)^(-1)] 

How do I find its partial derivatives at any given point, including $(0,0)$? This doesn't work (obviously, I guess):

point={0,0} D[f[x, y], x] /. x -> point[[1]] /. y -> point[[2]] 
$\endgroup$
1
  • 2
    $\begingroup$ f[x_, y_] := Exp[-(x^2 + y^2)^(-1)] point = {1, 1}; D[f[x, y], x] /. {x -> point[[1]], y -> point[[2]]} This worked.. $\endgroup$ Commented Sep 29, 2012 at 23:27

2 Answers 2

8
$\begingroup$

In case you have any problems, I recommend using the Derivative operator instead of D, since the latter works on expressions, while the former one can work on pure functions.

{Derivative[1, 0][f][x, y], Derivative[0, 1][f][x, y]} // TraditionalForm 

enter image description here

The subtlety here is that one cannot use it to find partial derivatives of f at {0,0}, e.g.

Derivative[0, 1][f][0, 0] 
Power::infy: Infinite expression 1/0 encountered. >> Infinity::indet: Indeterminate expression E^ComplexInfinity encountered. >> Power::infy: Infinite expression 1/0^2 encountered. >> Indeterminate 

however, you can use Limit instead of Derivative:

Limit[ #, h -> 0] & /@ {( f[0 + h, 0] - f[0, 0] )/ h, ( f[0, 0 + h] - f[0, 0] )/ h} 
{0, 0} 

In general, it works as we would like:

Limit[ #, h -> 0] & /@ { (f[x + h, y] - f[x, y])/ h, (f[x, y + h] - f[x, y])/ h} == { Derivative[1, 0][f][x, y], Derivative[0, 1][f][x, y] } 
True 

One can also take advantage of FoldList to follow computing several limits, e.g. :

FoldList[ Limit, (f[x + h, y] - f[x, y])/h, {h -> 0, y -> 0, x -> 0}] // TraditionalForm 

enter image description here

We have shown that the partial derivative with respect to x is continuous at {0,0}. We can show much more; namely, that any derivative of any order vanishes at {0,0}. We find here the few first terms of a Taylor series expansion near {0,0} :

Limit[ Limit[ Normal @ Series[ f[x, y], {y, y0, 7}, {x, x0, 7}], x0 -> 0], y0 -> 0] 
0 

i.e. this function is not analytic at {0,0}, since the Taylor series expansion is identically 0, while the function f itself is not.

$\endgroup$
4
  • 1
    $\begingroup$ Thanks, but formally, this is the limit of the derivative as the point tends to zero, not exactly the derivative at zero (though in this case they are equal). Do I have to resort to Limit and the definition of a derivative to do it in the general case? $\endgroup$ Commented Sep 29, 2012 at 17:27
  • 1
    $\begingroup$ You can find the Limit of the difference ratio directly. $\endgroup$ Commented Sep 29, 2012 at 17:30
  • $\begingroup$ Exactly, I just thought there's another way. $\endgroup$ Commented Sep 29, 2012 at 17:35
  • $\begingroup$ @mbork more exactly f is a smooth function everywhere but it is not analytic in {0,0}. $\endgroup$ Commented Sep 29, 2012 at 17:38
3
$\begingroup$

For evaluating derivatives for numerical arguments, one (somewhat neglected) function for the purpose is SeriesCoefficient[]. Of course, this produces derivatives scaled by factorials, so you have to multiply by the appropriate factorial factors to get the actual value of the derivative. For instance,

Derivative[3, 5][Function[{x, y}, Exp[-1/(x^2 + y^2)]]][1, 1] 117215/(256 Sqrt[E]) With[{p = 3, q = 5, x0 = 1, y0 = 1}, p! q! SeriesCoefficient[Exp[-1/(x^2 + y^2)], {x, x0, p}, {y, y0, q}]] 117215/(256 Sqrt[E]) 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.