I think Gilbert has a point. Some users may want to just convert the vector wrt the basis vectors, without substituting the coordinate vars. Maybe a 'vars' arg to express? So, if I want the coordinate vars also to be converted, express(vect, vars=True) by default, express(vect, vars=False)
On Wed, Jul 31, 2013 at 11:22 AM, Gilbert Gede <gilbertg...@gmail.com>wrote: > I think you should split the operation into 2 steps: 1) expression of > basis vectors in new frame and 2) expression of coordinates in new frame. > This way, if the user only wants to do one or the other, they are able to. > > I think you should have the order for the complete re-expression being 1) > and then 2). I would separate the _basis vectors_ by frame, into n-tuples > of the measure numbers, then put those measure numbers in a (n x 1) Matrix, > and multiply the proper DCM by that measure number matrix, giving you > another Matrix of the measure numbers in the new frame. Some things will > cancel out, so I think it's better to do this step on all a frame's basis > vectors together. > > Next, what Sachin posted for the coordinate transformation ([vector of > A's vars] = [Pos-vector of B wrt A] + DCM(A, B) * [vector of B's vars]) is > mostly correct - I would clarify that [Pos-vector of B wrt A] is: > Matrix([dot(p_bo_ao.express(A), bv) for bv in A.basis_vectors()]). Again, > this is why I would do the basis expression first, so you can do this > expression of the position vector without issue. > > Does that help to clarify things? > > -Gilbert > > > > > On Tue, Jul 30, 2013 at 12:34 PM, Sachin Joglekar <srjoglekar...@gmail.com > > wrote: > >> Ya, I agree quite a bit of handling-the-symbols would be required. Maybe, >> we could cache the relationships (dicts) between coordinate variables of >> different frames? >> Then, when 'express' is called, just iterate through the atoms of the >> vector expression and note the systems whose variables we come across? >> About the validity, I had discussed this method with Gilbert in the past, >> but I guess they should confirm this before you go ahead. >> >> >> On Wed, Jul 31, 2013 at 12:14 AM, Sachin Joglekar < >> srjoglekar...@gmail.com> wrote: >> >>> You may want to use the method I used while hacking the old mechanics >>> module to do the kind of re-expression we want to achieve. say a vector v >>> from frame A to frame B >>> First, we need to calculate the coordinate variables of frame A in terms >>> of those of B. >>> We can do this using - >>> [vector of A's vars] = [Pos-vector of B wrt A] + DCM(A, B) * [vector of >>> B's vars] >>> In above equation, don't take the LHS as a 'vector field'. It's just a >>> column matrix with the respective symbols denoting coordinate variables of >>> A. >>> Comparing the entries in LHS and RHS will help you contrust a dict >>> mapping A.x, A.y and A.z in terms of B.x, B.y, B.z >>> >>> Use the sympy subs method on v to remove A.x, A.y and A.z from its >>> expression. Suppose we now get v1 >>> Then just do >>> [final vector] = DCM(A, B) * [v1] >>> >>> The above will give the required re-expressed vector. >>> >>> For the above method to work, you *just* need to separate the vector >>> into components based on the basis _vectors_, not scalars. Since we are >>> going to 'subs' them, their occurences don't matter. And according to me, >>> thats what separate should do- just think of basis vectors. Then use the >>> above algo on each component thus found out to get the final result. You >>> can try this with an example and confirm the validity. >>> >>> @stefan, @gilbert, am I correct? >>> >>> >>> On Tue, Jul 30, 2013 at 11:46 PM, Prasoon Shukla < >>> prasoon92.i...@gmail.com> wrote: >>> >>>> @All: This is a cry for help. >>>> >>>> I am completely stumped at the *express* method. The implementation >>>> that I had before had a flaw that I hadn't noticed until now (until >>>> Gilbert's PR on by branch). Anyway, let me try to describe the situation. >>>> >>>> Initially, I had an separate method that would take a vector and return >>>> it separated by coordinate systems in dictionary form. To my chagrin, this >>>> kind of separation cannot always work. Consider two coordinate systems, c0 >>>> and c1, both rectangular. Let us have a vector, v. >>>> >>>> v = c0.x * c1.e_y >>>> express >>>> Obviously, this cannot be separated into vectors separated by >>>> coordinate systems. This is the case I wasn't considering when I wrote the >>>> express method last. And that's why, I need to rewrite a new express >>>> method. >>>> >>>> I have been thinking of how to implement this but I'm getting nowhere. >>>> I do have one way, that I think might work and am currently writing the >>>> code for it. But, I'm not at all too sure of it. >>>> >>>> I think that by now, all three of you have a fair idea of the code. >>>> Please suggest an algorithm to accomplish this. >>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "sympy" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/sympy/t-Je0beTIIU/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> sympy+unsubscr...@googlegroups.com. >>>> To post to this group, send email to sympy@googlegroups.com. >>>> Visit this group at http://groups.google.com/group/sympy. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> >> > -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.