I am now converting chapter 23 from book "2^5 Problems for STEM Education" to the chapter of new book about Mathcad and Python.
Look at the attachment! Do you have any comments, suggestions and additions to this chapter.
There is one major flaw in your calculation. The center of buoyancy is not included. Many ships have the center of gravity above the above Archimedes center of force.
I looked closer at your figures. Please keep on mind, the location of the center of buoyancy moves as the ship heels. This results in a righting arm, which will return the ship vertical. Typically, the righting arm increases to maximum then decreases to zero. The ship will capsizes at that heel. You can use the term "center of displacement", but the term is not used in naval architecture.
You took one of the more unique conditions for ship stability. Your calculation is typically done for submarines, but is possible for surface vessels. (By the way, the center of buoyancy for a submarine does not change.) I come back to my original comment, the center of gravity for a surface ship is normally above the center of buoyancy. Reference "Principles of Naval Architecture" pub by The Society of Naval Architecture and Marine Engineering.
Once again you are correct; I yield to your expertise.
You can manipulate the CG position in my sheet by altering the thickness of the steel ballast. If I do that (and bring the resulting plots into PowerPoint so I can level out the waterline) we get the following:
The higher CG is stable but when the ship is near level it's going to be more sensitive to perturbations. (Probably a proper shape would mitigate that.