매개변수 방정식의 미분

252 days ago by namy0727

t, x, y = var('t, x, y') t0 = -2; t1 = 2 dt = (t1-t0)/40 @interact def para_tan1(f=input_box(t^2, label='x = f', type=SR), g=input_box(t^3-3*t, label='y = g', type=SR), Start = input_box(default = t0), End = input_box(default = t1), tpoint = input_box(default=-sqrt(3))): init = Start end = End tpt = tpoint dxdt = diff(f,t); dydt = diff(g,t) min_x = find_local_minimum(f,init,end )[0] max_x = find_local_maximum(f,init,end )[0] min_y = find_local_minimum(g,init,end )[0] max_y = find_local_maximum(g,init,end )[0] p = point((f(t=init),g(t=init)), color='red', size=30) + point((f(t=end),g(t=end)), color='red', size=30) p+= text('$t = %s$'%(init), (f(t=init)+0.2,g(t=init)-0.2), color='red', fontsize=15) + text('$t = %s$'%(end), (f(t=end)+0.2,g(t=end)+0.2), color='red', fontsize=15) p+= parametric_plot((f, g), (t,init,end),rgbcolor = (1,0,0), thickness=2) R = RealField(16) p+= point((f(t=tpt),g(t=tpt)), color='red', size=30)+text('$t = %s$'%(R(tpt)), (f(t=tpt)+0.5,g(t=tpt)+0.2), color='red', fontsize=15) if dxdt(t=tpt) == 0: p+= line([[f(t=tpt),min_y],[f(t=tpt),max_y]], thickness=2) x0=f(t=tpt); R(x0) pretty_print(html('Tangent line is $x\;=\;%s$'%latex(x0))) else: dydx = dydt/dxdt R = RealField(8) s = dydx(t=tpt); R(s) x0=f(t=tpt); R(x0) y0=g(t=tpt); R(y0) tan_lin = y0 + s*(x-x0) p+= plot(tan_lin, (x, min_x, max_x), thickness=2) pretty_print(html('Tangent line is $y\;=\;%s$'%latex(tan_lin))) p.show(xmin = min_x, xmax = max_x, ymin = min_y, ymax = max_y, aspect_ratio=1) 
       
x = f 
y = g 
Start 
End 
tpoint 

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

t, x, y = var('t, x, y') t0 = -2*pi; t1 = 2*pi r = 1 @interact def para_tan2(f=input_box(r*(t-sin(t)), label='x = f', type=SR), g=input_box(r*(1-cos(t)), label='y = g', type=SR), Start = input_box(default = t0), End = input_box(default = t1), tpoint = input_box(default=pi/3)): R = RealField(16) init = R(Start); end = R(End) tpt = tpoint dxdt = diff(f,t); dydt = diff(g,t) min_x = find_local_minimum(f,init,end )[0] max_x = find_local_maximum(f,init,end )[0] min_y = find_local_minimum(g,init,end )[0] max_y = find_local_maximum(g,init,end )[0] p = point((f(t=init),g(t=init)), color='red', size=30) + point((f(t=end),g(t=end)), color='red', size=30) p+= text('$t = %s$'%(init), (f(t=init)+0.2,g(t=init)+0.2), color='red', fontsize=15) + text('$t = %s$'%(end), (f(t=end)+0.2,g(t=end)+0.2), color='red', fontsize=15) p+= parametric_plot((f, g), (t,init,end),rgbcolor = (1,0,0), thickness=2) R = RealField(16) p+= point((f(t=tpt),g(t=tpt)), color='red', size=30)+text('$t = %s$'%(R(tpt)), (f(t=tpt)+0.2,g(t=tpt)-0.2), color='red', fontsize=15) if dxdt(t=tpt) == 0: p+= line([[f(t=tpt),min_y],[f(t=tpt),max_y]], thickness=2) x0=f(t=tpt); R(x0) pretty_print(html('Tangent line is $x\;=\;%s$'%latex(x0))) p.show(xmin = min_x, xmax = max_x, ymin = min_y, ymax = max_y, aspect_ratio=1) else: dydx = dydt/dxdt R = RealField(8) s = dydx(t=tpt); R(s) x0=f(t=tpt); R(x0) y0=g(t=tpt); R(y0) tan_lin = y0 + s*(x-x0) p+= plot(tan_lin, (x, min_x, max_x), thickness=2) pretty_print(html('Tangent line is $y\;=\;%s$'%latex(tan_lin))) p.show(xmin = min_x, xmax = max_x, ymin = min_y, ymax = max_y, aspect_ratio=1) 
       
x = f 
y = g 
Start 
End 
tpoint 

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