Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. smin = -1;
  2. h[z_] := Exp[-z/2]
  3. smax=zmax/.Last @ Reap[
  4. NDSolveValue[
  5. {
  6. int'[z] == (Exp[z] - 1) h[z], int[smin] == 0,
  7. WhenEvent[int[z]==0, {"StopIntegration", Sow[z, "zmax"]}]
  8. },
  9. int,
  10. {z, smin, Infinity}
  11. ],
  12. _,
  13. #1 -> First@#2&
  14. ]
  15.  
  16. sol = Last@
  17. Reap[NDSolveValue[{int'[z] == (Exp[z] - 1) h[z], int[smin] == 0,
  18. WhenEvent[int[z] == 0, {"StopIntegration", Sow[z, "zmax"]}]},
  19. int, {z, smin, Infinity}], _, #1 -> First@#2 &]
  20. smax = zmax /. First@sol
  21.  
  22. sol = Last@
  23. Reap[NDSolveValue[{int'[z] == (Exp[z] - 1) h[z], int[smin] == 0,
  24. WhenEvent[int[z] == 0, {"StopIntegration", Sow[z, "zmax"]}]},
  25. int, {z, smin, Infinity}], _, #1 -> First@#2 &]
  26. smax = zmax /.sol
  27.  
  28. smax = Hold[
  29. zmax /. Last@
  30. Reap[NDSolveValue[{int'[z] == (Exp[z] - 1) h[z], int[smin] == 0,
  31. WhenEvent[int[z] == 0, {"StopIntegration", Sow[z, "zmax"]}]},
  32. int, {z, smin, Infinity}], _, #1 -> First@#2 &]
  33. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement