tahayassen said:
Well, I wasn't asking for an easier one necessarily. I was just wondering if there was any alternative to the sine function.
I'm still confused to why gravity doesn't affect dynamic motion. I've uploaded a diagram.
The first question is answered by the theory of linear ordinary differential equations. For your case it reads
m \ddot{x}=-k x
or
\ddot{x}=-\omega^2 x \quad \text{with} \quad \omega=\sqrt{k/m}.
This means you look for all functions that reproduce themselves up to a factor -\omega^2<0.
There are two functions, which come immediately to mind:
x_1(t)=A \cos(\omega t), \quad x_2(t)=B \sin(\omega t).
Since the differential equation is linear, also any superposition of the two solutions is another solution. Thus we have
x(t)=A \cos(\omega t)+B \sin(\omega t).
One can strictly prove that this is the complete set of solutions. The two constants A and B must be determined from the initial conditions. Since the differential equation is of 2nd order, you must give both the initial position x_0=x(0) at t=0 and also the initial velocity v(0)=\dot{x}(0)=v_0. Now
v(t)=\dot{x}(t)=-A \omega \sin(\omega t) + B \omega \cos(\omega t).
Thus we find
x(0)=A=x_0, \quad v(0)=B \omega=v_0 \; \Rightarrow B=\frac{v_0}{\omega}.
Thus the solution, fulfilling the initial conditions, is uniquely determined to be
x(t)=x_0 \cos(\omega t)+\frac{v_0}{\omega} \sin(\omega t).
One can also rewrite this solution into the form given on your lab sheet:
x(t)=A \sin(\omega t+\phi).
Due to the addition theorem this is
x(t)=A [\sin(\omega t) \cos \phi+\cos(\omega t) \sin \phi].
Thus you just have to choose A and \phi such that
A \cos \phi=\frac{v_0}{\omega}, \quad x_0=A \sin \phi.
This gives
A^2 (\cos^2 \phi+\sin^2 \phi)=A^2= \left (\frac{v_0}{\omega} \right)^2 + x_0^2,
leading to
A=\sqrt{ \left (\frac{v_0}{\omega} \right)^2 + x_0^2}.
Further, with this value of A the phase is given by
\phi=\mathrm{sign}(x_0) \arccos\left (\frac{v_0}{\omega x_0} \right).
To your second question. Let x' the coordinate of the point mass defined such that for x'=0 the spring is unstretched. Then the total force acting on the mass is the sum of the gravitational force and the force from the spring:
F=m g-k x'.
The point, were F=0, i.e., where the force of the spring is exactly compensating the gravitational force, is given by
m g-k x_0=0 \; \Rightarrow x_0=\frac{m g}{k}.
Thus you can write for the force
F=k(x_0-x').
Now setting x=x'-x_0 you find the equation of motion
m \ddot{x}'=m\ddot{x}=F=k(x_0-x')=-k x,
which is the equation of motion for a harmonic oscillator. So, as the other posters have already explained, the reason that the gravitational force drops out is due to the counting of the x coordinate from the equilibrium point x_0.