From: JamesU <jamesu@europa.com>
Newsgroups: comp.sys.hp48
Subject: numerical integration in ML, uuencoded
Date: Sat, 21 Nov 1998 10:20:02 -0800
Lines: 85
Message-ID: <3657044E.36F789BD@europa.com>
NNTP-Posting-Host: 204.202.55.132
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
X-Trace: 911672198 SLS4T.EBE3784CCCAC usenet57.supernews.com
X-Complaints-To: newsabuse@supernews.com
X-Mailer: Mozilla 4.05 [ja] (Win95; I)
Xref: republic.btigate.com comp.sys.hp48:18875

INTEG -- PERFORMS DISCRETE TRAPEZOIDAL INTEGRATION
(C) Copyright 1994 by James Unterburger.  All rights reserved.
 -- Version 1.0 1994/02/22
 -- 260 bytes, #19BAh checksum (BYTES command)

This routine is essentially a "waveform integrator", where the
input can be considered a waveform consisting of data points
defined by the input vectors Y (dependent) and X (independent).
For example, the X values represent time and the Y values represent
the corresponding values of some function of signal(s) in
an electronic circuit, obtained from a circuit simulator (like
SPICE).

The X vector is assumed to be monotonically increasing, else
an "Invalid Array Element" error occurs.  There is no restriction
on the "step-sizes" of the X vector, i.e., non-uniform discretization
of the waveform is OK.

The output is a vector of the same length as the input vectors
which is the integral (trapezoidal formula) of the waveform.

INPUT:
2:  N-element REAL vector Y of dependent values
1:  N-element REAL vector X of independent values,
    monotonically increasing (else "Invalid Array Element")

OUTPUT:
1:  N-element REAL vector I, values of the integral of Y
    with respect to X, defined thus:

    I(1) = 0

            K-1
          1 +--|
    I(K)= - >    [Y(j+1)+Y(j)]*[X(j+1)-X(j)]       K=2,3,...,N
          2 +--|
            j=1


     (C) Copyright 1994 by James Unterburger.  All rights reserved.

     Noncommercial distribution allowed, provided that this
     copyright message is preserved, and any modified versions
     are clearly marked as such.

     This program makes use of undocumented low-level features of
     the HP48 calculator, and may or may not cause loss of data,
     excessive battery drainage, and/or damage to the calculator
     hardware.  The Author takes no responsibility whatsoever for
     any damage caused by the use of this program.

     THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Bug reports, enhancement requests, praise, and damnation are always
appreciated.  This particular function is the start of what I hope
to be a suite of "waveform processing" functions, a waveform being
defined by two same-sized vectors.  I am looking for suggestions
as to what other functions to program.  I have in mind the IEEE
defined waveform functions (waveform->scalar) as well as general
WF processing (decimation, interpolation, correlation, convolution,
etc.).  Please contact me if you have any special requests.
==============================================================================

 James Unterburger                  e-mail: jamesu@europa.com
==============================================================================