Hey everyone,
I've been having some trouble understanding something, and was hoping that people here might be able to help figure it out.
I've been trying to derive the output of a basic RC as shown below:

I'm trying to derrive how the capacitor charges and discharges. Though, I'm only going to go over how the capacitor charges in this post, as I'm assuming that I'm making the same mistake for both charge and discharge.
I know that the equation to describe the charing of the capacitor is:

However, It doesn't take into account the initial voltage accorss the capacitor, plus I would like to derrive it from Ohm's, Faraday's, and Kirkoff's laws in order to get a better mathematical understanding of the circuit.
I've tried two approaches: one where I (wrongly) assume that the current flowing into the capacitor is a constant, and another where I subsitiure the current as derived from Ohm's and Kirkoff's laws into faraday's law. I find that both methods have elements that look correct, but are totally different, and are both wrong.
Method 1First I start off with Faraday's law, to describe the capacitor:

Faraday's law only give the rate of change of the voltage accross the capacitor, not the actual voltage. Therefore, I rearrange Faraday's law, integrating the current over the capacitance. Then once integrated define the constant as the initial voltage accross the capacitor.

If I use Ohm's law to specify the current, as it's limited by the resistor, I get:
n.b. VI is denoted VS in the diagramI think this is the way forward. However, my skill in maths isn't good enough to solve this, as the voltage accross the capacitor is on both sides.
Going back a step, I (wrongly) assume that the current is a constant. I then integrate to give:

I can then just derive the current from the resistor, and substitute it into the equation to give:

Rearrange to get the voltage accross the capacitor:

After plotting this equation, I thought that I'd worked out the answer. It's the correct shape, and behaves as you would expect when the starting voltage is adjusted. However, the rise time is slower than you would expect it to be.
Method 2Here, I start by substituting the current from the start:

Rearrange:

Then integrate:

Then rearrange to get the voltage accross the capacitor:

This appears to be close to the actual answer, in appearance. However, when it's plotted it's totally wrong.
Can anyone here give some insight? I feel that I'm close, but I'm making a dumb mistake somewhere.