Re: DSolve question
- To: mathgroup at smc.vnet.net
- Subject: [mg88788] Re: [mg88746] DSolve question
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 16 May 2008 05:34:46 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Duty = 6/10; SWfreq = 10^6; Vin = 32/10; Vout = 18/10; L = 47*10^-8; R = 8/1000; T = 1/SWfreq; Dt1 = Duty*T; Dt2 = (1 - Duty)*T; VL2 = -Vout; VL1 = Vin - Vout; Clear[i1, i2, i]; i1[t_] = i[t] /. DSolve[{L * i'[t] + R i[t] - VL1 == 0, i[0] == a1}, i[t], t][[1]] // FullSimplify (a1 - 175)/E^((800000*t)/47) + 175 i2[t_] = i[t] /. DSolve[{L * i'[t] + R i[t] - VL2 == 0, i[0] == a2}, i[t], t][[1]] // FullSimplify (a2 + 225)/E^((800000*t)/47) - 225 Solve[{i1[0] == i2[T], i1[Dt1] == i2[Dt1]}, {a1, a2}][[1]] // FullSimplify {a1 -> -((25*(7 - 16*E^(12/1175) + 9*E^(4/235)))/(-1 + E^(4/235))), a2 -> (25*(9 - 25*E^(4/235) + 16*E^(32/1175)))/(-1 + E^(4/235))} % // N {a1->14.1825,a2->18.2886} Bob Hanlon ---- igwood <igwood at yahoo.co.jp> wrote: > Hi everyone. I'm looking for help using the result of DSolve. > In the code below the DSolve statements in In[3] and In[4] find i1[t] and i2[t] respectively in terms of variable t and a constant a1, a2 respective ly. Then, numerical values for a1 and a2 will be found by simultaneous equations equating i1[t] and i2[t] in the FindRoot statement in In[7]. > However, I haven=C3=A2=C2=80=C2=99t been able to make Mathematica relate the i1[t], i2[t] in FindRoot to the i1[t], i2[t] resulting from DSolve. I =C3=A2=C2=80=C2=99ve tried several ways and finally the way below and alway= s get errors. > On the other hand if I COPY and PASTE the DSolve output Out[3], Out[4] following the -> into the lhs of i1[t] = lhs, then the FindRoot gives me the a1, and similar for a2.. > If anyone can instruct me on how to get the FindRoot to recognize the i1[t], i2[t] found from DSolve I would appreciate it. I guess in other words, how do I get output of DSolve to be a usable function. > > In my own reply to this post I will paste the example of the code where COPY/PASTE has been used as described above to give numerical values for a1, a2. > > Thanks in advance. > > > In[1]:= Duty = .6; SWfreq = 1*10^6; Vin = 3.2; Vout = 1.8; L = > 4.7*10^-7; R = 0.008; > > In[2]:= Dt1 = > Duty (1/SWfreq); Dt2 = (1 - Duty) (1/SWfreq); VL2 = - Vout; VL1 == > Vin - Vout; T = 1/SWfreq; > > In[3]:= it1 = > Simplify[DSolve[{L i1'[t] + R i1[t] - VL1 == 0, i1[0] == a1}, i1[t], > t]] > > Out[3]= {{i1[t] -> 175.+ (-175. + 1. a1) E^(-17021.3 t)}} > > In[4]:= it2 = > Simplify[DSolve[{L i2'[t] + R i2[t] - VL2 == 0, i2[0] == a2}, i2[t], > t]] > > Out[4]= {{i2[t] -> -225. + (225.+ 1. a2) E^(-17021.3 t)}} > > In[5]:= i1[t_] = i1[t] /. it1 > > Out[5]= {175.+ (-175. + 1. a1) E^(-17021.3 t)} > > In[6]:= i2[t_] = i2[t] /. it2 > > Out[6]= {-225. + (225.+ 1. a2) E^(-17021.3 t)} > > In[7]:= FindRoot[{i1[0] == i2[T], > i1[Dt1] == i2[Dt1]}, > {a1, 0}, {a2, 0}] > > During evaluation of In[7]:= Thread::tdlen: Objects of unequal length \ > in {0,{-0.983123}}+{{1.,0}} cannot be combined. >> > > During evaluation of In[7]:= Thread::tdlen: Objects of unequal length \ > in {{1.,0}}+{0,{-0.983123}} cannot be combined. >> > > During evaluation of In[7]:= Thread::tdlen: Objects of unequal length \ > in {0,{-0.989839}}+{{0.989839,0}} cannot be combined. >> > > During evaluation of In[7]:= General::stop: Further output of \ > Thread::tdlen will be suppressed during this calculation. >> > > During evaluation of In[7]:= FindRoot::njnum: The Jacobian is not a \ > matrix of numbers at {a1,a2} = {0.,0.}. >> > > Out[7]= {a1 -> 0., a2 -> 0.} >