||'''Book'''|| Advanced Engineering Mathematics || ||'''Author'''|| Erwin Kreyszig || ||'''Edition'''|| 8th Edition || /* code_begins */ {{{ #We wil use L for Inductance, C for capacitance, R for Ohm's resistance. L,R,t,E0 = var('L,R,t,E0') # Defining the variables we will be using E = function('E',t) # E is function of t I = function('I',t) # I is function of t show(L*diff(I,t) + R*I -E) ode_model = L*diff(I,t)+R*I-E # This is a ordinary differential equations we have to solve #First we will do it for simple case where L = 0.1 henry, R = 5 ohms and V = 12 volts E(t) = 12 ode_model1 = L*diff(I,t)+R*I-E ode_model2 = ode_model1.subs(L=0.1,R=5) # Substituting the values of L and R ode_sol = desolve(ode_model2,I) # This is a solution of ode show(ode_sol) # Variation of graph with respect to variation in initial condition @interact def f(i1=(-2.4,2.4,0.4)): ode_sol1 = ode_sol(t,c=i1) show(plot(ode_sol1,t,0,0.1,axes=true, xmin=0, xmax=0.15, ymin=0, ymax=5)) E(t) = E0 ode_model1 = L*diff(I,t)+R*I-E ode_sol = desolve(ode_model1,I,ivar=t) # This is a solution of ode show(ode_sol) #Now we will do it for simple case where L = 0.1 henry, R = 5 ohms and E = E0sin(wt) E0,w = var('E0,w') E(t) = E0*sin(w*t) ode_model1 = L*diff(I,t)+R*I-E #ode_model2 = ode_model1.subs(L=0.1,R=5) # Substituting the values of L and R ode_sol = desolve(ode_model1,I,ivar = t) # This is a solution of ode print(ode_sol.simplify()) # Will plot the graph for a simplified case, when the assumptions are made. I(t)=exp(-0.1*t) + sin(t-pi/4) plot(I(t),t,0,12*pi) }}} /* code_ends */ * '''Solution by''': * Praveen Kumar,Student,IIT Roorkee * Tale Praffullkumar, Student, IIT Roorkee