import math def sin_approx(x, acc): approx = 0 term1 = x n = 1 while abs(term1)>= acc: approx += term1 n += 2 term1 = ((-1)*(n//2))*(x**n)/math.factorial(n) return approx
import math def sin_approx(x, acc): approx = 0 term1 = x n = 1 while True: approx += term1 if term1 < acc: break n += 2 term1 = ((-1)*(n//2))*(x**n)/math.factorial(n) return approx
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)