Dot product of complex vectors



On 6/25/07, Andrew Pinsky <andrew.pinsky at gmail.com> wrote:

> > Maybe declare(x, nonscalar), declare(x,complex) will work for you.
>
> I've tried it. But it gives an error:

dotproduct, as it stands, allows only literal matrices as arguments.
It seems we could easily relax that restriction.
Here is a modified definition of dotproduct that is more lenient.

dotproduct(a,b):=if matrixp(a) and matrixp(b)
            then block([scalarmatrixp:true],
                       if matrix_size(a) # matrix_size(b)
                            or second(matrix_size(a)) # 1
                           then error("Dunno what to do if matrix
arguments are different sizes")
                           else ctranspose(a) . b)
            else ctranspose(a) . b$


Maybe this is helpful, but it wouldn't hurt to make dotproduct
a simplifying function; to make that easier, we could first define
a new property "bilinear" and then declare dotproduct to have
that property .... Just thinking out loud here.

Robert Dodier