       Re: DSolve question

• To: mathgroup at smc.vnet.net
• Subject: [mg88764] Re: DSolve question
• From: dh <dh at metrohm.ch>
• Date: Fri, 16 May 2008 05:30:11 -0400 (EDT)
• References: <g0h82g\$mu1\$1@smc.vnet.net>

Hi,

DSolve always gives a list of possible solutions, even if there is only

one. Therefore, your functions are lists and not scalars. E.g. look at

Out. You can fix this by taking the first elemenbt. E.g.:

i1[t_] = (i1[t] /. it1)[]

or you can pick the first element when you define it1.

With this fix, everything should work as expected.

hope this helps, Daniel

ood wrote:

> Hi everyone. I'm looking for help using the result of DSolve.

> In the code below the DSolve statements in In and In find i1[t] and i2[t] respectively in terms of variable t and a constant a1, a2 respectively. 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.

> However, I havenâ??t been able to make Mathematica relate the i1[t], i2[t] in FindRoot to the i1[t], i2[t] resulting from DSolve. Iâ??ve tried several ways and finally the way below and always get errors.

> On the other hand if I COPY and PASTE the DSolve output Out, Out 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:= Duty = .6; SWfreq = 1*10^6; Vin = 3.2; Vout = 1.8; L =

>  4.7*10^-7; R = 0.008;

>

> In:= Dt1 =

>  Duty (1/SWfreq); Dt2 = (1 - Duty) (1/SWfreq); VL2 = - Vout; VL1 =

>  Vin - Vout; T = 1/SWfreq;

>

> In:= it1 =

>  Simplify[DSolve[{L i1'[t] + R i1[t] - VL1 == 0, i1 == a1}, i1[t],

>    t]]

>

> Out= {{i1[t] -> 175.+ (-175. + 1. a1) E^(-17021.3 t)}}

>

> In:= it2 =

>  Simplify[DSolve[{L i2'[t] + R i2[t] - VL2 == 0, i2 == a2}, i2[t],

>    t]]

>

> Out= {{i2[t] -> -225. + (225.+ 1. a2) E^(-17021.3 t)}}

>

> In:= i1[t_] = i1[t] /. it1

>

> Out= {175.+ (-175. + 1. a1) E^(-17021.3 t)}

>

> In:= i2[t_] = i2[t] /. it2

>

> Out= {-225. + (225.+ 1. a2) E^(-17021.3 t)}

>

> In:= FindRoot[{i1 == i2[T],

>   i1[Dt1] == i2[Dt1]},

>  {a1, 0}, {a2, 0}]

>

> During evaluation of In:= Thread::tdlen: Objects of unequal length \

> in {0,{-0.983123}}+{{1.,0}} cannot be combined. >>

>

> During evaluation of In:= Thread::tdlen: Objects of unequal length \

> in {{1.,0}}+{0,{-0.983123}} cannot be combined. >>

>

> During evaluation of In:= Thread::tdlen: Objects of unequal length \

> in {0,{-0.989839}}+{{0.989839,0}} cannot be combined. >>

>

> During evaluation of In:= General::stop: Further output of \

> Thread::tdlen will be suppressed during this calculation. >>

>

> During evaluation of In:= FindRoot::njnum: The Jacobian is not a \

> matrix of numbers at {a1,a2} = {0.,0.}. >>

>

> Out= {a1 -> 0., a2 -> 0.}

>

• Prev by Date: Re: Linking EventHandler to a Control Object
• Next by Date: Re: Expression manipulation
• Previous by thread: Re: DSolve question
• Next by thread: Re: DSolve question