Solution of system of nonlinear equations

7 views (last 30 days)
Swami
Swami on 16 Oct 2024
Edited: Pavl M. on 17 Oct 2024
I have following system of equations to find q1, q2, q3 and q4, which I am unable to solve using solve using matlab 'solve' or 'fsolve' commands. All the values should be positive and should not be exceeding 1.0. Are there any suggestions? Or should I implement newton method to solve it?
eqc1_pre = 91.907*q1 - 1.1978e-14*q3 + 3.534e-14*q1*q3 + 9.1309e+6*(0.007649*q1 + 0.03937*q3)*(0.0038245*q1^2 + 0.03937*q1*q3 + 0.18186*q3^2 - 996.13*q3 - 0.03937*q4 + 1.6325e+7) + 1.819e-13*q3^2 == 0
eqc2_pre = 2914.4*q2 - 875.08*q3 + 3645.7*q2*q3 + 1.3054e+7*(0.007649*q2 + 0.03937*q3)*(0.0038245*q2^2 + 0.03937*q2*q3 + 0.18186*q3^2 - 996.23*q3 - 0.03937*q4 + 1.6325e+7) + 18765.0*q3^2 == 0
eqc3_pre = 3.638e-13*q1*q3 - 875.08*q2 - 9.4963e+8*q3 - 18765.0*q4 - 1.1978e-14*q1 + 37530.0*q2*q3 + 9.1309e+6*(0.03937*q1 + 0.36373*q3 - 996.13)*(0.0038245*q1^2 + 0.03937*q1*q3 + 0.18186*q3^2 - 996.13*q3 - 0.03937*q4 + 1.6325e+7) + 1.3054e+7*(0.03937*q2 + 0.36373*q3 - 996.23)*(0.0038245*q2^2 + 0.03937*q2*q3 + 0.18186*q3^2 - 996.23*q3 - 0.03937*q4 + 1.6325e+7) + 1.767e-14*q1^2 + 1822.8*q2^2 + 260050.0*q3^2 + 7.7808e+12 == 0
eqc4_pre = - 1374.8*q1^2 - 14153.0*q1*q3 - 1965.6*q2^2 - 20235.0*q2*q3 - 158850.0*q3^2 + 8.701e+8*q3 + 34387.0*q4 - 1.4259e+13 == 0
  4 Comments
John D'Errico
John D'Errico on 16 Oct 2024
Answers is not a job seeking forum. Please do not put requests for someone to hire you in your posts. I've removed them for you.
Aquatris
Aquatris on 16 Oct 2024
Edited: Aquatris on 16 Oct 2024
@Pavl M. Did you even solve the problem that was asked? The question askes for solutions within [0 1] space where as, if I understood your confusing comment, your solution does not put any constraints to the parameters.

Sign in to comment.

Answers (3)

Alex Sha
Alex Sha on 17 Oct 2024
@Swami Between the range [0,1] you specified, most likely, there should be no real numbers solution,an approximate solution is:
q1: -31830.1002324947
q2: -31835.6758682725
q3: 6184.74933332136
q4: 336421377.881206

John D'Errico
John D'Errico on 17 Oct 2024
Edited: John D'Errico on 17 Oct 2024
This will be literally impossible to do in double precision, given the huge dynamic range of those coefficients. But we can look to see if it is even likely a solution does exist.
syms q [4,1]
eqc_pre(1) = 91.907*q1 - 1.1978e-14*q3 + 3.534e-14*q1*q3 + 9.1309e+6*(0.007649*q1 + 0.03937*q3)*(0.0038245*q1^2 + 0.03937*q1*q3 + 0.18186*q3^2 - 996.13*q3 - 0.03937*q4 + 1.6325e+7) + 1.819e-13*q3^2;
eqc_pre(2) = 2914.4*q2 - 875.08*q3 + 3645.7*q2*q3 + 1.3054e+7*(0.007649*q2 + 0.03937*q3)*(0.0038245*q2^2 + 0.03937*q2*q3 + 0.18186*q3^2 - 996.23*q3 - 0.03937*q4 + 1.6325e+7) + 18765.0*q3^2;
eqc_pre(3) = 3.638e-13*q1*q3 - 875.08*q2 - 9.4963e+8*q3 - 18765.0*q4 - 1.1978e-14*q1 + 37530.0*q2*q3 + 9.1309e+6*(0.03937*q1 + 0.36373*q3 - 996.13)*(0.0038245*q1^2 + 0.03937*q1*q3 + 0.18186*q3^2 - 996.13*q3 - 0.03937*q4 + 1.6325e+7) + 1.3054e+7*(0.03937*q2 + 0.36373*q3 - 996.23)*(0.0038245*q2^2 + 0.03937*q2*q3 + 0.18186*q3^2 - 996.23*q3 - 0.03937*q4 + 1.6325e+7) + 1.767e-14*q1^2 + 1822.8*q2^2 + 260050.0*q3^2 + 7.7808e+12;
eqc_pre(4) = - 1374.8*q1^2 - 14153.0*q1*q3 - 1965.6*q2^2 - 20235.0*q2*q3 - 158850.0*q3^2 + 8.701e+8*q3 + 34387.0*q4 - 1.4259e+13;
vpa(eqc_pre(:),4)
UGH. But we can look at whether it is likely a solution even exists in the hyper-box [0,1]^4.
double(subs(eqc_pre,q,rand(4,1)))
ans = 1×4
1.0e+17 * 0.0001 0.0001 -3.6066 -0.0001
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
double(subs(eqc_pre,q,rand(4,1)))
ans = 1×4
1.0e+17 * 0.0000 0.0000 -3.6070 -0.0001
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
double(subs(eqc_pre,q,rand(4,1)))
ans = 1×4
1.0e+17 * 0.0000 0.0000 -3.6077 -0.0001
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
However, I would point out that having substituted three sets of random numbers into those equations, almost always equation 3 tends to run about 3.6e17, and those computations were performed in high precision.
eq3 = matlabFunction(eqc_pre(3))
eq3 = function_handle with value:
@(q1,q2,q3,q4)q1.*(-1.1978e-14)-q2.*8.7508e+2-q3.*9.4963e+8-q4.*1.8765e+4+q1.*q3.*3.638e-13+q2.*q3.*3.753e+4+(q1.*3.59483533e+5+q3.*3.321182257e+6-9.095563417e+9).*(q3.*(-9.9613e+2)-q4.*3.937e-2+q1.*q3.*3.937e-2+q1.^2.*3.8245e-3+q3.^2.*1.8186e-1+1.6325e+7)+q1.^2.*1.767e-14+q2.^2.*1.8228e+3+q3.^2.*2.6005e+5+(q2.*5.1393598e+5+q3.*4.74813142e+6-1.300478642e+10).*(q3.*(-9.9623e+2)-q4.*3.937e-2+q2.*q3.*3.937e-2+q2.^2.*3.8245e-3+q3.^2.*1.8186e-1+1.6325e+7)+7.7808e+12
eq3val = eq3(rand(1000000,1),rand(1000000,1),rand(1000000,1),rand(1000000,1));
min(eq3val)
ans = -3.6078e+17
max(eq3val)
ans = -3.6061e+17
This is enough to convince me that no solution exists in that region, since any of a set of 1e6 random points in the box NEVER see any deviation from a very narrow range, that is very far from zero.

Pavl M.
Pavl M. on 17 Oct 2024
Edited: Pavl M. on 17 Oct 2024
Here, I've solved it in more than 4 methods, for specific equations' system approximated solutions found with fixed interval constraints [a,b] added as per requirements plan:
A.1: Runs:
I've corrected, revamped functionality, amended the software program running codes presented in my comment above.
Working codes in Matlab compatible T.C.E. (fles SystemOfNonlinEqSolver1.m, newton_method.m, fronext.m, ...+):
Pictures are worth than thouthands words.I have the corresponding, according to specifications software program code maintaining running on file disk storage controller electronic unit processed machine. I developed them. They are for sale, if you need the software program codes running, contact me more + for more.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!