Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancellation in the calculation of the orbital frequencies #56

Open
nielsw2 opened this issue Sep 26, 2023 · 3 comments
Open

Cancellation in the calculation of the orbital frequencies #56

nielsw2 opened this issue Sep 26, 2023 · 3 comments

Comments

@nielsw2
Copy link
Member

nielsw2 commented Sep 26, 2023

The equations for the Mino time t and phi frequencies (Eq. 21 of https://arxiv.org/pdf/0906.1420.pdf) have the term $r_3-r_+$ in the denominator and there are points in the parameter space where this is zero. As an example, consider:

a0 = 0.9;
p0 = 7.035330;
e0 = 0.251521;

rp = M + Sqrt[M^2 - a^2];

orbit = KerrGeoOrbit[a0, p0, e0, 1];

orbit["RadialRoots"] - Block[{M = 1, a = a0}, rp]

which gives

{7.96361, 4.18553, 3.41949*10^-14, -1.43589}

This does not seem to cause an issue in Mathematica (though no doubt careful fine tuning would lead to a loss of precision) but it is causing a problems with these equations are CForm'ed for use in FEW. There must be a way to re-write the equations to factor out the problematic term.

@MvdMeent
Copy link
Collaborator

For the record this happens exactly when L = 2 r_p E/a.

@lorenzsp
Copy link

lorenzsp commented Oct 5, 2023

I isolated the problematic terms and checked if the numerator rounds off to zero every time rp=r3. Fortunately, this is the case for the 10000 evolutions I tested. The C++ code was rewritten in the following way:

// This term is zero when r3 - rp == 0.0
    double prob1 = (2 * M * En * rp - a * L) * (EllipticK(pow(kr, 2)) - (r2 - r3)/(r2 - rp) * EllipticPi(hp, pow(kr, 2)));
    if (abs(prob1)!=0.0){
        prob1 = prob1/(r3 - rp);
    }
    double CapitalUpsilonPhi = (CapitalUpsilonTheta)/(sqrt(Epsilon0zp)) + (2 * a * CapitalUpsilonr)/(M_PI * (rp - rm) * sqrt((1 - pow(En, 2)) * (r1 - r3) * (r2 - r4))) * ( prob1 - (2 * M * En * rm - a * L)/(r3 - rm) * (EllipticK(pow(kr, 2)) - (r2 - r3)/(r2 - rm) * EllipticPi(hm, pow(kr,2))) );

    // This term is zero when r3 - rp == 0.0
    double prob2 = ((4 * pow(M, 2) * En - a * L) * rp - 2 * M * pow(a, 2) * En) * (EllipticK(pow(kr, 2)) - (r2 - r3)/(r2 - rp) * EllipticPi(hp, pow(kr, 2)));
    if (abs(prob2)!=0.0){
        prob2 = prob2/(r3 - rp);
    }
    double CapitalGamma = 4 * pow(M, 2) * En+ (2 * CapitalUpsilonr)/(M_PI * sqrt((1 - pow(En, 2)) * (r1 - r3) * (r2 - r4))) * (En/2 * ((r3 * (r1 + r2 + r3) - r1 * r2) * EllipticK(pow(kr, 2)) + (r2 - r3) * (r1 + r2 + r3 + r4) * EllipticPi(hr,pow(kr, 2)) + (r1 - r3) * (r2 - r4) * EllipticE(pow(kr, 2))) + 2 * M * En * (r3 * EllipticK(pow(kr, 2)) + (r2 - r3) * EllipticPi(hr,pow(kr, 2))) + (2* M)/(rp - rm) * (
        prob2
    - ((4 * pow(M, 2) * En - a * L) * rm - 2 * M * pow(a, 2) * En)/(r3 - rm) * (EllipticK(pow(kr, 2)) - (r2 - r3)/(r2 - rm) * EllipticPi(hm,pow(kr, 2)))
    )
    );

@barrywardell
Copy link
Member

Is this related to issue #50?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants