Sale!

Lab #4 Taylor Series Expansion

$30.00

Category:
Rate this product

CST8233: Lab #4
Taylor Series Expansion
Objective
The objective of this lab is to familiarize the student with the theory topics
covered in week 3. Mainly, this lab focuses on Taylor Series expansion.
Earning
To earn your mark for this lab, each student should finish the lab’s
requirements within the lab session and demonstrate the working code to the
instructor.
Discussion
Before starting the lab, the student has to show the instructor the steps of
developing Taylor series in general. Then, each student should derive Taylor
series for the function 𝑓(𝑥) = ln 𝑥 around 𝑎 = 1.
Laboratory Problem Description
The Taylor series expansion of 𝑓(𝑥) = ln 𝑥 around 𝐶 is given as:
ln 𝑥 = ∑(−1)
𝑛−1
(𝑥 − 𝑎)
𝑛
𝑛

𝑛=1
Part A: Write a C\C++ program which takes x as input and computes the
series for up to 10 terms. Your program should print the final value of 𝑓(𝑥) =
ln 𝑥 obtained along with the absolute and relative errors. Your program needs
to get the true value of 𝑓(𝑥) = ln 𝑥 using the built-in function in C.
Part B: Run your program for x = 0.5, 1.5, 2.0, and 3.3. Report the results
you get for each one. How accurate are your results?
Part C: Run your program for the same value of x as in part B but change
the number of terms to be 100. Report the results you get for each one. How
accurate are your results?
;
Part B Test:
Enter the value of x: 0.5
The number 0f terms: 10
True value = -0.693147
Taylor value = -0.692967
Absolute error=0.000180
Relative error =-0.025966
Enter the value of x:1.5
The number 0f terms :10
True value = 0.405465
Taylor value = 0.405532
Absolute error =0.000067
Relative error =0.016573
Enter the value of x:2.0
The number 0f terms :10
True value = 0.693147
Taylor value = 0.745635
Absolute error =0.052488
Relative error =7.572380
Enter the value of x:3.3
The number 0f terms :10
True value = 1.193922
Taylor value = 135.794385
Absolute error =134.600462
Relative error =11273.802614

Reviews

There are no reviews yet.

Be the first to review “Lab #4 Taylor Series Expansion”

Your email address will not be published. Required fields are marked *

Scroll to Top