2
$\begingroup$

Having difficulty solving the following instructions:

Solve the system of simultaneous transcendental equations (e^x+ ln(y) = 2 ; sin(x) + cos(y) = 1). Hint: Look for a solution pair (x,y) that meets both conditions.

  1. How do I get this to give me a value for both x and y?
  2. What do the error messages mean?

Here is my input and output:

In[32]:= eq1 = Exp[x] + Ln[y] -2
eq2 = Sin[x] + Cos[y] - 1
system = Solve[eq1 == 0 & eq2 == 0, {x, y}]

Out[32]= -2 + E^x + Ln[y]

Out[33]= -1 + Cos[y] + Sin[x]

During evaluation of In[32]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

During evaluation of In[32]:= Solve::svars: Equations may not give solutions for all "solve" variables.

Out[34]= {{y -> -ArcCos[1 - Sin[x]]}, {y -> ArcCos[1 - Sin[x]]}}
$\endgroup$
6
  • 2
    $\begingroup$ This is that the solution are computed using inverse functions. From the documentation (Solve::ifun): "Inverse functions normally give one branch of a general inverse, so equations that are solved in terms of inverse functions may omit solutions associated with other branches." $\endgroup$
    – mgamer
    Commented Feb 7, 2020 at 6:52
  • 2
    $\begingroup$ Hint: Look up Ln in the help system here reference.wolfram.com/language/?source=nav and then look up Log in the help system. You can also evaluate Ln[1] and Log[1] and see what you get $\endgroup$
    – Bill
    Commented Feb 7, 2020 at 6:56
  • 2
    $\begingroup$ Use && instead of & $\endgroup$
    – Roman
    Commented Feb 7, 2020 at 7:13
  • 3
    $\begingroup$ Right, others were faster ;-) There are syntactic issues in your code, analytical solution is unlikely, you can use FindRoot: Plot[{Exp[2 - Exp[x]], ArcCos[1 - Sin[x]]}, {x, 0, 4}, Epilog -> {PointSize[Large], Red, Point[{x, y} /. FindRoot[{Exp[x] + Log[y] == 2, Sin[x] + Cos[y] == 1}, {x, 0.8}, {y, 0.8}]]} ] $\endgroup$
    – mgamer
    Commented Feb 7, 2020 at 7:17
  • 1
    $\begingroup$ "Ln"? Surprised you didn't get more diagnostic output. $\endgroup$ Commented Feb 7, 2020 at 16:05

2 Answers 2

7
$\begingroup$

The system under consideration can be solved numerically. First, the plot

eq1 = Exp[x] + Log[y] - 2;eq2 = Sin[x] + Cos[y] - 1;
ContourPlot[{eq1 == 0, eq2 == 0}, {x, -Pi, Pi}, {y, 0, 2*Pi}]

enter image description here

suggests the location of the only real solution within these bounds. Second,

FindRoot[eq1 == 0 && eq2 == 0, {{x, 1}, {y, 1}}]
*{x -> 0.624295, y -> 1.14233} *

Similar questions were asked and answered a lot.

$\endgroup$
2
  • 3
    $\begingroup$ there are more solutions though: try ContourPlot[{eq1 == 0, eq2 == 0}, {x, -2Pi, 2Pi}, {y, 0, 4*Pi}] $\endgroup$
    – chris
    Commented Feb 7, 2020 at 7:50
  • 1
    $\begingroup$ @chris: Thank you for your valuable comment. There is likely an infinite set of the solutions up tp ContourPlot[{eq1 == 0, eq2 == 0}, {x, -16*[Pi], 6*[Pi]}, {y, 0, 4 [Pi]}]. $\endgroup$
    – user64494
    Commented Feb 7, 2020 at 7:58
4
$\begingroup$
eq1 = Exp[x] + Log[y] - 2; eq2 = Sin[x] + Cos[y] - 1;

By specifying a region of interest (i.e., bounds on x and y), you can use either NSolve or Solve. This eliminates the need for initial estimates.

pts = NSolve[eq1 == 0 && eq2 == 0 && -2 Pi < x < 2 Pi && 0 < y < 3 Pi, 
   {x, y}, WorkingPrecision -> 12]

(* {{x -> -5.72429888179, y -> 7.36496544358}, 
    {x -> -3.52187172728, y -> 7.17394645329}, 
    {x -> 0.624294646094, y -> 1.14233150365}, 
    {x -> 3.14159265359, y -> 6.58739712575*10^-10}} *)

Verifying the solutions

eq1 == 0 && eq2 == 0 /. pts

(* {True, True, True, True} *)
$\endgroup$
8
  • 1
    $\begingroup$ +1. However, ContourPlot[{eq1 == 0, eq2 == 0}, {x, -2*Pi, 2*Pi}, {y, 0, 3*Pi}, PlotPoints -> 50, WorkingPrecision -> 12] shows only three solutions and FindRoot[eq1 == 0 && eq2 == 0, {{x, 3}, {y, 0.1}}] performs $$\{x\to 3.14159\, +\text{1.9843579483064874$\grave{ }$*${}^{\wedge}$-23} i,y\to \text{6.587397125792588$\grave{ }$*${}^{\wedge}$-10}-\text{2.7353757755297136$\grave{ }$*${}^{\wedge}$-20} i\} $$ $\endgroup$
    – user64494
    Commented Feb 7, 2020 at 19:12
  • 1
    $\begingroup$ @user64494 - the plot has difficulties because the curve is essentially horizontal. Increasing the PlotPoints even more and increasing MaxRecursion will get progressively closer to displaying a fourth solution, but the plot slows down to a dead stop. I believe that this is essentially a limiting case. $\endgroup$
    – Bob Hanlon
    Commented Feb 7, 2020 at 19:22
  • 1
    $\begingroup$ @user64494 - FindRoot[eq1 == 0 && eq2 == 0, {{x, 3}, {y, 1/100}}, WorkingPrecision -> #] & /@ Range[20, 50, 10] suggests that by increasing the WorkingPrecision the imaginary parts can be made arbitrarily small. $\endgroup$
    – Bob Hanlon
    Commented Feb 7, 2020 at 19:29
  • 1
    $\begingroup$ Blowing up ContourPlot[{eq1 == 0, eq2 == 0}, {x, 3, 3.5}, {y, 0, 0.05}, PlotPoints -> 50, WorkingPrecision -> 12], I see the fourth root. $\endgroup$
    – user64494
    Commented Feb 7, 2020 at 19:31
  • 1
    $\begingroup$ There are more solutions, e. g. x->-16.2923,y->7.38906. Seems to be infinitely many, actually $\endgroup$ Commented Feb 7, 2020 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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