CoCalc Public FilesІнтерактивна демонстрація.sagews
Views : 36
%var t
@interact(style="background-color:LightCyan; border:5px inset Blue; border-radius: 6px;box-shadow : 8px 8px 4px #888;",layout={'top': [['te']],'bottom':[['r'],['A']]})
def reper(te=text_control(default="<font color=blue size=6><b>Рухомий репер</b><br></font>",label=False),r=input_box(default=[t^2,t,t],label="<font color=blue size=5>$\overrightarrow{r}=$</font>", width=30),A=input_box(default=(4,2,2),label="<font color=blue size=5>$A$</font>", width=30),t0=input_box(default=2,label="<font color=blue size=5>$t_0=$</font>", width=30),m = input_grid(3,2, default = [[2,6],[1,4],[1,3]], label="<font color=blue size=5>$x$<br>$y$<br>$z$</font>", to_value=matrix, width=30),T = input_grid(1,2, default = [[1.5,2.5]], label="<font color=blue size=5>$t$</font>", to_value=matrix, width=30),p1=checkbox(default=False, label="<font color=blue size=5>Спрямна площина</font>", readonly=False),p2=checkbox(default=False, label="<font color=blue size=5>Нормальна площина</font>", readonly=False),p3=checkbox(default=False, label="<font color=blue size=5>Стична площина</font>", readonly=False)):
r=vector(r)
dr(t)=[diff(r[0],t),diff(r[1],t),diff(r[2],t)]
d2r(t)=[diff(diff(r[0],t),t),diff(diff(r[1],t),t),diff(diff(r[2],t),t)]
v1=vector([dr[0](t0)/abs(dr(t0))+A[0],dr[1](t0)/abs(dr(t0))+A[1],dr[2](t0)/abs(dr(t0))+A[2]])
v2=vector([dr(t0).cross_product(d2r(t0))[0]/abs(dr(t0).cross_product(d2r(t0)))+A[0],dr(t0).cross_product(d2r(t0))[1]/abs(dr(t0).cross_product(d2r(t0)))+A[1],dr(t0).cross_product(d2r(t0))[2]/abs(dr(t0).cross_product(d2r(t0)))+A[2]])
v3=vector([dr(t0).cross_product(d2r(t0))[0]/abs(dr(t0).cross_product(d2r(t0))),dr(t0).cross_product(d2r(t0))[1]/abs(dr(t0).cross_product(d2r(t0))),dr(t0).cross_product(d2r(t0))[2]/abs(dr(t0).cross_product(d2r(t0)))]).cross_product(vector([dr[0](t0)/abs(dr(t0)),dr[1](t0)/abs(dr(t0)),dr[2](t0)/abs(dr(t0))]))
v3=vector([v3[0]+A[0],v3[1]+A[1],v3[2]+A[2]])
f(x,y,z)=det(matrix([[x-A[0],v1[0]-A[0],v2[0]-A[0]],[y-A[1],v1[1]-A[1],v2[1]-A[1]],[z-A[2],v1[2]-A[2],v2[2]-A[2]]]))==0
f1(x,y,z)=det(matrix([[x-A[0],v3[0]-A[0],v2[0]-A[0]],[y-A[1],v3[1]-A[1],v2[1]-A[1]],[z-A[2],v3[2]-A[2],v2[2]-A[2]]]))==0
f2(x,y,z)=det(matrix([[x-A[0],v3[0]-A[0],v1[0]-A[0]],[y-A[1],v3[1]-A[1],v1[1]-A[1]],[z-A[2],v3[2]-A[2],v1[2]-A[2]]]))==0
if p1==False and p2==False and p3==False:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')
else:
if p1==True and p2==True and p3==True:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')+implicit_plot3d(f(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='green', opacity=0.3)+implicit_plot3d(f1(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='red', opacity=0.3)+implicit_plot3d(f2(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='yellow', opacity=0.3)
elif p1==True and p2==True and p3==False:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')+implicit_plot3d(f(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='green', opacity=0.3)+implicit_plot3d(f1(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='red', opacity=0.3)
elif p1==True and p2==False and p3==True:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t,T[0][0], T[0][1]), color='black')+implicit_plot3d(f(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='green', opacity=0.3)+implicit_plot3d(f2(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='yellow', opacity=0.3)
elif p1==False and p2==True and p3==True:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')+implicit_plot3d(f1(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='red', opacity=0.3)+implicit_plot3d(f2(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='yellow', opacity=0.3)
elif p1==False and p2==False and p3==True:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')+implicit_plot3d(f2(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='yellow', opacity=0.3)
elif p1==False and p2==True and p3==False:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')+implicit_plot3d(f1(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='red', opacity=0.3)
elif p1==True and p2==False and p3==False:
ti=arrow3d(A,(v1[0],v1[1],v1[2]),2)+arrow3d(A,(v2[0],v2[1],v2[2]),2)+arrow3d(A,(v3[0],v3[1],v3[2]), 2)+parametric_plot3d((r[0], r[1], r[2]), (t, T[0][0], T[0][1]), color='black')+implicit_plot3d(f(x,y,z), (x, m[0][0], m[0][1]), (y, m[1][0],m[1][1]), (z, m[2][0],m[2][1]),color='green', opacity=0.3)
show(ti, aspect_ratio=[1,1,1], spin=1)

Interact: please open in CoCalc