# # A second order DE is solved completely with application to # a circuit problem. # # -------------------------------------------------------------------------------- # # Art Belmonte # Tue, 20/Feb/96 # Math 308-509 # Text, Section 3.9: Forced Vibrations # > unprotect(LZ):\ #\ LZ:=proc(c)\ local a, d, k, L, n, p, r, s, x, y, Z;\ n:=nops(c) - 1;\ a:=array(0..n, c);\ p:=0; s:=0;\ for k from 0 to n do\ p:=p + a[k]*r^(n-k);\ s:=s + a[k]*(D@@(n-k))(y)\ od;\ L:=unapply(s, y);\ Z:=unapply(p, r);\ #d:=convert(L(y)(x)=0, diff);\ [eval(L), eval(Z)]\ end:\ #\ protect(LZ):\ -------------------------------------------------------------------------------- # Ex 2-0 (S3.9, 190/18): Electric circuit > L:=1; R:=5000; C:=1/4 / 1000000;\ unassign('Q'); setup:=LZ([L, R, 1/C]);\ LDO:=setup[1]; Z:=setup[2];\ homog_deq:=convert(LDO(Q)(t)=0, diff);\ nonhomog_deq:=convert(LDO(Q)(t)=12, diff);\ IC:={Q(0)=0, D(Q)(0)=0}; IVP:={nonhomog_deq} union IC; -------------------------------------------------------------------------------- # Ex 2-1: Find general solution, Qc, of the corresponding # homogeneous problem. > rt:=solve(Z(r)=0, r);\ Qc:=unapply(c1*exp(-1000*t) + c2*exp(-4000*t), t);\ Q:=Qc;\ check:=simplify(homog_deq); -------------------------------------------------------------------------------- # Ex 2-2: Ensure that (the terms of) g(t), the RHS in the # nonhomogeneous DE, is of the form in Table 3.6.1 (T-159) or # Table 4.3.1 (T-204). Otherwise, use the method of variation of # parameters. It is in this case, the method of undetermined # coefficients is the ticket! > rhs(nonhomog_deq); -------------------------------------------------------------------------------- # Ex 2-3: Set up the subproblems, one for each term in g(t). > unassign('Q');\ nh1:=convert(LDO(Q)(t)=12, diff); -------------------------------------------------------------------------------- # Ex 2-4: For each subproblem, assume the form of the particular # solution to the corresponding nonhomogeneous subproblems. > Qp1:=unapply(a, t); -------------------------------------------------------------------------------- # Ex 2-5: Find the particular solution to each subproblem. Then sum # them to form a particular solution to the full nonhomogeneous # problem. > simplify(subs(Q(t)=Qp1(t), nh1));\ sol:=solve(identity(", t), {a});\ Qp1:=unapply(subs(sol, Qp1(t)), t);\ Qp:=Qp1; -------------------------------------------------------------------------------- # Ex 2-6: Finally, obtain the general solution to the full # nonhomogeneous problem by adding the general solution to the # homogeneous problem and the particular solution to the full # nonhomogeneous problem. > Q:=unapply(Qc(t)+Qp(t), t);\ check:=simplify(nonhomog_deq); -------------------------------------------------------------------------------- # Ex 2-7: Resolve constants using ICs. > IC; c_sols:=solve(", {c1, c2});\ final_solution; Q:=unapply(subs(c_sols, Q(t)), t);\ final_check:=simplify(IVP);\ #plot(u(t), t=0..0.6); -------------------------------------------------------------------------------- # Ex 2-8: Other requests... > charge_after_one_thousandth_of_a_second:=Q(0.001);\ charge_after_one_hundredth_of_a_second:=Q(0.01);\ general_charge:=Q(t);\ Limit(Q(t), t=infinity); limiting_charge:=value("); -------------------------------------------------------------------------------- >