Daniel B. answered 12/23/20
A retired computer professional to teach math, physics
Let
m = 10 g = 0.01 kg be the mass attached to the spring,
A = 3 mm = 0.003 m be the amplitude,
T = 0.1 s be the period,
k (unknown) be the spring constant.
The spring energy is given by the formula
E = kA²/2
We do not know k, but we can calculate it from the given period, whose formula is
T = 2π√(m/k)
From that we can express
k = 4π²m/T²
Now we can calculate the energy
E = kA²/2 = 4π²mA²/2T² = 2m(πA/T)²
Substituting actual numbers
E = 2 x 0.01 kg (π x 0.003 m / 0.1 s)² = 1.78 x 10-4 J