Re: Multiplication of matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg89132] Re: Multiplication of matrices
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Mon, 26 May 2008 06:24:09 -0400 (EDT)
- References: <g1di51$9r5$1@smc.vnet.net>
TomᨠProcházka schrieb:
> Hi,
>
> does anyone know how to simplify expressions like
> A.((-1)*B)
> or A.(5B)
> with A and B (general) matrices to expressions like
> -A.B
> 5 A.B
> I am sorry for such a stupid question :-) Thanks!
A general method to gather products of numbers in front of multilinear
operations is
expr //.
{HoldPattern[Dot[a___, b_?NumericQ*c_, d___]] :> b*Dot[a, c, d]}
--
Roland Franzius