:orphan:
# SNESSolve
Solves a nonlinear system F(x) = b. Call `SNESSolve()` after calling `SNESCreate()` and optional routines of the form `SNESSetXXX()`.
## Synopsis
```
#include "petscsnes.h"
PetscErrorCode SNESSolve(SNES snes, Vec b, Vec x)
```
Collective
## Input Parameters
- ***snes -*** the `SNES` context
- ***b -*** the constant part of the equation F(x) = b, or `NULL` to use zero.
- ***x -*** the solution vector.
## Note
The user should initialize the vector,x, with the initial guess
for the nonlinear solve prior to calling `SNESSolve()`. In particular,
to employ an initial guess of zero, the user should explicitly set
this vector to zero by calling `VecSet()`.
## See Also
[](ch_snes), `SNES`, `SNESCreate()`, `SNESDestroy()`, `SNESSetFunction()`, `SNESSetJacobian()`, `SNESSetGridSequence()`, `SNESGetSolution()`,
`SNESNewtonTRSetPreCheck()`, `SNESNewtonTRGetPreCheck()`, `SNESNewtonTRSetPostCheck()`, `SNESNewtonTRGetPostCheck()`,
`SNESLineSearchSetPostCheck()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchGetPreCheck()`
## Level
beginner
## Location
src/snes/interface/snes.c
## Examples
src/snes/tutorials/ex1.c
src/snes/tutorials/ex12.c
src/snes/tutorials/ex13.c
src/snes/tutorials/ex14.c
src/snes/tutorials/ex15.c
src/snes/tutorials/ex16.c
src/snes/tutorials/ex17.c
src/snes/tutorials/ex18.c
src/snes/tutorials/ex19.c
src/snes/tutorials/ex1f.F90
src/snes/tutorials/ex2.c
## Implementations
SNESSolve_Composite in src/snes/impls/composite/snescomposite.c
SNESSolve_FAS in src/snes/impls/fas/fas.c
SNESSolve_NGS in src/snes/impls/gs/snesgs.c
SNESSolve_KSPONLY in src/snes/impls/ksponly/ksponly.c
SNESSolve_NEWTONLS in src/snes/impls/ls/ls.c
SNESSolve_MS in src/snes/impls/ms/ms.c
SNESSolve_Multiblock in src/snes/impls/multiblock/multiblock.c
SNESSolve_NASM in src/snes/impls/nasm/nasm.c
SNESSolve_NCG in src/snes/impls/ncg/snesncg.c
SNESSolve_Anderson in src/snes/impls/ngmres/anderson.c
SNESSolve_NGMRES in src/snes/impls/ngmres/snesngmres.c
SNESSolve_NEWTONTRDC in src/snes/impls/ntrdc/ntrdc.c
SNESSolve_Patch in src/snes/impls/patch/snespatch.c
SNESSolve_QN in src/snes/impls/qn/qn.c
SNESSolve_NRichardson in src/snes/impls/richardson/snesrichardson.c
SNESSolve_Shell in src/snes/impls/shell/snesshell.c
SNESSolve_NEWTONTR in src/snes/impls/tr/tr.c
SNESSolve_VINEWTONRSLS in src/snes/impls/vi/rs/virs.c
SNESSolve_VINEWTONSSLS in src/snes/impls/vi/ss/viss.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c)
[Index of all SNES routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)