VF里,用梯形法求定积分 ∫sinxdx (a=0,b=π/2) 积分上限为b 下限为a近似计算公式为h/2[sina(a)+2(sina(a+h)+sin(a+2h)+.sin(a+nh)-sina(b))]要用VF来做
问题描述:
VF里,用梯形法求定积分 ∫sinxdx (a=0,b=π/2) 积分上限为b 下限为a
近似计算公式为h/2[sina(a)+2(sina(a+h)+sin(a+2h)+.sin(a+nh)-sina(b))]
要用VF来做
答
******函数调用示意s1 = Integral(0,PI() / 2,0.001)returnfunction Integral && 梯形法求积分parameters a,b,h && 要求 b > a,并且h > 0s = 0 && 积分值n = (b - a) / h && 梯形数量for i = 1 to ns = s + sin(a + ...