Re: Why are the functions different?

• To: mathgroup at smc.vnet.net
• Subject: [mg55635] Re: [mg55609] Why are the functions different?
• From: "Florian Jaccard" <florian.jaccard at he-arc.ch>
• Date: Fri, 1 Apr 2005 05:36:07 -0500 (EST)
• Reply-to: <florian.jaccard at he-arc.ch>
• Sender: owner-wri-mathgroup at wolfram.com

Hello Helge !

If you define  f1[x_]:=... ,
and you plot :  Plot[f1[x],{x,0,5}] ,
x is replaces by 0, 0+very small , etc. to calculate the points of the
ploting.
Mathematica will then try to find f1[0]=Normal[Series[Tanh[0],{0,0,5}]] ,
which is of course not possible!

You have 2 possibilities to do what you want :

1)
define :  f1[x_]= Normal[Series[Tanh[x], {x, 0, 5}]]

2)
f1[x_]:=...

and :  Plot[Evaluate[f1[x],{x,0,5}]]

Regards

F.Jaccard

-----Message d'origine-----
De : Helge Stenstroem [mailto:helge.stenstrom.NOSPAM at NOSPAMericsson.com]
Envoyé : jeu., 31. mars 2005 08:24
À : mathgroup at smc.vnet.net
Objet : [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: Replacing an expression by an expression
• Previous by thread: Re: Why are the functions different?
• Next by thread: Re: Why are the functions different?