Discussion: Introducing new operators for matrix computation

Huaiyu Zhu huaiyu_zhu at rock.localdomain
Sat Jul 15 18:25:08 EDT 2000


In comp.lang.python, you wrote:
>
>B*[sin(A*x+b).*(A*y)/3]/C 
>
>Is spelled
>
>(Assume all matrices are originall matrix-wise)
>
># sin() already works element by element, unless you define
># sin(A) = A-(A^3/3!)+(A^5/5!)-....
>B*(sin(A*x+b).Element()*(A*y).Element()/3)/C
>

Hmm, I can see one advantage of writing a.*b as

a.Element()*b.Element()

That is, instead of sinm(x) and sin(x) we can write

sin(x) and sin(x.Element())

But both functions still need to be implemented, and each function call
would involve a member lookup, an initializsation and a type comparison.  So
overall it is perhaps disadvantageous.

BTW, the matrix sin function is equivalent to the Taylor expansion, but it
is calculated differently, using eigendecomposition.

Huaiyu





More information about the Python-list mailing list