-
peng111说:
使用hadoop语言,给定x和n的值,求sin(x),公式如下
siin x=x-x立方/3!+x的五次方/5!一直到+(-1)的n-1次方*x的2n-1次方/(2n-1)!解释:
map(x,n):
result = x
for i in range(1,n):
result = result - pow(x,2i-1)/factorial(2i-1)*(pow(-1,i-1))
return result
reduce(list):
final_result = 0
for result in list:
final_result += result
return final_result