Skip to main content

function construction - How to find (numerical) value of a derivative at point?


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]]

Answer




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.


Comments