vb求cos(x)的近似值,cos(x)=1-x^2/2!+x^4/4!-.+(-1)^(n=1)*x(2*n-2)/(
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/18 18:12:33
vb求cos(x)的近似值,cos(x)=1-x^2/2!+x^4/4!-.+(-1)^(n=1)*x(2*n-2)/(2*n-2)!精确到10^-6
Private Sub Command1_Click()
Dim i As Integer,b As Integer,c As Integer
x = Text1.Text
b = 0
For i = 1 To n
b = b + a(i)
c = Abs(b \ 1 - b)
If c < 10 ^ (-6) Then
Text2.Text = b
Next i
End If
End Sub
Public Function a(i As Single) As Double
Dim i As Integer,d As Integer
d = 1
x = Text1.Text
For j = 1 To 2 * i - 2
d = d * j
Next j
a(i) = (-1) ^ (i + 1) * x ^ (2 * n - 2) / d
End Function
我建了两个text文本,一个输入x,一个输出结果,然后点击一个命令框计算输出结果,
Private Sub Command1_Click()
Dim i As Integer,b As Integer,c As Integer
x = Text1.Text
b = 0
For i = 1 To n
b = b + a(i)
c = Abs(b \ 1 - b)
If c < 10 ^ (-6) Then
Text2.Text = b
Next i
End If
End Sub
Public Function a(i As Single) As Double
Dim i As Integer,d As Integer
d = 1
x = Text1.Text
For j = 1 To 2 * i - 2
d = d * j
Next j
a(i) = (-1) ^ (i + 1) * x ^ (2 * n - 2) / d
End Function
我建了两个text文本,一个输入x,一个输出结果,然后点击一个命令框计算输出结果,
太麻烦了我觉得.只要do loop就行了.
Private Sub Command1_Click()
x = Val(Text1.Text)
t = 2
n = 2
s = 1
Do
f = (-1) ^ (n + 1) * x ^ (2 * (n - 1)) / t
s = s + f
n = n + 1
t = t * (2 * n - 3) * (2 * (n - 1))
Loop Until Abs(f)
Private Sub Command1_Click()
x = Val(Text1.Text)
t = 2
n = 2
s = 1
Do
f = (-1) ^ (n + 1) * x ^ (2 * (n - 1)) / t
s = s + f
n = n + 1
t = t * (2 * n - 3) * (2 * (n - 1))
Loop Until Abs(f)
设f(x)=cos^(nπ+x).sin^(nπ-x)/cos^[(2n+1)π-x](n∈z)求f(π/6)的值
.若f(x)={sin(n派-x)cos(n派+x)/cos[(n+1)派-x]}*tan(x-n派)cot[(n派/2
已知向量m=(根号3sin(x/4),1),向量n=(cos(x/4),cos^2(x/4))
cos x=1/2,求x?
已知向量m=(根号3sin(x/4),1),向量n=(cos(x/4),cos^2(x/4))f(x)=m.n
已知f(x)=cos²(nπ+x)sin²(nπ-x)/cos²[(2n+1)π-x](n
已知函数f(x)=6cos^4x-5cos^2x+1/2cos^2x-1,求f(x)的定义域值域
一道VB题目,实验5.6 对x=1,2,...,10,求函数f(x)=x-10*cos(x
已知向量m=(根号3sin(x/4),1),向量n=(cos(x/4),cos^2(x/4)),若m.n=1
编写一个程序,输入x和n后计算公式的近似值.e^x=1+x+x^2/2!+x^3/3!+⋯+x^n/n!
VB求e的近似值利用e^x的近似公式计算e(直到最后一项小于10^-6)e^x=1+x/1!+x^2/2!+……x^n/
帮忙解一道极限的题n=>无穷lim[cos(x/2)cos(x/2^2)cos(x/2^3)...cos(x/2^n)]