Re: How come doesn't this work?
- To: mathgroup at smc.vnet.net
- Subject: [mg75708] Re: [mg75659] How come doesn't this work?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Wed, 9 May 2007 04:24:19 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200705080947.FAA18448@smc.vnet.net>
- Reply-to: murray at math.umass.edu
It doesn't work because you used "=" (Set) instead of ":=" (SetDelayed)in your definition for Grafico. With Set, Mathematica tries to evaluate the right-hand side of the definition immediately, in order to assign it to the left-hand side. But your n does not yet have any numerical value, hence Taylor[n] does not yet have a specific Taylor polynomial value, and hence Plot cannot work. The clue as to what was happening should be the error message you get, about n not being numerical. The fix is simple, change = to := in the definition of Grafico: Grafico[n_] := Plot[.....] Then something like Grafico[5] works as expected. P.S. It would be much better if you use as Subject of a post here something much more specific than "How come doesn't this work?" Anolethron wrote: > I know I have to put Evaluate In but it doesn't work still. > Taylor[n_] := Normal[Series[ArcTan[x], {x, 0, n}]] > > F = ArcTan[x] > Grafico[n_] = > Plot[{F, Taylor[n]} // Evaluate, {x, -Pi, Pi}, > DisplayFunction -> $DisplayFunction] > > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- How come doesn't this work?
- From: "Anolethron" <abacus78685@tin.it>
- How come doesn't this work?