[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Francesco Potorti`
Subject: fsolve
Date: Tue, 08 Aug 1995 12:48 +0100 (MET)

I wrote:
   Hi, is there someone willing to help me to use fsolve?  
   It always tells me that the iteration is not making good progress and
   stops after 15 iterations, nor there seems to be any way of making it
   iterate longer.  I put a debugging printf inside the function that
   fsolve calls, so I can see the argument it is called with (a two
   variable vector).

   Why does fsolve call three times the function with the initial value?

Ted Harding answered:
   It might help if you gave details of the function you want fslove to

Thanks you for your offering.  I solved the problem, and its solution
may help others and raise some documentation issue I discuss in the

It is normal that fsolve calls the function to solve three times.
Printing the arguments with higher precision yelds:

x(1)=0.8, x(2)=0.3
x(1)=0.800000011921, x(2)=0.3
x(1)=0.8, x(2)=0.30000000447
x(1)=0.795942933187, x(2)=0.305377249969
x(1)=0.795896024488, x(2)=0.305423099879
x(1)=0.795895597217, x(2)=0.305423512898
x(1)=0.795895597196, x(2)=0.305423512918

So the values are in fact slightly different, but this is not apparent
with the standard precision.  I suppose fsolve is computing the
gradient of the function here.

The reason why it did not converge is a problem qith quad(), which I
used inside the function to solve.  Indeed, I had to integrate from 0
to Inf a gaussian with mean 100 and sigma 2, which is sensibly
different from 0 only around 100.  quad missed that region and told
that the integral was around 1e-14 (it should have been around 1).  I
could not either give quad a singularity vector, because that one is
not accepted with infinite intervals.  So I had to break the
integration in two infinite intervals, (-Inf, 100) and (100, Inf).

1st issue:
  Shouldn't suggestions like this be given in the info manual?

2nd issue:
  I could not find a way to get the values of quad_options and
  fsolve_options from inside a script.  Shoulnd't quad_options("abs")
  suffice?  It does not work.

3rd issue:
  The info manual does not explicitely say if the fourth optional
  argument to quad is an absolute or relative tolerance.

Thanks for listening.
         Francesco Potorti`     | address@hidden (Internet)
         researcher at          | 39369::pot (DECnet)
         CNUCE-CNR, Pisa, Italy | +39-50-593203 (voice) 904052 (fax)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]