Problem 55775. Taylor Series
You can use a Taylor series to approximate common functions. The Taylor series for sin(x) is
Using only the first several terms in the series could get you a good approximation to the function.
Write a function that takes a point x at which to evaluate the sine function and a tolerance level that defines how close you want the Taylor series approximation to be to the actual value. Your function should output the approximate value of sin(x).
Solution Stats
Problem Comments
-
2 Comments
Rafael S.T. Vieira
on 30 Oct 2022
Using sin(x) to test the tolerance level is probably inadequate. We should be testing how much a new term improved the solution compared to the previous one. If we calculate sin(x) there is no need to use the Taylor series.
Ricardo
on 3 Feb 2023
You are right. I made a solution with the remainder of Lagrange for error estimation. I avoided the sin(x) usage for comparing approximation and real values.
Solution Comments
Show commentsProblem Recent Solvers130
Suggested Problems
-
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
565 Solvers
-
Replace Nonzero Numbers with 1
406 Solvers
-
154 Solvers
-
Check that number is whole number
4557 Solvers
-
特定の値がベクトル内に含まれているかを確認するコードを書こう
319 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!