2
$\begingroup$

I have a problem to reproduce a graph. Follows the commands used:

X[r_] = -A Csc[ϕ];
Y[r_] = Sqrt[B + a^2 Cos[ϕ]^2 - A^2 Cot[ϕ]^2];
A = (r^2 (3 M - r) - a^2 (M + r))/(a (r - M));
B = (r^3 (4 a^2 M - r (3 M - r)^2))/(a^2 (r - M)^2);
M = 1; a = 0.79; ϕ = Pi/2;
ParametricPlot[{X[r], Y[r]}, {r, 0, 2 Pi}]

enter image description here

However, the graph should be as follows:

enter image description here

i.e., I haven't been able to close the curve. Someone can help? Some hint?

$\endgroup$
4
  • 3
    $\begingroup$ simply look at your data ! Table[{X[r], Y[r]}, {r, 0, 2 Pi, .2 Pi}] and you'll see it generates complex numbers. Your code is also strange. Why write function X[r_] = -A Csc[\[Phi]]; when there is no explicit r in RHS? but your main problem is your data is complex. $\endgroup$
    – Nasser
    Feb 16, 2020 at 5:02
  • $\begingroup$ Thanks by the comments @Nasser. Note that both quantities A and B are defined on the third and fourth row, respectively. $\endgroup$
    – Andrey
    Feb 16, 2020 at 5:26
  • $\begingroup$ Do you mean to say X[r_] := and Y[r_] :=? $\endgroup$
    – Mark R
    Feb 16, 2020 at 8:55
  • $\begingroup$ @MarkR, these are the functions to be plotted. Both are functions dependent on the variable r (see the definition of A and B). $\endgroup$
    – Andrey
    Feb 16, 2020 at 17:19

1 Answer 1

4
$\begingroup$

Your definitions are viable:

ClearAll[A,B,ϕ,X, Y]

X[r_] = -A Csc[ϕ];
Y[r_] = Sqrt[B + a^2 Cos[ϕ]^2 - A^2 Cot[ϕ]^2];

A = (r^2 (3 M - r) - a^2 (M + r))/(a (r - M));
B = (r^3 (4 a^2 M - r (3 M - r)^2))/(a^2 (r - M)^2);
M = 1; a = 0.79; ϕ = Pi/2;

Now check the domain of your function.

dom = FunctionDomain[{Y[r], r > 1}, r, Reals]

(*  1.83298 <= r <= 3.80951  *)

Plot both (X,Y) and (X,-Y) over the domain:

ParametricPlot[{{X[r], Y[r]}, {X[r], -Y[r]}},
 {r, First@dom, Last@dom}, GridLines -> Automatic,
 PlotStyle -> {{Black, Dashed}}, Frame -> True]

enter image description here

However, the left edge is not as vertical as in the desired plot.

Notice that we had to specify $r>1$ for our domain. There is a different solution for $r<1$. We should have specified $r>M$.

$\endgroup$
1
  • $\begingroup$ thank you very much! About the left edge, simply set the value a=0.99 and we will have something like vertical. You have solved my problem, thanks again. $\endgroup$
    – Andrey
    Feb 16, 2020 at 17:13

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.