numerical programming - - ap7
numerical programming - - ap7
where yn is the solution vector at time, that contains the values, f(tn,yn) represents the derivative
of the system at time tn.
initially Vc(0) = 0 and I(0) = 0. rlc_derivatives function computes the derivatives of Vc(t) and I(t)
based on the current values of voltage and current.
using Adams-Bashforth formula to update the voltage and current values at each time step. We
use the values from the previous two steps to predict the next one.
solving ODEs using selected numerical methods
system of ODEs is solved using the methods described above. The code initializes the system's
state at t = 0 and then iterates through time steps to solve for the voltage and current at each
time point. The Euler method is used initially to obtain the first estimate, and then the Adams-
Bashforth method is applied to the remaining steps.
numerical experiments and visualize
code performs numerical integration over specified time range tfinal=20 seconds with a time step
h = 0.01. using matplotlib to visualize the voltage across capacitor and current as function.
voltage across the capacitor increases and decreases in an oscillatory manner due to the energy
exchange between the inductor and capacitor, while the current follows a similar oscillatory pattern but
with a phase shift.