~ubuntu-branches/ubuntu/saucy/python-scipy/saucy

« back to all changes in this revision

Viewing changes to Lib/sandbox/newoptimize/test_optimize.py

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import optimize as opt
2
 
from base import *
3
 
 
4
 
def f( x ):
5
 
    return nm.sum( x ** 4 )
6
 
 
7
 
def fg( x ):
8
 
    return 4 * (x ** 3)
9
 
 
10
 
conf = Struct( epsRD = 1e-3,
11
 
               epsOF = 1e-4,
12
 
               epsOFG = 1e-4,
13
 
               iMax = 20,
14
 
               norm = nm.Inf,
15
 
               ls = True, # Linesearch.
16
 
               log = True,
17
 
               check = 0,
18
 
               delta = 1e-6 )
19
 
 
20
 
x0 = nm.arange( 100, dtype = nm.float64 )
21
 
x, log = opt.fmin_sd( conf, x0, f, fg )
22
 
print x
23
 
print log