Re: Re: [Help]How to reprensent the result in vector form?
- To: mathgroup at smc.vnet.net
- Subject: [mg51594] Re: [mg51584] Re: [Help]How to reprensent the result in vector form?
- From: DrBob <drbob at bigfoot.com>
- Date: Wed, 27 Oct 2004 01:53:53 -0400 (EDT)
- References: <cl9t1d$7m0$1@smc.vnet.net> <200410230422.AAA26310@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
This won't always work, however. crossrule = {a3_ b2_ - a2_ b3_, a1_ b3_ - a3_ b1_, a2_ b1_ - a1_ b2_} -> myCross[{b1, b2, b3}, {a1, a2, a3}]; Cross[{u1, u2, u3}, {v1, v2, v3}] /. crossrule myCross[{u1,u2,u3},{v1,v2,v3}] Fine so far, but these should return cross products too: Cross[{-u1,u2,u3},{v1,v2,v3}]/.crossrule {-u3 v2+u2 v3,u3 v1+u1 v3,-u2 v1-u1 v2} Cross[{u1,-u2,u3},{v1,v2,v3}]/.crossrule {-u3 v2-u2 v3,u3 v1-u1 v3,u2 v1+u1 v2} Cross[{u1,u2,-u3},{v1,v2,v3}]/.crossrule {u3 v2+u2 v3,-u3 v1-u1 v3,-u2 v1+u1 v2} Besides this problem there are other issues, such as: (1) EVERY vector is the cross product of two vectors, and (2) The vectors are never unique. Good luck!! Bobby On Sat, 23 Oct 2004 00:22:49 -0400 (EDT), Steve Luttrell <steve_usenet at _removemefirst_luttrell.org.uk> wrote: > You can use a replacement rule to convert your expression into the compact > form that you want: > > Define the replacement rule. > > crossrule = {a3_ b2_ -a2_ b3_,a1_ b3_ -a3_ b1_,a2_ b1_ -a1_ b2_} -> > myCross[{b1,b2,b3},{a1,a2,a3}]; > > Apply the rule to your expression. > > result = {-u3 v2 + u2 v3, u3 v1 - u1 v3, -u2 v1 + u1 v2}/.crossrule > > which gives the output > > myCross[{u1,u2,u3},{v1,v2,v3}] > > You could make the notation more compact by doing this > > result /. {{u1,u2,u3} -> u,{v1,v2,v3} -> v} > > which gives the output > > myCross[u,v] > > Another (related but more sophisticated) method is to use the > Utilities`Notation` package to implement the reformatting of your output > automatically. This includes a way of defining infix operators so that you > can get an output that looks like u x v rather than myCross[u,v] > > Steve Luttrell > > "melon" <sweetmelon at gmail.com> wrote in message > news:cl9t1d$7m0$1 at smc.vnet.net... >> I used mathmetica5 to solve a vector equation. Mathmetica expands the >> result into sub-variable form. But I want to get the vector form. How >> to do that? >> >> ex: >> Solution: >> {-u3 v2 + u2 v3, u3 v1 - u1 v3, -u2 v1 + u1 v2} >> I want mathematica give me {u cross v} >> >> p,s, Could you add me into the forum? Thank you very much. Regards. >> >> ShenLei >> > > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- Re: [Help]How to reprensent the result in vector form?
- From: "Steve Luttrell" <steve_usenet@_removemefirst_luttrell.org.uk>
- Re: [Help]How to reprensent the result in vector form?