How Does Taylor's Formula Apply to Calculating Trigonometric Functions?

  • Thread starter Thread starter sponsoredwalk
  • Start date Start date
  • Tags Tags
    Formula
Click For Summary

Homework Help Overview

The discussion revolves around the application of Taylor's Formula to calculate the sine function, specifically sin(0.1). The original poster expresses confusion regarding the accuracy of their calculations compared to calculator results and the treatment of the remainder term in Taylor's series.

Discussion Character

  • Mixed

Approaches and Questions Raised

  • The original poster attempts to derive Taylor's polynomial for sin(x) and compute sin(0.1) using the series expansion. They question the accuracy of their result and the relevance of the remainder term Rⁿ.
  • Some participants suggest checking the calculator mode (degrees vs. radians) as a potential source of discrepancy in results.
  • Others discuss the implications of the remainder term and how it relates to determining the number of terms needed for a desired accuracy.
  • There is mention of using linear approximation as an alternative method, raising further questions about the validity and derivation of the error function.

Discussion Status

The discussion is ongoing, with participants exploring different interpretations of Taylor's Formula and its application. Some guidance has been provided regarding the importance of the remainder term and the conditions for achieving the desired accuracy, but no consensus has been reached on the best approach.

Contextual Notes

Participants are navigating the complexities of Taylor's Formula, including the treatment of the remainder term and the implications of using different modes on calculators. There is also a focus on the accuracy required for the approximation of sin(0.1) to three decimal places.

sponsoredwalk
Messages
531
Reaction score
5
Hello, I know how to rederive & prove Taylor's Formula as being a simple application
of Integration By Parts to ∫f'(x) dx = f(b) - f(a) leading to

f(b) = f(a) + f'(a)(b - a) + ½f''(a)(b - a)² + ... + Rⁿ

and that we can approximate f(x) by setting a = 0 & b = x

f(x) = f(0) + f'(0)x + ½f''(0)x² + ... + Rⁿ

and I understand that Rⁿ lies between the lower & upper bound, i.e.
∃ c ∈ (a,b) : f ⁿ (c)(b - a)ⁿ/n! = Rⁿ
& f ⁿ (c)(b - a)ⁿ/n! = Rⁿ

but I'm confused on how to apply all of this.

For example, f(x) = sinx

okay, I can create the taylor polynomial

sinx = x - x³/3! + x^5/5! - ... + Rⁿ

and the question is compute sin(0.1) to 3 decimals.

Well
a = 0,
x = 0 + 0.1 = 0.1

If I compute it to 3 decimals I get

sin(0.1) = (0.1) - (0.1)³/3! + (0.1)^5/5! = 0.099...

Would this be the 3 decimals? Like, this is not correct at all compared to my calculator's answer for sin(0.1).
the way the book has done it has me really confused.
When I add the error on I get no significant change,
I'm confused as to what the point of the formula is here.

I used my calculator for this btw (isn't this equation supposed to do away with calculators? ) ?

Now, my book has done something very different & I don't understand.
(Serge Lang: A First Course in Calculus - page 309)

Lang ignores calculating the Rⁿ term, and hasn't shown me how to get it yet, but
uses the sin/cosine natural upper bound of 1, so Rⁿ ≤ Mⁿ|xⁿ|/n!
where Mⁿ = 1 as an upper bound.

(As a side note, this comes from the proof that ∃ c ∈ (a,b) : f ⁿ (c)(b - a)ⁿ/n!
where he's chosen f ⁿ (v)(b - a)ⁿ/n! = Mⁿ = 1, i.e. v being the maximum,
is the logic correct or am I missing something? He's just squeezing in Rⁿ underneath)With this he just calculates
Rⁿ ≤ Mⁿ|xⁿ|/n! -----------> Rⁿ ≤ 1|(0.1)³|/3!
Rⁿ ≤ (0.001)/6

Now, he says that "such accuracy would put us in the required range of accuracy.
Hence we can just use the first term of Taylor's formula."

sin(0.1) = 0.100 ± (0.001)/6

I have no idea how or why he just did all that, non whatsoever...

I don't understand how I could get an incorrect answer by using the x/3! & x/5!
because the added values are supposed to give a better approximation, not a
worse one

Edit: Thinking about it I can use linear approximation:

f(x) = f(x₀) + f'(x₀)(x - x₀)
f(x) = sin(0) + cos(0)(x - 0)
f(x) = x
sin(0.1) = 0.100

and then use the error function thing but it seems to come out of nowhere, i.e. I made it up &
while it's good to have that backup I'm trying to learn how to get this thing right :p

Another Edit: I think I got it

sin(0.1) = sin(0) + cos(0)•(0.1) - sin(0)•(0.1)² /2 - cos(0)•(0.1)³/6 = 0 + 0.1 - 0 - (0.001)/6

Now, 0.001/6 would be around the third decimal place & that's what the question asked for.

I think that's right, please let me know as it seems correct :D
 
Last edited:
Physics news on Phys.org
sponsoredwalk said:
sinx = x - x³/3! + x^5/5! - ... + Rⁿ

and the question is compute sin(0.1) to 3 decimals.

Well
a = 0,
x = 0 + 0.1 = 0.1

If I compute it to 3 decimals I get

sin(0.1) = (0.1) - (0.1)³/3! + (0.1)^5/5! = 0.099...

Would this be the 3 decimals? Like, this is not correct at all compared to my calculator's answer for sin(0.1).

Your calculator is in degree mode, switch it to radians (or Rad as it often is on calculators,) my calculator gives

\sin (0.1)\appox 0.001745328366 in degree mode​

and

\sin (0.1)\appox 0.99833416647 in radian mode​

also, your calculation of sin(0.1) = (0.1) - (0.1)³/3! + (0.1)^5/5! = 0.099...

is, well

\sin (0.1)\appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.99833416667​

accurate to ten decimal places! A bit too accurate. The first step in the solution to this problem is part that you didn't understand in the book: The proper value of n is what you want to know firs. Beginning with the formula

R_{n}(x)\leq M_{n} \frac{x^n}{n!}​

where R_{n}(x) is the remainder term after calculating n terms of the Taylor series, and \left| f^{(n)}(x)\right| \leq M_{n}. To determine the value of n from the formula (how many terms to calculate in the series to achieve the desired 3 decimal place accuracy) use the bounds of the nth derivative of the function, namely

\left| \frac{d^n}{dx^n}\sin x \right| \leq 1 =: M​

and the required accuracy, which is 3 decimal places so we want R_{n}(0.1)< 0.001, hence we require that

0.001\leq 1\cdot \frac{(0.1)^n}{n!}​

work out the values of the right-hand side for n=1,2, and 3 to see that n=3 is the proper value, now compute the value of the third Taylor polynomial at x=0,1 to get the estimate


\sin (0.1)\appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.99833416667​

the first equation we solved tells us that even though we at ten place accuracy, no lesser amount of terms would give the desired accuracy.
 
Hey thanks for taking the time to write such an in-depth reply but I'm still a little confused.

I've rewritten out all of my knowledge on this topic to make sure I'm not confused, the
rest of this post will just be the proofs & I'll post another post straight after with my confusion.

Using the Fundamental Theorem of Calculus:

\int_{a}^{b} f ' (t)\,dt \ = \ f(b) \ - \ f(a)

We'll rewrite this in integration by part form:

u \ = \ f'(t) \ , \ du \ = \ f''(t) dt \ ,\ dv \ = \ dt \ , \ v \ = \ - (b - t)

(The "v" term includes the minus due to a chain rule differentiation removing it anyway! Very sneaky thing that confused me for a few minutes but I like it! :D).

\int_{a}^{b} u dv \ = \ u v |^b_a \ - \ \int_{a}^{b} v du

\int_{a}^{b} f ' (t)\,dt \ = \ - f'(t)(b \ - \ t) |^b_a \ - \ \int_{a}^{b} - f''(t)(b \ - \ a)dt

\int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ + \ \int_{a}^{b} f''(t)(b \ - \ a)dt

\int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ - \ f''(t)\frac{(b \ - \ a)^2}{2} |^b_a \ - \ \int_{a}^{b} - f'''(t)\frac{(b \ - \ a)^2}{2}dt

\int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt

\int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt

Okay, before I go on I'd like to qualify that the left hand side can be
rewritten as

\int_{a}^{b} f ' (t)\,dt \ = \ f(b) \ - \ f(a)

so that the above becomes

\ f(b) \ - \ f(a) \ = \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt

or better yet:

\ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt

Okay, well you'd keep going with the right hand term until you've
calculated the (n - 1) term & then you want the "n"th term

\ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + ... \ + \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt

\ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + ... \ - \ \ f^n (t) \frac{(b \ - \ t)}{(n )!}^{(n)} |^b_a \ - \ \ f^{(n + 1)}(t) dt \frac{(b \ - \ t)}{(n )!}^{(n)}

\ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + ... \ + \ f^n (a) \frac{(b \ - \ a)}{(n )!}^{(n)} \ + \ \int_{a}^{b} \ f^{(n + 1)}(t) \frac{(b \ - \ t)}{(n )!}^{(n)} dt

Alright, I think all of that is right. My old calculus book gave some
horrendous proof that I don't think anyone would bother memorizing
but this one just falls out of combining I.B.P. with the F.T.C.

As for the proof that

\int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt \ = \ \frac{f^n(c)}{n!}(b \ - \ a)^n

f^n(u) \ = \ m \ \le \ M \ = \ f^n(v) \

These are constants and we'll squeeze the integral in between themm \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ dt \ \le \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt \ \le \ M \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ dt

m \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} dt \ \le \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt \ \le \ M \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} dt

\int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} f^n (u) dt \ \le \ R_n \ \le \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} f^n (v) dt

\frac{(b \ - \ a)}{n!}^{n} f^n (u) \ \le \ R_n \ \le \ \frac{(b \ - \ a)}{n!}^{n} f^n (v)

So, by the Intermediate Value Theorem ∃ c ∈ (a,b) : \frac{f^n(c)}{n!}(b \ - \ a)^n

I'm wondering, is there a way to find this "c" numerically because
neither of the two books I've looked in give you a way to find this?
 
Last edited:
I hope you see how easy & intuitive all of this is, well as for the rest of the
way the chapter goes it's quite confusing.

There's a theorem that says

If ∃ M_n : | f^n(x) | \ \le \ M_n then

| \frac{f^n(c)}{n!}(b \ - \ a)^n | \le \ \frac{M_n|b - a|^n}{n!}

I don't even know what this means, I think it means that if there is a
number such that the "n"th derivative is less than this number then
it's less than the right hand side.

Furthermore, I don't know how to use this in practice :(
The following bits of the chapter all rely on this specific concept & I
can't advance until I get it.

Example, compute sin(0.1) to three decimals.

sin(0.1) ≈ sin(0) + cos(0)•(0.1) - sin(0)•(0.1)²/2 - cos(0)•(0.1)³/6 + sin(0)•(0.1)⁴/24 + cos(0)•(0.1)⁵/120 - sin(0)•(0.1)^6/6! - ...

sin(0.1) ≈ 0 + 0.1 - 0 - (0.1)³/6 + 0 + (0.1)⁵/120 - 0 - ...

sin(0.1) ≈ 0 + 0.1 - 0 - (0.1)³/6 + 0 + (0.1)⁵/120 - 0 - ...

sin(0.1) ≈ 0 + 0.1 - 0 - 0.001/6 + 0 + 0.00001/120 - 0 - ...

sin(0.1) ≈ 0.1 - 0.001/6 + 0.00001/120 - ...

That would give you accuracy to 3 decimal places but I don't see
how the "error" function thing even fits in here or is needed?
If you know, how would I find "c" in this particular example?

Oh, and you've written

<br /> \sin (0.1)\appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.9983341666 7<br />

at the end of your post, but I see you forgot a space in the \sin (0.1)\appox 0.1 term :-p

<br /> \sin (0.1) \appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.9983341666 7<br />

I was confused just until right now where I clicked on it & quoted it :-p NVM!
 
Alright, I think I've got it but there's still a lot of questions...

If you look at the proof in the second post I have a M_n term.
That represents the maximum value on the interval & I think the
formula is saying that you take the maximum possible value of the
"n"th derivative on the interval you're evaluating and you can safely
assume that to be an upper bound.

Because it's a trigonometric function we have a bound of 1 so we
can safely set M_n \ = \ 1

Now, if I am to use the error term in the specific example I gave
I need to find a value of "n" so that I come out with 3 decimal
places of error. 3 seems like a good term! This is kind of a trial-&-error
aspect of the whole process right?

Anyway, if I do this then I'm fine for my example but I have a further
question, how are you supposed to deal with this in general?

If you have a strange polynomial function with lots of curves in
the interval how do you find as suitable M_n ?
Do you just use the normal calculus process of finding max & min
on this separate term?

Is it not just a hell of a lot easier to determine the "c" term & use that?
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
3K
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 27 ·
Replies
27
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K