TUpolyExp1D TCL UTILITIES USER MANUAL TUpolyExp1D
SYNOPSIS
Return the 1D polynomial expansion of a given value
PACKAGE
TCLUTILS
NAME
TUpolyExp1D
USAGE
set rV  [TUpolyExp1D  X nC A {Offset} {uLim} {lLim}]
INPUT DEFINITIONS
X - Input Variable
nC - The number of polynomial coefficients
A - Array of polynomial coefficients
Offset - Optional offset into the polynomial coefficient array. Default is 0.
uLim - Optional upper limit clamp. Produced values above this limit are clamped to it. If uLim and lLim are identical this check is bypassed. Default is 0.
lLim - Optional lower limit clamp. Produced values below this limit are clamped to it. If uLim and lLim are identical this check is bypassed. Default is 0.
RETURN DEFINITION
rV - The result of the polynomial expansion.
DESCRIPTION
TUpolyExp1D solves polynomials of the form:
          rV = A(0) + A(1)X + A(2)X2 + ... + A(nC -1)XnC -1
      
The result is returned through the procedure. The routine provides for an optional offset into the coefficent array as well as the ability to clamp the returned value to either an upper or to a lower limit. Setting the upper and lower limits to the same value (the default condition) turns off the limit checking feature.
ERRORS
None Generated
C BACKING
Yes
EXAMPLE(S)
# SET up coefficients for expansion of e^X

set A(0) 1.0
set SgN -1.0
for { set J 0 ; set I 1 } { $I < 20 } { incr I ; incr J } {
   set A($I) [expr $SgN * $A($J) / double($I)]
}

# SOLVE for e^-1 and e^-2

set rV [TUpolyExp1D 1.0 20 A ]
puts stderr "e^-1 IS $rV"
set rV [TUpolyExp1D 2.0 20 A ]
puts stderr "e^-2 IS $rV"

> e^-1 IS 0.367879441171
> e^-2 IS 0.135335283235

      
Apr 18, 2003