Warren Weckesser | 6 Feb 19:55
Gravatar

[Fwd: Re: weired results with ode solver]

I replied to Oz, but didn't "Reply to all", so for completeness, I'm 
forwarding this to the list.

Gravatar
From: Warren Weckesser <warren.weckesser <at> enthought.com>
Subject: Re: weired results with ode solver
Date: 2010-02-06 18:51:38 GMT
Oz Nahum wrote:
> Hi Warren,
> Thanks for your answer,
>
> here is my updated code:
<snip>
> from pylab import *
> plot(timerange/86400, c[:,0], 'bo')
> plot(timerange/86400, c[:,1], 'go')
> plot(timerange/86400, c[:,2], 'ko')
> show()
>
>
> I seems that it runs much faster than matlab (though I have not really
> checked). It's syntacticly clearer to read. Much more fun.
> There is one issue that bothers me still. I don't want to show the
> concentrations every second. So I divide by 86400 sec perday. However,
> this results in smeared concentrations, where every day has  a few of
> them. Why is that ? how can I remove it ?
>   

This is a consequence Python's integer division.  'timerange' is an 
array of integers, and you are dividing by 84600, an integer, so the 
result will be an array of integers.  Change those three plot() function 
calls to:

plot(timerange/86400.0, c[:,0], 'bo')
plot(timerange/86400.0, c[:,1], 'go')
plot(timerange/86400.0, c[:,2], 'ko')

Warren

_______________________________________________
SciPy-User mailing list
SciPy-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

Gmane