무한급수의 부분합

375 days ago by namy0727

x, i, n = var('x, i, n') @interact def series(fn=input_box(1/(n*(n+1)), label='$a_n =$'), end=input_box(100, label='n ='), infsum=selector(['No', 'Yes'], nrows=1, label="Total Sum =")): sn = [] for i in range(1,end+1): sn.append(sum(fn,n,1,i)) appsum = RDF(sn[end-1]) pretty_print(html("$$\sum_{n=1}^{%s} %s = %s$$"%(end,latex(fn),latex(appsum)))) if infsum == 'Yes': s = sum(fn,n,1,infinity) pretty_print(html("$$\sum_{n=1}^{\infty} %s = %s$$"%(latex(fn),latex(s)))) p= list_plot([(i,fn(n=i)) for i in range(1,end+1)], size=30, rgbcolor=(1,0,0)) p+= sum(line([(i,0),(i,fn(n=i))],thickness=2, rgbcolor=(1,0,0)) for i in range(1,end+1)) p+= list_plot([(i+1,sn[i]) for i in range(end)], size=30, rgbcolor=(0,0,1)) p.show() 
       
$a_n =$ 
n = 
Total Sum = 

Click to the left again to hide and once more to show the dynamic interactive window