subs:={omega0->Sqrt[k/m],zeta->c/(2*Sqrt[m*k]),x0->-g*m/k}

xt=A*Exp[-zeta*omega0*t]*Sin[Sqrt[1-zeta^2]*omega0*t+phi]-g/omega0^2

vt=FullSimplify[D[xt,t]]

energy=(m*g*x+k*x^2/2+m*v^2/2 == m*g*(x0-A)+k*(x0-A)^2/2 )/.subs

Solve[energy,A]

amplitude=((Sqrt[k m (v^2)+(((g m+k x))^2)])/k)

getphi[A_,isUp_]:=If[isUp,ArcSin[(x+g/omega0^2)/A],π-ArcSin[(x+g/omega0^2)/A]]

experiment:={g->9.8,m->3,k->2,c->0.3}

initials:={x->-5,v->3}

amplitude/.experiment/.initials

getphi[amplitude/.experiment/.initials,True]/.subs/.experiment/.initials

Minimize[{((xt+5)^2+(vt-3)^2)/.subs/.experiment/.{t->0},A>0},{A,phi}]

{xt==-5,vt==3,A>0}/.subs/.experiment/.initials

Solve[{xt==-5,vt==3,A>0,phi≥0,phi<2*π}/.subs/.experiment/.initials/.{t->0},{A,phi}]

xt/.subs/.{t->0}

vt/.subs/.{t->0}

Solve[{xt==x,vt==v,A>0,phi≥0,phi<2*π}/.subs/.experiment/.{t->0},{A,phi}]

xt/.subs/.experiment/.{A->10.60077410113466`,phi->1.155576128610492`,t->0}

vt/.subs/.experiment/.{A->10.60077410113466`,phi->1.155576128610492`,t->0}

xt/.subs/.{t->0}

FullSimplify[vt/.subs/.{t->0}]

Solve[{-((g m)/k)+A Sin[phi]==x,A (Sqrt[(k/m)]) ((Sqrt[1-((c^2)/(4 k m))]) Cos[phi]-((c Sin[phi])/(2 (Sqrt[k m]))))==v,g≥0,k>0,m>0,c≥0},{A,phi}]

FullSimplify[Solve[-g*m/k+((Sqrt[k m (v^2)+(((g m+k x))^2)])/k)*Sin[phi]==x,phi]]

{{phi->ConditionalExpression[π-ArcSin[((g m+k x)/(Sqrt[k m (v^2)+(((g m+k x))^2)]))]+2 π C[1],C[1]∈Integers]},{phi->ConditionalExpression[ArcSin[((g m+k x)/(Sqrt[k m (v^2)+(((g m+k x))^2)]))]+2 π C[1],C[1]∈Integers]}}/.experiment/.initials

Plot[xt/.subs/.experiment/.{A->10.372559954032564,phi->1.2087096232338574`},{t,0,25}]

(x''[t]+2*zeta*omega0*x'[t]+omega0^2*x[t]==-g)/.subs

DSolve[{(x''[t]+2*zeta*omega0*x'[t]+omega0^2*x[t]==-g)/.subs},x[t],t]

DSolve[{(x''[t]+2*zeta*omega0*x'[t]+omega0^2*x[t]==-g)/.subs,x'[0]==v1,x[0]==x1},x[t],t]//FullSimplify

((1/(2 (k^(3/2)) (Sqrt[(c^2)-4 k m])))(E^(-(((c (Sqrt[(k/m)]) (Sqrt[m])+(Sqrt[k]) (Sqrt[(c^2)-4 k m])) t)/(2 (Sqrt[m]) (Sqrt[k m]))))) (c (-1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))) (Sqrt[(k/m)]) (Sqrt[m]) (g m+k x1)+(Sqrt[k]) ((1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))-2 (E^(((c (Sqrt[(k/m)]) (Sqrt[m])+(Sqrt[k]) (Sqrt[(c^2)-4 k m])) t)/(2 (Sqrt[m]) (Sqrt[k m]))))) g m (Sqrt[(c^2)-4 k m])+2 (-1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))) (Sqrt[k]) (Sqrt[m]) (Sqrt[k m]) v1+(1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))) k (Sqrt[(c^2)-4 k m]) x1)))/.experiment/.{x1->-5,v1->3,t->0}

newsol:=(1/(2 (k^(3/2)) (Sqrt[(c^2)-4 k m])))(E^(-(((c (Sqrt[(k/m)]) (Sqrt[m])+(Sqrt[k]) (Sqrt[(c^2)-4 k m])) t)/(2 (Sqrt[m]) (Sqrt[k m]))))) (c (-1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))) (Sqrt[(k/m)]) (Sqrt[m]) (g m+k x1)+(Sqrt[k]) ((1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))-2 (E^(((c (Sqrt[(k/m)]) (Sqrt[m])+(Sqrt[k]) (Sqrt[(c^2)-4 k m])) t)/(2 (Sqrt[m]) (Sqrt[k m]))))) g m (Sqrt[(c^2)-4 k m])+2 (-1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))) (Sqrt[k]) (Sqrt[m]) (Sqrt[k m]) v1+(1+(E^(((Sqrt[k m]) (Sqrt[(c^2)-4 k m]) t)/((Sqrt[k]) (m^(3/2)))))) k (Sqrt[(c^2)-4 k m]) x1))

FullSimplify[DSolve[{(x''[t]+2*zeta*omega0*x'[t]+omega0^2*x[t]==-g)/.subs,x'[0]==v1,x[0]==x1},x[t],t],{Element[t,Reals],Element[v1,Reals],Element[x1,Reals],Element[m,Reals],Element[g,Reals],Element[c,Reals],Element[k,Reals],m>0,g>0,c≥0,k>0}]

news:=(((E^(-(((c+(Sqrt[(c^2)-4 k m])) t)/(2 m)))) ((1+(E^(((Sqrt[(c^2)-4 k m]) t)/m))-2 (E^(((c+(Sqrt[(c^2)-4 k m])) t)/(2 m)))) g m (Sqrt[(c^2)-4 k m])+c (-1+(E^(((Sqrt[(c^2)-4 k m]) t)/m))) (g m+k x1)+k (2 (-1+(E^(((Sqrt[(c^2)-4 k m]) t)/m))) m v1+(1+(E^(((Sqrt[(c^2)-4 k m]) t)/m))) (Sqrt[(c^2)-4 k m]) x1)))/(2 k (Sqrt[(c^2)-4 k m])))

news/.experiment/.{x1->-5,v1->3,t->0}

Simplify[ExpToTrig[news]]

FullSimplify[news]

news/.{(Sqrt[(c^2)-4 k m])->p,x1->x,v1->v}

Plot[news/.experiment/.{x1->-15,v1->-15},{t,0,25}]

Plot[news/.{g->9.8,m->2,k->2,c->0.1}/.{x1->-5,v1->3},{t,0,100},PlotRange->All]

news/.{g->9.8,m->3,k->2,c->4}/.{x1->-5,v1->3}//FullSimplify

FullSimplify[DSolve[{(x''[t]+2*zeta*omega0*x'[t]+omega0^2*x[t]==-g)/.subs,x'[0]==v1,x[0]==x1},x[t],t],{Element[t,Reals],Element[v1,Reals],Element[x1,Reals],Element[m,Reals],Element[g,Reals],Element[c,Reals],Element[k,Reals],m>0,g>0,c≥0,k>0,c^2<4*k*m}]

FullSimplify[TrigReduce[ExpToTrig[(((E^(-(((c+I (Sqrt[-(c^2)+4 k m])) t)/(2 m)))) (I (1+(E^((I (Sqrt[-(c^2)+4 k m]) t)/m))-2 (E^(((c+I (Sqrt[-(c^2)+4 k m])) t)/(2 m)))) g m (Sqrt[k (-(c^2)+4 k m)])-2 (k^(3/2)) m v1+2 (E^((I (Sqrt[-(c^2)+4 k m]) t)/m)) (k^(3/2)) m v1+I (Sqrt[(k^3) (-(c^2)+4 k m)]) x1+I (E^((I (Sqrt[-(c^2)+4 k m]) t)/m)) (Sqrt[(k^3) (-(c^2)+4 k m)]) x1+c (-1+(E^((I (Sqrt[-(c^2)+4 k m]) t)/m))) (Sqrt[k]) (g m+k x1)))/(2 (k^(3/2)) (Sqrt[(c^2)-4 k m])))]]]

ExpToTrig[Exp[Sqrt[-1]*x]]

ExpToTrig[Exp[Sqrt[-1]*x]]

TraditionalForm[Style[(((E^(-(((c+I (Sqrt[-(c^2)+4 k m])) t)/(2 m)))) (I (1+(E^((I (Sqrt[-(c^2)+4 k m]) t)/m))-2 (E^(((c+I (Sqrt[-(c^2)+4 k m])) t)/(2 m)))) g m (Sqrt[k (-(c^2)+4 k m)])-2 (k^(3/2)) m v1+2 (E^((I (Sqrt[-(c^2)+4 k m]) t)/m)) (k^(3/2)) m v1+I (Sqrt[(k^3) (-(c^2)+4 k m)]) x1+I (E^((I (Sqrt[-(c^2)+4 k m]) t)/m)) (Sqrt[(k^3) (-(c^2)+4 k m)]) x1+c (-1+(E^((I (Sqrt[-(c^2)+4 k m]) t)/m))) (Sqrt[k]) (g m+k x1)))/(2 (k^(3/2)) (Sqrt[(c^2)-4 k m]))),FontSize->34]]

FullSimplify[DSolve[{(x''[t]+2*zeta*omega0*x'[t]+omega0^2*x[t]==-g)/.subs/.{c->Sqrt[4*k*m]},x'[0]==v1,x[0]==x1},x[t],t],{Element[t,Reals],Element[v1,Reals],Element[x1,Reals],Element[m,Reals],Element[g,Reals],Element[k,Reals],m>0,g>0,k>0}]

TraditionalForm[Style[(((E^(-(Sqrt[(k/m)]) t)) (g (m-(E^((Sqrt[(k/m)]) t)) m+(Sqrt[k m]) t)+k (x1+t (v1+(Sqrt[(k/m)]) x1))))/k),FontSize->34]]