[SciPy-User] strange behavior calling odeint from brentq

Schmidt, Phil PSchmidt@watlow....
Tue Nov 22 14:11:06 CST 2011


Hello,

I am implementing the shooting method using optimize.brentq() and integrate.odeint(). The following is an outline of my code:

def objective(t2, *args):
    t1 = args[0]
    x_init = args[1]
    x_target = args[2]
    x = odeint(dxdt, x_init, [t1, t2])
    return x - x_target

t_target = brentq(objective, t1, t2, args=(t1, x_init, x_target))

I have observed that if I place do-nothing statements in the objective function (e.g., print statements or dummy assignments like t1=t1), sometimes I will get different answers for t_target. I have not identified a pattern for when this may or may not occur, but presumably there is some dependency between brentq() and odeint().

I am running Scipy 0.9.0rc3, Python 2.6.5, Windows XP.

Can anyone explain why this is happening, and point me to the "right" way to do what I'm attemtping?

Thanks,
Phil



______________________________________________________________________
This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.

All e-mails and attachments sent and received are subject to monitoring, reading and archival by Watlow. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Watlow accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.

Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Watlow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20111122/a98edee4/attachment.html 


More information about the SciPy-User mailing list