taylor series expansion for acos(1-x)
5 views (last 30 days)
Show older comments
MatLab gave error messages for taylor(acos(1-x),x) (after syms x) while the expansion does exist?
0 Comments
Accepted Answer
John D'Errico
on 30 Oct 2019
Edited: John D'Errico
on 30 Oct 2019
Actually, the expansion you ask for does NOT exist. Why not? Because. I hope that is a good enough answer.. ;-)
Seriously, the expansion fails, because at x==0, there is a singularity, so you cannot write a Taylor series. Think about it. What is the first derivative of acos(1-x), evaluated at x==0?
fprime = diff(acos(1-x),x)
fprime =
1/(1 - (x - 1)^2)^(1/2)
>> subs(fprime,x,0)
Error using symengine
Division by zero.
Error in sym/subs>mupadsubs (line 160)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 145)
G = mupadsubs(F,X,Y);
So can you write a Taylor series, expanded around x==0? NO! NO! NO!
But does that mean no expansion exists? A Tsaylor series expansion DOES exist, as long as you use an expansion point where the function is not singular. The default expansion point for the function Taylor is at x==0. So, in one line, we can get a series expansion as you seem to want, as long as you override the default for the expansion point.
taylor(acos(1-x),x,'expansionpoint',0.5)
ans =
pi/3 + (2*3^(1/2)*(x - 1/2))/3 - (2*3^(1/2)*(x - 1/2)^2)/9 + (8*3^(1/2)*(x - 1/2)^3)/27 - (28*3^(1/2)*(x - 1/2)^4)/81 + (608*3^(1/2)*(x - 1/2)^5)/1215
Will the Taylor series give anything meaningful, if you then tried to use it at x==0? NO! It won't work well, not in trying to predict the value at x==0. But that just reflects the idea that trying to predict the value of a function with an infinite slope at the prediction point using a polynomial approximation is likely to be a really bad idea.
Not all functions are well approximated by Taylor series. (You might want to re-read your class notes about convergence of a series.)
0 Comments
More Answers (1)
Robert Tzou
on 30 Oct 2019
1 Comment
John D'Errico
on 4 Nov 2019
Edited: John D'Errico
on 4 Nov 2019
Please don't use answers to make a comment. Use comments to make comment.
Of course, If you knew what you wnted - that A Taylor series will fail when expanded around zero, then why are you complaining that a Taylor series won't work?
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!