利计算。
mfp吧
全部回复
仅看楼主
level 12
喂wswswsws 楼主
help
@language:simplified_chinese
计算复利。
OK
@end
endh
function fulijs( )
variable x=input("请输入,[本金,利率%,时间]:")
variable a=x[0]
variable b=x[1]
variable c=x[2]
variable d
d=a*((1+b%)**c)
print("结果:"+round(d,3)+"\n")
return (fulijs())
endf
2016年08月09日 03点08分 1
level 13
[疑问]利息d=a*(((1+b%)**c)-1)。弄个if分支,给束循环。把结果汇总作个图
2016年08月09日 04点08分 2
level 13
function pic_lix()
plot2DEX("利息/本金", "(利率(0.04~0.05);时间:50)", "x(本金:元)", "y(利息:元)", "black", true, "4%", "yellow", "point", 4, "blue", "solid", 2, 1, 50, 1, "t", "t*(1.04**50-1)","5%", "yellow", "point", 4, "green", "solid", 2, 1, 50, 1, "t", "t*(1.05**50-1)")
plot2DEX("利息/时间", "(本金:100;时间:50)", "x(时间:年)", "y(利息:元)", "black", true, "4%", "yellow", "point", 4, "blue", "solid", 2, 1, 50, 1, "t", "100*(1.04**t-1)","5%", "yellow", "point", 4, "green", "solid", 2, 1, 50, 1, "t", "100*(1.05**t-1)")
plot2DEX("利息/利率", "(本金:100;时间:50)", "x(利率:%)", "y(利息:元)", "black", true, "t%", "yellow", "point", 4, "blue", "solid", 2, 0, 10, 1, "t", "100*((1+t/100)**50-1)")
endf
2016年08月09日 06点08分 3
[真棒]
2016年08月09日 07点08分
level 12
喂wswswsws 楼主
2016年08月09日 07点08分 4
level 12
喂wswswsws 楼主
@zhengtao94364 为什么不能把用户输入的数据带到plot2dex里呢?
function fulijs_tu( )
//计算第n年的利息。
variable x=input("请输入,[本金,利率%,时间]:")
variable a=x[0]
variable b=x[1]
variable c=x[2]
variable d,e
for e=1 to c step 1
d=a*(((1+b%)**e)-1)
print("第"+e+"年的利息:"+round(d,3)+"\n")
next
plot2DEX("复利计算", "每年的利息", "x(时间)", "y(利息:元)", "black", true, "增长趋势", "yellow", "point", 4, "blue", "solid", 2, 0, 10, 1, "t", "x[0]*((1+x[1]/100)**x[2]-1)")
return (fulijs())
endf
比如把a,b,c,带进去。我用x[0],x[1],x[2],也不行。
2016年08月09日 07点08分 5
level 12
喂wswswsws 楼主
就像这样,为什么是无效的表达式和没有找到定义的参数。
function fulijs_tu( )
//计算第n年的利息。
variable x=input("请输入,[本金,利率%,时间]:")
variable a=x[0]
variable b=x[1]
variable c=x[2]
plot2DEX("复利计算", "每年的利息", "x(时间)", "y(利息:元)", "black", true, "增长趋势", "yellow", "point", 4, "blue", "solid", 2, 0, c, 1, "t+1", "a*((1+b/100)**(t+1)-1)")
variable d,e
for e=1 to c step 1
d=a*(((1+b%)**e)-1)
print("第"+e+"年的利息:"+round(d,3)+"\n")
next
return (fulijs())
endf
2016年08月09日 07点08分 6
level 13
"a*((1+b/100)**(t+1)-1)"不存在,自变量为t,函数中不能有别的变量,只能是含t的函数f(t)表达式,画图中a,b,c要为常数或含t的表达式
2016年08月09日 13点08分 7
当用户输入a,和b时,a,b就相当于常量啊!
2016年08月09日 14点08分
level 13
function fulijs(a,b,c)
variable d=a*(((1+b/100)**(c+1))-1)
variable s="增长趋势,0,"+c+",1,t+1,"+a+"*(((1+"+b/100+")**(t+1))-1)"
variable s1=tostring(s)
variable cv1=split(s1,",")
variable m1=trim(cv1[0])
variable a1=evaluate(cv1[1])
variable b1=evaluate(cv1[2])
variable c1=evaluate(cv1[3])
variable t1=trim(cv1[4])
variable f1=trim(cv1[5])
plot2DEX("复利计算/每年的利息", "每年的利息", "x时间:年", "y利息:元", "black", true,m1, "green", "triangle", 2, "blue", "solid", 1, a1,b1,c1,t1,f1)
return("利息(元):"+round(d,2))
endf
2016年08月12日 04点08分 8
[真棒]变量的定义牛,手动点赞
2016年08月12日 07点08分
系统函数运用自如,高手。
2016年08月12日 07点08分
level 12
喂wswswsws 楼主
成了,现在既可以打出每年的利息,还可以作图。
源代码如下:
nction fulijs_tu( )
//计算第n年的利息。
variable x=input("请输入,[本金,利率%,时间]:")
variable a=x[0]
variable b=x[1]
variable c=x[2]
variable d,e
for e=1 to c step 1
d=a*(((1+b%)**e)-1)
print("第"+e+"年的利息:"+round(d,3)+"\n")
next
variable s="增长趋势,-1,"+(c-1)+",1,t+1,"+a+"*(((1+"+b/100+")**(t+1))-1)"
variable s1=tostring(s)
variable cv1=split(s1,",")
variable m1=trim(cv1[0])
variable a1=evaluate(cv1[1])
variable b1=evaluate(cv1[2])
variable c1=evaluate(cv1[3])
variable t1=trim(cv1[4])
variable f1=trim(cv1[5])
plot2DEX("复利计算/每年的利息", "每年的利息", "x时间:年", "y利息:元", "black", true,m1, "green", "triangle", 2, "blue", "solid", 1, a1,b1,c1,t1,f1)
return (fulijs_tu())
endf
感谢@zhengtao94364 的作图函数的完善。
2016年08月12日 08点08分 9
level 13
①循环退出问题,
②输入if(or(a==0,b==0,c==0))即a,b,c有其一为零怎样解决?
③读取文本data进行批量计算并存储。
④相关数据批量作图
2016年08月12日 10点08分 11
1,可以直接退出就可以了。 2,可以用if判断,然后打印提示重新输入正确数据。 3,文本操作现在还不是很懂。 4,完全不懂怎么办。 我慢慢完善。
2016年08月12日 11点08分
1