Professional Documents
Culture Documents
Math Assign2 Merged
Math Assign2 Merged
1 Using four significant figures in the computations, (a)Write a program to determine 𝑑(sin(𝑥))⁄𝑑𝑥 at x =0.2 from the forward difference
approximation for 0 ≤ 𝑥 ≤ 1. (b)Write a program to determine 𝑑(𝑐𝑜𝑠(𝑥))⁄𝑑𝑥 at x =0.8 from the backward difference approximation for 0 ≤ 𝑥 ≤ 1.
Deduct insights about the value of h that gives the most accurate result. (This requires experimentation). Assume suitable values if required.
import math
import matplotlib.pyplot as plt