use of $csign



I tried changing sign-log to

(defun sign-log (x)
  (setq x (cadr x)) ;; looking at sign of log(x)
  (cond ((eq t (meqp x 1)) (setf sign '$zero)) ;; log(1) = 0.
 ;; for x in unit circle and x # 1, log(x) is pure imaginary
 ((and  *complexsign* (eq 1 (meqp 1 (take '(mabs) x))) (mnqp x 1))
  (setf sign '$imaginary))
 ;; log(x) is positive for x > 1
 ((eq t (mgrp x 1)) (setf sign '$pos))
 ;; log(x) is negative for 0 < x < 1.
 ((and (eq t (mgrp x 0)) (eq t (mgrp 1 x))) (setf sign '$neg))
 ;; when *complexsign* is true, return $complex, else $pnz.
 (*complexsign* (setf sign '$complex))
 (t (setf sign '$pnz)))
  sign)

The testsuite gets through with a few errors--some integrals in
rtest_integrate
(#270 for example) fail--actually, with my sign-log, test #270 generates a
huge expression that might be correct but it contains many terms such as
atan2(0,h). Changing

  (*complexsign* (setf sign '$complex))

to

  (*complexsign* (setf sign '$pnz))

makes the testsuite more quiet.

What is the meaning of the defmvars minus, evens, and odds in compar.lisp?



Barton

-----maxima-bounces at math.utexas.edu wrote: -----

>To:?Barton?Willis?<willisb at unk.edu>
>From:?Dieter?Kaiser?<drdieterkaiser at web.de>
>Sent?by:?maxima-bounces at math.utexas.edu
>Date:?09/16/2009?04:29PM
>cc:?"maxima at math.utexas.edu"?<maxima at math.utexas.edu>
>Subject:?Re:?[Maxima]?use?of?$csign
>
>Am?Mittwoch,?den?16.09.2009,?07:24?-0500?schrieb?Barton?Willis:
>>?Should?csign(log(x))?-->?complex?or?pnz??More?generally,?if?csign
>returns
>>?complex,
>>?does?this?mean?that?the?expression?is?non-real?for?all?inputs?or
>non-real
>>?for?some
>>?inputs?
>
>Hello?Barton,
>
>your?comments?are?right.
>
>The?handling?of?functions?by?$csign?is?not?complete?and?consistent.?More
>work?is?possible?and?necessary.
>
>Now,?all?functions?are?assumed?to?be?real?valued?for?a?real?or?a?complex
>argument.
>
>(%i1)?csign(f(x));
>(%o1)?????????????????????????????????pnz
>(%i2)?declare(z,complex);
>(%o2)????????????????????????????????done
>(%i3)?csign(f(z));
>(%o3)?????????????????????????????????pnz
>
>But?not?in?all?cases?as?you?have?observed?for?the?log?function:
>
>(%i8)?csign(log(x));
>(%o8)?????????????????????????????????pnz
>(%i9)?csign(log(z));
>(%o9)???????????????????????????????complex
>
>Now,?we?have?to?declare?the?symbol?for?the?function?to?be?complex?to?get
>a?complex?answer:
>
>(%i10)?declare(f,complex)$
>
>(%i11)?csign(f(x));
>(%o11)??????????????????????????????complex
>
>The?time?I?have?worked?on?the?complex?components?I?have?hesitated?to
>change?the?behavior?that?every?function?is?assumed?to?have?real?values.
>The?problem?is,?that?a?lot?of?known?results?will?change.?Furthermore?I
>have?not?seen?in?fully?depth?all?relations?between?the?different
>routines?for?the?complex?components?which?might?cause?subtle?bugs.
>
>But?I?think?we?should?improve?the?complex?behavior?step?by?step?to?get
>more?nice?results.
>
>By?the?way:?I?think?it?is?important?too?to?improve?the?sqrt?function,
>see?the?bugs?sqrt(1/x)?->?1/sqrt(x)?and?sqrt(%i/x)?->?-%i/sqrt(x),?to
>get?more?correct?results?for?complex?expressions.
>
>Dieter?Kaiser
>
>
>_______________________________________________
>Maxima?mailing?list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima