# `optimize.tests.test_nonlin`¶

Unit tests for nonlinear solvers Author: Ondrej Certik May 2007

## Module Contents¶

### Classes¶

 `TestNonlin`() Check the Broyden methods for a few test problems. `TestSecant`() Check that some Jacobian approximations satisfy the secant condition `TestLinear`() Solve a linear equation; `TestJacobianDotSolve`() Check that solve/dot methods in Jacobian approximations are consistent `TestNonlinOldTests`() Test case for a simple constrained entropy maximization problem

### Functions¶

 `F`(x) `F2`(x) `F2_lucky`(x) `F3`(x) `F4_powell`(x) `F5`(x) `F6`(x)
`F`(x)
`F2`(x)
`F2_lucky`(x)
`F3`(x)
`F4_powell`(x)
`F5`(x)
`F6`(x)
class `TestNonlin`

Check the Broyden methods for a few test problems.

broyden1, broyden2, and newton_krylov must succeed for all functions. Some of the others don’t – tests in KNOWN_BAD are skipped.

`_check_nonlin_func`(f, func, f_tol=0.01)
`_check_root`(f, method, f_tol=0.01)
`_check_func_fail`(*a, **kw)
`test_problem_nonlin`()
`test_tol_norm_called`()
`test_problem_root`()
class `TestSecant`

Check that some Jacobian approximations satisfy the secant condition

`_check_secant`(jac_cls, npoints=1, **kw)

Check that the given Jacobian approximation satisfies secant conditions for last npoints points.

`test_broyden1`()
`test_broyden2`()
`test_broyden1_update`()
`test_broyden2_update`()
`test_anderson`()
class `TestLinear`

Solve a linear equation; some methods find the exact solution in a finite number of steps

`_check`(jac, N, maxiter, complex=False, **kw)
`test_broyden1`()
`test_broyden2`()
`test_anderson`()
`test_krylov`()
class `TestJacobianDotSolve`

Check that solve/dot methods in Jacobian approximations are consistent

`_func`(x)
`_check_dot`(jac_cls, complex=False, tol=1e-06, **kw)
`test_broyden1`()
`test_broyden2`()
`test_anderson`()
`test_diagbroyden`()
`test_linearmixing`()
`test_excitingmixing`()
`test_krylov`()
class `TestNonlinOldTests`

Test case for a simple constrained entropy maximization problem (the machine translation example of Berger et al in Computational Linguistics, vol 22, num 1, pp 39–72, 1996.)

`test_broyden1`()
`test_broyden2`()
`test_anderson`()
`test_linearmixing`()
`test_exciting`()
`test_diagbroyden`()
`test_root_broyden1`()
`test_root_broyden2`()
`test_root_anderson`()
`test_root_linearmixing`()
`test_root_excitingmixing`()
`test_root_diagbroyden`()