Math-Q: Solving linear equations complex variables

G'day all,
How to solve the following equation please, (A, B, C,.. real constants, while X, Y are complex variables: knowing that the equations are determinate (applied for several inputs of data so that the number of unknown=knowns)
A+imaginary(B)= Real[(C.Real(X)+D.Real(Y)+ E.imaginary(X)+F.imaginary(Y))]+ Imaginary[ (G.Real(X)+H.Real(Y)- I.imaginary(X)+J.imaginary(Y))] ----Eq(1)
I was thinking of Two possibilities :
sol-1
the real part for RS = the Real part in the LS:
the imaginary part for RS = the Real part in the LS
noting that each real part has both real&imaginary variables
After first attempt : it seems no solution exist for this case
A=[(C.Real(X)+D.Real(Y)+ E.imaginary(X)+F.imaginary(Y))]----1
B=[(G.Real(X)+H.Real(Y)+ I.imaginary(X)+J.imaginary(Y))]--2
Thanks

12 Comments

Hi
You said that B is real number but you use imaginary(B) at Eq(1).
Am I missing something ?
And something else : when you write C.Real(x) do you mean C * Re(x) ?
I kept the form of the equation as it is for clarification. But, thanks, I see now it is mispresented here.it is the constant of imaginary part and it is not imaginary(B).
Imaginary(B) =1i*B
C.Real(x)=C*Real(x)
Thanks
this does not appear to be matlab code .
It is math question. I need it for the cod I am writing.
Is there a relationship between x and X, or y and Y ? You say that X and Y are complex: how about x and y ?
What is being solved for?
I get the impression that you are trying to solve for X and Y ?
"Sorry"
Updated the question: there is only X,Y variables. Also, they are complex variables.
the solution is for the vaiables X,Y
I am with this code since month, my previous Questions show first version of the code.
I got a cod for solving (similar) porblm, it seems they used the scond option above (in the question, real part= all the real vairables in the equations, the same for the imaginary part) which doesnt solved or worked when I tested in my code.
However, I solved the problem few days ago and lost everything after power failure without save. at that time the challenge was I getting real solution not complex [ this part discussed in previous post, Walter calrify it due to the form of equation posted there should the solution be real; I am stduying if the constructed equation has mistake]
Thanks
In the below, D_ is your D variable, I_ is your variable I, and I is the imaginary unit, and substitute X = Xr + I*Ximag, Y = Yr + I*Ximag for real Xr, Yr, Ximag, Yimag: Then your equations become,
A+I*B = (-I_+I*G+C)*Xr+(I*H-J+D_)*Yr+(-I*I_-E)*Ximag-(I*J+F)*Yimag
AA+I*BB = (-S+I*Q+K)*Xr+(I*R+L-T)*Yr+(-I*S-M)*Ximag-(I*T+N)*Yimag
Taking the real and imaginary parts of the two equations gives four equations in the four variables Xr, Yr, Ximag, Yimag, and that is enough to lead to a solution.
A+I*B = (-I_+I*G+C)*Xr+(I*H-J+D_)*Yr+(-I*I_-E)*Ximag-(I*J+F)*Yimag
AA+I*BB = (-S+I*Q+K)*Xr+(I*R+L-T)*Yr+(-I*S-M)*Ximag-(I*T+N)*Yimag
I am really thankful for your help. This totally make sense. I have it in my note but did not give it any shot to try it as I stick with very stupid mistakes.
Thanks angain
The solutions are not especially "nice", but the process is pretty straight forward. For example,
Xr = ((AA*S-BB*M)*J^2+((-AA*I_-A*S+BB*E+B*M)*T+N*BB*I_+(-AA*D_+A*L-B*N)*S+(AA*R-BB*L)*E-M*(A*R-BB*D_))*J+(A*I_-B*E)*T^2+((AA*D_-A*L-BB*F)*I_+B*F*S+(-AA*H+B*L)*E+M*(A*H-B*D_))*T+((-AA*R+BB*L)*F+N*(A*R-BB*D_))*I_+((AA*H-B*L)*F-N*(A*H-B*D_))*S+(-BB*H+B*R)*(-E*N+F*M))/((K*S-M*Q-S^2)*J^2+(((2*S-K)*I_+M*G+E*Q-C*S)*T+(-L*S+M*R+N*Q)*I_+D_*S^2+(C*L-D_*K-E*R-G*N)*S+(K*R-L*Q)*E+M*(-C*R+D_*Q))*J+(C*I_-E*G-I_^2)*T^2+(L*I_^2+(-C*L+D_*K-D_*S-F*Q-H*M)*I_+(E*H+F*G)*S+(G*L-H*K)*E-M*(-C*H+D_*G))*T-I_^2*N*R+((F*R+H*N)*S+(-K*R+L*Q)*F-N*(-C*R+D_*Q))*I_-F*H*S^2+((-G*L+H*K)*F+N*(-C*H+D_*G))*S-(-G*R+H*Q)*(-E*N+F*M))
Do watch out for I_ being your I variable not the imaginary unit. The package I used for computation uses I as the imaginary unit so I had to rename the I variable.
residue = sum( (real(lhs(EQN))-real(rhs(EQN))^2 + (imag(lhs(EQN))-imag(rhs(EQN))^2 )
dxr = diff(residue, xreal )
d2xr = diff(dxr, xreal)
candidate_min_xreal = solve( dxr, xreal )
d2xr_val = subs(d2xr, xreal, candidate_min_xreal)
mask1 = isAlways(imaginary(d2xr_val) == 0) & isAlways(real(d2xr_val) > 0)
xr_at_min = candidate_min_xreal(mask1)
Except that really you should be using "could it be" instead of isAlways. Hmmm.... let me think... couldItBe = @(proposition) ~isAlways(~proposition) so you could use that.
Once you have candidate xreal, you can substitute them in to residue, then follow the same kind of logic but for a different one of the variables. Keep going until you have minimized for all of the variables or have arrived at a contradiction (in which case take a different potential value of the last variable substituted.)
1) Like I posted before,
couldItBe = @(proposition) ~isAlways(~proposition)
2) xr_at_min is "candidate xreal" that can be substituted into the residue
3) "I have a vector of xreal, and y_real ..etc"
That is inconsistent with your "The equation has 2 separable parts (Real+Imaginary) with four real variabels."
4) Each cycle of differentiation, solve for a zero, differentiate a second time, substitute the roots into the second derivative, accept the solutions that are potentially positive, substitute those into the equation: each round of that reduces the number of free variables by 1 (but does potentially introduce multiple solution branches based upon the possibility of multiple solutions for the zero.) You may get to a point where you can demonstrate that all of the substitutions into the second derivative come out negative or zero: if so then you reject that and move backwards to the last point where you had a choice of solutions and take the next possible solution and move forward from there. Eventually you may arrive at a full list of substitutions that in chain result give you a minima: if so run back substitutions until you get a full list of values for the variables, and add that full list of values to your solution list, after which you go back to the last point you had a choice of solutions and move forwards with the next candidate. If you reach the end of all possible branches without having found at least one full list of solutions, then the equations do not have a minima, in which case the minima will be found at some mix of +/- infinity for all of the variables.
Thank you for your answer. Actually, It seems on higher level than my experience with Matlab. I am not sure I am capable to simulate the procedure correctly. I will give it try.
The equation that I want to be solve seems very complicated. It takes me while to have more accurate understanding to the real structure of the equation.
You are correct, my the original post was for kinda of prlimineary and might be unaccurate interpretation to the problem.
I am not sure if the suggested solution is still valid for the new definition of the problem (equaiton with a vectors of variable). I will the question in in new post.
Thank

Sign in to comment.

Answers (0)

Asked:

on 16 Nov 2018

Edited:

on 28 Nov 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!