f



Simplifying {0,0,0}.X.{0,0,0}

Hello,

In brief: Is there a way that I can specify that "X" is a matrix and
will resolve to zero when dot multiplied with a vector of zeros?

I'm constructing a swathe of expressions that contain things like
(when expanded): {0,0,0}.X.{0,0,0}, where X is an arbitrary (well,
positive definite) square matrix of obvious size, and I'd like to be
able to have mathematica simplify that for me without much
intervention.

My only option at the moment is to manually perform the replacements
{{0, 0, 0}.X._ -> 0, _.X.{0, 0, 0} -> 0} (the left and right vectors
won't always both be zeros), but this is tedious to perform for a
large number of expressions. I could also define the matrix X in terms
of its indices and end up with expressions in terms of x11, x12, ... ,
x33, but I'd rather not do that.

Any help would be greatly appreciated.

Many thanks in advance,
Will Robertson


0
wspr81 (1209)
3/6/2007 10:35:22 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

3 Replies
1373 Views

Similar Articles

[PageSpeed] 51


Hi Will,

simply efine two rules for X:

X/: {0,0,0}.X=0;

X/: X.{0,0,0}=0

Daniel





Will Robertson wrote:

> Hello,

> 

> In brief: Is there a way that I can specify that "X" is a matrix and

> will resolve to zero when dot multiplied with a vector of zeros?

> 

> I'm constructing a swathe of expressions that contain things like

> (when expanded): {0,0,0}.X.{0,0,0}, where X is an arbitrary (well,

> positive definite) square matrix of obvious size, and I'd like to be

> able to have mathematica simplify that for me without much

> intervention.

> 

> My only option at the moment is to manually perform the replacements

> {{0, 0, 0}.X._ -> 0, _.X.{0, 0, 0} -> 0} (the left and right vectors

> won't always both be zeros), but this is tedious to perform for a

> large number of expressions. I could also define the matrix X in terms

> of its indices and end up with expressions in terms of x11, x12, ... ,

> x33, but I'd rather not do that.

> 

> Any help would be greatly appreciated.

> 

> Many thanks in advance,

> Will Robertson

> 

> 



0
dh142 (1271)
3/7/2007 8:07:08 AM
Hi,

X /: Dot[X, a : {0 ..}] := a

will help.

Regards
   Jens

Will Robertson wrote:
> Hello,
> 
> In brief: Is there a way that I can specify that "X" is a matrix and
> will resolve to zero when dot multiplied with a vector of zeros?
> 
> I'm constructing a swathe of expressions that contain things like
> (when expanded): {0,0,0}.X.{0,0,0}, where X is an arbitrary (well,
> positive definite) square matrix of obvious size, and I'd like to be
> able to have mathematica simplify that for me without much
> intervention.
> 
> My only option at the moment is to manually perform the replacements
> {{0, 0, 0}.X._ -> 0, _.X.{0, 0, 0} -> 0} (the left and right vectors
> won't always both be zeros), but this is tedious to perform for a
> large number of expressions. I could also define the matrix X in terms
> of its indices and end up with expressions in terms of x11, x12, ... ,
> x33, but I'd rather not do that.
> 
> Any help would be greatly appreciated.
> 
> Many thanks in advance,
> Will Robertson
> 
> 

0
kuska (2791)
3/7/2007 8:10:24 AM
Will Robertson wrote:
> Hello,
>
> In brief: Is there a way that I can specify that "X" is a matrix and
> will resolve to zero when dot multiplied with a vector of zeros?
>
> I'm constructing a swathe of expressions that contain things like
> (when expanded): {0,0,0}.X.{0,0,0}, where X is an arbitrary (well,
> positive definite) square matrix of obvious size, and I'd like to be
> able to have mathematica simplify that for me without much
> intervention.
>
> My only option at the moment is to manually perform the replacements
> {{0, 0, 0}.X._ -> 0, _.X.{0, 0, 0} -> 0} (the left and right vectors
> won't always both be zeros), but this is tedious to perform for a
> large number of expressions. I could also define the matrix X in terms
> of its indices and end up with expressions in terms of x11, x12, ... ,
> x33, but I'd rather not do that.

Hi Will,

If I have correctly understood your query, the following combination of
up-values to the symbol X and down-values to the Dot operator should do
what you are looking for.

In[1]:=
X /: {(0)...} . X = 0;
X /: X . {(0)...} = 0;
Unprotect[Dot];
{___} . 0 = 0;
0 . {___} = 0;
Protect[Dot];
UpValues[X]
DownValues[Dot]
{0, 0} . X
X . {0, 0, 0}
{1, 2, 3, 4} . X . {0, 0, 0, 0}
{0, 0, 0, 0, 0} . X . {5, 6, 7, 8, 9}

Out[7]=
{HoldPattern[{(0)...} . X] :> 0,

   HoldPattern[X . {(0)...}] :> 0}

Out[8]=
{HoldPattern[{___} . 0] :> 0,

   HoldPattern[0 . {___}] :> 0}

Out[9]=
0

Out[10]=
0

Out[11]=
0

Out[12]=
0

Regards,
Jean-Marc

0
3/8/2007 9:42:12 AM
Reply: