1
$\begingroup$

I have two equations with two unknowns $-10<x<0$ and $0<y<15$ $$3 y \cosh (4 x) \cos (y)+(2 x+5) \cosh (x) \sin (y)=0,\\3 x \cosh (x) \cos (y)-(2 x+5) \sinh (x) \cos (y)=0$$

  • I would like to find numerical solutions of $(x,y)$ which solve this system of equations. I use NSolve but it does not work.
NSolve[{3 y Cos[y] Cosh[4 x] + (5 + 2 x) Cosh[x] Sin[y] == 0, 
  3 x Cos[y] Cosh[x] - (5 + 2 x) Cos[y] Sinh[x] == 0}, {x, y}]

  • Then, I want to show those points in a plot.

Any comments are greatly appreciated.

$\endgroup$
4
$\begingroup$
Clear["Global`*"]

EDIT: Corrected intervals in Solve

sol = Solve[{3 y Cos[y] Cosh[4 x] + (5 + 2 x) Cosh[x] Sin[y] == 0, 
    3 x Cos[y] Cosh[x] - (5 + 2 x) Cos[y] Sinh[x] == 0, -10 < x < 0, 
    0 < y < 15}, {x, y}] /. r_Root :> N[r]

(* {{x -> -(5/2), y -> π/2}, {x -> -(5/2), y -> (3 π)/2}, {x -> -(5/2), 
  y -> (5 π)/2}, {x -> -(5/2), y -> (7 π)/2}, {x -> -(5/2), 
  y -> (9 π)/2}, {x -> -0.737455, y -> 1.66515}, {x -> -0.737455, 
  y -> 4.74558}, {x -> -0.737455, y -> 7.87399}, {x -> -0.737455, 
  y -> 11.0099}, {x -> -0.737455, y -> 14.1483}} *)

If Solve or NSolve doesn't work, use FindRoot

sol = Flatten[
  Outer[FindRoot[{3 y Cos[y] Cosh[4 x] + (5 + 2 x) Cosh[x] Sin[y] == 
       0, 3 x Cos[y] Cosh[x] - (5 + 2 x) Cos[y] Sinh[x] == 
       0}, {{x, #1}, {y, #2}}] &, {-3, -1}, {2, 4, 8, 11, 14}], 1]

(* {{x -> -2.5, y -> 1.5708}, {x -> -2.5, y -> 4.71239}, {x -> -2.5, 
  y -> 7.85398}, {x -> -2.5, y -> 10.9956}, {x -> -2.5, 
  y -> 14.1372}, {x -> -0.737455, y -> 1.66515}, {x -> -0.737455, 
  y -> 4.74558}, {x -> -0.737455, y -> 7.87399}, {x -> -0.737455, 
  y -> 11.0099}, {x -> -0.737455, y -> 14.1483}} *)

Plotting,

ContourPlot[{3 y Cos[y] Cosh[4 x] + (5 + 2 x) Cosh[x] Sin[y] == 0, 
  3 x Cos[y] Cosh[x] - (5 + 2 x) Cos[y] Sinh[x] == 0}, {x, -10, 0}, {y, 0, 
  15}, Epilog -> {Red, AbsolutePointSize[4], Point[{x, y} /. sol]}, 
 PlotPoints -> 75, MaxRecursion -> 5, 
 PlotLegends -> Placed["Expressions", Top]]

enter image description here

$\endgroup$
7
  • $\begingroup$ Thank you very much. Unfortunately, when I use this code, I get a lot of errors (I have added the screenshot of the errors to the question). And why you have considered a different domain for $x,y$? $\endgroup$
    – user80187
    May 25 at 7:01
  • $\begingroup$ When I copied your code the intervals were not included in the code and I did not notice you had mentioned them in the text. I corrected the intervals. Presumably you are using an older version since Solve doesn't work for you. I will add solution using FindRoot $\endgroup$
    – Bob Hanlon
    May 25 at 7:28
  • $\begingroup$ Thanks. I am using Mathematica 12.0 and the error still persists. $\endgroup$
    – user80187
    May 25 at 7:29
  • $\begingroup$ I used v12.3. Use FindRoot $\endgroup$
    – Bob Hanlon
    May 25 at 7:33
  • $\begingroup$ Thanks, FindRoot works. $\endgroup$
    – user80187
    May 25 at 7:37

Your Answer

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