Post Reply 
How to evaluate A Taylor series at a specific value
08-22-2018, 06:56 PM (This post was last modified: 08-22-2018 08:14 PM by Albert Chan.)
Post: #20
RE: How to evaluate A Taylor series at a specific value
[Image: taylor.png]

(05-12-2018 02:56 PM)Joe Horn Wrote:  
(05-12-2018 02:44 PM)DrD Wrote:  taylor(sin(x))|x = 0.5

Hmmmm.... That seems to return sin(.5), not the desired result. Not sure why.
Perhaps the x gets substituted right away, resulting in taylor(sin(.5))?

This is a bug.
Evaluate a taylor series while carrying the O[x] term is meaningless.
This is how Mathematica hande it:

In[1]:= taylor = Series[Sin[x], {x, 0, 5}]
Out[1]= x - x^3/6 + x^5/120 + O[x]^6

In[2]:= taylor /. x -> 0.5
SeriesData::ssdn: Attempt to evaluate a series at the number 0.5; returning Indeterminate.
Out[2]= Indeterminate

In[3]:=Normal[taylor] /. x -> 0.5 (* Drop the O[x] term, then substitute *)
Out[3]= 0.479427

BTW, Mathematica (v 4.0) had the bug too, if x had Pi in it.

In[4]:= taylor /. x-> 1/2 + Pi/10^10 // N
Out[4]= 1. 0.5 - 0.166667 0.125 + .00833333 0.03125 + O[0.5]^6

In[5]:= % // Normal (* above should be Indeterminate too ! Sad *)
Out[5]= 0.479427

BTW, you can test evaluation order with this: (x/x) |x = 0
For Mathematica, it is evaluation before substitution, result = 1, not 0/0
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How to evaluate A Taylor series at a specific value - Albert Chan - 08-22-2018 06:56 PM



User(s) browsing this thread: 1 Guest(s)