       Re: Why are the functions different?

• To: mathgroup at smc.vnet.net
• Subject: [mg55642] Re: [mg55609] Why are the functions different?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Fri, 1 Apr 2005 05:36:13 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```f1[x_]:=Normal[Series[Tanh[x],{x,0,5}]];

f0[x_]:=x-x^3/3+(2*x^5)/15;

Yes they are the same when Evaluated.  Further, the Help for Plot says you
should Evaluate the first argument whenever possible

Plot[Evaluate[{Tanh[z],f1[z]}],{z,-1,1}];

Alternatively,

f2[x_]:=Evaluate[Normal[Series[Tanh[x],{x,0,5}]]];

Plot[{Tanh[z],f2[z]},{z,-1,1}];

Use ?f1 and ?f2 to look at their stored definitions.

Bob Hanlon

>
> From: Helge Stenstroem
To: mathgroup at smc.vnet.net
> Date: 2005/03/31 Thu AM 01:24:00 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg55642] [mg55609] Why are the functions different?
>
> 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
>
>

```

• Prev by Date: Re: Why are the functions different?
• Next by Date: Re: Why are the functions different?
• Previous by thread: Re: Why are the functions different?
• Next by thread: Re: Why are the functions different?