I get a close error/remainder to this series, but it's wrong why?

  • Thread starter Thread starter s3a
  • Start date Start date
  • Tags Tags
    Series
Click For Summary
SUMMARY

The forum discussion centers on calculating the error in approximating the function f(x) = ln(sec(x)) using its fourth-degree Taylor polynomial at a = 0. The user correctly identifies the error as E(-0.1) = ln(sec(-0.1)) - (1/2*0.1^2 + 1/12*0.1^4), yielding a result of approximately 2.22899019757457996644E-8, which slightly differs from the provided correct answer of 2.22899018157481E-8. The discrepancy arises from the limitations of floating-point precision in calculations. The discussion also touches on the relevance of Lagrange's remainder formula for error estimation when direct computation of f(x) is impractical.

PREREQUISITES
  • Understanding of Taylor series and Maclaurin series
  • Familiarity with error analysis in numerical methods
  • Knowledge of Lagrange's remainder formula
  • Basic proficiency in floating-point arithmetic and its limitations
NEXT STEPS
  • Study Taylor series convergence and error bounds
  • Learn about Lagrange's remainder formula and its applications
  • Explore numerical methods for function approximation
  • Investigate floating-point precision issues in computational mathematics
USEFUL FOR

Mathematicians, students studying calculus, and anyone involved in numerical analysis or computational mathematics will benefit from this discussion.

s3a
Messages
828
Reaction score
8

Homework Statement


The Taylor series for f(x) = ln(sec(x)) at a = 0 is ##Σ_{n=0}^{∞} c_n x^n##.

(a) Find the first few coefficients. (I don't need help for this part.)

(b) Find the exact error in approximating ln(sec(-0.1)) by its fourth-degree Taylor polynomial at a = 0.

Homework Equations


E(x) = f(x) - ##P_n (x)##, or in this case, E(-0.1) = f(-0.1) - ##P_4 (-0.1)##


The Attempt at a Solution


I found the cofficients of each term of the polynomial, but I don't feel it's necessary to show you how I did that, since you can just confirm that I'm right by looking here.:
http://www.wolframalpha.com/input/?i=ln(sec(x))+maclaurin+polynomial

If I'm correct, for this problem, the error is the difference between the function and the 4th degree polynomial.:
E(-0.1) = f(-0.1) - ##P_4 (-0.1)## = ln(sec(-0.1)) – (1/2*0.1^2+1/12*0.1^4) = 2.22899019757457996644E-8 ≠ 2.22899018157481E-8

Notice how my answer (which is the one on the left-hand side) differs slightly from the correct answer (which is the one on the right-hand side) of the problem.

Where is this small disagreement in error/remainder values coming from?

Any input would be greatly appreciated!
 
Physics news on Phys.org
s3a said:

Homework Statement


The Taylor series for f(x) = ln(sec(x)) at a = 0 is ##Σ_{n=0}^{∞} c_n x^n##.

(a) Find the first few coefficients. (I don't need help for this part.)

(b) Find the exact error in approximating ln(sec(-0.1)) by its fourth-degree Taylor polynomial at a = 0.

Homework Equations


E(x) = f(x) - ##P_n (x)##, or in this case, E(-0.1) = f(-0.1) - ##P_4 (-0.1)##


The Attempt at a Solution


I found the cofficients of each term of the polynomial, but I don't feel it's necessary to show you how I did that, since you can just confirm that I'm right by looking here.:
http://www.wolframalpha.com/input/?i=ln(sec(x))+maclaurin+polynomial

If I'm correct, for this problem, the error is the difference between the function and the 4th degree polynomial.:
E(-0.1) = f(-0.1) - ##P_4 (-0.1)## = ln(sec(-0.1)) – (1/2*0.1^2+1/12*0.1^4) = 2.22899019757457996644E-8 ≠ 2.22899018157481E-8

Notice how my answer (which is the one on the left-hand side) differs slightly from the correct answer (which is the one on the right-hand side) of the problem.

Where is this small disagreement in error/remainder values coming from?

Any input would be greatly appreciated!

Who ever generated that 'correct' answer probably used a floating point calculator that was only accurate to 16 decimal places. There's no real reason to list that many decimal places. Especially when the last 12 or so aren't even correct.
 
  • Like
Likes   Reactions: 1 person
Dick said:
Who ever generated that 'correct' answer probably used a floating point calculator that was only accurate to 16 decimal places. There's no real reason to list that many decimal places. Especially when the last 12 or so aren't even correct.
Okay, so ln(sec(-0.1)) – (1/2*0.1^2+1/12*0.1^4) is the correct answer, right?

Also, I have to consider only up to, and including, n=4 and not n=5, right? I ask since the n=5 case yields 0, so I just want to make sure that I understand the procedure correctly too, and it's not just a coincidence that I get the correct answer (because of the n=5 case being 0, in this case).

Assuming everything is fine concerning what I said above, could you please tell me why one would use Lagrange's remainder formula instead of just computing ##E(x) = f(x) – P_n(x)## (which seems easier and yields and accurate answer)?
 
We have
0.1->2.22899019757457996644E-8
0.0999999998804874->2.22899018157481E-8

The second answer results from a less accurate calculation.
To see exactly how that happens we would need to know more about how each calculation was performed.
 
  • Like
Likes   Reactions: 1 person
s3a said:
...why one would use Lagrange's remainder formula instead of just computing ##E(x) = f(x) – P_n(x)## (which seems easier and yields and accurate answer)?

Lagrange's remainder formula can be used when we cannot calculate f(x).
We use the Maclaurin polynomial because f is expensive or impossible to compute. If we compute f(x) to high accuracy we might not even need to use the Maclaurin polynomial.
 
  • Like
Likes   Reactions: 1 person
Thanks guys! :)
 

Similar threads

Replies
6
Views
3K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 20 ·
Replies
20
Views
12K