Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!EN.ECN.PURDUE.EDU!wscott From: wscott@EN.ECN.PURDUE.EDU (Wayne H Scott) Newsgroups: comp.sys.handhelds Subject: Bessel functions Message-ID: <9002201947.AA24782@en.ecn.purdue.edu> Date: 20 Feb 90 19:47:58 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 56 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. To anyone who enjoys HP28 optimization please work on this. I know it can be much faster but I just haven't had the time. 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 * 0 1.e-50 DUP DUP 2 * 0 0 -> m bkp1 tiny bk t bn bkp2 << m 1 - 0 FOR k bkp1 'bkp2' STO bk 'bkp1' STO 2 k 1 + * bkp1 * x / bkp2 - 'bk' STO IF k n == bk THEN bk 'bn' STO END IF k 0 > k 2 MOD 0 == AND THEN t 2 bk * + 't' STO END if k 0 == THEN t bk + 't' STO END -1 STEP bn t / >> 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