We have the bug report ID: 932095 - ode2 redundant asksign.
At first a more simple example to show the problem:
(%i3) integrate(x^a,x)+integrate(x^(a-1),x);
Is a+1 zero or nonzero?
z;
Is a zero or nonzero?
n;
(%o3) log(x)+x^a/a
The problem is that Maxima loses the fact that a+1 = 0.
The reason is that the function $asksign writes its facts in the actual
context. The function $integrate creates its own context. This context
is killed when the integration is finished. Therefore, the next
integration no longer knows the facts the user has answered during the
evaluation of the first integral.
The problem can be solved if $asksign uses its own global context to
store facts. I have done an implementation of this idea.
At first we have to modify the functions which are used by $asksign to
write facts into a context. This is an example for the function TDZERO:
(defun tdzero (x)
(let ((context '$asksigndata))
(daddeq t x)
(push (cons x '$zero) locals)))
We bind the value of context to a global context with the name
'$asksigndata. This has to be done for the functions TDPOS, TDNEG, ...
too.
Next we have to modify the function CLEARSIGN:
(defun clearsign ()
(let ((context '$asksigndata))
...
At last we have to create a global context which is active:
($newcontext '$asksigndata)
($activate '$asksigndata)
With this changes we get for the example from above:
(%i5) integrate(x^a,x)+integrate(x^(a-1),x);
Is a+1 zero or nonzero?
z;
(%o5) log(x)+x^a/a
The redundant questions vanish because the facts are stored in the
global context '$asksigndata and not in the local context created by the
integration routine.
Furthermore, it is no longer necessary to store the facts from $asksign
in the global list LOCALES to clear the facts after finishing the
evaluation. We can simply kill the global context '$asksigndata and
create a new one if needed.
Remark: The function TDZERO and friends are called from the the $sign
functions too, to store some additional data. Therefore, $sign will
benefit from the global context too. Because the additional data from
$sign is killed too, if the local context is killed.
Dieter Kaiser