Build mathematical modelsLesson 40 of 48 · 9 min
Derive a charging response
Solve a forced linear ODE and interpret its time constant and limiting value.
Maths refresher: Approaching an equilibrium
A stable first-order response can approach a target exponentially. A time constant is the time scale in the exponential’s denominator.
At the voltage is 0. At it reaches , about 63.2% of the final value.
An RC charging model balances the input voltage with the capacitor voltage and a derivative term. Under an ideal constant-voltage input, sets the characteristic time scale. The zero initial voltage supplies the starting condition.
Represent the unknown voltage as a function of time and solve the first-order ODE. Positive resistance and capacitance support the expected stable response. Check the solution against the equation, its initial value and its long-time limit.
This is an idealised model with authored symbolic parameters, not an electrical measurement. Real components have tolerances, nonideal behaviour and operating limits. A symbolic solution is useful because it exposes which parameter combinations govern the response, while leaving validation of the circuit model as a separate task.
Will the ideal long-time capacitor voltage depend on R if V is held fixed?
Write a prediction (optional)
Exact solution of an idealised circuit model
Select Run Python with the code unchanged.
Your saved draft is open. To use the published code, select Restore example in Tools. Use Recover draft to bring back your code.
Tools
About Python
Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗
Ctrl+Enter or ⌘+Enter runs Python.
Execution error
Technical error details
Your result
Python text output
Compare with the worked example
Executed from the published Python during the site build. Your own run appears above. Build environment ↗
Worked text output
Charging response: Eq(v(t), V - V*exp(-t/(C*R))) Time constant: C*R Initial voltage: 0 ODE check: (True, 0) Long-time voltage: V Fraction at one time constant: 1 - exp(-1)
Read the starter result
Read Time constant and Long-time voltage separately. sets the time scale. V is the ideal long-time voltage. Initial voltage verifies the condition at time zero.
Edit and compare
Replace initial = 0 with initial = V/4. Select Run Python. Read Initial voltage and compare Charging response and Long-time voltage with the first run. Which part of the solution changed?
Scope. This ideal lumped circuit excludes tolerances, parasitics, nonlinear components and any safety or hardware design assessment.
Try a fresh case
What does increasing R with C fixed change in the ideal model?
Need a hint?
Hint 1
Inspect the exponential denominator.
Hint 2
Keep the input definition separate from the system parameters.