# \[?\] Solve two non-linear equations?

**URL:** <https://community.wolfram.com/t/solve-two-non-linear-equations/11062>\
**Category:** Questions\
**Tags:** equation-solving, symbolic-computations\
**Created:** [August 5, 2017, 5:43pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062 "2017-08-05T17:43:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sotiristsatsos](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sotiristsatsos](https://community.wolfram.com/u/sotiristsatsos)\
**Post date:** [August 5, 2017, 5:43pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/1 "2017-08-05T17:43:32Z")

</div>

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}}]

```

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [August 6, 2017, 5:46am UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/2 "2017-08-06T05:46:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sotiristsatsos](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sotiristsatsos](https://community.wolfram.com/u/sotiristsatsos)\
**Post date:** [August 7, 2017, 2:37pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/3 "2017-08-07T14:37:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [August 7, 2017, 5:18pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/4 "2017-08-07T17:18:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sotiristsatsos](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sotiristsatsos](https://community.wolfram.com/u/sotiristsatsos)\
**Post date:** [August 7, 2017, 6:02pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/5 "2017-08-07T18:02:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sotiristsatsos](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sotiristsatsos](https://community.wolfram.com/u/sotiristsatsos)\
**Post date:** [August 7, 2017, 6:05pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/6 "2017-08-07T18:05:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [August 8, 2017, 4:40am UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/7 "2017-08-08T04:40:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sotiristsatsos](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sotiristsatsos](https://community.wolfram.com/u/sotiristsatsos)\
**Post date:** [August 19, 2017, 2:14pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/8 "2017-08-19T14:14:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sotiristsatsos](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sotiristsatsos](https://community.wolfram.com/u/sotiristsatsos)\
**Post date:** [September 1, 2017, 4:57pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/9 "2017-09-01T16:57:37Z")

</div>

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 = 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];

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

theta = (At100_rc_Pc_MwB)/(3_dbm_Pb_MwC)  
S = Pi\*(rc^2)\*((Sin[i + Pi/36])^2 - (Sin[i])^2);

SC = (1 - Exp[-dc/lcc])_Exp[-da/lca]_(1 + theta_Exp[-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 + theta_Exp[-2\*db/lab] - theta))\*S;

SCb = (1 - Exp[-dc/lcc])\*  
Exp[-da/lca]_(1 + theta_Exp[-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 + theta_Exp[-2\*db/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}}]]

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [September 7, 2017, 6:08pm UTC](https://community.wolfram.com/t/solve-two-non-linear-equations/11062/10 "2017-09-07T18:08:29Z")

</div>

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
