[SciPy-user] optimize.fsolve starting guess
josef.pktd@gmai...
josef.pktd@gmai...
Wed Jan 14 12:33:53 CST 2009
On Wed, Jan 14, 2009 at 12:34 PM, Askey Scott A Capt AFIT/ENY
<Scott.Askey@afit.edu> wrote:
>
>
> -----Original Message-----
> From: Askey Scott A Capt AFIT/ENY
> Sent: Wednesday, January 14, 2009 12:25 PM
> To: 'scipy-user@scipy.org'
> Subject: optimize.fsolve starting guess
>
>
>
> -----Original Message-----
> From: Askey Scott A Capt AFIT/ENY
> Sent: Wednesday, January 14, 2009 9:46 AM
> To: scipy-user@scipy.org
> Subject: optimize.fsolve starting guess
>
> I am using fsolve to solve a systems of nonlinear equations to solve a
> dynamics problem that is marching forward in time.
>
>
>
> X(i+1)=fsolve(F,x(i),args=(x(i))
>
>
>
> F is a vector. My problem is Fsolve fail to converge as written above.
> F(x[i],x[i]) contains many zeros.
>
>
>
> It does converge if
>
>
>
> X(i+1)=fsolve(F,.99999*x(i),args=(x(i)) is used.
>
>
Does it converge if you try:
X(i+1)=fsolve(F, 1.0*x(i),args=(x(i))
then 1.0*x[i] makes a temporary copy, x[i].copy()
I don't know about your specific problem, but one problem with python
is to watch out for mutable arguments. If fsolve doesn't make a copy
of the arguments, then the args values in your F function
might change during the solution search and it would be evaluating F
at the fixed point.
Josef
More information about the SciPy-user
mailing list