2
$\begingroup$

Let me try to be a bit schematic because my own expression is a bit complicated and could be not useful for future questions.

x=f[y*a[x]]

My problem is how to Plot y=y[x]. In principle, y is not a function but a parameter; but I need the curve y vs x

EDIT: Let me show you my functions

H=Sqrt[2α(1+2Sinh[Fk[α,k,H]]^2)-α^2-1] 

with

Fk[α,k,H]=-(((1+Sqrt[1 + 4 k^2 (1+(-1+H^2+α^2)^2/(4 H^2))]) (EllipticK[1/2 (1+1/Sqrt[1+4 k^2 (1+(-1+H^2 +α^2)^2/(4 H^2))])]-EllipticPi[1/2-1/(2 Sqrt[1 + 4 k^2 (1+(-1+H^2 +α^2)^2/(4 H^2))]),1/2(1+1/Sqrt[1+4 k^2 (1+(-1+H^2 + α^2)^2/(4 H^2))])]))/(2(1+4 k^2 (1+(-1+H^2+α^2)^2/(4 H^2)))^(1/4) Abs[k Sqrt[1+(-1+H^2+α^2)^2/(4 H^2)]]))

Sorry, I know it looks horrible. Thus, what I want is a plot k=k[H].

$\endgroup$
4
  • $\begingroup$ does the following example ClearAll[a, f]; f[x_] := Sin[x]; a[x_] := x Cos[x]; ContourPlot[x == f[y a[x]], {x, -Pi, Pi}, {y, 0, 20}, PlotPoints -> 100] give what you need? $\endgroup$
    – kglr
    Mar 15, 2019 at 23:34
  • $\begingroup$ @kglr Thanks. I'm running it now for my case but it is taking a lot of time. I edited my question to put my explicit example. $\endgroup$ Mar 15, 2019 at 23:59
  • $\begingroup$ what is the correspondence between {H, \[Alpha], k} and {y,a,x,f}? $\endgroup$
    – kglr
    Mar 16, 2019 at 0:07
  • $\begingroup$ @kglr you can fix \[Alpha] (sorry for not mention it), say \[Alpha]=0.8, it is not a problem. The correspondence is x=H, the huge square root would be f, a` the combination of elliptic integrals; and y=k $\endgroup$ Mar 16, 2019 at 0:27

1 Answer 1

3
$\begingroup$
ClearAll[k, H, f]
α = 4/5;
f[k_, H_] := -(((1 + Sqrt[1 + 4 k^2 (1 + (-1 + H^2 + α^2)^2/(4 H^2))]) 
 (EllipticK[1/2 (1 + 1/Sqrt[1 + 4 k^2 (1 + (-1 + H^2 + α^2)^2/(4 H^2))])] - 
  EllipticPi[1/2 - 1/(2 Sqrt[1 + 4 k^2 (1 + (-1 + H^2 + α^2)^2/(4 H^2))]), 
      1/2 (1 + 1/Sqrt[1 + 4 k^2 (1 + (-1 +  H^2 + α^2)^2/(4 H^2))])]))/
  (2 (1 + 4 k^2 (1 + (-1 + H^2 + α^2)^2/(4 H^2)))^(1/4) 
   Abs[k Sqrt[1 + (-1 + H^2 + α^2)^2/(4 H^2)]]));


Quiet @ ContourPlot[H == f[k, H], {H, 0, 1}, {k, -2, 2}, 
  PlotPoints -> 100, FrameLabel -> {"H", "k"}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks a lot. I had totally forgotten ContourPlot. I made a mistake when defined my functions, please check the correct definitions now. I was using ContourPlot in this case but it is taking infinite time. Is there a way to improve how ContourPlot works? Also, and didnt mention, sorry, that k>0 $\endgroup$ Mar 18, 2019 at 14:40
  • $\begingroup$ @resanrom, try (1) Clear all definitions using ClearAll[H, Fk, h, \[Alpha], k], (2) Use Fk[\[Alpha]_, k_, H_] := ... when you define Fk, then (3) use \[Alpha] = 3/4; ContourPlot[ Sqrt[2 \[Alpha] (1 + 2 Sinh[Fk[\[Alpha], k, H]]^2) - \[Alpha]^2 - 1] == Fk[\[Alpha], k, H], {H, 0, 1}, {k, -2, 2}, PlotPoints -> 100, FrameLabel -> {"H", "k"}] It is still slow but it eliminates the recursion limit issue and gives some output. $\endgroup$
    – kglr
    Mar 18, 2019 at 15:01

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.