Re: Why doesn't Mathematica solve this simple differential equation?
- To: mathgroup at smc.vnet.net
- Subject: [mg69334] Re: Why doesn't Mathematica solve this simple differential equation?
- From: p-valko at tamu.edu
- Date: Thu, 7 Sep 2006 04:30:41 -0400 (EDT)
- References: <eddqq8$3vq$1@smc.vnet.net><edjh7r$luh$1@smc.vnet.net> <edm1s7$cq7$1@smc.vnet.net>
If you want Mathematica to be smart, let her do the job symbolically: In: DSolve[eqns41, {Vc[t], Il[t]}, t] // First Out: {Il[t] -> Vo/(E^(t/(C1*R1 + C1*R2))*(R1 + R2)), Vc[t] -> Vo/E^(t/(C1*R1 + C1*R2))} In: % /. {C1 -> 1.0*10^-6, R1 -> 16, R2 -> 27, Vo -> 4.0} Out: {Il[t] -> 0.093023 * E^(-23255.81*t), Vc[t] -> 4. * E^(-23255.81*t)} Regards P.V. Joseph Gwinn wrote: > In article <edjh7r$luh$1 at smc.vnet.net>, > Joseph Gwinn <JoeGwinn at comcast.net> wrote: > > > In article <eddqq8$3vq$1 at smc.vnet.net>, > > Joseph Gwinn <JoeGwinn at comcast.net> wrote: > > > > > Here is the system I'm trying to solve. It's an electrical circuit > > > consisting of a capacitor C1 (with initial voltage 4.0 volts), a > > > resistor R1, and a diode in series. > > > > I just read the Mathematica 5.2 NDSolve Advanced Documentation section > > on Differential Algebraic Equations. > > > > It occurs to me that, aside from the typos, what may be happening is > > that I'm handing Mathematica something that looks like a Differential > > Algebraic Equation (DAE) of index exceeding 1, as Mathematica was able > > to solve the system with one implicit equation (for the diode, with a > > capacitor but no resistor). > > I now have a clean example of the problem: > > eqns41 = {Vc'[t] == -Il[t]/C1, Vc[t] == (R1 + R2)*Il[t], Vc[0] == Vo} > > eqns42 = eqns41 /. {C1 -> 1.0*10^-6, R1 -> 16, R2 -> 27, Vo -> 4.0} > > eqns42soln = NDSolve[eqns42, Vc, {t, 0, 1}] > > The above fails: "NDSolve::overdet: There are fewer dependent variables, > {Vc[t]}, than equations, so the system is underdetermined." > > eqns41a = Eliminate[eqns41, Il[t]] > > eqns42a = eqns41a /. {C1 -> 1.0*10^-6, R1 -> 16, R2 -> 27, Vo -> 4.0} > > eqns42asoln = NDSolve[eqns42a, Vc, {t, 0, 1}] > > The above works. > > Eliminate[] cannot make a self-consistent system from an inconsistent > system, so the original system must also be consistent. Yet it fails. > > Does Mathematica think that this system is some kind of complicated DAE? > Apparently, given that Eliminate[] solves the problem. Why couldn't > NDSolve do its own algabraic reduction? The variable Il[t] was not > requested as an output. > > I have a few more such examples, so the issue isn't restricted to this > example. > > The other issue is that *all* combinations of real electronic components > (that is, circuits) lead to a numerically solvable system of ODEs, > because all circuits will do something real if constructed and tested. > So, aside from eliminating silly mistakes, this should not be hard, and > I'm trying to figure out the root cause of these random-appearing > failures. Mathematica is probably trying to do something that ordinary > circuit simulators (such as SPICE) wouldn't dream of. > > Joe Gwinn