# [SciPy-User] lsoda vs. Coulomb friction

David Goldsmith d.l.goldsmith@gmail....
Wed Feb 3 15:00:19 CST 2010

```On Wed, Feb 3, 2010 at 12:16 PM, Charles R Harris <charlesr.harris@gmail.com
> wrote:

>
>
> On Wed, Feb 3, 2010 at 9:28 AM, Ryan Krauss <ryanlists@gmail.com> wrote:
>
>> I am trying to use odeint (i.e. lsoda) on a mechanical system that
>> involves a mass and friction modeled as a viscous term plus Coulomb
>> friction.  The discontinuity near 0 velocity makes lsoda mad.  It
>> complains that it has to do excess work (lazy algorithm :).  In spite
>> of its complaining, the result leads to fairly good agreement between
>> model and experiment.  But is there a better way to handle this?
>>
>>
> You might try some of the other stiff solvers. The algorithms for stiff
> equations tend to be implicit, i.e., they have to solve non-linear equations
> and are inherently slower for that reason. Other than that I haven't any
> suggestions.
>
>
Hi, Ryan.  To elaborate on Chuck's reply: first, are you using
scipy.integrate.ode.ode or scipy.integrate.odepack.odeint?  If the former,
use vode and use its set_integrator() method with keyword argument 'method'
set equal to 'bdf'.  See, e.g.,
http://docs.scipy.org/scipy/docs/scipy.integrate.ode.ode/ for more
information.  If you're using the latter, you may want to switch to the
former, as odeint's docstring has this to say about stiff systems:

"   :
:
Returns
-------
:
:
infodict : dict, only returned if full_output == True
:
:
'mused'  a vector of method indicators for each successful time step:
1: adams (nonstiff), 2: bdf (stiff)"

Note that it's a _return_ value: apparently with odeint, you can't specify
which method to use, you can only "hear" which method the algorithm decided
to use for you.

HTH,

DG

Chuck
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100203/a59b54a2/attachment.html
```