#446 qq.lisp is broken (numerical integration)

closed
nobody
Lisp Core (471)
5
2005-05-16
2003-11-15
No

(C1) load("qq.lisp");
Load failed for
C:/maxima/Maxima/share/maxima/5.9.0/share/numeric/qq
.lisp
-- an error. Quitting. To debug this try DEBUGMODE
(TRUE);)
(C2) 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

Barton

Discussion

  • Barton Willis

    Barton Willis - 2003-11-17

    Logged In: YES
    user_id=895922

    The change

    ;(DEFUN ($QUANC8 TRANSLATED-MMACRO) (F A B
    &OPTIONAL (C NIL C-P))
    ; (IF (NOT C-P)
    ; `((CALL-QUANC8) ,F ,A ,B)
    ; `((CALL-QUANC8) ((LAMBDA) ((MLIST) ,A) ,F) ,B ,C)))

    (defun $quanc8 (f a b &optional (c nil c-p))
    (if (not c-p)
    (call-quanc8 f a b)
    (call-quanc8 `((lambda) ((mlist) ,a) ,f) b c)))

    allows qq.lisp to load correctly. Here are a few simple
    tests

    (C1) load("c:/maximacvs/maxima/share/numeric/qq.lisp");
    (D1)
    c:/maximacvs/maxima/share/numeric/qq.lisp
    (C2) QUANC8_ABSERR : 1.0e-12;
    (D2) 1.0E-12
    (C3) quanc8('(1/x),x,1,2);
    (D3) 0.69314718056001
    (C4) %-log(2.0d0);
    (D4) 6.283862319378386E-14
    (C5) f(x) := block([], mode_declare(x,float), 1/x)$
    (C6) compile(f)$
    Compiling gazonk0.lsp.
    End of Pass 1.
    End of Pass 2.
    OPTIMIZE levels: Safety=2, Space=2, Speed=2
    Finished compiling gazonk0.lsp.
    (C7) quanc8(f,1,2);
    (D7) 0.69314718056001

    Barton

     
  • Wolfgang Jenkner

    Logged In: YES
    user_id=581700

    However, the double integral example in the demo won't work. This
    shows why $QUANC8 can't be a DEFUN...

    I rewrote it as

    (defmspec $quanc8 (form)
    (setq form (cdr form))
    (if (cdddr form)
    (apply #'call-quanc8
    (meval `((lambda) ((mlist) ,(cadr form)) ,(car form)))
    (mapcar #'meval (cddr form)))
    (apply #'call-quanc8 (mapcar #'meval form))))

    All examples in the demo seem to work as expected (after lower-casing
    them). My current versions of the relevant files are

    http://members.inode.at/wjenkner/maxima/qq.lisp

    http://members.inode.at/wjenkner/maxima/qq.dem

    This works in CLISP. SBCL has some problem with the type declarations
    in QUANC8 (without them it works fine).

     
  • Barton Willis

    Barton Willis - 2003-11-18

    Logged In: YES
    user_id=895922

    1. Nice work.

    2. The load(qq.lisp) bug was already reported (but not
    resolved) in bug 614631. I think we should commit
    the fix and close both bugs.

    Barton

     
  • Wolfgang Jenkner

    Logged In: YES
    user_id=581700

    ad 1) Thanks :-)

    I have added a TRANSLATE property for $QUANC8 (see the URLs in the
    previous message below). So the last example in the demo (concerning
    the function p) really shows a speed difference between the
    interpreted and the translated version as intended, at least for CLISP
    and SBCL (I haven't tested it with GCL). For SBCL the difference
    seems quite impressive, actually.

    This also requires a small patch to numer.lisp (see below)

    ad 2) I still don't know why SBCL doesn't grok that type declaration.
    I'll recompile SBCL and see. It would also be a good thing to test
    the code with CMUCL.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Index: numer.lisp
    ===================================================================
    RCS file: /cvsroot/maxima/maxima/src/numer.lisp,v
    retrieving revision 1.1.1.1
    diff -u -r1.1.1.1 numer.lisp
    --- numer.lisp 8 May 2000 06:09:41 -0000 1.1.1.1
    +++ numer.lisp 18 Nov 2003 17:06:15 -0000
    @@ -155,6 +155,8 @@
    (OR LPROPS MPROPS)
    (OR MPROPS LPROPS))
    (GETL F '(OPERATORS)))))
    + ((functionp f)
    + (list 'expr f))
    ((consp f) ;(EQ (TYPEP F) 'LIST)
    (LIST (IF (MEMQ (CAR F) '(FUNCTION LAMBDA NAMED-LAMBDA))
    'EXPR
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     
  • Wolfgang Jenkner

    Logged In: YES
    user_id=581700

    SBCL was quite right in not accepting the type declaration. Binding
    something to NIL and then declaring it a FIXNUM is not a good idea.
    Anyway, fixed.

     
  • Robert Dodier

    Robert Dodier - 2005-05-16

    Logged In: YES
    user_id=501686

    Patches to share/numeric/qq.lisp and src/numer.lisp were
    committed 2003/11/21.

    load(qq)$ demo(qq)$ works as expected in Maxima 5.9.1cvs
    (clisp 2.33 and gcl 2.6.6).

     
  • Robert Dodier

    Robert Dodier - 2005-05-16
    • status: open --> closed
    • labels: --> Lisp Core
     

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