Re: How to reprensent the result in vector form?
- To: mathgroup at smc.vnet.net
- Subject: [mg51657] Re: How to reprensent the result in vector form?
- From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
- Date: Wed, 27 Oct 2004 23:43:55 -0400 (EDT)
- References: <cl9t1d$7m0$1@smc.vnet.net> <200410230422.AAA26310@smc.vnet.net> <clndek$o4s$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I fully agree with you that my suggestion was not a general solution. I had in mind the sort of piecemeal replacement(s) you sometimes have to do at the end of a derivation to coax the result into the form you want. I usually concoct these on the fly and store them as rules. A quick (and very dirty!) fix to the problem of matching to ALL possible sign combinations is crossrule2= Flatten[Table[{Sign[ai3 bi2]a3_ b2_ -Sign[ai2 bi3]a2_ b3_, Sign[ai1 bi3]a1_ b3_ -Sign[ai3 bi1]a3_ b1_, Sign[ai2 bi1]a2_ b1_ -Sign[ai1 bi2]a1_ b2_}-> myCross[{bi1 b1,bi2 b2,bi3 b3},{ai1 a1,ai2 a2,ai3 a3}],{ai1,-1,1, 2},{ai2,-1,1,2},{ai3,-1,1,2},{bi1,-1,1,2},{bi2,-1,1,2},{bi3,-1,1,2}], 5]; Now your 3 counterexamples behave thus: Cross[{-u1,u2,u3},{v1,v2,v3}]/.crossrule2 myCross[{u1,-u2,-u3},{-v1,-v2,-v3}] Cross[{u1,-u2,u3},{v1,v2,v3}]/.crossrule2 myCross[{-u1,u2,-u3},{-v1,-v2,-v3}] Cross[{u1,u2,-u3},{v1,v2,v3}]/.crossrule2 myCross[{-u1,-u2,u3},{-v1,-v2,-v3}] I agree with your final two remarks about the non-uniqueness of the representation. However, I think the original question was to do with spotting a particular type of pattern in the algebra, and then rewriting it in a more compact and familiar notation. Because this sort of pseudo-inversion is non-unique I tend to make up the replacement rules on an ad hoc basis as I said earlier. Steve Luttrell "DrBob" <drbob at bigfoot.com> wrote in message news:clndek$o4s$1 at smc.vnet.net... > 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 >
- Follow-Ups:
- Re: Re: How to reprensent the result in vector form?
- From: DrBob <drbob@bigfoot.com>
- Re: Re: How to reprensent the result in vector form?
- From: DrBob <drbob@bigfoot.com>
- Re: Re: How to reprensent the result in vector form?
- 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?