查看程序错误在哪clearinput"n:" to ndime v(n)for i=1 to n step 1s=sqrt(0.0001+(0.0004+0.02*(sqrt(1.8*i-0.0001*i^2)-sqrt(1.8*(i-1)-0.0001*(i-1)^2)))^2)a=10.05*sin(atan(0.04+0.02*(sqrt(18000*i-i^2)-sqrt(18000*(i-1)-(i-1)^2))))+1.05*cos(atan(0.04
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 14:41:05
查看程序错误在哪clearinput"n:" to ndime v(n)for i=1 to n step 1s=sqrt(0.0001+(0.0004+0.02*(sqrt(1.8*i-0.0001*i^2)-sqrt(1.8*(i-1)-0.0001*(i-1)^2)))^2)a=10.05*sin(atan(0.04+0.02*(sqrt(18000*i-i^2)-sqrt(18000*(i-1)-(i-1)^2))))+1.05*cos(atan(0.04
查看程序错误在哪
clear
input"n:" to n
dime v(n)
for i=1 to n step 1
s=sqrt(0.0001+(0.0004+0.02*(sqrt(1.8*i-0.0001*i^2)-sqrt(1.8*(i-1)-0.0001*(i-1)^2)))^2)
a=10.05*sin(atan(0.04+0.02*(sqrt(18000*i-i^2)-sqrt(18000*(i-1)-(i-1)^2))))+1.05*cos(atan(0.04+0.02*(sqrt(18000*i-i^2)-sqrt(18000*(i-1)-(i-1)^2))))
v(i)=v(i-1)+sqrt(2*a*s)
"结果:"+str(v(i))
endfor
cancel
是关于V=∑sqrt(2*a*s) 求和的 一个计算程序 高手帮看看哪出错了
查看程序错误在哪clearinput"n:" to ndime v(n)for i=1 to n step 1s=sqrt(0.0001+(0.0004+0.02*(sqrt(1.8*i-0.0001*i^2)-sqrt(1.8*(i-1)-0.0001*(i-1)^2)))^2)a=10.05*sin(atan(0.04+0.02*(sqrt(18000*i-i^2)-sqrt(18000*(i-1)-(i-1)^2))))+1.05*cos(atan(0.04
数组定义的下标是从1开始,你的循环从1开始,程序里又有v(i-1),就成了v(0),所以就出错了,你可以在开始给v(1)赋值为0,然后循环从2开始,如:
input"n:" to n
dime v(n)
v(1)=0
for i=2 to n step 1
或者,我看你的程序是一个累加,你不如直接用一个变量k,不用数组:
k=k+sqrt(2*a*s)
?"结果:"+str(k)