I think you are using a velocity constraint when it is not needed. You have your generalized coordinates: q1 and q2. L is simply sqrt(q1**2 + q2**2), right? I think you need to define ell = sqrt(q1**2 + q2**2). The velocity constraint functionality of KanesMethod is primarily in place to deal with non-holonomic constraints, which you don't have. It can probably be manipulated to be used for other things, but I don't think it is useful for this problem.
Jason moorepants.info +01 530-601-9791 On Tue, Jan 13, 2015 at 2:48 AM, Guillaume Gay <[email protected]> wrote: > A follow up: > > I believe this comment in kanes.py (l. 206) is related. In my case, the > constant is not negligeable. > > # Form of non-holonomic constraints is B*u + C = 0. > # We partition B into independent and dependent columns: > # Ars is then -B_dep.inv() * B_ind, and it relates dependent > speeds > # to independent speeds as: udep = Ars*uind, neglecting the C > term. > B_ind = self._k_nh[:, :p] > B_dep = self._k_nh[:, p:o] > self._Ars = -B_dep.LUsolve(B_ind) > > > > Best, > > Guillaume > > Le 13/01/2015 09:45, Guillaume Gay a écrit : > > Hi Jason, thanks a lot for the help. > > I simplified a lot the definitions, and used directly the velocities in > the definitions. > > So the KanesMethod class can be instanciated, and the `to_linearizer` > method works. The only issue I'm left with is that the M, A, B matrices > output by the `linearizer.linearize()` are not consistent with the > equations of motion - when you compare the f_3 equation with the uquations > from M[dot q, dot u] = A[q, u]: the constant term is droped - compare cells > In [8] and In [10] & In [11] on the notebook bellow: > > > http://nbviewer.ipython.org/github/glyg/Notebooks/blob/master/kt_sim/minimum%20Linear%20Force%20Velocity.ipynb > > I'm not sure if this is my fault, or just that the linearizer wont work in > my case because of the form of the contraint... > > Best, > > Guillaume > > > Le 12/01/2015 19:10, Jason Moore a écrit : > > I meant: p1.set_vel(N, u1 * N.x) > > > Jason > moorepants.info > +01 530-601-9791 > > On Mon, Jan 12, 2015 at 10:08 AM, Jason Moore <[email protected]> > wrote: > >> Some notes: >> >> - Since you specified your kinematic relations as u = q', then you >> should set your velocities with u instead of q, for example: p1.set_vel(N >> , u1d * N.x) >> - I doubt that you need to specify any velocity constraints and thus you >> will not have any dependent speeds. You've defined ell as some new >> coordinate, but do not add it as an independent coordinate. I don't think >> this is correct. It will likely work if you just remove the coordinate >> constraint stuff. >> >> >> Jason >> moorepants.info >> +01 530-601-9791 >> >> On Mon, Jan 12, 2015 at 5:12 AM, Guillaume Gay <[email protected]> >> wrote: >> >>> >>> Hi, >>> >>> I'm trying to use sympy KanesMethod to model biological assemblies (i.e. >>> the mitotic spindle). >>> >>> Molecular motors in biology follow linear force velocity relationships, >>> such that F = F_max(1 -ld/V_max) where ld is the relative speed of the two >>> points on which the force is applied (distant of l). >>> >>> I strugle to implement this in the Kanes formalism... I tried various >>> things: >>> * constraint the generalized speed as u = (V_max - ld) >>> * declare the above relation in the kinetic differential equation >>> >>> In both cases, the `to_linearizer` method rises a: >>> >>> ValueError: Cannot have dynamicsymbols outside dynamic forcing vector. >>> >>> * use directly ld as the speed, and declare it as auxiliary >>> >>> Then I have a shape mismatch when I try to linearize. >>> >>> Bellow is a notebook with the code: >>> >>> >>> http://nbviewer.ipython.org/github/glyg/Notebooks/blob/master/kt_sim/minimum%20Linear%20Force%20Velocity.ipynb >>> >>> >>> Best, >>> >>> Guillaume >>> >>> -- >>> Guillaume Gay, PhD >>> >>> http://damcb.com >>> >>> 43 rue Horace Bertin >>> 13005 Marseille >>> >>> +33 953 55 98 89 <%2B33%20953%2055%2098%2089> >>> +33 651 95 94 00 <%2B33%20651%2095%2094%2000> >>> >>> n°SIRET 751 175 233 00020 >>> >>> -- >>> 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/54B3C853.5090405%40gmail.com. >>> 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/CAP7f1AhCfvka0rhDA3%2BuboCbk-8e3eWF8yHQaJYUQZ%2B6w%3DV_jA%40mail.gmail.com > <https://groups.google.com/d/msgid/sympy/CAP7f1AhCfvka0rhDA3%2BuboCbk-8e3eWF8yHQaJYUQZ%2B6w%3DV_jA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > Guillaume Gay, PhD > http://damcb.com > > 43 rue Horace Bertin > 13005 Marseille > > +33 953 55 98 89 > +33 651 95 94 00 > > n°SIRET 751 175 233 00020 > > > > -- > Guillaume Gay, PhD > http://damcb.com > > 43 rue Horace Bertin > 13005 Marseille > > +33 953 55 98 89 > +33 651 95 94 00 > > n°SIRET 751 175 233 00020 > > -- > 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/54B4F7E7.6060909%40gmail.com > <https://groups.google.com/d/msgid/sympy/54B4F7E7.6060909%40gmail.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/CAP7f1Ahf6KJfPpizu%2B3MnjS-Yi%3D2osT1LumONE%3DE4mgQj%2BgcLQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
