Vector multiplication??

• To: mathgroup at yoda.physics.unc.edu
• Subject: Vector multiplication??
• From: William M. MacDonald <mcdonald at fafner.umd.edu>
• Date: Tue, 8 Dec 92 15:45:56 -0500

```The following was not sent to this group but may be of general
interest so I am sending it.

To: "Katherine (Williams) Derbyshire" <kewms at kew.com>
Subject: Re: Vector multiplication??

Regarding A^2 where A is a vector.

There is a very powerful element-by-element processing built into
Mathematica that makes it unnecessary to write explicit DO loops for
many things. If A and B are vectors of the same length then
1.     A^2 gives the list of the elements squared, A[i]^2;
2.     A*B gives the list with elements A[i]*B[i]
3.     A + B gives the list with elements A[i]+B[i];

4.     A^B is the list with elements A[i]^B[i];
5.     A/B is the list with elements A[i]/B[i].
Also if one defines
n=Range[0,10]
then
x^n
is the list
{1,x,x^2,x^3,...,x^10}

All this is very obvious to anyone who knows APL, so its just a
matter of learning the language.

```

• Prev by Date: Yearend retrospective
• Next by Date: Re: window size
• Previous by thread: Vector multiplication??
• Next by thread: Vector multiplication??