Solution of system of nonlinear equations
12 views (last 30 days)
Show older comments
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
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.
Answers (3)
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)))
double(subs(eqc_pre,q,rand(4,1)))
double(subs(eqc_pre,q,rand(4,1)))
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))
eq3val = eq3(rand(1000000,1),rand(1000000,1),rand(1000000,1),rand(1000000,1));
min(eq3val)
max(eq3val)
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.
0 Comments
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.
0 Comments
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!