Tim, Responses intertwined below:
On Friday, April 6, 2012 2:12:13 PM UTC-7, Tim Lahey wrote: > > Hi, > > I now know why I was confused about SymPy supporting functions that > depend upon x,y,z,t. It's because the sympy.physics.mechanics doesn't > support it (since it requires this dynamicsymbol class). It assumes > that things are functions of time only. > > Looking through the code for sympy.physics.mechanics, I've noticed > that it's very slanted towards the Kane and Levinson approach, even in > all the supporting functions and classes and as a result, it forces > one into something that they might not be comfortable with. > I would beg differ. The equation of motion derivation is completely separate from the kinematic and kinetic definitions. As is stands, any method of equation of motion derivation can be used to solve classical multi-body dynamics with the currently defined classes. We haven't written any examples for methods other than Kane's yet due to sparse resources to do so. We also haven't implemented automated classes for any other methods yet, for the same reason. One GoSC code applicant<https://github.com/sympy/sympy/wiki/GSoC-2012-Application----Angadh-Nanjangud----sympy.physics.mechanics>hopes to remedy both of those issues this summer. > One example I'm thinking of is the approach of how it handles inertia. > If I have an inertia matrix in a defined frame, how am I supposed to > include it? If I know Ixx, Iyy, Izz and the cross-products of inertia > how do I use them? The example in the rigidbody.py file is, > > >>> from sympy import Symbol > >>> from sympy.physics.mechanics import ReferenceFrame, Point, > RigidBody > >>> from sympy.physics.mechanics import outer > >>> m = Symbol('m') > >>> A = ReferenceFrame('A') > >>> P = Point('P') > >>> I = outer (A.x, A.x) > >>> Inertia_tuple = (I, P) > >>> B = RigidBody('B', P, A, m, Inertia_tuple) > >>> # Or you could change them afterwards > >>> m2 = Symbol('m2') > >>> B.mass = m2 > > I don't see how to use the known info about I in this example. Looking > through functions.py, there's an inertia function that does what I > want, but this isn't clear if one is trying to define a rigid body > because they'd look at the rigid body class. Plus, printing out the > inertia matrix would be a nice option, rather than the given form. > > We have a dyadic class to handle inertia. > Dyadics<http://en.wikipedia.org/wiki/Dyadic_tensor>are typically not as > popular as tensor formulations but they have the advantage of being basis independent (unlike tensors). We probably need more functionality to expose the dyadics as tensors so that they folks who don't want to learn about dyadics may have an easier time working with them. The current inertia function is one such function that does that. It allows you to define an inertia dyadic with a tensor like formulation. > How is parallel axis theorem carried out in this code? I can't find an > example. A parallel axis theorem matrix is defined in > sympy.physics.matrices, but I doubt it's used. What about rotation of > the inertia matrix? > We don't have an explicit parallel axis method or function. Here is an example of how you can write the parallel axis function with dyadic notation: https://github.com/angadhn/sympy/blob/a368bc0c871a75cbea0ffe1a2efc553fced1cbd6/sympy/physics/mechanics/kane.py#L471 We'd love for someone to formalize this into some functions that follow the more traditional ideas for ease of understanding. > Next, is the kinematic equations function. First, they seem to be hard > coded based upon the sequence of rotations. Second, what is meant by u > and qdot? Nowhere is this defined or explained, even by just giving a > reference. There's rotation matrices about the 1-, 2-, and 3-axes > available in sympy.matrices (if needed, but I'm guessing there's > another way you'd prefer). > As with all open source projects, the documentation is sometimes weak. Please submit issues with regards to missing documentation and we all can try to remedy it. > Trying to puzzle out the examples in the documentation is difficult > since there's lots of Python code, but really no explanation as to > what the symbols are. What are u1, u2, u3, q1, q2, q3 and how do they > relate to the figure? It's mentioned that they're configuration and > speed variables but it's not stated which are which (it's stated only > at the end of the example). Plus the choice of names (configuration > and speed) is definitely a Kane thing. Most texts I've read would have > called them position and velocity variables. > We'd love to have some examples written for different formulations and for the current documentation to be improved. We welcome any pull requests or issues that point these out specifically. > What does orientnew do? It's not clear from the example. I'm assuming > it's a rotation about an axis (or presumably an angle). Plus, the > frames Y and L should be shown on the diagram (plus R should be moved > next to the specific frame), especially since you're defining angular > velocities in one of them. > Same as above. > What is Dmc (put this on the figure)? The r * L.z confused me a bit. I > figured out that you're saying a distance r in the L.z direction, but > I rarely write out things that way. I'm normally specifying the frame > and the complete vector. I get that's what you're doing, but could I > pass a matrix or a tuple and multiply by L? I'd probably create a > vector in the L frame and use that, but I get that r * L.z is a > shortcut. Nowhere is just defining a vector in a frame done in the > example on its own. > We have a Vector class that, by design, was not intended to be generated explicitly. The approach is to create a reference frame and specify vectors using the basis of the reference frame. It would be relatively easy to add vector creation functions/methods as you suggest that interact with the Vector class, giving a different view on the creation and manipulation of vectors. > What does v2pt_theory and a2pt_theory do? (Also, why the theory > suffix?). I'm guessing that Dmc is the centre of mass of the disc, but > nowhere is that stated. I'm also guessing that v2pt_theory and > a2pt_theory are the velocity and acceleration of Dmc with respect to > point C. > v2pt and a2pt are helper methods to define velocities of points on the same rigid body. You don't have to use them if you don't want to. > Why compute the kinematic differential equations by hand? Why not show > how to do it with the module? It seems like a lost opportunity. > > I'm coming at this from the perspective of one who has been involved > in the teaching of a number of physics courses. If you define a symbol > in your code, it should show up in the text and if at all possible, in > a corresponding figure. Also, it would be nice if the output was LaTeX > output to show the full utility of the package. > > Thoughts? > We'd love to see some pull requests implementing features that you've suggested. We'd also gladly fix and improve and documentation errors or clarity issues that you find. The easy way to keep track of that would be submitting them as issues. Thanks for your review! > Tim. > > -- > Tim Lahey > PhD Candidate, Systems Design Engineering > University of Waterloo > http://about.me/tjlahey > > On Friday, April 6, 2012 2:12:13 PM UTC-7, Tim Lahey wrote: > > Hi, > > I now know why I was confused about SymPy supporting functions that > depend upon x,y,z,t. It's because the sympy.physics.mechanics doesn't > support it (since it requires this dynamicsymbol class). It assumes > that things are functions of time only. > > Looking through the code for sympy.physics.mechanics, I've noticed > that it's very slanted towards the Kane and Levinson approach, even in > all the supporting functions and classes and as a result, it forces > one into something that they might not be comfortable with. > > One example I'm thinking of is the approach of how it handles inertia. > If I have an inertia matrix in a defined frame, how am I supposed to > include it? If I know Ixx, Iyy, Izz and the cross-products of inertia > how do I use them? The example in the rigidbody.py file is, > > >>> from sympy import Symbol > >>> from sympy.physics.mechanics import ReferenceFrame, Point, > RigidBody > >>> from sympy.physics.mechanics import outer > >>> m = Symbol('m') > >>> A = ReferenceFrame('A') > >>> P = Point('P') > >>> I = outer (A.x, A.x) > >>> Inertia_tuple = (I, P) > >>> B = RigidBody('B', P, A, m, Inertia_tuple) > >>> # Or you could change them afterwards > >>> m2 = Symbol('m2') > >>> B.mass = m2 > > I don't see how to use the known info about I in this example. Looking > through functions.py, there's an inertia function that does what I > want, but this isn't clear if one is trying to define a rigid body > because they'd look at the rigid body class. Plus, printing out the > inertia matrix would be a nice option, rather than the given form. > > How is parallel axis theorem carried out in this code? I can't find an > example. A parallel axis theorem matrix is defined in > sympy.physics.matrices, but I doubt it's used. What about rotation of > the inertia matrix? > > Next, is the kinematic equations function. First, they seem to be hard > coded based upon the sequence of rotations. Second, what is meant by u > and qdot? Nowhere is this defined or explained, even by just giving a > reference. There's rotation matrices about the 1-, 2-, and 3-axes > available in sympy.matrices (if needed, but I'm guessing there's > another way you'd prefer). > > Trying to puzzle out the examples in the documentation is difficult > since there's lots of Python code, but really no explanation as to > what the symbols are. What are u1, u2, u3, q1, q2, q3 and how do they > relate to the figure? It's mentioned that they're configuration and > speed variables but it's not stated which are which (it's stated only > at the end of the example). Plus the choice of names (configuration > and speed) is definitely a Kane thing. Most texts I've read would have > called them position and velocity variables. > > What does orientnew do? It's not clear from the example. I'm assuming > it's a rotation about an axis (or presumably an angle). Plus, the > frames Y and L should be shown on the diagram (plus R should be moved > next to the specific frame), especially since you're defining angular > velocities in one of them. > > What is Dmc (put this on the figure)? The r * L.z confused me a bit. I > figured out that you're saying a distance r in the L.z direction, but > I rarely write out things that way. I'm normally specifying the frame > and the complete vector. I get that's what you're doing, but could I > pass a matrix or a tuple and multiply by L? I'd probably create a > vector in the L frame and use that, but I get that r * L.z is a > shortcut. Nowhere is just defining a vector in a frame done in the > example on its own. > > What does v2pt_theory and a2pt_theory do? (Also, why the theory > suffix?). I'm guessing that Dmc is the centre of mass of the disc, but > nowhere is that stated. I'm also guessing that v2pt_theory and > a2pt_theory are the velocity and acceleration of Dmc with respect to > point C. > > Why compute the kinematic differential equations by hand? Why not show > how to do it with the module? It seems like a lost opportunity. > > I'm coming at this from the perspective of one who has been involved > in the teaching of a number of physics courses. If you define a symbol > in your code, it should show up in the text and if at all possible, in > a corresponding figure. Also, it would be nice if the output was LaTeX > output to show the full utility of the package. > > Thoughts? > > Tim. > > -- > Tim Lahey > PhD Candidate, Systems Design Engineering > University of Waterloo > http://about.me/tjlahey > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/pAX8RXRjbPEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
