When I ask Maxima for the value of
diff(integrate(f(y),y,0,x),x);
then it correctly derives that this expression is f(x). However, if I slightly modify the expression to
diff(integrate(f(y)^(1/2),y,0,x),x);
then Maxima asks be whether x is positive, zero, or negative. Answering positive or negative leads to the correct and same result of f(x)^(1/2). Answering zero gives an error because deriving by a constant is not well-defined.
Is this a limitation of Maxima or is there a way to get Maxima to get the right result without asking for the sign of x?
I have version 5.41.0 of Maxima and am using it via version 18.02.0 of wxMaxima.
Looks like the question is coming from integrate
, not diff
:
(%i2) integrate (f(y), y, 0, x);
x
/
[
(%o2) I f(y) dy
]
/
0
(%i3) integrate (sqrt(f(y)), y, 0, x);
Is x positive, negative or zero?
p;
x
/
[
(%o3) I sqrt(f(y)) dy
]
/
0
(%i4) integrate (sqrt(f(y)), y, 0, x);
Is x positive, negative or zero?
n;
0
/
[
(%o4) - I sqrt(f(y)) dy
]
/
x
Reordering the limits of integration is okay, although maybe not necessary, and it's inconsistent between %i2 and %i3. I guess that's a bug.
After that, diff
has the expected effect:
(%i5) diff (%o2, x);
(%o5) f(x)
(%i6) diff (%o3, x);
(%o6) sqrt(f(x))
(%i7) diff (%o4, x);
(%o7) sqrt(f(x))
You can suppress the question by telling Maxima whether x
is greater or less than zero. I don't know if that makes sense for the problem you are trying to solve.
(%i8) assume (x > 0);
(%o8) [x > 0]
(%i9) integrate (sqrt(f(y)), y, 0, x);
x
/
[
(%o9) I sqrt(f(y)) dy
]
/
0
(%i10) diff (%, x);
(%o10) sqrt(f(x))