Kevin, Here is another example of doing that:
https://github.com/pydy/pydy#usage-1 Jason moorepants.info +01 530-601-9791 On Tue, Apr 22, 2014 at 8:00 AM, Jason Moore <[email protected]> wrote: > Kevin, > > You are correct, you should include the force, sin(b*t), in the force > list. Then KanesMethod, for example will give you: > > Mx' = f(x, t) > > The force, sin(b*t), will be explicitly in the f(x, t) portion. You can > then think of it as: > > Mx' = f_(x) + u(t) > > where u(t) = sin(b * t) > > Then when you want to integrate the equations you must make sure that t is > available for the ode right hand side. > > def rhs(x, t, ...) > > return solve(M, f_(x) + u(t)) > > Something like that. If you show a more complete piece of code that I can > run, then I can give you more specific advice. > > > Jason > moorepants.info > +01 530-601-9791 > > > On Tue, Apr 22, 2014 at 4:11 AM, Kevin Bockstael <[email protected] > > wrote: > >> >> Hi >> >> I would like to include a periodic external force into a multiple mass >> damper-system. My first thought was to include it in the forcelist (using >> KanesMethod) >> which would then become something like in the code below. (where b is the >> frequency of the periodic force) >> This however, returns an error whenever i want to integrate the dynamical >> equations. >> Does anyone know how to include the external force f(t) = sin(b*t), so i >> can integrate the dynamical equations? >> >> Thanks >> >> q1,u1,q2,u2 = dynamicsymbols('q1 u1 q2 u2') >> q1d, q2d = dynamicsymbols('q1 q2',1) >> m1,c1,k1, m2,c2,k2, g,t,b = symbols('m1 c1 k1 m2 c2 k2 g t b') >> N = ReferenceFrame('N') >> O=Point('O') >> O.set_vel(N,0) >> P = Point('P') >> P.set_vel(N,-u1*N.y) >> Q=Point('Q') >> Q.set_vel(N,-(u2+u1)*N.y) >> kd=[q1d-u1,q2d-u2] >> FL = >> [(P,(2*k1*q1-k1*q2+c1*u1)*N.y),(Q,((k1+k2)*q2-k1*q1+c2*u2+sin(b*t))*N.y)] >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sympy. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/b1b1fd3f-196f-4151-a3c1-c94e82ef18c4%40googlegroups.com<https://groups.google.com/d/msgid/sympy/b1b1fd3f-196f-4151-a3c1-c94e82ef18c4%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAP7f1AhjTJ13s%3D2S7xpyRpn%3DW3OENb_%2BMn0ugd66u0PwG8ix-Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
