Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I tried to search if similar questions existed but I have not found anything. Can someone help me with this code?

Plot[Normal[Series[Cos[x], {x, 0, 4}]], {x, 0, 3}] 

I am getting an error message

General::ivar: 0.00006128571428571428` is not a valid variable. >>

I would like to plot a series expansion... Thanks in advance.

Regards, Umberto

PS This is a very reduced piece of the work I am working on, just to be able to reproduce the error...

share|improve this question

closed as off-topic by Artes, m_goldberg, RunnyKine, Simon Woods, b.gatessucks May 17 at 16:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Artes, m_goldberg, RunnyKine, Simon Woods, b.gatessucks
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Plot[Evaluate@Normal[Series[Cos[x], {x, 0, 4}]], {x, 0, 3}] –  Öskå May 17 at 13:42
    
Or Plot[ Normal[Series[Cos[x], {x, 0, 4}]], {x, 0, 3}, Evaluated -> True]. –  Artes May 17 at 13:42
    
Ah ok. Thanks a lot to both! –  fasttouch May 17 at 13:42
    
Or fn[x_]:= Normal[Series[Cos[x], {x, 0, 4}]] and Plot[fn[x]...] –  Öskå May 17 at 13:43

1 Answer 1

up vote 3 down vote accepted

From the Series(Possible Issues section):

Series must be converted to normal expressions before being plotted:

Plot[Evaluate[Normal[Series[Sin[x], {x, 0, 10}]]], {x, 0, 2 Pi}]

Mathematica graphics

Or as Artes said in his comment:

Plot[Normal[Series[Sin[x], {x, 0, 10}]], {x, 0, 2 Pi}, Evaluated -> True]
share|improve this answer
    
Thanks a lot for your answer! –  fasttouch May 17 at 14:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.