0% found this document useful (0 votes)
3 views

numerical programming - - ap7

Uploaded by

nani chkhenkeli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

numerical programming - - ap7

Uploaded by

nani chkhenkeli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

AP--7

I worked on the RLC circuit described by linear second order ODE.


equation for the voltage across the capacitor Vc(t)

equation for the current in the circuit I(t)

selecting linear multistep method


I selected linear multistep method, code uses combination of Euler's method for initial prediction
and Adams-Bashforth method.
I used Adams-Bashforth method because it provides more accurate solution than single-step
methods like Euler's, especially over larger time steps or for systems with more complex
dynamics like an RLC circuit.

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.

You might also like