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

Brentq fails when eccentricity is low #3

Closed
MCLindner opened this issue Oct 17, 2020 · 0 comments
Closed

Brentq fails when eccentricity is low #3

MCLindner opened this issue Oct 17, 2020 · 0 comments

Comments

@MCLindner
Copy link
Owner

Problem: (-1*d_perigalactic * e) / (eccentricity - 1)) must be greater than initial separation for brentq to work

The _get_vxvy() function in Combine.py works fine for the parameters we are interested in, but if eccentricity is too low and (-1*d_perigalactic * e) / (eccentricity - 1)) - r) is negative,
brentq will fail.
This makes sense given that f(a) and f(b) must have different signs, but I am unsure if this makes sense physics-wise. Obviously the initial separation must also be less than or equal to the intergalactic distance, and violating that errors as it should.

This may all be fine, but investigation is needed to make sure.

Error message:
Traceback (most recent call last):
File "Main.py", line 31, in
combined = two_bodys.combine()
File "/home/michael/NBody/Combine.py", line 205, in combine
x1, y1, vx1, vy1 = self._initial_conds(which_gal=self.Gal1)
File "/home/michael/NBody/Combine.py", line 157, in _initial_conds
x, y, vx, vy = self._get_vxvy(which_gal)
File "/home/michael/NBody/Combine.py", line 84, in _get_vxvy
self.inital_separation)
File "/home/michael/miniconda3/lib/python3.7/site-packages/scipy/optimize/zeros.py", line 776, in brentq
r = _zeros._brentq(f, a, b, xtol, rtol, maxiter, args, full_output, disp)
ValueError: f(a) and f(b) must have different signs

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

No branches or pull requests

1 participant