I tried:
html("<h1>Partícula bajo oscilador lineal</h1>")
var('t s')
@interact
def newtraph(m = input_box(default=1, label='masa'),
b = input_box(default=1, label='viscosidad aire'),
T = input_box(default=10, label='tiempo total'),
k1 =input_box(default=1, label='primer autovalor'),
k2 =input_box(default=1, label='segundo autovalor'),
k3 =input_box(default=1, label='tercer autovalor'),
Fx =input_box(default=0, label='Impulso unitario x'),
Fy =input_box(default=0, label='Impulso unitario y'),
Fz =input_box(default=0, label='Impulso unitario z'),
CI= input_box(default=[1,1,0,1,1,-2], label='CI')):
N=matrix(3)
U=identity_matrix(3)
K=diagonal_matrix([k1,k2,k3])
A=block_matrix([[N,U],[-K/m, -b*U/m]])
A0=block_matrix([[N,U],[-K/m, N]])
print 'hi'
S=exp(A*t)
Ss=exp(A*(t-s))
show(S)
show(Ss)
u=vector([0,0,0,Fx,Fy,Fz])
B=Ss*u
show(B)
CI=vector(CI)
Xh=S*CI
XP=integral(B,s,0,t)
X=Xh+XP
show(X)
#parametric_plot3d((X[0],X[1],X[2]),(t,0,T))
and it seemed to work well. Everything except the plot seemed to be computed. As for the plot, changing the last line to:
parametric_plot3d((lambda t: real(X[0](t=t).n()), lambda t: real(X[1](t=t).n()), lambda t: real(X[2](t=t).n())), (t,0,T)).show()
seemed to solve the problem of the function returning imaginary outputs (or nearly imaginary outputs)
Can you state a specific question?
Also, assuming this was posted by @canisvetus, please use descriptive tags, not your username.
The program not calculates a good answer for exp(A*t)