[SciPy-user] minimization returns values never used in residuum function

Bernhard Voigt bernhard.voigt@gmail....
Tue Aug 28 16:03:54 CDT 2007

Dear list,

I've defined a residuum function based on angles which is cyclic. I'm adding
pi for values smaller zero and taking the module for values larger pi:

def res(self, event, x=None, y=None, z=None,
            zenith=None, azimuth=None, energy=None, level=10):

        if zenith < 0:
            zenith += math.pi
        zenith = zenith % math.pi
        print 'zen: %f' % zenith

        if azimuth < 0:
            azimuth += math.pi * 2
        azimuth = azimuth % (math.pi * 2)
        print 'az: %f' % azimuth

The minimizer (I was using leastsq and fmin_bfgs for now) returns negative
values and values beyond the boundaries, though it never calls the residuum
function with these values. Here's the output when calling the minimization:
.... fmin_bfgs example.......
zen: 0.634435
az: 1.198491
zen: 0.641435
az: 1.198491
zen: 0.634435
az: 1.205491
zen: 0.634435
az: 1.198491
Result: array([ 57.18310254,   7.48167597])

....... leastsq example ...........
zen: 3.116993
az: 0.359548
zen: 3.116993
az: 0.359548
zen: 3.116993
az: 0.359548
Result: array([-0.02459993,  0.35954834])

Where in the result the numbers are zenith and azimuth, respectively.

Can someone explain what's going on?

Thanks, Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070828/47e62df4/attachment.html 

More information about the SciPy-user mailing list