# Numerical solution of complicated trigonometric equation

I have the following equation to numerically solve for \[CurlyPhi] as function of $k$ and $x$. $k$ is normally between $-\pi\leq k\leq\pi$.

   A = 0.5;
B = 0.1;
P = -2.5;
Sin[3*k + \[CurlyPhi]]/Sin[2*k + \[CurlyPhi]] ==
P + 2 Cos[k] + x^2/(1 + B*x^2) + (
A*x^2*(Sin^2)[k])/((Sin^2)[2*k + \[CurlyPhi]] + B*x^2*(Sin^2)[k])


Since this is analytically not solvable, so I started with lim $x\to 0$, and the solution is found in this limit, but then I want to see how numerical solutions \[CurlyPhi] would change with increasing $x$. So either directly numerical solution or this way is OK but I don't understand how to do it. Any suggestions?

• The solution is done in the same way you asked for in your question "mathematica.stackexchange.com/questions/180484/…" – Ulrich Neumann Aug 24 '18 at 7:26
• I couldn't understand what's u there? Secondly, the output is too long even after providing the parameters as above with several (...1....)^n which i dont know what they mean. Lastly, that was a numerical solution? – AtoZ Aug 24 '18 at 7:32
• If you show your own efforts it is easier to support you and less time consuming... – Ulrich Neumann Aug 24 '18 at 7:36
• This (Sin^2)[k] is a syntax error. In Mma it is Sin[k]^2. – Alexei Boulbitch Aug 24 '18 at 8:30

If you define the equation as

eq[\[CurlyPhi]_, k_, x_] := Sin[3*k + \[CurlyPhi]]/Sin[2*k + \[CurlyPhi]] ==
P + 2 Cos[k] +x^2/(1 + B*x^2) + (A*x^2* Sin [k]^2)/(Sin  [2*k + \[CurlyPhi]]^2 + B*x^2*Sin [k]^2) /. {A -> 1/2,B -> 1/10, P -> -25/10}


Contourplot shows you the numerical solutions for variing x:

Manipulate[ContourPlot [Evaluate[eq[\[CurlyPhi], k, x]] , {\[CurlyPhi], 0, 2 Pi}, {k, -Pi,Pi}, FrameLabel -> {\[CurlyPhi], k}], {{x, 1}, 0, 3, .01,Appearance -> "Labeled"}] The several solutions can be evaluated with

phi[x_?NumericQ, k_ /; -Pi <= k <= Pi] := \[CurlyPhi] /.
NSolve[{eq[\[CurlyPhi], k, x],0 <= \[CurlyPhi] <= 2 Pi}, \[CurlyPhi], Reals]
phi[1, 3]
(* {0.193985, 3.33558}*)

• Now it should work (hopefully) – Ulrich Neumann Aug 24 '18 at 8:53
• Possible, but what is the different appearance? My MMA version is 11.0.1 – Ulrich Neumann Aug 24 '18 at 9:00
• What's your input? Did you change Sin^2[...]? – Ulrich Neumann Aug 24 '18 at 9:04
• No idea, try Option MaxRecursion-> inside ContourPlot. – Ulrich Neumann Aug 24 '18 at 9:10
• So you didn't used my definition of eq[...] which already contains ==... – Ulrich Neumann Aug 24 '18 at 9:28
A = 1/2;
B = 1/10;
P = -5/2;

phi[k_, x_, p0_] := \[CurlyPhi] /.
FindRoot[Sin[3*k + \[CurlyPhi]]/
Sin[2*k + \[CurlyPhi]] - (P + 2 Cos[k] + x^2/(1 + B*x^2) +
A*x^2*Sin[k]^2/(Sin[2*k + \[CurlyPhi]]^2 + B*x^2*Sin[k]^2)) ==
0, {\[CurlyPhi], p0}]
Plot3D[phi[k, x, 1], {k, -Pi, Pi}, {x, -1, 1}, PlotRange -> All,
Mesh -> None, ColorFunction -> Hue] 