Re: Why are the functions different?
- To: mathgroup at smc.vnet.net
- Subject: [mg55650] Re: [mg55609] Why are the functions different?
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 1 Apr 2005 05:36:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Helge,
Use...
f1[x_] = Normal[Series[Tanh[x], {x, 0, 5}]]
f0[x_] := x - x^3/3 + (2*x^5)/15
and then everything plots properly.
Plot[f0[x], {x, -2, 2}];
Plot[f1[x], {x, -2, 2}];
By using Set instead of DelayedSet on f1, f1 is actually defined as the
series approximation. By using DelayedSet and then putting it in Plot,
without using Evaluation, Plot substitutes explicit x values into the Series
expression, which then makes no sense. For example the 'iterator' portion
then takes forms like {1.2, 0, 5} instead of {x, 0, 5} when Plot is trying
to evaluate at x = 1.2.
Now I wonder if you email address will work after I edit it.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Helge Stenstroem
To: mathgroup at smc.vnet.net
[mailto:helge.stenstrom.NOSPAM at NOSPAMericsson.com]
How are these two functions (f0 and f1) different? f0 can be plotted,
but f1 cannot.
f1[x_] := Normal[Series[Tanh[x], {x, 0, 5}]]
f0[x_] := x - x^3/3 + (2*x^5)/15
When evaluated like this:
f0[x]
f1[x]
they look the same.
The following gives error messages if f0 is replaced by f1.
Plot[{Tanh[z], f0[z]}, {z, -1, 1}]
(Mathematica 4.1 on Windows 2000)
--
Helge Stenström