In reality the gravitational field that close to the centre of Mars will be Is probably why you see the warning messages. The large numbers will almostĬertainly cause problems with the numerical accuracy of the integrator which Massive using the formula that you have shown. The gravitational field at that point in Mars is Of Mars is ~3e6m but your initial condition is at (1000, 1000)m which is very
#Scipy odeint code#
Your code assumes that Mars is centred at the (0, 0) point.
![scipy odeint scipy odeint](https://media.cheggcdn.com/media%2Fb65%2Fb6526aef-33d0-4d0f-a654-a2bff26d3427%2Fimage.png)
The physical problem is that your initial conditions are actually inside the There are two problems with your code: one physical and one programmatic. Others have already said this but I'd like to repeat it: it would be a lotĮasier for me to help with something like this if you put your code in the Y, info = integrate.odeint(f, y0, t, full_output=1) Vs = 2.138e3 # Phobos orbit average velocity Rs = 9.376e6 # Phobos orbit semi-major axis I started with `Rsx = Rxy` and `Vsx = -Vsy`. I ran your calculation for Phobos, assuming a perfectly circular Radius approaches zero, odeint will have problems converging. In the model it continues until the radius is 0. The trajectory is decaying into the planet. Then inside the f(x,t) function change the calculation of r to this: You can improve the accuracy of that radius calculation by using Possibly making G a negative quantity is causing the problems?Īnother minor comment on your code, in the f(x, t) function you have a G is quoted as a positive quantity, G = 6.67e-11 m³/(kg*s²), or the same Notice that you have made G a negative value? That is unusual, normally In the meantime, I have a couple of comments about your code. Scipy mailing list, I would really appreciate it if you were to write I've managed to have a look at the screenshot, there are no obvious
![scipy odeint scipy odeint](https://computationalmindset.com/posts/neural-networks/ordinary-differential-equation-solvers/nn_odesolvers_result_tdeq_2.png)
It as text rather than just a screenshot would make it much easier to Office) so I can at least see the print-screen, but being able to access Many of us here, I'm a Linux user and don't have access to Microsoft I will try to find a program that will let me view your. If it is more than a hundred lines or so, it will Is your code copy and pasted as text, if possible directly in the body Unfortunately print-screen is not so helpful here. Have, what else can I do to stop this message from appearing? I'veĪttached a quick print-screen of the code. It's quite possible I haven't done this right. Work by increasing the maxstep and I also tried to run withįull_output =1. Run with full_output = 1 to get quantitative information." YouĬan see that as part of the odeint function I tried to stop the excess Then run your code, and cut and paste the traceback to yourĪppears saying: "Excess work done on this call (perhaps wrong Dfun Sorry I can't help you, but the way it works best here is that youĪctually cut and paste your code in your email. What else can I do to stop this message from appearing? Stop the excess work by increasing the maxstep and I also tried to run withįull_output =1. Information." You can see that as part of the odeint function I tried to
![scipy odeint scipy odeint](https://i.stack.imgur.com/GsTJh.png)
![scipy odeint scipy odeint](https://user-images.githubusercontent.com/1814174/71502838-55292800-2840-11ea-96cc-dcefeb7ae326.png)
Run with full_output = 1 to get quantitative Often when run an error message appears saying: "Excess work done on thisĬall (perhaps wrong Dfun type). The exact same code can also end up displaying different graphs Showing the satellite making immediate sharp turns or jumping up and down in For certain initial conditions the programme displays impossible orbits, The idea is that I'm modelling the orbit of a Of ODEs (obtained by splitting Newton's law of gravity ma=-Gm1m2r/r^3 in two I'm a python beginner, currently using scipy's 'odeint' to compute to a set I've attached a quick print-screen of the code. If I have, what else can I do to stop this message from appearing? Run with full_output = 1 to get quantitative information." You can see that as part of the odeint function I tried to stop the excess work by increasing the maxstep and I also tried to run with full_output =1. For example when initial conditions are set at: xx0=.-Often when run an error message appears saying: "Excess work done on this call (perhaps wrong Dfun type). The exact same code can also end up displaying different graphs when run multiple times. I have two problems:-For certain initial conditions the programme displays impossible orbits, showing the satellite making immediate sharp turns or jumping up and down in velocity. The idea is that I'm modelling the orbit of a satellite as it approaches Mars. I'm a python beginner, currently using scipy's 'odeint' to compute to a set of ODEs (obtained by splitting Newton's law of gravity ma=-Gm1m2r/r^3 in two ordinary differentials).