Matrix calculations

Hi
I am new to Igor Pro and I want to make matrices and do calculations by using these matrices.
I can handle with matrices which have real, known elements.but the problem is,I have matrices with imaginery elements too.
Again I have unknown variables.
As an example I have to do,

[ x-iy y+iz ][ x-iz g+id] [ a-iy b+iz]
[a-ib c+id] * [a-ia a+ih] +[x-ih c+iz ]

I need the final answer from these variables.

How can I write procedures for such calculations

Thanks
Duli
Hello Duli,

Normal matrices can be real or complex but they always have real indices. As such, an index in bracket could not be complex and should evaluate to a single number. Your expression [ x-iy y+iz ] is both complex and not very meaningful unless you missed some operator between the two y's.

To be able to help you better I'd need to know the precise mathematical expressions that you are trying to evaluate.

A.G.
WaveMetrics, Inc.

Hello Sir,
Ok I will write my matrix as this way.
MatA ={{ x-iy, y+iz},{a-ib c+id}}
(That means; MatA is a 2x2 matrix; MatA[1,1]=x-iy, MatA[1,2]=y+iz, MatA[2,1]=a-ib, MatA[2,2]=c+id

MatB ={{x-iz, g+id},{a-ia, a+ih}}
MatC={{a-iy, b+iz},{x-ih, c+iz }

I want to get the MatA*MatB+MatC

I am sorry for the bad explanation in the previous post
Thanks
Hello Duli,

You wrote:
>MatA ={{ x-iy, y+iz},{a-ib c+id}}
>(That means; MatA is a 2x2 matrix; MatA[1,1]=x-iy, MatA[1,2]=y+iz, MatA[2,1]=a-ib, MatA[2,2]=c+id

Then you should execute:

Make/C/D/N=(2,2) MatA={{cmplx(x,-y),cmplx(a,-b)},{cmplx(y,z),cmplx(c,d)}}

Similarly for MatB and MatC.

To get the expression MatA*MatB+MatC

Then you should execute:

MatrixOP/O result=MatA x MatB +MatC

I hope this helps,

A.G.
WaveMetrics, Inc.
If you prefer code that resembles standard notation more closely, you might want to define i explicitly, as in

Variable i=cmplx(0,1)

then you can write expressions such as

Make/C/D/N=(2,2) MatA={{x-i*y, a-i*b}, {y+i*z, c+i*d}}

which I find easier to read


Igor wrote:
Hello Duli,

You wrote:
>MatA ={{ x-iy, y+iz},{a-ib c+id}}
>(That means; MatA is a 2x2 matrix; MatA[1,1]=x-iy, MatA[1,2]=y+iz, MatA[2,1]=a-ib, MatA[2,2]=c+id

Then you should execute:

Make/C/D/N=(2,2) MatA={{cmplx(x,-y),cmplx(a,-b)},{cmplx(y,z),cmplx(c,d)}}

Similarly for MatB and MatC.

To get the expression MatA*MatB+MatC

Then you should execute:

MatrixOP/O result=MatA x MatB +MatC

I hope this helps,

A.G.
WaveMetrics, Inc.

John Bechhoefer
Department of Physics
Simon Fraser University
Burnaby, BC, Canada