vb程序编码,计算表达式s=-x+2x^2/3!-4x^4/5!+6x^8/7!-…,x属于[1,2],要求计算精度为第
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/11 03:44:31
vb程序编码,
计算表达式s=-x+2x^2/3!-4x^4/5!+6x^8/7!-…,x属于[1,2],要求计算精度为第n项的值小于10^(-5)
计算表达式s=-x+2x^2/3!-4x^4/5!+6x^8/7!-…,x属于[1,2],要求计算精度为第n项的值小于10^(-5)
Dim s As Double, x As Single, t As Double, n As Integer, m As Integer, fact As Double
x = Rnd + 1
n = 2
s = -x
Do
m = 2 ^ (n - 1)
fact = 1
For i = 1 To 2 * n - 1
fact = fact * i
Next i
t = (-1) ^ n * (2 * n - 2) * x ^ m / fact
s = s + t
If (2 * n - 2) * x ^ m / fact < 10 ^ (-5) Then Exit Do
n = n + 1
Loop
Print "当最后一项等于" & (2 * n - 2) * x ^ m / fact & "时," & "s" & " = " & s编码大概这样写,但是由于数值太大,会提示溢出错误.VB中没有提供可以存储这么大数的数值类型.
x = Rnd + 1
n = 2
s = -x
Do
m = 2 ^ (n - 1)
fact = 1
For i = 1 To 2 * n - 1
fact = fact * i
Next i
t = (-1) ^ n * (2 * n - 2) * x ^ m / fact
s = s + t
If (2 * n - 2) * x ^ m / fact < 10 ^ (-5) Then Exit Do
n = n + 1
Loop
Print "当最后一项等于" & (2 * n - 2) * x ^ m / fact & "时," & "s" & " = " & s编码大概这样写,但是由于数值太大,会提示溢出错误.VB中没有提供可以存储这么大数的数值类型.
vb程序编码,计算表达式s=-x+2x^2/3!-4x^4/5!+6x^8/7!-…,x属于[1,2],要求计算精度为第
用vb计算表达式s=-x+2x^2/3!-4x^4/5!+6x^8/7!-…,x属于[1,2],要求计算精度为第n项的值
C语言编程:计算S=-x+2x^2/3!-4x^4/5!+6x^6/7!-.,x属于[1,2],要求计算精度为第n项的值
vb编写程序,计算表达式的值 1+x/2!+x^2/4!+x^3/6!+.x^n(2n)!
编写程序,单击计算按钮,则计算下面表达式的值,要求精度为第n项的值小于0.00001. S=1+2x/x2+3x/x3+
a*b=2×a+b 计算x*2x*3x*4x*5x*6x*7x*8x*9x=3039 x=
C语言编写程序计算下列函数(精度为0.0001%) (1)sinx=x-x^3/3!+x^5/5!-x^7/7!+...
计算(x*x+4x+5)/(x+2)-(x*x+6x+10)/(x+3)+1
写出用秦九韶算法计算多项式f(x)=8x^7+5x^6+3x^4+2x+1的程序?并求出当x=2时,函数值f(2)的值.
x/x-3-5x/x^2-x-6计算
计算:(x-1)(x^2-4X+3)-x(x^2-5X+2)有过程
计算2x X 4x--3x=