Sorry for the late reply. Was busy with assignments. Anyway, so here's how we can proceed with this. First, we need to have all the base vectors and base scalars changed to rectangular coordinates. That I think, will be easy using the methods that I have written.
Next comes the conversion of base vectors, as you've said, to the coordinate system in which we expect the result. That can be done as well - though I don't quite understand what you mean by 'separate to n-tuples with measures of basis vectors'. Do you want me to collect the coefficients of the base vectors? And this will need to be done for every coordinate system. So if v = c0.x * c1.e_y + c0.y * c1.e_z + c1.x * c0.e_x for examples, then, we separate as follows: { c0: (c1.x, 0, 0), c1: (0, c0.x, c0.y) } where the n-tuples represent the coefficients of e_x, e_y and e_z. Is this what you meant? If so, I'll proceed to multiply the matrices with DCMs and get measure numbers in the required frame - albeit in the old frames. Then, I should proceed to change these measure numbers to required coordinate systems as well. Right? Anyway, we can calculate Pos_vect of B wrt A = Pos_vect of B - Pos_vect of A as well, I think. But, there will be a problem when converting these vectors to other coordinate systems. This will cause a recursion error (maximum depth) since express will call to itself. So, that is a problem still. So, is this how I should proceed? On Wednesday, July 31, 2013 11:22:57 AM UTC+5:30, Gilbert Gede 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 > <srjogl...@gmail.com<javascript:> > > 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 >> <srjogl...@gmail.com<javascript:> >> > 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 >>> <prasoon...@gmail.com<javascript:> >>> > 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+un...@googlegroups.com <javascript:>. >>>> To post to this group, send email to sy...@googlegroups.com<javascript:> >>>> . >>>> 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.