Ask Your Question

# exponential matrix exp(A*t)

asked 2012-03-09 02:51:35 -0500

This post is a wiki. Anyone with karma >750 is welcome to improve it.

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]])
S=exp(A*t)
Ss=exp(A*(t-s))
u=vector([0,0,0,Fx,Fy,Fz])
B=Ss*u
CI=vector(CI)
Xh=S*CI
XP=integral(B,s,0,t)
X=Xh+XP
parametric_plot3d((X[0],X[1],X[2]),(t,0,T))

edit retag close merge delete

## Comments

Can you state a specific question?

( 2012-03-09 03:10:48 -0500 )edit

Also, assuming this was posted by @canisvetus, please use descriptive tags, not your username.

( 2012-03-09 03:14:20 -0500 )edit

The program not calculates a good answer for exp(A*t)

( 2012-03-09 03:42:54 -0500 )edit

## 1 answer

Sort by » oldest newest most voted

answered 2012-03-09 06:55:46 -0500

This post is a wiki. Anyone with karma >750 is welcome to improve it.

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)

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2012-03-09 02:51:35 -0500

Seen: 295 times

Last updated: Mar 09 '12