2
$\begingroup$

I need to graph the function $$f_s(x)=\frac{1+2x^2-3x^2\Xi(x)}{1-x^2},$$ were $$\Xi(x)= \begin{cases} \frac{1}{\sqrt{1-x^2}}\tanh^{-1}(\sqrt{1-x^2}); & 0\leq x<1\\ \frac{1}{\sqrt{x^2-1}}\tan^{-1}(\sqrt{x^2-1}); & x \geq1 \end{cases}.$$

My effort:

P1 = Plot[(1 + 2 x^2)/(1 - x^2) + (3 x^2 ArcTanh[Sqrt[x^2 - 1]])/\!\(\*SuperscriptBox[\((\*SuperscriptBox[\(x\), \(2\)] - 1)\), \({\*FractionBox[\(3\), \(2\)]}\)]\), {x, 1, 14},  PlotTheme -> "Scientific", PlotStyle -> Black,  FrameTicks -> {{{-2, -1.5, -1, 0, 0.5, 1}, 
 None}, {{0, 2, 4, 6, 8, 10, 12, 14}, None}}]

P2 = Plot[(1 + 2 x^2)/(1 - x^2) - (3 x^2 ArcTanh[Sqrt[-x^2 + 1]])/\!\(\*SuperscriptBox[\((\(-\*SuperscriptBox[\(x\), \(2\)]\) + 1)\), \({\*FractionBox[\(3\), \(2\)]}\)]\), {x, 0, 1},  PlotTheme -> "Scientific", PlotStyle -> Black,  FrameTicks -> {{{-2, -1.5, -1, 0, 0.5, 1}, 
 None}, {{0, 2, 4, 6, 8, 10, 12, 14}, None}}]

Show[P1, P2]

I want the graph is equal to enter image description here

or enter image description here

$\endgroup$
  • $\begingroup$ Your formula suggests that you should use Tanh, but in your code you use ArcTan. $\endgroup$ – C. E. Jul 12 '17 at 0:10
  • $\begingroup$ it is true. I'm sorry. $\endgroup$ – Dinesh Shankar Jul 12 '17 at 0:16
1
$\begingroup$

Just use $\Xi(x) = \frac{1}{\sqrt{x^2-1}}\tanh(\sqrt{x^2-1})$ for all $x$ instead. Or use $\frac{1}{\sqrt{1-x^2}}\tan(\sqrt{1-x^2})$ for the $x<1$ range instead.

I meant to make this a comment, but since I answered it instead, here is the plot I think you want:

LogLinearPlot[(1+2x^2-3x^2 Tanh[Sqrt[x^2-1]]/Sqrt[x^2-1])/(1-x^2), {x,0,100}]

enter image description here

Update

Looking at the literature, (e.g., Exact solution of the Thomas-Fermi equation for a trapped Bose-Einstein condensate with dipole-dipole interactions by Claudia Eberlein, Stefano Giovanazzi, and Duncan H. J. O’Dell) it seems that the correct function uses ArcTan, and that the formula for $x<1$ is obtained by analytic continuation. So, I think the plot you want is:

LogLinearPlot[(1+2x^2-3x^2 ArcTan[Sqrt[x^2-1]]/Sqrt[x^2-1])/(1-x^2), {x,0.01,100}]

enter image description here

which seems to perfectly match your expected plot.

One more comment. Note:

FullSimplify[
    ComplexExpand[ArcTanh[Sqrt[1-x^2]]/Sqrt[1-x^2]-ArcTan[Sqrt[-1+x^2]]/Sqrt[-1+x^2]],
    x > 0
]

Piecewise[{{0, x != 1}}, Indeterminate]

So, there is no need for a Piecewise definition of $\Xi(x)$. Mathematica can analytically continue both formulas into each other.

$\endgroup$
  • $\begingroup$ My function was wrong. I'm so sorry $\endgroup$ – Dinesh Shankar Jul 12 '17 at 0:26
  • $\begingroup$ @user3321 Are you sure it's supposed to be ArcTanh? A brief survey of the literature seems to indicate that it's supposed to be ArcTan. $\endgroup$ – Carl Woll Jul 12 '17 at 0:41
  • $\begingroup$ Now it's right. I'm sorry again $\endgroup$ – Dinesh Shankar Jul 12 '17 at 0:49
3
$\begingroup$

Here is a start:

Ξ[x_] := Piecewise[{{1/Sqrt[1 - x^2]*Tanh[Sqrt[1 - x^2]], 0 <= x < 1}},
  1/Sqrt[x^2 - 1]*Tanh[Sqrt[x^2 - 1]]]

f[x_] := (1 + 2*x^2 - 3 x^2*Ξ[x])/(1 - x^2)

Plot[f[x], {x, 0, 16}, PlotRange -> {Automatic, {-2, 2}}, 
 Frame -> True, AxesStyle

Mathematica graphics

$\endgroup$
  • $\begingroup$ My function was wrong. I'm so sorry. $\endgroup$ – Dinesh Shankar Jul 12 '17 at 0:21
  • $\begingroup$ @user3321 No problem, just take from my answer how you define a piecewise function and you can use it with your correct formula. $\endgroup$ – halirutan Jul 12 '17 at 0:31

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.