2
$\begingroup$

I want to solve a system of coupled equations. After facing problems solving the coupled system, I reduced it to both of the systems uncoupled. Even uncoupled, the equations will not solve simultaneously. Each simulated separately solves fine. Together, they simulate very briefly, then produce the error:

Divide::infy: Infinite expression 1/(0. +0. I) encountered. >>

I'm guessing this is something I can solve by wrestling with the solver, but I don't know where to start. Suggestions?

This is the full system:

Ib[V_] := If[V <= 0.75,
    0,
    (V - 0.75)/325];
Ic[V_] := If[V <= 0.75,
    0,
    80 (V - 0.75)/325];

allEqns = {
  5 10^-11 r''[t] + 1.4 10^-6 r'[t] + 57560 r[t] == 
      1.02 10^-8 (Abs[A[t]])^2,
  A'[t] + A[t] (1.58 10^7 - I (1.41 10^7 + 1.48 10^19 r[t])) == 
      1.62 10^8 I,

900 10^-12 Vc1'[t] == IL[t] - Ic[-Vc2[t]],
900 10^-12 Vc2'[t] == (-3 - Vc2[t])/180 + Ib[-Vc2[t]] + IL[t],
600 10^-9 IL'[t] == 3 - Vc1[t] - Vc2[t] - 27 IL[t]};


myInits = {
  r[0] == 0, r'[0] == 0, A[0] == 0,
  Vc1[0] == 0, Vc2[0] == 1, IL[0] == 0};

myVars = {A, r, Vc1, Vc2, IL};

sol = NDSolve[{
  allEqns,
  myInits
  },
  myVars,
  {t, 0, 0.0000357}];

And here is system 1 (an optomechanical oscillator):

allEqns = {
  5 10^-11 r''[t] + 1.4 10^-6 r'[t] + 57560 r[t] == 
      1.02 10^-8 (Abs[A[t]])^2,
  A'[t] + A[t] (1.58 10^7 - I (1.41 10^7 + 1.48 10^19 r[t])) == 
      1.62 10^8 I};

myInits = {
  r[0] == 0, r'[0] == 0, A[0] == 0};

myVars = {A, r};

sol = NDSolve[{
   allEqns,
   myInits
   },
   myVars,
   {t, 0, 0.0000357}];

And here is system 2 (a Colpitts oscillator):

Ib[V_] := If[V <= 0.75,
   0,
   (V - 0.75)/325];
Ic[V_] := If[V <= 0.75,
   0,
   80 (V - 0.75)/325];

allEqns = {
   900 10^-12 Vc1'[t] == IL[t] - Ic[-Vc2[t]],

   900 10^-12 Vc2'[t] == (-3 - Vc2[t])/180 + Ib[-Vc2[t]] + IL[t],

   600 10^-9 IL'[t] == 3 - Vc1[t] - Vc2[t] - 27 IL[t]};


myInits = {
   Vc1[0] == 0, Vc2[0] == 1, IL[0] == 0};

myVars = {Vc1, Vc2, IL};

sol = NDSolve[{
   allEqns,
   myInits
   },
   myVars,
   {t, 0, 0.0000357}];

Any suggestions and broader guidance on assuaging the solver is greatly appreciated. Thanks.

$\endgroup$
  • 2
    $\begingroup$ you need to define Ib and Ic so that they only take numeric arguments Ib[V_?NumericQ] := (restart your kernel when you do that) $\endgroup$ – george2079 May 7 '18 at 18:45
  • $\begingroup$ Thanks very much for this somewhat confusing help! It runs when they are separate--why does the input need to be specified as numeric when they are simultaneous? $\endgroup$ – KBL May 7 '18 at 19:00
  • 2
    $\begingroup$ When NDSolve can "see" the discontinuity it treats that point specially. Really I don't see why that is causing a problem here. suspect the complex function has something to do with it. Try decoupling real and imaginary parts of A so you have two real equations instead of a complex one. $\endgroup$ – george2079 May 7 '18 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.