If I define a function through a conditional pattern, its derivative is not defined in the whole domain of the original function...
Minimal code to reproduce : for instance, I define
f[x_/;-2<x<2]=x^2
and f'[x] is only defined for -1.5<x<1.5 (it's not exactly 1.5...)
How can this be solved ? I use MMA v13 on Windows 10
Thanks in advance.
f[x_] := Piecewise[{{x^2, -2 < x < 2}, {Undefined, True}}]
is probably what you're looking for. $\endgroup$f
rather than relying on the function to handle the exceptions. $\endgroup$