# 매개변수 곡선의 길이

## 789 days ago by namy0727

t = var('t') r = 1 @interact def para_arc(f=input_box(r*(t-sin(t)), label='x = f(t) =', type=SR), g=input_box(r*(1-cos(t)), label='y = g(t) =', type=SR), Start = input_box(default = 0), End = input_box(default = 2*pi), n = slider(1,20,1,1)): pretty_print(html('$$x = %s, \quad y = %s$$'%(latex(f),latex(g)))) a = Start b = End xfunc(t) = f yfunc(t) = g dt = (b-a)/n xpts = [xfunc(t=a+i*dt) for i in range(n+1)] ypts = [yfunc(t=a+i*dt) for i in range(n+1)] p=Graphics() ds = [] for i in range(0,n): p+=line([(xpts[i],ypts[i]),(xpts[i+1],ypts[i+1])]) dx = xpts[i+1] - xpts[i] dy = ypts[i+1] - ypts[i] ds.append(sqrt(dx^2 + dy^2)) Ln = sum(ds); Ln = RDF(Ln) dxdt = diff(f,t); dydt = diff(g,t) dsdt = sqrt(dxdt^2+dydt^2); dsdt.simplify_full() L = integral(dsdt,t,a,b/2); L =2*L; L = RDF(L) err = abs(L - Ln) p+= parametric_plot((f, g), (t,a,b),rgbcolor = (1,0,0)) p.show(aspect_ratio=1) print "L =", L print "Ln = %s" %(Ln) print "Error =", err

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