wscott@EN.ECN.PURDUE.EDU (Wayne H Scott) (02/21/90)
This is a new version of the bessel function program. It is faster by using stack functions and it fixes one bug in the previous posting. This is a function I wrote to aid in my study of FM signal modulation. It computes the bessel function. It expects n and x to be on the stack and it returns the result of the bessel function. Note it is recursive so it should be named J or change the one reference to this name within the program. J << -> n x << << IF n 0 < THEN n NEG x J n 2 MOD 2 * 1 - * NEG ELSE IF x 0 == THEN n 0 == ELSE 17.1032 .2639 n * + .6487 x ABS * + .0018 n * x ABS * - .6457 n x ABS MAX * + .5 + FLOOR 2 / CEIL 2 * 1.e-50 0 -> m tiny bn << tiny 2 * 0 0 tiny m 1 - 0 FOR k ROT DROP 2 k 1 + * OVER * x / 3 PICK - IF k n == THEN DUP 'bn' STO END if k 0 == THEN DUP 5 ROLL + 4 ROLLD ELSE IF k 2 MOD 0 == THEN DUP 2 * 5 ROLL + 4 ROLLD END END -1 STEP 3 DROPN bn SWAP / >> END END >> >> Ported from MatLab librarys. _______________________________________________________________________________ Wayne Scott | INTERNET: wscott@en.ecn.purdue.edu Electrical Engineering | BITNET: wscott%ea.ecn.purdue.edu@purccvm Purdue University | UUCP: {purdue, pur-ee}!en.ecn.purdue.edu!wscott