I am new to Julia and so please pardon if the following is too trivial. I am solving an ODE and I am interested in the derivative and second derivative of the solution. In my problem, I need the derivatives as they go into the RHS of a second ODE. There is one way coupling between the two sets of ODEs.
I tried using Calculus.derivative(u,x) etc in the second ODE, where x is a vector and u is the solution from the first ODE. I get the error:"Solution interpolation cannot extrapolate before the first timepoint. Either start solving earlier or use the local extrapolation from the integrator interface.".
I am guessing that the derivative is being calculated at the first point using central differences and hence the problem (we do not know the solution for x<x0 for x-range from x0 to xf). Is there a way of extrapolating the derivative calculated at points close to x0 (and a similar procedure at the end point) while the derivative at rest of the points are determined using central differences? The error message is suggesting a way using the "integrator interface" but I do not understand this very well.
I just checked with a similar function in MATLAB and it appears that the "gradient" function there calculates the central difference numerical derivative, except at the edges or ends, where it calculates a one-sided derivative. Is this an issue here?
PS: I have raised the same issue under JuliaMath/DifferentialEquations.jl. I am not sure which of the two places is the right one for this question.
I am new to Julia and so please pardon if the following is too trivial. I am solving an ODE and I am interested in the derivative and second derivative of the solution. In my problem, I need the derivatives as they go into the RHS of a second ODE. There is one way coupling between the two sets of ODEs.
I tried using Calculus.derivative(u,x) etc in the second ODE, where x is a vector and u is the solution from the first ODE. I get the error:"Solution interpolation cannot extrapolate before the first timepoint. Either start solving earlier or use the local extrapolation from the integrator interface.".
I am guessing that the derivative is being calculated at the first point using central differences and hence the problem (we do not know the solution for x<x0 for x-range from x0 to xf). Is there a way of extrapolating the derivative calculated at points close to x0 (and a similar procedure at the end point) while the derivative at rest of the points are determined using central differences? The error message is suggesting a way using the "integrator interface" but I do not understand this very well.
I just checked with a similar function in MATLAB and it appears that the "gradient" function there calculates the central difference numerical derivative, except at the edges or ends, where it calculates a one-sided derivative. Is this an issue here?
PS: I have raised the same issue under JuliaMath/DifferentialEquations.jl. I am not sure which of the two places is the right one for this question.