Message Boards Message Boards

0
|
5225 Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:

[?] Solve two non-linear equations?

Posted 7 years ago

I am a new one here... so i need your help for a solution!!

Here is a problem where I need to solve 2 non linear equations that contain summaries.. Can anyone help to overcome this problem? I need a solution for the da and db (the unknown variables). The file is attached .. Thank you in advance.

rc = 47;


IntensityA = 17346;
IntensityB = 9831;
IntensityC = 91882;
KBC = 0.422;
KAB = 0.43;
BAB = (IntensityA/IntensityB)*KAB;
BBC = (IntensityB/IntensityC)*KBC;

lba = 4.12;
lbb = 2.05;
lcc = 1.82;
lcb = 1.49;
lca = 2.95;
laa = 3.44;
lac = 2.12;
lab = 1.72;
lbc = 2.52;

At100 = 0.0035;
Pc = 3.85;
Pb = 7.18;
MwB = 231.85;
MwC = 79.88;

theta = (At100*rc*Pc*MwB)/(3*db*Pb*MwC);

rb = rc + db;
ra = rc + db + da;

dc = 2*rc*Cos[i];
db = Sqrt[rb^2 - (rc*Sin[i])^2] - rc*Cos[i];
da = Sqrt[ra^2 - (rc*Sin[i])^2] - Sqrt[rb^2 - (rc*Sin[i])^2];

S = Pi*rc^2*((Sin[i + Pi/180])^2 - (Sin[i])^2);

SC = (1 - Exp[-dc/lcc])*Exp[-da/lca]*(1 + theta*Exp[-db/lcb] - theta)*
   S;
SB = (1 - Exp[-db/lbb])*Exp[-da/lba]*(1 + Exp[-dc/lbc]*Exp[-db/lbb])*S;
SA = (1 - Exp[-da/laa])*(1 + 
     Exp[-dc/lac]*Exp[-da/laa]*(1 + theta*Exp[-2*db/lab] - theta))*S;

Ic = Sum[SC, {i, Pi/180, Pi/2}];
Ia = Sum[SA, {i, Pi/180, Pi/2}];
Ib = Sum[SB, {i, Pi/180, Pi/2}];



R1 = (Ib/Ic ) - BBC;
R2 = (Ia/Ib) - BAB;
FindRoot[{R1 == 0, R2 == 0}, {{da, 1}, {db, 1}}]
Attachments:
POSTED BY: Sotiris Tsat
9 Replies
Posted 7 years ago

Hello Bill. I have one more question. As you can see the problem has a solution. However I want to find solutions to a limited range of them such as, for example 0<theta<1 ,0.4<dam<2, dbm>0 and ofcourse reals (not complex numbers) .You have any idea? ClearAll["Global`*"] rc = 47;

IntensityA = 12808; IntensityB = 30852; IntensityC = 82858; KBC = 1.07; KAB = 4.36;

BAB = (IntensityA/IntensityB)*KAB; BBC = (IntensityB/IntensityC)*KBC;

lba = 4.13; lbb = 2.05; lcc = 1.83; lcb = 1.49; lca = 2.96; laa = 3.45; lac = 2.12; lab = 1.73; lbc = 2.53;

At100 = 0.014; Pc = 3.85; Pb = 7.18; MwB = 231.85; MwC = 79.88;

rb = rc + dbm; ra = rc + dbm + dam;

dc = 2rcCos[i]; db = Sqrt[rb^2 - (rcSin[i])^2] - rcCos[i]; da = Sqrt[ra^2 - (rcSin[i])^2] - Sqrt[rb^2 - (rcSin[i])^2];

f1 = 0.25 + 28.49461Exp[-3.63(rb/rc)]; f2 = -0.05 + 39.79446Exp[-3.63(rb/rc)];

theta = (At100rcPcMwB)/(3dbmPbMwC) S = Pi(rc^2)((Sin[i + Pi/36])^2 - (Sin[i])^2);

SC = (1 - Exp[-dc/lcc])Exp[-da/lca](1 + thetaExp[-db/lcb] - theta) S; SB = theta(1 - Exp[-db/lbb]) Exp[-da/lba](1 + Exp[-dc/lbc]Exp[-db/lbb])Sf1; SA = (1 - Exp[-da/laa])(1 + Exp[-dc/lac]Exp[-da/laa](1 + thetaExp[-2db/lab] - theta))S;

SCb = (1 - Exp[-dc/lcc])* Exp[-da/lca](1 + thetaExp[-db/lcb] - theta)*S; SBb = theta(1 - Exp[-db/lbb]) Exp[-da/lba](1 + Exp[-dc/lbc]Exp[-db/lbb])Sf2; SAb = (1 - Exp[-da/laa])(1 + Exp[-dc/lac]Exp[-da/laa](1 + thetaExp[-2db/lab] - theta))S;

Ic = Sum[SC, {i, 0, Pi/2, Pi/36}]; Ia = Sum[SA, {i, 0, Pi/2, Pi/36}]; Ib = Sum[SB, {i, 0, Pi/2, Pi/36}]; Icp = Sum[SC, {i, 0, Pi/2, Pi/36}]; Iap = Sum[SA, {i, 0, Pi/2, Pi/36}]; Ibp = Sum[SB, {i, 0, Pi/2, Pi/36}];

R1 = (0.785(Ia/Ib) + 0.215(Iap/Ibp)) - BAB; R2 = (0.785(Ib/Ic) + 0.215(Ibp/Icp)) - BBC;

Assuming[Reals, FindRoot[{R2 == 0, R1 == 0}, {{dbm, 1}, {dam, 0.8}}]]

Attachments:
POSTED BY: Sotiris Tsat
Posted 7 years ago

This

theta = (At100*rc*Pc*MwB)/(3*dbm*Pb*MwC);

appears to be causing you problems. If I remove that, then evaluate the rest of your assignments, and finally

NMinimize[{Norm[R2]+Norm[R1], 0<theta<1 && 0.4<dam<2 && dbm>0}, {theta, dam, dbm}]

quickly returns

{1.34609*10^-8, {theta -> 0.60021, dam -> 0.886882, dbm -> 0.761926}}

If instead I do not remove the assignment to theta then

NMinimize[{Norm[R2]+Norm[R1], 0<theta<1 && 0.4<dam<2 && dbm>0}, {dam, dbm}]

returns

{0.0526246, {dam -> 0.791757, dbm -> 0.341362}}

and

(At100*rc*Pc*MwB)/(3*dbm*Pb*MwC) /. dbm -> 0.3413622051761988`

shows

0.999987

so that does not find nearly as good a minimum and theta is up against your boundary

POSTED BY: Bill Simpson
Posted 7 years ago

Problem solved.. thank Bill for your time! Finally it was easy!

POSTED BY: Sotiris Tsat
Posted 7 years ago

All of your equations are defined in terms of i, i is only defined inside each Sum, but you seem to want to find roots for da and db perhaps outside of the Sums.

Are those roots for some specific i?

POSTED BY: Bill Simpson
Posted 7 years ago

Also you forgot that in the particular domain rc=47 (known) takes place

POSTED BY: Sotiris Tsat
Posted 7 years ago

I have already fix the summation. But if you can see i am asking from the program to find the local minimum i.e. the roots for db=1 and da=1 (around the one, for example in the particular problem the solution is about da=0.8 and db=0.3 lets say).By this way I want to confine the solutions. The domain that you tried to simplify is the key for sure but until now i cannot understand why doesnt work.

POSTED BY: Sotiris Tsat
Posted 7 years ago

Without assigning any values to your parameters, perhaps this can provide some information

Simplify[
  Reduce[{
    ra == rc + db + da,
    rb == rc + db,
    da == Sqrt[ra^2 - (rc*Sin[i])^2] - Sqrt[rb^2 - (rc*Sin[i])^2],
    db == Sqrt[rb^2 - (rc*Sin[i])^2] - rc*Cos[i]},
  {da, db}],
Pi/180 <= i <= Pi/2]

That gives some warnings that it cannot find a single solution. But, with or without the Simplify, you might be able to look at the result of that, possibly provide some additional information about the domain of ra, rb, rc, da, db and provide it enough information that it could give you solutions for da and db.

You probably also want to change each of your Sums from

Ia = Sum[SA, {i, Pi/180, Pi/2}]

to

Ia = Sum[SA, {i, Pi/180, Pi/2, Pi/180}]

if you want it to sum every two degrees because otherwise it will only sum the values i=Pi/180 and i=Pi/180+1 and then stop.

POSTED BY: Bill Simpson
Posted 7 years ago

it is impossible to define the problem differently (i believe so). For example if I use initial values for da the problem gives me the result i want . The reverse process unfortunately can not be done i.e. i can's solve via this process the system of tghose eq. in order to find the unknowns da,da.As you can see the da,db is the real unknown variables an not ra, rb because ra,ra are depended from rc wchich is known.

POSTED BY: Sotiris Tsat
Posted 7 years ago

Everything seems fine until you get to

db = Sqrt[rb^2 - (rc*Sin[i])^2] - rc*Cos[i]

To do that it looks up the value of rb which is rc + db. To do that it looks up the value of rc which is 47. Then it looks up the value of db. You have started defining the value of db and so it starts all over again with your db=Sqrt[...]. And it does all this over and over and over until after doing this 1024 times it puts up a warning and usually fails.

Perhaps this is only a small typo. Or perhaps you didn't mean to define db in terms of db.

Can you formulate your problem where the value of variables aren't defined in terms of the value of those same variables?

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract