3
$\begingroup$

I want to give assumptions for the D function. Say I want to calculate $\frac{d|x|}{dx}$ for $x>0$, which is 1.

I write D[Abs[x], x, Assumptions -> x > 0] which gives

D::optx: Unknown option Assumptions in D[Abs[x],x,Assumptions->x>0]. >> Why doesn't D take assumptions?

$\endgroup$
1
  • 8
    $\begingroup$ Because Assumptions is not a valid option for D[]; see Options[D]. What you want is FullSimplify[D[Abs[x], x], x > 0]. $\endgroup$ Commented Jul 7, 2012 at 4:25

1 Answer 1

8
$\begingroup$

Many situations where assumptions play a role in differentiations can be equally or more clearly expressed by going back to the Limit defining the derivative in the first place. And Limit does take assumptions.

So for your example, instead of using D, you could write

Limit[(Abs[x + e] - Abs[x])/e, e -> 0, Assumptions -> x > 0]

(* ==> 1 *)

Here I've specified the assumption as an option. Another implicit assumption with Limit is that the small parameter e is taken to be real.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.