:orphan:
# SNESFunction
Functional form used to convey the nonlinear function to `SNES` in `SNESSetFunction()` 
## Synopsis
```
#include "petscsnes.h"
PetscErrorCode SNESFunction(SNES snes,Vec x,Vec f,void *ctx);
```
Collective


## Input Parameters

- ***snes -*** the `SNES` context
- ***x    -*** state at which to evaluate residual
- ***ctx     -*** optional user-defined function context, passed in with `SNESSetFunction()`



## Output Parameter

- ***f  -*** vector to put residual (function value)





## See Also
 [](ch_snes), `SNESSetFunction()`, `SNESGetFunction()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/interface/snes.c.html#SNESFunction">src/snes/interface/snes.c</A>


---
[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)  
