MATLAB Answers

Solving lengthy nonlinear complex equations in complex variables

3 views (last 30 days)
ubtc
ubtc on 28 Oct 2020
Commented: Alex Sha on 30 Oct 2020
Hello Everyone!
I am trying to solve a set of 4 complex nonlinear equations in 4 complex variables, containing lengthy algebraic expressions with large complex numbers. I have tried vpasolve, solve, fsolve but all get stuck due to voluminous computations involved & no result is appeared. The expressions/equations cannot be shortened or moulded. Please provide suggestions to solve this problem. The code is as under:
_______________________________________________________________________________________________________________________________________
>> syms Y1s Y3s Y4s Y7s
>> e1=(220000/(sqrt(3)))/(((1.8e17*(Y3s*(4.4e63 - 2.0e63i) + Y4s*(6.9e63 - 3.1e63i) + Y7s*(9.4e63 - 4.2e63i) + Y3s*Y4s*(7.8e61 + 1.4e62i) + Y3s*Y7s*(1.1e62 + 1.9e62i) + Y4s*Y7s*(1.6e62 + 2.9e62i) - Y3s*Y4s*Y7s*(5.5e60 - 3.9e60i) - 7.0e64 - 2.1e65i))/(- Y1s*(1.2e82 + 3.7e82i) - Y3s*(1.4e82 + 4.1e82i) - Y4s*(1.5e82 + 4.3e82i) - Y7s*(2.0e82 + 5.5e82i) + Y1s*Y3s*(7.7e80 - 3.4e80i) + Y1s*Y4s*(1.2e81 - 5.4e80i) + Y3s*Y4s*(1.4e81 - 6.2e80i) + Y1s*Y7s*(1.7e81 - 7.4e80i) + Y3s*Y7s*(1.9e81 - 8.6e80i) + Y4s*Y7s*(2.0e81 - 9.2e80i) + Y1s*Y3s*Y4s*(1.4e79 + 2.4e79i) + Y1s*Y3s*Y7s*(1.9e79 + 3.3e79i) + Y1s*Y4s*Y7s*(2.9e79 + 5.1e79i) + Y3s*Y4s*Y7s*(3.4e79 + 5.9e79i) - Y1s*Y3s*Y4s*Y7s*(9.7e77 - 6.9e77i) - 9.7e83 + 2.7e83i))*484)-((3.9046-44.6295*i)*1000);
>> e3=(220000/(sqrt(3)))/(((4.4e16*(Y1s*(1.7e64 - 7.8e63i) + Y4s*(3.2e64 - 1.4e64i) + Y7s*(4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*Y7s*(9.3e80 + 3.4e79i) + Y4s*Y7s*(9.9e80 + 3.5e79i) + Y1s*Y3s*Y4s*(6.9e77 + 1.2e79i) + Y1s*Y3s*Y7s*(1.0e78 + 1.7e79i) + Y1s*Y4s*Y7s*(1.5e78 + 2.6e79i) + Y3s*Y4s*Y7s*(1.8e78 + 3.0e79i) - Y1s*Y3s*Y4s*Y7s*(5.3e77 - 8.5e76i) - 4.4e83 - 8.5e82i))*484)-((1.5165-17.3338*i)*1000);
>> e7=(220000/(sqrt(3)))/(((1.2e4*(Y1s*(1.9e77 + 7.3e76i) + Y3s*(2.2e77 + 8.2e76i) + Y4s*(2.3e77 + 8.7e76i) - Y1s*Y3s*(1.1e75 - 4.2e75i) - Y1s*Y4s*(1.7e75 - 6.4e75i) - Y3s*Y4s*(2.0e75 - 7.4e75i) - Y1s*Y3s*Y4s*(1.3e74 + 2.2e73i) + 2.8e78 - 6.0e78i))/(Y1s*(2.5e82 - 4.9e82i) + Y3s*(2.7e82 - 5.5e82i) + Y4s*(2.8e82 - 5.8e82i) + Y7s*(3.5e82 - 7.5e82i) + Y1s*Y3s*(1.1e81 + 4.2e80i) + Y1s*Y4s*(1.7e81 + 6.7e80i) + Y3s*Y4s*(2.0e81 + 7.7e80i) + Y1s*Y7s*(2.4e81 + 9.2e80i) + Y3s*Y7s*(2.7e81 + 1.0e81i) + Y4s*Y7s*(2.9e81 + 1.1e81i) - Y1s*Y3s*Y4s*(1.0e79 - 3.8e79i) - Y1s*Y3s*Y7s*(1.4e79 - 5.2e79i) - Y1s*Y4s*Y7s*(2.2e79 - 8.0e79i) - Y3s*Y4s*Y7s*(2.5e79 - 9.3e79i) - Y1s*Y3s*Y4s*Y7s*(1.7e78 + 2.7e77i) - 1.2e84 - 7.0e83i))*484)-((4.8371-55.2888*i)*1000);
>> result = solve(e1,e3,e4,e7,Y1s,Y3s,Y4s,Y7s)
_______________________________________________________________________________________________________________________________________
  4 Comments
ubtc
ubtc on 29 Oct 2020
Thanks for your suggestions! "fsolve" happens to solve the equations, whereas "vpasolve" remains stuck.

Sign in to comment.

Answers (2)

Alex Sha
Alex Sha on 29 Oct 2020
Try to find numerical solutions as below;
y1s.realpart: 11.0169967890388
y1s.imagpart: -125.141575853451
y3s.realpart: 7.81970377305325
y3s.imagpart: -106.356946529629
y4s.realpart: 3.07796056296378
y4s.imagpart: -36.8035908733627
y7s.realpart: 15.4211136064375
y7s.imagpart: -178.419654796614
  2 Comments
Alex Sha
Alex Sha on 30 Oct 2020
Hi, ubtc, the results are obtained by 1stOpt, a math software other than Matlab, much easy for using, and without requiring the guess of initial-start valus for each parameter, the total code like below:
ComplexPar Y1s,Y3s,Y4s,Y7s;
ComplexStr = i;
Function
(220000/(sqrt(3)))/(((1.8e17*(Y3s*(4.4e63 - 2.0e63*i) + Y4s*(6.9e63 - 3.1e63*i) + Y7s*(9.4e63 - 4.2e63*i) + Y3s*Y4s*(7.8e61 + 1.4e62*i) + Y3s*Y7s*(1.1e62 + 1.9e62*i) + Y4s*Y7s*(1.6e62 + 2.9e62*i) - Y3s*Y4s*Y7s*(5.5e60 - 3.9e60*i) - 7.0e64 - 2.1e65*i))/(- Y1s*(1.2e82 + 3.7e82*i) - Y3s*(1.4e82 + 4.1e82*i) - Y4s*(1.5e82 + 4.3e82*i) - Y7s*(2.0e82 + 5.5e82*i) + Y1s*Y3s*(7.7e80 - 3.4e80*i) + Y1s*Y4s*(1.2e81 - 5.4e80*i) + Y3s*Y4s*(1.4e81 - 6.2e80*i) + Y1s*Y7s*(1.7e81 - 7.4e80*i) + Y3s*Y7s*(1.9e81 - 8.6e80*i) + Y4s*Y7s*(2.0e81 - 9.2e80*i) + Y1s*Y3s*Y4s*(1.4e79 + 2.4e79*i) + Y1s*Y3s*Y7s*(1.9e79 + 3.3e79*i) + Y1s*Y4s*Y7s*(2.9e79 + 5.1e79*i) + Y3s*Y4s*Y7s*(3.4e79 + 5.9e79*i) - Y1s*Y3s*Y4s*Y7s*(9.7e77 - 6.9e77*i) - 9.7e83 + 2.7e83*i))*484)-((3.9046-44.6295*i)*1000);
(220000/(sqrt(3)))/(((4.4e16*(Y1s*(1.7e64 - 7.8e63*i) + Y4s*(3.2e64 - 1.4e64*i) + Y7s*(4.3e64 - 2.0e64*i) + Y1s*Y4s*(3.1e62 + 5.4e62*i) + Y1s*Y7s*(4.3e62 + 7.5e62*i) + Y4s*Y7s*(7.7e62 + 1.3e63*i) - Y1s*Y4s*Y7s*(2.2e61 - 1.6e61*i) - 3.2e65 - 9.3e65*i))/(- Y1s*(1.2e82 + 3.7e82*i) - Y3s*(1.4e82 + 4.1e82*i) - Y4s*(1.5e82 + 4.3e82*i) - Y7s*(2.0e82 + 5.5e82*i) + Y1s*Y3s*(7.7e80 - 3.4e80*i) + Y1s*Y4s*(1.2e81 - 5.4e80*i) + Y3s*Y4s*(1.4e81 - 6.2e80*i) + Y1s*Y7s*(1.7e81 - 7.4e80*i) + Y3s*Y7s*(1.9e81 - 8.6e80*i) + Y4s*Y7s*(2.0e81 - 9.2e80*i) + Y1s*Y3s*Y4s*(1.4e79 + 2.4e79*i) + Y1s*Y3s*Y7s*(1.9e79 + 3.3e79*i) + Y1s*Y4s*Y7s*(2.9e79 + 5.1e79*i) + Y3s*Y4s*Y7s*(3.4e79 + 5.9e79*i) - Y1s*Y3s*Y4s*Y7s*(9.7e77 - 6.9e77*i) - 9.7e83 + 2.7e83*i))*484)-((3.4339-39.25*i)*1000);
(220000/(sqrt(3)))/(((5.0e3*(Y1s*(1.2e77 + 5.5e75*i) + Y3s*(1.4e77 + 5.7e75*i) + Y7s*(2.0e77 + 7.0e75*i) + Y1s*Y3s*(1.4e74 + 2.5e75*i) + Y1s*Y7s*(2.9e74 + 5.2e75*i) + Y3s*Y7s*(3.7e74 + 6.1e75*i) - Y1s*Y3s*Y7s*(1.1e74 - 1.7e73*i) + 5.3e77 - 4.0e78*i))/(Y1s*(2.4e81 - 1.7e82*i) + Y3s*(2.6e81 - 1.9e82*i) + Y4s*(2.7e81 - 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79*i) - Y1s*Y3s*Y4s*Y7s*(1.7e78 + 2.7e77*i) - 1.2e84 - 7.0e83*i))*484)-((4.8371-55.2888*i)*1000);
The outcome will be:
y1s.realpart: 11.0169967890388
y1s.imagpart: -125.141575853451
y3s.realpart: 7.81970377305327
y3s.imagpart: -106.356946529629
y4s.realpart: 3.07796056296379
y4s.imagpart: -36.8035908733627
y7s.realpart: 15.4211136064375
y7s.imagpart: -178.419654796614

Sign in to comment.


ubtc
ubtc on 29 Oct 2020
Thank you, everyone!
I have solved the problem by using fsolve. (I had not tried this properly earliear). The answer is as following:-
ans =
1.0e+02 *
0.1102 - 1.2514i 0.0782 - 1.0636i 0.0308 - 0.3680i 0.1542 - 1.7842i
It is same as pointed out by Mr. Alex Sha above but only limited to four decimal places. However, as you can see in original equations, I have simplified the equations using simplify & Variable-precision arithmetic (up to 2 decimal points)
eq = simplify(eq,'Steps',10)
eq = vpa(eq, 2)
I shall definitely try to solve without using "vpa" via "fsolve" method. However, Is there some more accurate way other than "fsolve", to solve such lengthy nonlinear equations in complex variables (more than 8 equations in same no. of variables) with more precision without using "vpa"?

Community Treasure Hunt

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

Start Hunting!