Guest User

Untitled

a guest
Mar 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"];
  2. Clear[sol]
  3. sol = NDSolve[{y'[x] == -0.2 y[x], y[0] == 10}, y, {x, 0, 100},
  4. Method -> {"EventLocator", "Event" -> y[x] - 1 == 0}];
  5. end = Max[InterpolatingFunctionDomain[First[y /. sol]][[1]]]
  6.  
  7. sol = NDSolve[{x'[t] == a*x[t] - c*x[t]*y[t], x[0] == 10,
  8. y'[t] == -b*y[t] + d*x[t]*y[t], y[0] == 10}, {x[t], y[t]}, {t, 0,
  9. tend}, Method -> {"EventLocator", "Event" -> y[t] - 1 == 0}];
  10.  
  11. end = InterpolatingFunctionDomain[y /. First[sol]]
  12.  
  13. InterpolatingFunctionDomain[y]
Add Comment
Please, Sign In to add comment