The "Undefined Variable Error: InterpolatingAdjoint" error occurs when the InterpolatingAdjoint method is not properly imported in the Julia code. To resolve this error, one should ensure that the InterpolatingAdjoint method is explicitly imported in the code, like so:
using DifferentialEquations
using DiffEqSensitivity
function my_ode!(du,u,p,t)
du[1] = -u[1] + p[1]*u[2]
du[2] = u[1] - p[2]*u[2]
end
function my_ode_jac!(J,du,u,p,t)
J[1,1] = -1; J[1,2] = p[1]
J[2,1] = 1; J[2,2] = -p[2]
end
p = [1.5,1.0]
u0 = [1.0,0.0]
tspan = (0.0,2.5)
prob = ODEProblem(my_ode!,u0,tspan,p,jac=my_ode_jac!)
sol = solve(prob,Vern9(),adjoint=true)
sensitivity_interpolant = InterpolatingAdjoint(sol)
Here, the DiffEqSensitivity package is imported in addition to the DifferentialEquations package, and the Sensitivity package's InterpolatingAdjoint method is used to create a sensitivity interpolant.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-12 07:38:28 +0000
Seen: 11 times
Last updated: Jul 12 '23
How can the Root Locus method in Julia be used to determine roots for a specific value of gain "K"?
How can SharedArray and pmap be applied in Julia?
How to use unicodeplots() function in Julia?
I keep receiving a 404 error while running the application on AWS EC2, can you help me with that?
How do I resolve a 502 error when attempting to call an HTTPS REST API from an HTTP REST API?
In a Bootstrap 5.1 Modal popup, why is the property 'classList' unable to be read for undefined?