0
$\begingroup$

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?

$\endgroup$
4
  • 2
    $\begingroup$ The solution is done in the same way you asked for in your question "mathematica.stackexchange.com/questions/180484/…" $\endgroup$ Aug 24, 2018 at 7:26
  • $\begingroup$ 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? $\endgroup$
    – AtoZ
    Aug 24, 2018 at 7:32
  • $\begingroup$ If you show your own efforts it is easier to support you and less time consuming... $\endgroup$ Aug 24, 2018 at 7:36
  • 1
    $\begingroup$ This (Sin^2)[k] is a syntax error. In Mma it is Sin[k]^2. $\endgroup$ Aug 24, 2018 at 8:30

2 Answers 2

2
$\begingroup$

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

enter image description here

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}*)
$\endgroup$
17
  • 1
    $\begingroup$ Now it should work (hopefully) $\endgroup$ Aug 24, 2018 at 8:53
  • 1
    $\begingroup$ Possible, but what is the different appearance? My MMA version is 11.0.1 $\endgroup$ Aug 24, 2018 at 9:00
  • 1
    $\begingroup$ What's your input? Did you change Sin^2[...]? $\endgroup$ Aug 24, 2018 at 9:04
  • 1
    $\begingroup$ No idea, try Option MaxRecursion-> inside ContourPlot. $\endgroup$ Aug 24, 2018 at 9:10
  • 1
    $\begingroup$ So you didn't used my definition of eq[...] which already contains ==... $\endgroup$ Aug 24, 2018 at 9:28
2
$\begingroup$
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]

fig1

$\endgroup$

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.