-2
$\begingroup$

I need to plot this function $$ \Omega_{rq}=\sqrt{1+\frac{1-\epsilon_{dd}\left[\frac{2-5\kappa^2}{2(1-\kappa^2)}+\frac{\kappa^2(6+9\kappa^2)f_s(\kappa)}{4(1-\kappa^2)^2}\right]}{1+\epsilon_{dd}\left[\frac{3}{2}\frac{\kappa^2 f_s(\kappa)}{1-\kappa^2}-1\right]}}$$ as a function of $\lambda$ for $\epsilon_{dd}=0.42$. The values of kappa and lambda are the values that solve the equation. $$3\kappa^2 \epsilon_{dd}\left[\left(\frac{\lambda^2}{2}+1\right)\frac{f_s(\kappa)}{1-\kappa^2}-1\right]+(\epsilon_{dd}-1)(\kappa^2-\lambda^2)=0 $$ where $$f_s(\kappa)=\frac{1+2\kappa^2}{1-\kappa^2}-\frac{3\kappa^2 artanh \sqrt{1-\kappa^2} }{(1-\kappa^2)^{3/2}}. $$

My code:

edd=0.42

Do[Print[FindRoot[ 3 y^2 edd ((i^2/2 + 1) *(((1 + 2 y^2)/(1 - y^2)) - (3 y^2 ArcTanh[Sqrt[1 - y^2]])/(1 - y^2)^(3/2))/(1 - y^2) -1) + (edd - 1) (y^2 - i^2), {y, 0.1}]], {i, 0.2, 5, 0.1}]

Data = Import["C:\\Users\\Desktop\\dd\\teste.txt", "Data"]

Do[Print[Sqrt[   1 + (1 - 
   edd ((2 - 
        5 Data[[j]]^2)/(2 (2 - Data[[j]]^2))) + (Data[[j]]^2 (6 + 
         9 Data[[
            j]]^2) (((1 + 2 Data[[j]]^2)/(1 - 
             Data[[j]]^2)) - (3 Data[[j]]^2 ArcTanh[
             Sqrt[1 - Data[[j]]^2]])/(1 - Data[[j]]^2)^(3/2)))/
     4*(1 - Data[[j]]^2)^2)/(1 + 
   edd (3/2 (((((1 + 2 Data[[j]]^2)/(1 - 
                Data[[j]]^2)) - (3 Data[[j]]^2 ArcTanh[
                Sqrt[1 - Data[[j]]^2]])/(1 - Data[[j]]^2)^(3/
                2)) Data[[j]]^2)/(1 - Data[[j]]^2)) - 1))]], {j,   1, 8, 1}]

Is this code correct?

$\endgroup$
  • $\begingroup$ You ask if your code is correct. Correct for what? It certainly isn't going to give you an expression or a function you can plot. It won't even give you values of Ω from which you could make a list plot. Further, if is not clear how the data you import fits in. We will likely need to see that data to help you. Finally, using Do and Print is probably wrong; you should look at Table. $\endgroup$ – m_goldberg Jan 5 '18 at 14:17
4
$\begingroup$

I don't understand your code, but you shouldn't use names starting with upper case letters, because these are meant for built-in functions.

To plot Ω as a function of λ, your functions must be defined:

ϵ = 0.42;
fs[κ_] = (1 + 2 κ^2)/(1 - κ^2) - 3 κ^2 ArcTanh[Sqrt[1 - κ^2]] (1 - κ^2)^(-3/2);
eq[λ_, κ_] = 3 κ^2 ϵ ((λ^2/2 + 1) fs[κ]/(1 - κ^2) - 1) + (ϵ - 1) (κ^2 - λ^2);
Ω[λ_, κ_] = Sqrt[1 + (1 - ϵ ((2 - 5 κ^2)/(2 (1 - κ^2)) + (κ^2 (6 + 9 κ^2) fs[κ])/(4 (1 - κ^2)^2)))/(1 + ϵ (3/2 κ^2 fs[κ]/(1 - κ^2) - 1))];

The equation can be solved w.r.t. λ (I select just the positive solution which is all we need because the function to plot is even)

λsol[κ_] = λ /. Last[Solve[eq[λ, κ] == 0, λ]];

Now the plot can be parametrized by κ

ParametricPlot[{λsol[κ], Ω[λsol[κ], κ]}, {κ, 0, 8}, AspectRatio -> 1/GoldenRatio]

To show the evenness plot instead {{-λsol[κ], Ω[λsol[κ], κ]}, {λsol[κ], Ω[λsol[κ], κ]}}

$\endgroup$

Your Answer

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

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