next up previous index
Next: F001 Linear Algebra Up: CERNLIB Previous: E408 Conversion of

E409 Summation of Trigonometric Series

Routine ID: E409
Author(s): T. Håvie, K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 01.12.1994
Language: FortranRevised:

Function subprograms RTRGSM and DTRGSM compute the sum of the trigonometric series

f(x) = a0+∑k=1nakcoskx+∑k=1mbksinkx

for a given argument x in the range -π≤x ≤π and given coefficients ak,bk .

On CDC and Cray computers, the double-precision version DTRGSM is not available.

Structure:

FUNCTION subprogram
User Entry Names: RTRGSM, DTRGSM

Usage:

In any arithmetic expression, for t=R (type REAL), t=D (type DOUBLE PRECISION),

    tTRGSM(X,A,N,B,M,IOP)
has the value f(x) .
X
(Type according to t) Argument x.
A
(Type according to t) One-dimensional array of dimension (0:d) where d ≥N , containing the constant coefficient a0 in A(0) and the cosine coefficients ak (k=1,...,n) in A(k).
N
( INTEGER) The number n of cosine coefficients.
B
(Type according to t) One-dimensional array of length ≥M , containing the sine coefficients bk (k=1,...,n) in B(k).
M
( INTEGER) The number m of sine coefficients.
IOP
( INTEGER) An option number:
= 1: the general case,
= 2: all bk are zero, i.e. f(x)=f(-x) ,
= 3: all ak are zero, i.e. f(x)=-f(-x) .

Method:

Standard recurrence relations are used for calculating the sum (see Ref. 1).

Notes:

For a function f(z) given in the range a ≤z ≤b , use the transformation
x = {2πb-a}(z-{b+a2})&quad;for IOP=1,

x = π {z-ab-a}&quad;for IOP=2 or IOP=3.

References:

  1. W. Clenshaw, A note on the summation of Chebyshev series, MTAC (later renamed Math. Comp.) 9 (1955) 118--120.

Matrices, Vectors and Linear Equations

F001



next up previous index
Next: F001 Linear Algebra Up: CERNLIB Previous: E408 Conversion of


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995