[Maxima] Absolute value of the Log function
drdieterkaiser at web.de
Sat Aug 22 14:38:25 CDT 2009
I have reported some problems with the limit of the factorial and log
functions. Furthermore I think we have a problem with the absolute value
of the log function.
I have got step by step the code to get correct answers, but finally I
had a problem with the following example
This example does not simplify to inf after improving simplimln and the
absolute value of the Log function.
Furthermore I have observed the following strange answers of the current
The following limit does not work as expected:
sign: sign of infinity is undefined.
-- an error. To debug this try debugmode(true);
We get the limit from below and above:
But I think in all cases the correct answer should be inf.
The failure to get the limit of abs(log(x)) as x-> 0 after improving
simplimln and the absolute value of the Log function shows a special
problem in the routine $limit.
After preparing the expression and setting the context we do the
following resimplification in the routine $limit:
;; Resimplify in light of new assumptions.
(limitsimp ($expand (hide exp) 1 0) var))))))
The problem is, that in special situations this code simplifies the Abs
function away. This is e.g. the case for the simple example
limit(abs(x),x,infinity). Maxima now calculates the limit of the
argument of the Abs function, but lost the information to take the
absolute value after getting the limit of the argument. This causes
problems when an infinity is involved in the limit.
In the case limit(abs(log(x)),x,0) Maxima simplifies to -log(x). Again
the information to take the absolute value is simplified away.
I think we actually get some correct results by accident. If we change
the following limit to
and correct the wrong simplification of log(x) -> -log(x) the limit of
abs(log(x)) -> 0 no longer works, because of the problem in $limit.
I have added the following code to the routine $limit just before we do
;; Try to find the limit and sign of the argument of the
;; Abs function before doing any other simplification.
(if (and (not (atom exp)) (eq (caar exp) 'mabs))
(let* ((arg ($limit (cadr exp) var val))
(sgn ($sign arg)))
(cond ((eq arg '$infinity)
((eq sgn '$neg)
(mul -1 arg))
((member sgn '($pos $pz))
With this code all works fine. We get the expected limits and the
answers are really simplified. Here the discussed examples:
Finally one example of the testsuite will fail
integrate(1/x,x,minf,inf) no longer give the answer 0.
but returns a noun form. I think this integral should be divergent and
the example should be marked as an expected failure.
More information about the Maxima