Clear Filters
Clear Filters

Solving complex linear equations with conjugate operations

22 views (last 30 days)
Consider the following equations:
Assuming and , substitute them to equations
The real parts and imaginary parts correspondingly equate:
Regarding as unknowns, rearrange to obtain the linear system form .
The result is (using ):
My questions:
1. For complex linear equations involving conjugate operations, is it necessary to calculate them separately?
2. This is just an example. I intend to use this approach to address other similar systems of complex linear equations. In my calculations for other instances, I found the determinant of to be 1e-6, approximately zero. How should I handle this to ensure the accuracy of the equation solutions?
My MATLAB code is attached below.
clc;clear;close all;
%% Set a question
z_1_true=4+2i;%The true value of z1
z_2_true=5+3i;
ee1=z_1_true+z_2_true;%Constant term
ee2=conj(z_1_true)+2*z_2_true-z_1_true;
%% taking the real part and the imaginary part respectively, twice the number of equations
syms z_1 [2 1] real%z1
syms z_2 [2 1] real%z2
z1_com=z_1(1)+1i*z_1(2);%z1_com represents the complex form of z1
z2_com=z_2(1)+1i*z_2(2);
eqns2_com=[z1_com+z2_com-ee1;
conj(z1_com)+2*z2_com-z1_com-ee2];%Construct complex equation
eqns2=[real(eqns2_com)==0;imag(eqns2_com)==0];%Taking the real part and the imaginary part
vars=[reshape(z_1,1,2),reshape(z_2,1,2)];%The variables need to be solved
[A2,b2] = equationsToMatrix(eqns2,vars);%Extract the A and b matrices
Sol2=double(A2)\double(b2);%calculation method
z1_sol2=Sol2(1)+1i*Sol2(2);z2_sol2=Sol2(3)+1i*Sol2(4);
E11=z1_sol2+z2_sol2-ee1;
E22=conj(z1_sol2)+2*z2_sol2-z1_sol2-ee2;
disp('Solve separately:');
Solve separately:
disp(['true value of z1:', num2str(z_1_true),',result:',num2str(z1_sol2),',Error of first equation:',num2str(E11)]);
true value of z1:4+2i,result:4+2i,Error of first equation:0
disp(['true value of z2:', num2str(z_2_true),',result:',num2str(z2_sol2),',Error of second equation:',num2str(E22)]);
true value of z2:5+3i,result:5+3i,Error of second equation:0

Accepted Answer

David Goodmanson
David Goodmanson on 10 Mar 2024
Edited: David Goodmanson on 10 Mar 2024
Hello SB,
Any way you look at it you have four independent unknown quantities, but there is some choice of their form. For the linear system Af = g, for the unknowns you can use f = [z1; z2; z1*; z2*] instead of [x1; x2; y1; y2].
This leads to (by inspection)
A = [1 1 0 0
0 0 1 1
-1 2 1 0
1 0 -1 2]
g = [9+5i; 9-5i; 10+2i; 10-2i]
f = A\g
f =
4.0000 + 2.0000i
5.0000 + 3.0000i
4.0000 - 2.0000i
5.0000 - 3.0000i
as you would expect. IF A has real coefficients (as in this case), then the second row of A is merely the first row, only with A(1,1:2) swapped with A(1,3:4). The same is true of the fourth row, consisting of A(3,1:2) swapped with A(3,3:4). If you want to find A using symbolic variables it ought to be doable (although I am staying on the sidelines).
To check the matrix for how close it is to being singular, it's better to use cond instead of det. In this cases llike this where all the matrix elements are on the order of 1, det is probably all right, but unlike det, cond has does not have the same scaling issues. And if A is close to being singular, that fact really has very little to do with complex --> real part + imaginary part etc.; or whatever method is used.
  5 Comments
David Goodmanson
David Goodmanson on 26 Apr 2024
Hi SB,
I'm not sure how it could turn out that way, since the x,y variables and the z,z* variables are related by basically a similarity transformation on A. If you have
A*x = b
with all those quantities real, then let
z = T * x
[z1 ] [ 1 i 0 0] [x1]
[z1*] = [ 1 -i 0 0] * [y1]
[z2 ] [ 0 0 1 i] [x2]
[z2*] [ 0 0 1 -i] [y2]
and
x = T^(-1) * z
[x1] [ 1 1 0 0] [z1 ]
[y1] = (1/2) [ -i i 0 0] * [z1*] matrix is T^(-1)
[x2] [ 0 0 1 1] [z2 ]
[y2] [ 0 0 -i i] [z2*]
then
A*x = b
z = T*x
x = T^(-1) *z
so
T*A*T^(-1) *z = T*b
and it seems kind of inevitable that z1, z1*, z2, z2* end up as correct complex conjugates.
Shengfan Bi
Shengfan Bi on 30 Apr 2024 at 7:21
Hello David,
Thank you for your patience. This method indeed has no issue, it was my misunderstanding. Essentially, there is no difference compared to the solution where x and y are taken as independent variables, and the condition number of the coefficient matrix remains unchanged. However, it offers a different perspective.

Sign in to comment.

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!