# Problem with ODELocalSensitivityProblem

I am looking to use ODELocalSensitivityProblem to get the sensitivities of an ODE problem.
I define two different problems from the same system (defined with ModellingToolkit) as follows

``````probSens = ODELocalSensitivityProblem(final_sys,u0,(0.,trajTime),pAll)
prob = ODEProblem(final_sys, u0, (0.,trajTime),p=pAll)
``````

I then solve the two different problems

``````staticSolLocal =  solve(probSens, Vern9(), reltol=1e-12, abstol=1e-12, saveat=t_obs)
staticSol = solve(prob, Vern9(), reltol=1e-12, abstol=1e-12,  saveat=t_obs)
``````

I expect the solutions of the two problems to be the same (I know that the Local sensitivity problem will also have the sensitivites as solutions). However, when I plot one of the states for the two different problems, I get different solutions.

I would really appreciate any help understanding why I get different solutions. You can find the code here

Make sure you’re plotting the same output. Use the name, not the number, since you used structural_simplify you cannot guarantee the ordering of the equations is the same.

1 Like

Thanks for the suggestion @ChrisRackauckas.
I tried using the symbol name:

``````plot(staticSol.t,staticSol[lp.o₁], lw=3,labels="static",legend=:outertopright)
plot!(staticSolLocal.t,staticSolLocal[lp.o₁], lw=3, label="static Local sens")
``````

However, on the solution of the ODELocalSensitivityProblem I get the following error:

``````ERROR: Indexing symbol lp₊o₁(t) is unknown.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] DEFAULT_OBSERVED(sym::Term{Real, Nothing}, u::Vector{Float64}, p::Vector{Float64}, t::Float64)
@ SciMLBase ~/.julia/packages/SciMLBase/DKeLA/src/scimlfunctions.jl:4
[5] getindex
[6] copy
[7] materialize