:orphan:
# SNESObjectiveFunction
functional form used to convey an objective function to the nonlinear solver, that will be used instead of the 2-norm of the residual 
## Synopsis
```
#include <petscsnes.h>
SNESObjectiveFunction(SNES snes,Vec x,PetscReal *obj,void *ctx);
```

## Input Parameters

- ***snes -*** the `SNES` context
- ***X -*** solution
- ***obj -*** real to hold the objective value
- ***ctx -*** optional user-defined objective context





## See Also
 `SNES`, `SNESSetFunction()`, `SNESGetFunction()`, `SNESSetObjective()`, `SNESGetObjective()`, `SNESJacobianFunction`, `SNESFunction`

## Level
advanced

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snesob.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)  
