Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98387
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Christian Gollwitzer <auriocus@gmx.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: Scipy odeint (LSODA) gives inaccurate results; same code fine in MATLAB ode15s/ode23s |
| Date | Sat, 7 Nov 2015 07:54:48 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 34 |
| Message-ID | <n1k73h$agh$1@dont-email.me> (permalink) |
| References | <942d2bd0-6322-4733-a6dd-ceeed40368cb@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sat, 7 Nov 2015 06:52:33 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="09360e0ab07672f4bcf79b9f96c5414e"; logging-data="10769"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DXFQRk1KF8U4muL4ki1p8FJYA4NGrNRI=" |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
| In-Reply-To | <942d2bd0-6322-4733-a6dd-ceeed40368cb@googlegroups.com> |
| Cancel-Lock | sha1:r+h9v9Op8qEUGl1BRJMIEdq1prQ= |
| Xref | csiph.com comp.lang.python:98387 |
Show key headers only | View raw
Am 06.11.15 um 23:01 schrieb Abhishek: > I have code that runs perfectly well in MATLAB (using ode15s or > ode23s) but falters with Scipy odeint. The MATLAB code is for a > specific case of the generalized Python code. Here I have tried to > reproduce the specific case in Python. The logic in the code is > airtight and the algorithm is sound. I have also specified small rtol > and atol values, as well as a large mxstep. > > My code is below: > > [...Python code...] > > Why am I getting a "stiff-looking" graph in Python What does "stiff-looking" mean? I only know stiff differential equations, but this leads to noisy results. Your plots are smooth. > (http://i.stack.imgur.com/UGWSH.png), when MATLAB gives me a proper > one (http://i.stack.imgur.com/F2jzd.jpg)? I would like to understand > where the problem lies and how to solve it. It is very hard to analyze such a problem, unless you also post the Matlab code and plot both solutions into a single graph. What I can see at first is that the initial conditions can't be the same. Your Python graph starts around 10^7, while the Matlab graph starts at 10^5. WHat happens if you integrate a simpler system - say does it make sense to set some of the coefficients to zero and if you still get the same difference, can you simplify the program to expose the problem? How do you know that the Matlab code produces the correct answer? Christian
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Scipy odeint (LSODA) gives inaccurate results; same code fine in MATLAB ode15s/ode23s Abhishek <abhishek.mallela@gmail.com> - 2015-11-06 14:01 -0800
Re: Scipy odeint (LSODA) gives inaccurate results; same code fine in MATLAB ode15s/ode23s Christian Gollwitzer <auriocus@gmx.de> - 2015-11-07 07:54 +0100
Re: Scipy odeint (LSODA) gives inaccurate results; same code fine in MATLAB ode15s/ode23s Michael Torrie <torriem@gmail.com> - 2015-11-07 08:47 -0700
csiph-web