Created
October 1, 2024 01:16
-
-
Save sjhalayka/bc2b49a55c4173a5e4b30b5bdb113529 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main(void) | |
| { | |
| const double c = 299792458; // Speed of light in vacuum | |
| const double G = 6.674e-11; // Gravitational constant | |
| const double M = 1e41; // Galactic bulge mass | |
| double v = 220000; // Speed with dark matter | |
| const double start_distance = 6.1495e19; // Galactic bulge radius | |
| const double end_distance = 1e22; // just past the solar radius | |
| const size_t res = 10000; | |
| const double step_size = (end_distance - start_distance) / (res - 1); | |
| for (double r = start_distance; r <= end_distance; r += step_size) | |
| { | |
| const double v_N = sqrt(G * M / r); // Speed without dark matter | |
| if (v < v_N) | |
| v = v_N; | |
| const double D = 3.0 - log(v/v_N) / log(c); | |
| double x = start_distance / r; | |
| cout << r << " " << D << endl; | |
| // cout << r << " " << D/x << endl; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment