<br><br><div class="gmail_quote">On Sat, Jun 6, 2009 at 2:30 PM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com">robert.kern@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Sat, Jun 6, 2009 at 14:59, Alan G Isaac <<a href="mailto:aisaac@american.edu">aisaac@american.edu</a>> wrote:<br>
> On 6/6/2009 2:58 PM Charles R Harris apparently wrote:<br>
>> How about the common expression<br>
>> exp((v.t*A*v)/2)<br>
>> do you expect a matrix exponential here?<br>
><br>
><br>
> I take your point that there are conveniences<br>
> to treating a 1 by 1 matrix as a scalar.<br>
> Most matrix programming languages do this, I think.<br>
> For sure GAUSS does. The result of x' * A * x<br>
> is a "matrix" (it has one row and one column) but<br>
> it functions like a scalar (and even more,<br>
> since right multiplication by it is also allowed).<br>
><br>
> While I think this is "wrong", especially in a<br>
> language that readily distinguishes scalars<br>
> and matrices, I recognize that many others have<br>
> found the behavior useful. And I confess that<br>
> when I talk about quadratic forms, I do treat<br>
> x.T * A * x as if it were scalar.<br>
<br>
</div>The old idea of introducing RowVector and ColumnVector would help<br>
here. If x were a ColumnVector and A a Matrix, then you can introduce<br>
the following rules:<br>
<br>
x.T is a RowVector<br>
RowVector * ColumnVector is a scalar<br>
RowVector * Matrix is a RowVector<br>
Matrix * ColumnVector is a ColumnVector<br>
<font color="#888888"></font></blockquote><div><br>Yes, that is another good solution. In tensor notation, RowVectors have signature r_i, ColumnVectors c^i, and matrices M^i_j. The '*' operator is then a contraction on adjacent indices, a result with no indices is a scalar, and the only problem that remains is the tensor product usually achieved by x*y.T. But making the exception that col * row is the tensor product producing a matrix would solve that and still raise an error for such things as col*row*row. Or we could simply require something like bivector(x,y)<br>
<br>Chuck<br></div><br></div><br>