The first thing to calculate before computing the distribution of galactic rotation is the distribution of mass in the galaxy. As a first approximation, I will take the galaxy to be a central point mass (the black hole) of 10 million solar masses and a flat disk of uniformly distributed matter (stars) of 1 solar mass per cubic light year. The disk will have a diameter of 10,000 light years and the thickness of 3 light years which I shall take as a disk of zero thickness to start off with.
I will use Newtonian mechanics throughout with a conventional value of the gravitational constant.
![]()

![]()
![]()

![]()
Point P is R Km from the hub, the hub is M Kg and the element dR has mass rhodR where rho is the mass per cubic Km.
So the force on the element is the sum of all the gravitational pulls from all the other elements. Taking another arbitary point p, r Km from the Hub and at an angle theta from P, the total force on P is :
F=GrhodRM/R^2+SUM(GrhodRrhodr/((R-rcos(theta))^2+(rSin(theta))^2))
[For all valid values of R and r]
This force is proportional to the velocity of the star at this point so the velocity distribition can be calculated from this equation.
The results show a region of Keplerian motion distribution merging into a region of rigid rotation like a solid disk then a further region of Keplerian motion distribution.
This might explain the shape of the spiral arms and their winding up. These seem to be the remains of jets from the central black hole. Without the original existence of a central black hole the accretion disk that forms the rest of the galaxy cannot form.
There was a programming error in the previous calculation so here are the new results and calculations
The results
At Radius 1 The velocity is 3.6389359455973 At Radius 101 The velocity is 1.52431631615868 At Radius 201 The velocity is 1.55069372627264 At Radius 301 The velocity is 1.60870229555325 At Radius 401 The velocity is 1.67724209061256 At Radius 501 The velocity is 1.7496636322689 At Radius 601 The velocity is 1.82318147441577 At Radius 701 The velocity is 1.89647424223648 At Radius 801 The velocity is 1.96887951991093 At Radius 901 The velocity is 2.04006314709391 At Radius 1001 The velocity is 2.10986529983757 At Radius 1101 The velocity is 2.17822253859875 At Radius 1201 The velocity is 2.24512588170758 At Radius 1301 The velocity is 2.31059724104851 At Radius 1401 The velocity is 2.37467574471415 At Radius 1501 The velocity is 2.43740961568833 At Radius 1601 The velocity is 2.49885127988138 At Radius 1701 The velocity is 2.55905440181375 At Radius 1801 The velocity is 2.61807209493829 At Radius 1901 The velocity is 2.67595585871699 At Radius 2001 The velocity is 2.73275496977679 At Radius 2101 The velocity is 2.78851615784806 At Radius 2201 The velocity is 2.84328345960904 At Radius 2301 The velocity is 2.89709818197942 At Radius 2401 The velocity is 2.94999893042079 At Radius 2501 The velocity is 3.00202167297609 At Radius 2601 The velocity is 3.05319982040775 At Radius 2701 The velocity is 3.10356430885747 At Radius 2801 The velocity is 3.15314367514874 At Radius 2901 The velocity is 3.20196411690493 At Radius 3001 The velocity is 3.25004953046469 At Radius 3101 The velocity is 3.29742151932278 At Radius 3201 The velocity is 3.3440993644957 At Radius 3301 The velocity is 3.39009994558674 At Radius 3401 The velocity is 3.43543759689357 At Radius 3501 The velocity is 3.4801238756706 At Radius 3601 The velocity is 3.52416720774069 At Radius 3701 The velocity is 3.56757235538296 At Radius 3801 The velocity is 3.61033961641955 At Radius 3901 The velocity is 3.65246359614928 At Radius 4001 The velocity is 3.69393126108735 At Radius 4101 The velocity is 3.73471870669331 At Radius 4201 The velocity is 3.77478545917129 At Radius 4301 The velocity is 3.81406368734198 At Radius 4401 The velocity is 3.85243601707504 At Radius 4501 The velocity is 3.88968522742307 At Radius 4601 The velocity is 3.92536510921522 At Radius 4701 The velocity is 3.95840478075579 At Radius 4801 The velocity is 3.98549161436798 At Radius 4901 The velocity is 3.98923461011976
End of Results

Chart of Results
The Program

Option Explicit
Dim FileName As String
Dim FileNumber
Private Sub cmdCalculate_Click()
Const pi = 3.1415926
Dim Theta, dTheta, Diameter, ThetaRad, dThetaRad, rho, R, ds, dR, s, G, M, Sum,
Velocity, Force As Double
Dim ret
Diameter = Val(txtDiameter.Text)
rho = Val(txtDensity.Text)
G = Val(txtG.Text)
M = Val(txtMass.Text)
dR = 100: ds = 10: dTheta = 10
dThetaRad = dTheta * pi / 180
FileNumber = FreeFile()
Open FileName For Output As FileNumber Len = 1
For R = 1 To Diameter / 2 Step dR
For s = 1 To Diameter / 2 Step ds
For Theta = 0 To 350 Step dTheta
ret = DoEvents()
ThetaRad = Theta * pi / 180
If Not (R = s And Theta = 0) Then
Sum = Sum + rho * dR * R * dThetaRad * rho * ds * s * dThetaRad / ((R - s *
Cos(ThetaRad)) ^ 2 + (s * Sin(ThetaRad)) ^ 2)
End If
Next Theta
Next s
Force = (Sum + (rho * R * dThetaRad * dR / R ^ 2)) * G
Sum = 0
Velocity = Sqr(Force * R) / (rho * R * dThetaRad * dR)
Print #FileNumber, "At Radius "; R; " The velocity is "; Velocity
Next R
Close FileNumber
ret = MsgBox("Calculation finished", vbInformation, "Galaxy")
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdFileName_Click()
CommonDialog1.CancelError = True
On Error GoTo ErrorHandler
Rem CommonDialog1.Flags = cdlofnh1dereadonly
CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
Exit Sub
ErrorHandler:
MsgBox ("Error")
End Sub
End of Program
For comparison, I calculated the Keplerian velocity distribution for a single star orbiting the central black hole. Here are the results.
At Radius 1 The velocity is 1000 At Radius 101 The velocity is 99.5037190209989 At Radius 201 The velocity is 70.5345615858598 At Radius 301 The velocity is 57.6390417704235 At Radius 401 The velocity is 49.9376169438922 At Radius 501 The velocity is 44.676705160877 At Radius 601 The velocity is 40.7908508224002 At Radius 701 The velocity is 37.7694787300249 At Radius 801 The velocity is 35.3332626668787 At Radius 901 The velocity is 33.3148302326385 At Radius 1001 The velocity is 31.6069770620507 At Radius 1101 The velocity is 30.1374387339456 At Radius 1201 The velocity is 28.8554928412381 At Radius 1301 The velocity is 27.7243486500714 At Radius 1401 The velocity is 26.7165842572632 At Radius 1501 The velocity is 25.8112866459834 At Radius 1601 The velocity is 24.9921911602031 At Radius 1701 The velocity is 24.2464322484436 At Radius 1801 The velocity is 23.5636814813137 At Radius 1901 The velocity is 22.9355385129844 At Radius 2001 The velocity is 22.3550917004948 At Radius 2101 The velocity is 21.8165952144043 At Radius 2201 The velocity is 21.3152278159744 At Radius 2301 The velocity is 20.8469099612542 At Radius 2401 The velocity is 20.4081632653061 At Radius 2501 The velocity is 19.9960011996001 At Radius 2601 The velocity is 19.6078431372549 At Radius 2701 The velocity is 19.2414460721011 At Radius 2801 The velocity is 18.8948498713306 At Radius 2901 The velocity is 18.566333001717 At Radius 3001 The velocity is 18.2543764409228 At Radius 3101 The velocity is 17.9576340436322 At Radius 3201 The velocity is 17.6749080410067 At Radius 3301 The velocity is 17.4051286546177 At Radius 3401 The velocity is 17.1473370324297 At Radius 3501 The velocity is 16.9006708854465 At Radius 3601 The velocity is 16.6643523339933 At Radius 3701 The velocity is 16.4376775728237 At Radius 3801 The velocity is 16.220008041882 At Radius 3901 The velocity is 16.0107628501689 At Radius 4001 The velocity is 15.8094122478065 At Radius 4101 The velocity is 15.6154719791128 At Radius 4201 The velocity is 15.4284983795275 At Radius 4301 The velocity is 15.2480841032965 At Radius 4401 The velocity is 15.0738543882045 At Radius 4501 The velocity is 14.9054637793553 At Radius 4601 The velocity is 14.7425932467825 At Radius 4701 The velocity is 14.5849476421374 At Radius 4801 The velocity is 14.4322534482983 At Radius 4901 The velocity is 14.2842567828501
Chart of Velocity distribution for a Keplerian System

Program

Option Explicit
Dim FileName As String
Dim FileNumber
Private Sub cmdCalculate_Click()
Dim Mp, R, G, Diameter, Ms, dR, Velocity, Force As Double
Dim ret
Diameter = Val(txtDiameter.Text)
Mp = Val(txtDensity.Text)
G = Val(txtG.Text)
Ms = Val(txtMass.Text)
dR = 100
FileNumber = FreeFile()
Open FileName For Output As FileNumber Len = 1
For R = 1 To Diameter / 2 Step dR
Force = (Ms * Mp / R ^ 2) * G
Velocity = Sqr(Force * R) / Mp
Print #FileNumber, "At Radius "; R; " The velocity is "; Velocity
Next R
Close FileNumber
ret = MsgBox("Calculation finished", vbInformation, "System")
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdFileName_Click()
CommonDialog1.CancelError = True
On Error GoTo ErrorHandler
Rem CommonDialog1.Flags = cdlofnh1dereadonly
CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
Exit Sub
ErrorHandler:
MsgBox ("Error")
End Sub
End of Program
Chris.
24/12/2011