Re: matrix times a vector
- To: mathgroup at smc.vnet.net
- Subject: [mg49024] Re: [mg49002] matrix times a vector
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Tue, 29 Jun 2004 04:49:52 -0400 (EDT)
- References: <200406280813.EAA04270@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Jun 28, 2004, at 4:13 AM, David Salomon wrote:
> Question:
>
> The input {{a,b}, {c,d}}.{x,y} generates the output {a x+b y,c
> x+d y}.
>
> How can I get the output x{a,b}+y{c,d} ?
>
> This is a special case of lists with two elements. How
> can I extend this computation in an elegant way to lists
> with N elements?
>
Plus @@ MapThread[Times, {{{a, b}, {c, d}}, {x, y}}]
But because Mathematica treats {a,b} and {c,d} as vectors {a x+c y,b
x+d y} is the result which is equivalent to your desired output
assuming {a,b} and {c,d} can be treated as vectors. Replacing
{{a,b},{c,d}} and {x,y} in the above expression by your desired N
element lists will work assuming the N element sublists can be treated
as vectors.
Regards,
Ssezi
- References:
- matrix times a vector
- From: David Salomon <david.salomon@csun.edu>
- matrix times a vector