1
$\begingroup$

I have been trying to solve the following system of equations:

0.0345333 (0.23 + x) - 0.061978 (0.55 - x - y) == 
1.6*10^-19 (10^16 - 8.15658*10^16 Log[1 + E^(-38.61 x)]);

0.0345333 (-0.62 - y) + 0.061978 (0.55 - x - y) == 
1.6*10^-19 (10^16 + 6.88347*10^16 Log[1 + E^(-38.61 y)]);

Log=e based logarithm

I used NSolve, no answer was given although the evaluation was running. Later I turned to FindRoot and faced similar results.

I am new to Mathematica and never used it before. I will really appreciate any possible help from anyone regarding the solution of these equations.

Thanks in advance.

Kanak Dept. of EEE, BUET

$\endgroup$
  • $\begingroup$ Strange, I get error messages, can you post the code you are using ? $\endgroup$ – Sektor Apr 7 '16 at 9:09
6
$\begingroup$

Let us first give names to your equations:

    eq1 = 0.0345333 (0.23 + x) - 0.061978 (0.55 - x - y) == 
   1.6*10^-19 (10^16 - 8.15658*10^16 Log[1 + E^(-38.61 x)]);

eq2 = 0.0345333 (-0.62 - y) + 0.061978 (0.55 - x - y) == 
   1.6*10^-19 (10^16 + 6.88347*10^16 Log[1 + E^(-38.61 y)]);

Now a good idea would be to plot them. For that let us resolve the first equation with respect to y and the second - to x:

    sl1 = Solve[eq1, y]
sl2 = Solve[eq2, x]

(*  {{y -> 16.1348 (0.0340879 - 0.061978 x - 0.0345333 (0.23 + x) + 
      1.6*10^-19 (1.*10^16 - 8.15658*10^16 Log[1. + E^(-38.61 x)]))}}

{{x -> -16.1348 (-0.0340879 - 0.0345333 (-0.62 - 1. y) + 0.061978 y + 
      1.6*10^-19 (1.*10^16 + 6.88347*10^16 Log[1. + E^(-38.61 y)]))}}  *)

Now we can plot them:

  Show[{
  Plot[sl1[[1, 1, 2]]
   , {x, -0.1, 0.1}, AxesLabel -> {"x", "y"}],
  ParametricPlot[{sl2[[1, 1, 2]], y}, {y, -0.1, 1}, PlotStyle -> Red]
  }]

enter image description here

Now it is clear, where to take the initial values for the numeric calculation:

 FindRoot[{eq1, eq2}, {x, -0.04}, {y, 0.12}]

(*  {x -> -0.0406988, y -> 0.140409}  *)

and

FindRoot[{eq1, eq2}, {x, -0.07}, {y, -0.05}]

(* {x -> -0.0724718, y -> -0.0411336}  *)

Done. Have fun!

$\endgroup$
3
$\begingroup$

With ContourPlot one can find easily the roots.

eq1 = 0.0345333 (0.23 + x) - 0.061978 (0.55 - x - y) 
- (1.6*10^-19 (10^16 - 8.15658*10^16 Log[1 + E^(-38.61 x)]));

eq2 = 0.0345333 (-0.62 - y) + 0.061978 (0.55 - x - y) 
- (1.6*10^-19 (10^16 + 6.88347*10^16 Log[1 + E^(-38.61 y)]));

ContourPlot[{eq1 == 0, eq2 == 0}, {x, -0.1, 0.1}, {y, -0.1, 0.5}, GridLines -> Automatic]

enter image description here

sol1 = FindRoot[{eq1, eq2}, {x, -1}, {y, -1}]
(* {x -> -0.0724718, y -> -0.0411336} *)

sol2 = FindRoot[{eq1, eq2}, {x, -1}, {y, 1}]
(* {x -> -0.0406988, y -> 0.140409} *)

{eq1, eq2} /. sol1
(* {1.38778*10^-17, -3.46945*10^-18} *)

{eq1, eq2} /. sol2
(* {6.93889*10^-18, -1.95156*10^-18} *)

Edit

For completeness: With Stan Wagon's FindRoots2D in "Mathematica in Action" we get all roots in a given interval.

roots = FindRoots2D[{eq1, eq2}, {x, -1, 1}, {y, -1, 1}]
(* {{-0.0724718, -0.0411336}, {-0.0406988, 0.140409}} *)

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.