Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: [Help]How to reprensent the result in vector form?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51584] Re: [Help]How to reprensent the result in vector form?
  • From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
  • Date: Sat, 23 Oct 2004 00:22:49 -0400 (EDT)
  • References: <cl9t1d$7m0$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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
> 



  • Prev by Date: Re: Piecewise functions
  • Next by Date: Re: Piecewise functions
  • Previous by thread: Re: [Help]How to reprensent the result in vector form?
  • Next by thread: Re: Re: [Help]How to reprensent the result in vector form?