m1, m2, m = 400.0, 100.0, 500.0
k = 100E3
h = 0.10
xM = 9.83E-3
The potential energy of body no.2 before release is V=m2gh and its kinetic energy is 0, the potential energy at impact point is 0 and the kinetic energy is T=m2v22/2. During the free fall no energy is dissipated, hence m2gh=12m2v22→ →v2=√2gh
Using the conservation of momentum, the velocity v0 at time 0+ can be derived as follows m2v2=(m1+m2)v0→ →v0=v2m2m1+m2
The characteristics of the glued system are:
We have the superposition of two different responses,
the response to the weight of body no.2, with Δ=m2g/k it is
xΔ=Δ(1−cosωnt).
the response to the initial velocity,
xv=v0ωnsinωnt
Summing up,
x(t)=Δ+(v0ωnsinωnt−Δcosωnt)and the maximum displacement xM is
xM=Δ+√Δ2+v20ω2n.Rearranging and squaring both members, it is
(xM−Δ)2=x2M−2xMΔ+Δ2=Δ2+v20ω2nand eventually we can inject the dependencies on g to have
xM(xM−2m2gk)=2ghm22m2mk.Collecting g on one side of the equation and dividing both members by xM we have
2m2g(1+hxMm2m)=kxMand it is possible to write the code fragment that gives us the value of the surface acceleration of gravity.
g = k*xM/2/m2/(1+h/xM*m2/m)
print('g = %.3f m/s^2'%g)
A summary inspection of Wikipedia reveals that the surface gravity of the Moon is
gMoon=1.62m/s2.