MathGroup Archive 2004

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

Search the Archive

RE: matrix times a vector


David,

Is this what you want?

vector = {x, y};
matrix = {{a, b}, {c, d}};

vector.matrix
{a x + c y, b x + d y}

Or maybe...

vector .HoldForm /@ matrix
% // ReleaseHold
x {a, b} + y {c, d}
{a x + c y, b x + d y}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: David Salomon [mailto:david.salomon at csun.edu]
To: mathgroup at smc.vnet.net

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?

with thanks,


|David Salomon                                                            |
|
|Computer Science Dept.                     dsalomon at csun.edu        |
|California State University                http://www.ecs.csun.edu/~dxs  |
|Northridge, CA 91330-8281                  (818) 677-4954                |
|USA                                        fax (818) 677-7208            |
|                                                                         |
|            Macintosh --- because you can see right through windows.     |




  • Prev by Date: Re: matrix times a vector
  • Next by Date: Re: Net/Link: DLL (4)
  • Previous by thread: Re: matrix times a vector
  • Next by thread: Re: matrix times a vector