Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

For some sets of constants, NDSolve gives me true solutions, but when I try for example, T = 1/(2*2200), Mathematica does not respond. What can I do? The code below has no problem, but I need to change the constants defined at the beginning of the code and see the results. Any suggestions?

Io = 3.38*10^-12
NS = 8
Cp = 90*10^-15
Cs = 30*10^-15
T = 1/(2*2100)
ss = 51.23*10^-3
dV = 0.45
Cl = 1*10^-12
V = 0.3

\[Beta] = (2*Io)/((Cs + Cp)*ss)

a = \[Beta]*T
b = \[Beta]*T/2
c = Cl/((Cs + Cp)/(2 T))
d = Io/((Cs + Cp) /(2 T))

s = NDSolve[
  {Vo[t] == V + 
      Log[b/(E^((c*Vo'[t] + d)/ss) - 1)] ss + 
      Log[(b* E^((dV + c*Vo'[t] + d)/ss))/(E^((c*Vo'[t] + d)/ss) - 1)] ss + 
      Log[(a* E^((dV + c*Vo'[t] + d)/ss))/(E^((2*(c*Vo'[t] + d))/ss) - 1)] ss (NS-1),
   Vo[0] == 0.3
   }, 
  Vo,
  {t, -0.0001, 1}]  

Plot[Evaluate[Vo[t] /. s], {t, -0.0001, 1}, PlotRange -> All]
share|improve this question
1  
Specifying the option SolveDelayed -> True will rectify this. I have very little experience with NDSolve and so am not completely sure what the problem is or why this solves it, hence not posting this as an answer. Hopefully someone else can expand on the issue. –  Oleksandr R. Mar 24 '13 at 1:14
    
This solved the problem. At first, I only added this line, and it worked for values between 2200 and 4500, then it required initial value of derivative for bigger values . After giving that value, the problem is solved. Thanks. –  Cagatay Ozmen Mar 24 '13 at 11:47
add comment

1 Answer

In version 9 you get either one of two warning but a solution is found without any options. The warning reads:

NDSolveValue::ndsdtc: The time constraint of 1.` seconds was exceeded trying to solve for derivatives, so the system will be treated as a system of differential-algebraic equations. You can use Method->{"EquationSimplification"->"Solve"} to have the system solved as ordinary differential equations.

The second warning:

NDSolveValue::ntdvdae: Cannot solve to find an explicit formula for the derivatives. NDSolve will try solving the system as differential-algebraic equations.

This also explains why SolveDelayed->True works in previous versions. With this specified, the solver goes to a DAE solver which is able to solve the equation.

share|improve this answer
    
Okay, but why is the DAE solver able to work without explicit derivatives whereas the ordinary solver isn't? The documentation suggests that the difficulty is one of finding appropriate initial values and that, when using the DAE solver, "NDSolve first searches for initial conditions that satisfy the equations, using a combination of Solve and a procedure much like FindRoot". Merely mentioning "a procedure much like FindRoot" doesn't exactly explain much (including why this approach is specific to the DAE solver), so that's why I was hoping for a more enlightening answer. –  Oleksandr R. Mar 24 '13 at 10:35
1  
@OleksandrR. I don't know if this answers your question, but the reason FindRoot or something like it comes into play is this: the first-order DAE is equivalent to a second-order differential equation obtained by taking $d/dt$ on both sides. Since the order increased, we need an additional initial condition (for Vo'[0]). But the latter is not at our disposal because the original DAE fixes it via the value of V which got killed in the $d/dt$. This is where FindRoot comes in to determine what the correct Vo'[0] is. Then the 2nd order diff. eqn. can be solved as usual. –  Jens Mar 25 '13 at 4:47
    
Got it. Thank you, @Jens. So, the real problem is that the OP didn't specify an initial value for Vo'[0], even though NDSolve was able to work around this by transforming the problem. –  Oleksandr R. Mar 25 '13 at 4:48
    
@OleksandrR., you may want to have a look here for an overview of DAEs and their solution in M. Additionally, the value of Vo'[-0.0001] must also be consistent - a highly non trivial problem generally. @Jens, thanks for the explanation. –  user21 Mar 25 '13 at 5:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.