Graphics Programs Reference
In-Depth Information
Taylor Series
You can use
taylor
to generate Taylor polynomial expansions of a specified
order at a specified point. For example, to generate the Taylor polynomial up
to order 10 at 0 of the function sin
x
, we enter
>> syms x; taylor(sin(x), x, 10)
ans =
x-1/6*x^3+1/120*x^5-1/5040*x^7+1/362880*x^9
You can compute a Taylor polynomial at a point other than the origin. For
example,
>> taylor(exp(x), 4, 2)
ans =
exp(2)+exp(2)*(x-2)+1/2*exp(2)*(x-2)^2+1/6*exp(2)*(x-2)^3
computes a Taylor polynomial of
e
x
centered at the point
x
=
2.
The command
taylor
can also compute Taylor expansions at infinity:
>> taylor(exp(1/xˆ2), 6, Inf)
ans =
1+1/x^2+1/2/x^4
Default Variables
You can use any letters to denote variables in functions — either MATLAB's
or the ones you define. For example, there is nothing special about the use of
t
in the following, any letter will do as well:
>> syms t; diff(sin(tˆ2))
ans =
2*cos(t^2)*t
However, if there are multiple variables in an expression and you employ a
MATLAB command that does not make explicit reference to one of them,
then either you must make the reference explicit or MATLAB will use a
built-in hierarchy to decide which variable is the “one in play”. For example,
Search WWH ::
Custom Search