Changeset 78801d6381aaaf4f21967582680f26889582db60
- Timestamp:
- 04/15/12 10:50:16 (13 months ago)
- Author:
- Raymond Toy <toy.raymond@…>
- Children:
- 8c5195a87137fd61952a175a5dae676c70b480ef, 581a0a08f04a985424c09b6a7b3661d2eb58c3e9
- Parents:
- 5566bc397937c2e8979ee6847e8f59f279f1f643
- git-committer:
- Raymond Toy <toy.raymond@…> (04/15/12 10:50:16)
- Message:
-
- Add comments for integer-bessel-j-exp-arc.
- Simplify sum-an so we stop the sum when the terms no longer
contribute to the sum.
- Change big-n. This still needs work.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r235ac2
|
r78801d
|
|
| 180 | 180 | |
| 181 | 181 | |
| 182 | | ;; |
| | 182 | ;; Not really just for Bessel J for integer orders, but in that case, |
| | 183 | ;; this is all that's needed to compute Bessel J. For other values, |
| | 184 | ;; this is just part of the computation needed. |
| | 185 | ;; |
| | 186 | ;; Compute |
| | 187 | ;; |
| | 188 | ;; 1/(2*%pi) * (exp(-%i*v*%pi/2) * I(%i*z, v) + exp(%i*v*%pi/2) * I(-%i*z, v)) |
| 183 | 189 | (defun integer-bessel-j-exp-arc (v z) |
| 184 | 190 | (let* ((iz (* #c(0 1) z)) |
| … |
… |
|
| 258 | 264 | ;; sum(exp(-k*z)*a[n](k,v), k, 1, N) |
| 259 | 265 | ;; |
| | 266 | #+nil |
| 260 | 267 | (defun sum-an (big-n n v z) |
| 261 | 268 | (let ((sum 0)) |
| … |
… |
|
| 265 | 272 | (an n k v)))) |
| 266 | 273 | sum)) |
| | 274 | |
| | 275 | ;; Like above, but we just stop when the terms no longer contribute to |
| | 276 | ;; the sum. |
| | 277 | (defun sum-an (big-n n v z) |
| | 278 | (let ((eps (epsilon (realpart z)))) |
| | 279 | (do* ((k 1 (+ 1 k)) |
| | 280 | (term (* (exp (- (* k z))) |
| | 281 | (an n k v)) |
| | 282 | (* (exp (- (* k z))) |
| | 283 | (an n k v))) |
| | 284 | (sum term (+ sum term))) |
| | 285 | ((or (<= (abs term) (* eps (abs sum))) |
| | 286 | (> k big-n)) |
| | 287 | sum)))) |
| 267 | 288 | |
| 268 | 289 | ;; SUM-AB computes the series |
| … |
… |
|
| 400 | 421 | (t |
| 401 | 422 | ;; Need to fine-tune the value of big-n. |
| 402 | | (let ((big-n 100) |
| | 423 | (let ((big-n 10) |
| 403 | 424 | (vpi (* v (float-pi (realpart z))))) |
| 404 | 425 | (+ (integer-bessel-j-exp-arc v z) |