Commit 5566bc397937c2e8979ee6847e8f59f279f1f643

Authored by Raymond Toy
1 parent 2f48eb87

Add more tests for Bessel J. Not all of them pass.

Showing 1 changed file with 32 additions and 6 deletions
rt-tests.lisp
... ... @@ -1673,28 +1673,54 @@
1673 1673 nil)
1674 1674  
1675 1675 ;; Bessel J for complex args
1676   -(rt:deftest bessel-j-complex.pos-order.d.1
  1676 +(rt:deftest bessel-j-complex-arg.d.1
1677 1677 (let ((b (bessel-j 0d0 #c(1d0 1)))
1678 1678 (true #c(0.9376084768060293d0 -0.4965299476091221d0)))
1679 1679 (check-accuracy 50.73 b true))
1680 1680 nil)
1681 1681  
1682   -(rt:deftest bessel-j-complex.pos-order.d.2
  1682 +(rt:deftest bessel-j-complex-arg.d.2
1683 1683 (let ((b (bessel-j 1d0 #c(1d0 1)))
1684 1684 (true #c(0.6141603349229036d0 0.3650280288270878d0)))
1685 1685 (check-accuracy 52.51 b true))
1686 1686 nil)
1687 1687  
1688   -(rt:deftest bessel-j-complex.pos-order.d.3
  1688 +(rt:deftest bessel-j-complex-arg.d.3
1689 1689 (let ((b (bessel-j 2d0 #c(1d0 1)))
1690 1690 (true #c(0.0415798869439621d0 0.2473976415133063d0)))
1691 1691 (check-accuracy 50.41 b true))
1692 1692 nil)
1693 1693  
1694   -#+nil
1695   -(rt:deftest bessel-j-complex.pos-order.d.4
  1694 +(rt:deftest bessel-j-complex-arg.d.4
1696 1695 (let ((b (bessel-j 2.3d0 #c(1d0 1)))
  1696 + (true #c(-0.0141615213034667d0 0.1677798241687935d0)))
  1697 + (check-accuracy 48.56 b true))
  1698 + nil)
  1699 +
  1700 +(rt:deftest bessel-j-complex-arg.d.5
  1701 + (let ((b (bessel-j -2.3d0 #c(1d0 1)))
1697 1702 (true #c(0.1920598664138632d0 -0.5158676904105332d0)))
1698   - (check-accuracy 53 b true))
  1703 + (check-accuracy 50.97 b true))
1699 1704 nil)
1700 1705  
  1706 +(rt:deftest bessel-j-1/2-complex.d.1
  1707 + (loop for k from 0 below 10
  1708 + for x = (complex (random (/ pi 2))
  1709 + (random (/ pi 2)))
  1710 + for b = (bessel-j 0.5d0 x)
  1711 + for true = (* (/ (sin x) (sqrt x)) (sqrt (/ 2 pi)))
  1712 + for result = (check-accuracy 49.8 b true)
  1713 + when result
  1714 + append (list (list (list k x) result)))
  1715 + nil)
  1716 +
  1717 +(rt:deftest bessel-j-1/2-complex.q.1
  1718 + (loop for k from 0 below 10
  1719 + for x = (complex (random (/ (float-pi #q1) 2))
  1720 + (random (/ (float-pi #q1) 2)))
  1721 + for b = (bessel-j #q0.5 x)
  1722 + for true = (* (/ (sin x) (sqrt x)) (sqrt (/ 2 (float-pi #q1))))
  1723 + for result = (check-accuracy 212 b true)
  1724 + when result
  1725 + append (list (list (list k x) result)))
  1726 + nil)
... ...