[comp.sys.handhelds] Convolution Algerbra

zoron@en.ecn.purdue.edu (Soren M Burkhart) (12/09/90)

    I have an HP-28S and I wanted to know if there were any programs out
there that did convolutions.  I didn't see anything in the reference manuals.
If there aren't any for the 28S how about the 48SX?  THanks in advance.



   Soren Burkhart
   zoron@en.ecn.purdue.edu

             (nothing fancy just plain and simple :>)

bobc@hplsla.HP.COM (Bob Cutler) (12/11/90)

Here's a program I've been using on my 28s.  There's probably a more 
efficient way to write a convolution program, but what the heck, it works.

CONV expects two vectors on the stack as input and returns a vector.

For example, 

        To solve:

               (3x^2 +2x + 1)( x + 5)

        Enter:
               [3 2 1] [ 1 5] 'CONV'

        The result is

              [ 3 17 11 5]  or  (3x^4 + 17x^2 + 11x + 5)

Enjoy,
					
					Bob Cutler
					KE7ZJ
					Hewlett-Packard
					Lake Stevens Instrument Division
					Everett, WA 98205

----------------------------------------------------------------------

'CONV'
<< -> A
  << -> B
     << A SIZE LIST-> DROP 
         B SIZE LIST-> DROP 
         + 1 - -> N
         << A N 1 -> LIST
            RDM -> A
            << B N 1 ->LIST 
               RDM -> B
               << 1 N FOR 
                  I 0 
                  1 I FOR 
                  J A J GET B I J - 1 + GET * +
                  NEXT
               NEXT 
            N -> ARRY
          >> 
        >> 
      >> 
    >> 
  >> 
>>