I know that the solution of of the form i(t) = A*sin(wt + phi)
, I am really confused where to start in finding A, w and phi however. Here is the circuit in question:
The switches close at time t=0
The initial conditions are \$\small v_C=2.5\:V\$ and \$\small i_L=\frac{5}{400}=12.5\:mA\$.
For \$\small t \ge 0\$, the same current, \$\small i\$, flows through \$\small L\$ and \$\small C\$. If this current is assumed to flow clockwise, KVL gives
$$\small 2.5-\frac{1}{C}\int i\:dt =L\frac{di}{dt}$$
Differentiating and rearranging gives the 2nd order ODE
$$\small \frac{d^2 i}{dt^2}+\frac{i}{LC}=0 $$
Solution is of the form \$\small i=Asin(\omega t+\phi)\$.
Substituting for \$\small i\$ in the ODE
$$\small -A\omega ^2 sin(\omega t+\phi)+\frac{Asin(\omega t+\phi)}{LC}=0$$
Hence \$\small \omega^2 =\frac{1}{LC}\$
Since the \$\small LC\$ circuit is has no resistance, the phase angle between current and voltage is known, hence the value of \$\small A\$ can be found from the initial conditions.
First, I will present a method that uses Mathematica to solve this problem. When I was studying this stuff I used the method all the time (without using Mathematica of course). Besides that the answer of @Chu is excellent.
Well, we are trying to analyze the following circuit:
simulate this circuit – Schematic created using CircuitLab
When we use and apply KCL, we can write the following set of equations:
$$\text{I}_1=\text{I}_2+\text{I}_3\tag1$$
When we use and apply Ohm's law, we can write the following set of equations:
$$ \begin{cases} \text{I}_1=\frac{\text{V}_\text{i}-\text{V}_1}{\text{R}_1}\\ \\ \text{I}_2=\frac{\text{V}_1}{\text{R}_2}\\ \\ \text{I}_3=\frac{\text{V}_1-\text{V}_2}{\text{R}_3}\\ \\ \text{I}_3=\frac{\text{V}_2}{\text{R}_4} \end{cases}\tag2 $$
Substitute \$(2)\$ into \$(1)\$, in order to get:
$$ \begin{cases} \frac{\text{V}_\text{i}-\text{V}_1}{\text{R}_1}=\frac{\text{V}_1}{\text{R}_2}+\frac{\text{V}_1-\text{V}_2}{\text{R}_3}\\ \\ \frac{\text{V}_\text{i}-\text{V}_1}{\text{R}_1}=\frac{\text{V}_1}{\text{R}_2}+\frac{\text{V}_2}{\text{R}_4} \end{cases}\tag3 $$
Now, we can solve for \$\text{V}_1\$ and \$\text{I}_3\$:
Where I used the following Mathematica-code to find \$(4)\$ and \$(5)\$:
In[1]:=FullSimplify[
Solve[{I1 == I2 + I3, I1 == (Vi - V1)/R1, I2 == V1/R2,
I3 == (V1 - V2)/R3, I3 == V2/R4}, {I1, I2, I3, V1, V2}]]
Out[1]={{I1 -> ((R2 + R3 + R4) Vi)/(R2 (R3 + R4) + R1 (R2 + R3 + R4)),
I2 -> ((R3 + R4) Vi)/(R2 (R3 + R4) + R1 (R2 + R3 + R4)),
I3 -> (R2 Vi)/(R2 (R3 + R4) + R1 (R2 + R3 + R4)),
V1 -> (R2 (R3 + R4) Vi)/(R2 (R3 + R4) + R1 (R2 + R3 + R4)),
V2 -> (R2 R4 Vi)/(R2 (R3 + R4) + R1 (R2 + R3 + R4))}}
Now, applying this to your circuit we need to use (from now on I use the lower case letters for the function in the 'complex' s-domain where I used Laplace transform):
So, we get for \$(4)\$ and \$(5)\$:
Now, when we use inverse Laplace transform we can see:
Where I used the following Mathematica-codes to find \$(11)\$ and \$(12)\$:
In[2]:=R2 = 1/(s*c);
R4 = s*L;
Vi = u/s; FullSimplify[
Limit[InverseLaplaceTransform[(R2 (R3 + R4) Vi)/(
R2 (R3 + R4) + R1 (R2 + R3 + R4)), s, t], t -> Infinity,
Assumptions -> c > 0 && L > 0 && u > 0 && R1 > 0 && R3 > 0]]
Out[2]=ConditionalExpression[(R3 u)/(R1 + R3),
1/Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] \[Element] Reals &&
Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] > 0 &&
Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] < L + c R1 R3 &&
L + c R1 R3 + Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] > 0]
In[3]:=R2 = 1/(s*c);
R4 = s*L;
Vi = u/s; FullSimplify[
Limit[InverseLaplaceTransform[(R2 Vi)/(
R2 (R3 + R4) + R1 (R2 + R3 + R4)), s, t], t -> Infinity,
Assumptions -> c > 0 && L > 0 && u > 0 && R1 > 0 && R3 > 0]]
Out[3]=ConditionalExpression[u/(R1 + R3),
1/Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] \[Element] Reals &&
Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] > 0 &&
Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] < L + c R1 R3 &&
L + c R1 R3 + Sqrt[-4 c L R1 (R1 + R3) + (L + c R1 R3)^2] > 0]
Now, when the switch closes we can use Faraday's law to write:
$$\text{V}_\text{C}\left(t\right)=-\text{V}_\text{L}\left(t\right)\tag{13}$$
Now, we know the voltage current relations:
And the circuit is in series so \$\text{I}\left(t\right):=\text{I}_\text{C}\left(t\right)=\text{I}_\text{L}\left(t\right)\$. And we know the initial conditons:
So, we can solve for the current:
$$\text{I}\left(t\right)=\frac{\hat{\text{u}}}{\sqrt{\text{L}}}\cdot\frac{\sqrt{\text{L}}\cos\left(\frac{t}{\sqrt{\text{CL}}}\right)-\text{R}_3\sqrt{\text{C}}\sin\left(\frac{t}{\sqrt{\text{CL}}}\right)}{\text{R}_1+\text{R}_3}\tag{18}$$
Where I used the following Mathematica-code to find \$(18)\$:
In[4]:=DSolve[{x''[t]*L + (1/c)*x[t] == 0,
x[0] == u/(R1 + R3), (R3 u)/(R1 + R3) == -x'[0]*L}, x[t], t]
Out[4]={{x[t] -> -((
u (-Sqrt[L] Cos[t/(Sqrt[c] Sqrt[L])] +
Sqrt[c] R3 Sin[t/(Sqrt[c] Sqrt[L])]))/(Sqrt[L] (R1 + R3)))}}
5 / (200 + 200)A
, and since the current cant change instantly because there will be an infinite voltage then as they close it will stay the same, that's pretty all I'm pretty sure i have done correctly \$\endgroup\$