#479 oddp and evenp in functs.mac broken

closed
nobody
5
2006-07-19
2003-12-26
No

The evenp and oddp functions defined in functs.mac
are broken; the corresponding functions in simp.lisp
are non-broken. For example

(D0) DONE
(C1) oddp(x);
(D1) FALSE
(C2) load("functs")$
Warning - you are redefining the MACSYMA function
ODDP
Warning - you are redefining the MACSYMA function
EVENP
(C3) oddp(x);

Error: |$x| is not of type INTEGER.
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by MACSYMA-TOP-LEVEL.
Broken at MACSYMA-TOP-LEVEL. Type :H for Help.
MAXIMA>>:q
(C4) build_info();

Maxima version: 5.9.0
Maxima build date: 19:10 2/9/2003
host type: i686-pc-mingw32
lisp-implementation-type: Kyoto Common Lisp
lisp-implementation-version: GCL-2-5.0

Notes:

1) Since oddp and evenp as defined in simp.lisp are
non-broken, I suggest that oddp and evenp be
deleted from functs.mac.

2) To access the lcm function, maxima-grobner.lisp
loads functs.mac. I also suggest that we write a
new lcm function and place it in a file along with
the gcd code. That way maxima-grobner won't
have to load functs.mac.

3) Another thing; it's possible to declare a symbol
to be odd, but oddp ingnores the fact. Thus

(C2) declare(x,odd);
(D2) DONE
(C3) oddp(x);
(D3) FALSE

It might be worthwhile to experiment with new
versions of evenp and oddp; something like

(defun $oddp (x)
(cond ((integerp x) (oddp x))
(($integerp x) (oddp (cadr x)))
(t ($featurep x '$odd))))

(defun $evenp (x)
(cond ((integerp x) (evenp x))
(($integerp x) (evenp (cadr x)))
(t ($featurep x '$even))))

Barton

Discussion

  • Robert Dodier

    Robert Dodier - 2006-07-19
    • status: open --> closed
    • labels: --> Share Libraries
    • summary: oddp & evenp in functs.mac broken --> oddp and evenp in functs.mac broken
     
  • Robert Dodier

    Robert Dodier - 2006-07-19

    Logged In: YES
    user_id=501686

    evenp and oddp were cut out in r1.7
    share/simplification/functs.mac. Closing this report as fixed.

    By the way, the behavior of oddp and evenp wrt declared odd
    and even variables is strange, but it is consistent with the
    behavior of integerp (which likewise returns false for
    declared integer variables).

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks