rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

bessel_j with floating point argument #1567

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:48 Created by willisb on 2003-05-12 16:26:14 Original: https://sourceforge.net/p/maxima/bugs/312


The function bessel_j misbehaves with a floating point argument

(C1) bessel_j(0.2,3);

Error: #C(0.20000000000000001 0.0) is not of type (OR RATIONAL LISP:FLOAT). 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 (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

Evaluation took 0.00 seconds (0.00 elapsed)

This is caused by $bessel receiving a lisp complex number as its first argument -- it expects a Maxima number instead. A possible fix is to change

(defun $bessel_j (arg order) (if (and (numberp order) (numberp ($realpart arg)) (numberp ($imagpart arg))) ($bessel (complex ($realpart arg) ($imagpart arg)) order) (subfunmakes '$bessel_j (ncons order) (ncons arg))))

to

(defun $bessel_j (arg order) (if (and (numberp order) (numberp ($realpart arg)) (numberp ($imagpart arg))) ($bessel arg order)
(subfunmakes '$bessel_j (ncons order) (ncons arg))))

Barton

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:49 Created by rtoy on 2003-05-13 03:20:04 Original: https://sourceforge.net/p/maxima/bugs/312/#a59f


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:53 Created by rtoy on 2003-05-13 03:20:04 Original: https://sourceforge.net/p/maxima/bugs/312/#742e


Logged In: YES user_id=28849

This should be fixed now, in the way you suggest.

This brings up an important issue: What is the right way to call Bessel_J? Is it

bessel_j(x, n) or bessel_j[n](x)

Discussion moved to mailing list.