I am trying to solve a linear system of four equations with Mathematica. My variables are a1,a2, a1prime, a2prime. I use the code shown below:
eq1 = (kx* i + (0.5*k0*(Xmexx*ky - Xmexy*kx)) + (0.5*
h1*(Xmmxx*kx + Xmmxy*ky)))*
a1 + ((-i*kx) + (0.5*k0*(Xmexx*ky - Xmexy*kx)) - (0.5*
h2*(Xmmxx*kx + Xmmxy*ky)))*
a2 + ((ky*h1/k1) + (0.5*i*
k0*(h1/k1)*(Xmexx*kx + Xmexy*ky)) - (0.5*i*
k1*(Xmmxx*ky - Xmmxy*kx)))*
a1prime + ((ky*h2/k2) - (0.5*i*
k0*(h2/k2)*(Xmexx*kx + Xmexy*ky)) - (0.5*i*
k2*(Xmmxx*ky - Xmmxy*kx)))*
a2prime == (-kx*i) - (0.5 k0*(Xmexx*ky - Xmexy*kx)) + (0.5*
h1*(Xmmxx*kx - Xmmxy*ky))
eq2 = ((i*ky) + (0.5*k0*(Xmeyx*ky - Xmeyy*kx)) + (0.5*
h1*(Xmmyx*kx + Xmmyy*ky)))*
a1 + ((-i*ky) + (0.5*k0*(Xmeyx*ky - Xmeyy*kx)) - (0.5*
h2*(Xmmyx*kx + Xmmxy*ky)))*
a2 + ((-kx*h1/k1) + (0.5*i*
k0*(h1/k1)*(Xmeyx*kx + Xmeyy*ky)) - (0.5*i*
k1*(Xmmyx*ky - Xmmyy*kx)))*
a1prime + ((-kx*h2/k2) - (0.5*i*
k0*(h2/k2)*(Xmeyx*kx + Xmeyy*ky)) - (0.5*i*
k2*(Xmmyx*ky - Xmmyy*kx)))*
a2prime == ((-ky*i) - (0.5 k0*(Xmeyx*ky - Xmeyy*kx)) + (0.5*
h1*(Xmmyx*kx - Xmmyy*ky)))
eq3 = ((i*ky) + (0.5*k0*(Xmeyx*ky - Xmeyy*kx)) + (0.5*
h1*(Xmmyx*kx + Xmmyy*ky)))*
a1 + ((-i*ky*h2/(w*mu0)) - (0.5*w*
eps0*(Xeexx*ky - Xeexy*kx)) + (0.5*h2*Sqrt[
eps0/mu0] (Xemxx*kx + Xemxy*ky)))*
a2 + ((kx*k1/(w*mu0)) - (0.5*i*w*
eps0*(h1/k1) (Xeexx*kx + Xeexy*ky)) + (0.5*i*k1*Sqrt[
eps0/mu0] (Xemxx*ky - Xemxy*kx)))*
a1prime + ((-kx*k2/(w*mu0)) + (0.5*i*w*
eps0*(h2/k2) (Xeexx*kx + Xeexy*ky)) + (0.5*i*k2*Sqrt[
eps0/mu0] (Xemxx*ky - Xemxy*kx)))*
a2prime == ((-i*ky*h1/(w*mu0)) + (0.5*w*
eps0*(Xeexx*ky - Xeexy*kx)) - (0.5*h1*Sqrt[
eps0/mu0] (Xemxx*kx + Xemxy*ky)))
eq4 = ((i*kx*h1/(w*mu0)) - (0.5*w*eps0*(Xeeyx*ky - Xeeyy*kx)) - (0.5*
h1*Sqrt[eps0/mu0] (Xemyx*kx + Xemyy*ky)))*
a1 + ((i*kx*h2/(w*mu0)) - (0.5*w*
eps0*(Xeeyx*ky - Xeeyy*kx)) + (0.5*h2*Sqrt[
eps0/mu0] (Xemyx*kx + Xemyy*ky)))*
a2 + ((ky*k1/(w*mu0)) - (0.5*i*w*
eps0*(h1/k1) (Xeeyx*kx + Xeeyy*ky)) + (0.5*i*k1*Sqrt[
eps0/mu0] (Xemyx*ky - Xemyy*kx)))*
a1prime + ((-ky*k2/(w*mu0)) + (0.5*i*w*
eps0*(h2/k2) (Xeeyx*kx + Xeeyy*ky)) + (0.5*i*k2*Sqrt[
eps0/mu0] (Xemyx*ky - Xemyy*kx)))*
a2prime == ((i*kx*h1/(w*mu0)) + (0.5*w*
eps0*(Xeeyx*ky - Xeeyy*kx)) - (0.5*h1*Sqrt[
eps0/mu0] (Xemyx*kx + Xemyy*ky)))
Solve[eq1 && eq2 && eq3 && eq4, {a1, a2, a1prime,
a2prime}] // simplify;
By this code, I've got extremely complicated results. To simplify the results, i want to apply the substitutions below, but i don't know how to do that. Could anyone help me how to do that?
k = w Sqrt[mu0*eps0]
k1 = k
k2 = k
kt = Sqrt[kx^2 + ky^2]
h1 = Sqrt[k^2 - kt^2]
h2 = Sqrt[k^2 - kt^2]
h1 = k1z
h2 = k1z
k0 = w Sqrt[mu0*eps0]
Xeeyy = Xeexx
Xeexy = 0
Xeeyx = 0
Xemyy = Xemxx
Xemxy = 0
Xemyx = 0
Xmmyy = Xmmxx
Xmmxy = 0
Xmmyx = 0
Xmeyy = Xmexx
Xmexy = 0
Xmeyx = 0
I really appreciate your comments.
matrix = Array[mm, {4, 4}]
to create and arbitrary matrix and then runInverse@matrix
and take a look at it. Complicated! Now replace each ofmm[ , ]
with one of your complicated terms. $\endgroup$