Closed AchaseA closed 4 years ago
I haven’t gotten very far, but I did run your code for the gamma=2.0 parameter setting and saw the same behavior you mentioned. Notice that the error has an important key word in it:
/Users/mcde2235/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:49: RuntimeWarning: overflow encountered in double_scalars
which is overflow encountered
rather than double_scalars
- this goes back to Newman, Ch. 2 and Ch. 4 - where if you check the appendix of his book, overflows are referenced on pg. 127. (A web search is also useful).
I think you might want to consult your use of gamma ($\gamma$) and delta ($\delta$). I notice that you have gamma = 2.0, where Newman has delta = 2.0. Physically, what I think is happening, is that the solutions to these equations are exponential (i.e. these are more complicated versions of the exponential growth/decay equations), so you're using a sufficiently large exponent to blow up your fox or rabbit population.
Oh, I definitely was looking at the scalar issue rather than the overflow part of it. So I went back and read page 127, and it does make sense that I would run into an error if my values are too large, especially with exponential growth and decay. I tested smaller numbers and it seemed to work for the most part, and then I tried to input the conditions that Newman suggested in problem 8.3 and ran into the same exact error. This is strange to me because I feel like there is probably an issue with the code somehow that I'm not seeing if the values he suggested are also not working correctly. Any suggestions? I think I'll just have to dig a little deeper to see if there's a tiny error I'm missing.
Thank you!
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Mon, Apr 27, 2020 at 10:22 AM Danielle McDermott < notifications@github.com> wrote:
I haven’t gotten very far, but I did run your code for the gamma=2.0 parameter setting and saw the same behavior you mentioned. Notice that the error has an important key word in it: /Users/mcde2235/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:49: RuntimeWarning: overflow encountered in double_scalars
which is overflow encountered rather than double_scalars - this goes back to Newman, Ch. 2 and Ch. 4 - where if you check the appendix of his book, overflows are referenced on pg. 127. (A web search is also useful).
I think you might want to consult your use of gamma ($\gamma$) and delta ($\delta$). I notice that you have gamma = 2.0, where Newman has delta = 2.0. Physically, what I think is happening, is that the solutions to these equations are exponential (i.e. these are more complicated versions of the exponential growth/decay equations), so you're using a sufficiently large exponent to blow up your fox or rabbit population.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AchaseA/Final-Project-Predator-vs.-Prey-Model/issues/1#issuecomment-620121833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONSKMURI3EHNJMBDKQXZDTROW5LPANCNFSM4MRSKJ7Q .
Are you sure that you used the conditions specified by Newman? Did you see my notes of gamma vs. delta? Because the way I read your work vs. Newmans, I think you're mixing up the two quantities.
Okay, so I think I got it right this time with the delta and gamma and I'm getting the same error. I just pushed that specific case of what I believe to be what Newman is suggesting onto github. If you could take a look at that sometime tomorrow that would be great!
Thank you
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Mon, Apr 27, 2020 at 4:38 PM Danielle McDermott notifications@github.com wrote:
Are you sure that you used the conditions specified by Newman? Did you see my notes of gamma vs. delta? Because the way I read your work vs. Newmans, I think you're mixing up the two quantities.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AchaseA/Final-Project-Predator-vs.-Prey-Model/issues/1#issuecomment-620291032, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONSKMSLPNV7PQZD2PLVLTTROYJNPANCNFSM4MRSKJ7Q .
Its you're tilmestep. In a time range of 0-30, you're only take 20 steps. So h=1.5. This means that your uncertainties are huge - recall that RK4 has uncertainties of 5th order, so you have h^5 errors, meaning your exponentials are running away and blowing up. Decrease your tilmestep to something reasonable, and you'll have nice outputs.
Do improve your user interface. It was very unclear to me what the variables of r and t were when working with your code, or how I could control them (say started with t not zero).
Great, thank you! I was a little worried to try a super high number at first because I wasn't sure how long the code would take to run. Once I was troubleshooting, I had forgotten all about that part.
Thanks!
The code seems to run smoothly for some constant values and runs not so smoothly for other constant values. I haven't completely determined the reason why exactly, but when there is a certain arrangement of constants, the code still follows through, but the graph is clearly incorrect. An example of constants that works is: alpha = 1 beta = .5 gamma = 2 delta = 1 A couple of examples of constants that don't work are: alpha = 1 beta = .5 gamma = 2 delta = .3
alpha = 1 beta = .5 gamma = 1.5 delta = 2