rtoy / maxima

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

half integer bessel_y function #1566

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:25 Created by willisb on 2003-05-12 16:21:49 Original: https://sourceforge.net/p/maxima/bugs/311


The half-integer bessel functions of the second kind (the Y functions) evaluate incorrectly. Consider

(C1) besselexpand : true; (D1)
TRUE (C2) w : bessel_y[1/2](x)$ (C3) display2d : false; (D3) FALSE (C4) ev(w); (D4) -SQRT(2)*SIN(x)/(SQRT(%PI)*SQRT(x)) (C5)

The sin(x) upstairs should be a cos(x); to fix this, I think we need to swap %sin and %cos in besssel-y-simp; change the line

(simplify `((mtimes) -1 ,(bessel-jy-half-order arg rat- order '%sin '%cos)))

to

(simplify `((mtimes) -1 ,(bessel-jy-half-order arg rat- order '%cos '%sin)))

Additionally, the half-integer bessel functions evaluate to elementary functions too slowly. Consider

(D5) ALL (C6) besselexpand : true; Evaluation took 0.00 seconds (0.00 elapsed) (D6) TRUE (C7) w : bessel_j[19/2](x)$ Evaluation took 0.82 seconds (0.82 elapsed) (C8) w : bessel_j[21/2](x)$ Evaluation took 2.47 seconds (2.47 elapsed) (C9) w : bessel_j[23/2](x)$ Evaluation took 43.87 seconds (43.87 elapsed)

The time is increasing much too rapidly.

Barton

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:26 Created by rtoy on 2003-05-13 03:54:46 Original: https://sourceforge.net/p/maxima/bugs/311/#85a3


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:30 Created by rtoy on 2003-05-13 03:54:46 Original: https://sourceforge.net/p/maxima/bugs/311/#babf


Logged In: YES user_id=28849

The slow evaluation of the half-integer functions is caused by a poor choice of algorithms. It computes a larger order derivative to find the answer. Should use a different algorithm such as the one in A&S 10.1.8 and 10.1.9.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:33 Created by rtoy on 2003-05-13 03:57:00 Original: https://sourceforge.net/p/maxima/bugs/311/#a5eb


Logged In: YES user_id=28849

The slow evaluation of the half-integer functions is caused by a poor choice of algorithms. It computes a larger order derivative to find the answer. Should use a different algorithm such as the one in A&S 10.1.8 and 10.1.9.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:37 Created by rtoy on 2003-05-25 15:01:39 Original: https://sourceforge.net/p/maxima/bugs/311/#434b


Logged In: YES user_id=28849

Both of these issues should be fixed. The derivative with respect to order only done for J, though.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:42:41 Created by rtoy on 2003-05-25 15:01:39 Original: https://sourceforge.net/p/maxima/bugs/311/#1ac7