vb求和,求sin(x)=x/1-x^3/3!+x^5/5!- …… (-1)^(n-1)* x^(2*n-1)/(2n-1)!感叹号是阶乘的意思Private Sub Form_Click()Dim x%,,i%,q%x = Val(InputBox("请输入X的值"))Do While t >= 10 ^ (-5)s = s + tn = n + 1For k = 1 To 2 * n - 1q = q * kNex
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/26 02:46:35
vb求和,求sin(x)=x/1-x^3/3!+x^5/5!- …… (-1)^(n-1)* x^(2*n-1)/(2n-1)!感叹号是阶乘的意思Private Sub Form_Click()Dim x%,,i%,q%x = Val(InputBox("请输入X的值"))Do While t >= 10 ^ (-5)s = s + tn = n + 1For k = 1 To 2 * n - 1q = q * kNex
vb求和,求sin(x)=x/1-x^3/3!+x^5/5!- …… (-1)^(n-1)* x^(2*n-1)/(2n-1)!感叹号是阶乘的意思
Private Sub Form_Click()
Dim x%,,i%,q%
x = Val(InputBox("请输入X的值"))
Do While t >= 10 ^ (-5)
s = s + t
n = n + 1
For k = 1 To 2 * n - 1
q = q * k
Next k
t = ((-1) ^ (n - 1)) * (x ^ (2 * n - 1)) \ q
Loop
Print "s="; s
End Sub
当第n项的值小于10^-5时结束vb求和,求sin(x)=x/1-x^3/3!+x^5/5!- …… (-1)^(n-1)* x^(2*n-1)/(2n-1)!感叹号是阶乘的意思Private Sub Form_Click()Dim x%,,i%,q%x = Val(InputBox("请输入X的值"))Do While t >= 10 ^ (-5)s = s + tn = n + 1For k = 1 To 2 * n - 1q = q * kNex
Private Sub Form_Click()
Dim x%,s!,i%,q%
x = Val(InputBox("请输入X的值"))
Do While t >= 10 ^ (-5) '问题出在这里,因为t的初值是0,所以t