# Adjoint sensitivity analysis of ODE - get value of cost functional

**URL:** <https://discourse.julialang.org/t/adjoint-sensitivity-analysis-of-ode-get-value-of-cost-functional/28468>\
**Category:** General Usage\
**Created:** [September 6, 2019, 2:22pm UTC](https://discourse.julialang.org/t/adjoint-sensitivity-analysis-of-ode-get-value-of-cost-functional/28468 "2019-09-06T14:22:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DR59](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dr59/32/10087_2.png) [@DR59](https://discourse.julialang.org/u/DR59)\
**Post date:** [September 6, 2019, 2:22pm UTC](https://discourse.julialang.org/t/adjoint-sensitivity-analysis-of-ode-get-value-of-cost-functional/28468/1 "2019-09-06T14:22:27Z")

</div>

Dear all,

This question is related to the DifferentialEquations.jl package.

I’ve used the very helpful documentation [here](https://docs.juliadiffeq.org/latest/analysis/sensitivity.html) to implement adjoint sensitivity analysis on an ODE. Specifically, i have a cost function of the form  
 C(\theta) = \int^T\_0 L[x(t)] \ dt ,  
where x(t) is the state of my ODE over time. Calling the function adjoint\_sensitivities gives me \nabla C(\theta, the gradient of the cost in the parameters.

Is there some callback I can use that allows me to get the actual cost function C(\theta) itself? Currently I have to have a separate routine for getting the cost, and getting the cost gradient

Thanks
