Ask Your Question
0

exponential matrix exp(A*t)

asked 2012-03-09 09:51:35 +0200

this post is marked as community wiki

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 flag offensive close merge delete

Comments

Can you state a specific question?

Jason Grout gravatar imageJason Grout ( 2012-03-09 10:10:48 +0200 )edit

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

kcrisman gravatar imagekcrisman ( 2012-03-09 10:14:20 +0200 )edit

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

canisvetus gravatar imagecanisvetus ( 2012-03-09 10:42:54 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2012-03-09 13:55:46 +0200

this post is marked as community wiki

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)

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2012-03-09 09:51:35 +0200

Seen: 772 times

Last updated: Mar 09 '12