MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How come doesn't this work?

  • To: mathgroup at
  • Subject: [mg75708] Re: [mg75659] How come doesn't this work?
  • From: Murray Eisenberg <murray at>
  • Date: Wed, 9 May 2007 04:24:19 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <>
  • Reply-to: murray at

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


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
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

  • Prev by Date: Re: Eigenvalues in Mathematica 6.0.0 are SLOW
  • Next by Date: Re: Using FindFit with constraints ??
  • Previous by thread: How come doesn't this work?
  • Next by thread: Re: How come doesn't this work?