# TSForwardSetSensitivities
Sets the initial value of the trajectory sensitivities of solution  w.r.t. the problem parameters and initial values. 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSForwardSetSensitivities(TS ts, PetscInt nump, Mat Smat)
```
Logically Collective


## Input Parameters

- ***ts -*** the `TS` context obtained from `TSCreate()`
- ***nump -*** number of parameters
- ***Smat -*** sensitivities with respect to the parameters, the number of entries in these vectors is the same as the number of parameters





## Notes
Forward sensitivity is also called 'trajectory sensitivity' in some fields such as power systems.
This function turns on a flag to trigger `TSSolve()` to compute forward sensitivities automatically.
You must call this function before `TSSolve()`.
The entries in the sensitivity matrix must be correctly initialized with the values S = dy/dp|startingtime.


## See Also
 [](chapter_ts), `TSForwardGetSensitivities()`, `TSForwardSetIntegralGradients()`, `TSForwardGetIntegralGradients()`, `TSForwardStep()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/interface/sensitivity/tssen.c.html#TSForwardSetSensitivities">src/ts/interface/sensitivity/tssen.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex16fwd.c.html">src/ts/tutorials/ex16fwd.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20fwd.c.html">src/ts/tutorials/ex20fwd.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex23fwdadj.c.html">src/ts/tutorials/ex23fwdadj.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ts/interface/sensitivity/tssen.c)


[Index of all Sensitivity routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
