Question: differetiation of a function defined by min()

Hi, everyone,

I am dealing with a simplified model of my real problem. Here is the function definition

f:=(x,lambda)->min(x lambda,0)

I can plot this function in plot3d:

plot3d(f(x,lambda),x=-2..2,lambda=-2..2, axes=boxed)

but if I try to plot the derivitive of this function w.r.t. lambda (which is a discontinuous function) by:

plot3d(diff(f(x,lambda),lambda),x=-2..2,lambda=-2..2, axes=boxed)

I get error message: Error, (in PiecewiseTools:-Convert) unable to compare x and 0
apparantly, maple tries to convert the min() function into a piecewise function, but it needs the actual numeric value to know which is the minimum value. I have tried to use delayed evaluation, but no success so far. Anyone can give a clue on this problem?

Thanks!

Wei

Please Wait...