series
Taylor series of a function.
c=series(func,v)
c=series(func,v,n)
Inputs
func The function of a single variable whose series is to be found.
v The value of the variable at which the series is to be found.
n The desired number of terms in the series.
Outputs
c The vector from which the coefficients of the Taylor series may be easily computed (see below).


Description
The output is such that the near x=v the function can be approximated by


    c[1]+c[2]*(x-v)+c[3]*(x-v)^2+....c[n]*(x-v)^(n-1).


(Actual coefficients of the Taylor series are c[i]/factorial(i-1) ). Note that the series of only a limited set of functions can be computed. The main restrictions are (a) the function be real and scalar valued, (b) all the steps involved in the computaion must involve only the arithmetic operators and trigonometric, exponential, hyperbolic, or logarithmic functions.
Example
>>series(@sin,0)
            0            1            0      -0.1667            0

>>series(@(x)sin(x^2-2x),0)
  4.9304e-032           -2            1       1.3333           -2

>>series(@sin,0,10)
Columns 1 through 8
            0            1            0      -0.1667            0       0.0083            0      -0.0002
Columns 9 through 10
            0  2.7557e-006

>>series(@(x)sin(x^2-2x),0,10)
Columns 1 through 8
  4.9304e-032           -2            1       1.3333           -2       0.7333          0.5      -0.6413
Columns 9 through 10
       0.2444       0.0486

>>// The first term is the limit of the function sin(x)/x as x->0
>>series(@(x)sin(x)/x,0)
            1            0      -0.1667            0