You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem arises in the larger context of solving differential matrix Lyapunov equations with periodic coefficients, where the solution is guaranteed to be nonnegative definite. Therefore, it would be desirable to solve these equations directly for their Cholesky factors, to gain additional accuracy which is typically provided by working with square-root quantities. The following example is (probably) the simplest case which can be imagined (first order, constant coefficients):
dx/dt = -x +1, x(0) = 0, 0 <= t <= 1
which has x(t) = 1-exp(-t) as solution.
If we express x = u^2, the square-root quantity u satisfies the implicit differential equation
2*u*du/dt = -u^2 + 1, u(0) = 0, 0 <= t <= 1
The following code fails to compute the solution
using DifferentialEquations
using Sundials
function f(out,du,u,p,t)
out[1] = -2*u[1]*du[1]-u[1]^2+1
end
tspan = (0.0, 1.0)
differential_vars = [true]
u0 = [0.]
du0 = [0]
prob = DAEProblem(f, du0, u0, tspan, differential_vars = differential_vars)
sol = solve(prob, IDA(), abstol=1.e-10,reltol=1.e-10)
Just a final remark for those interested in a possibly open research issue:
The next step for me would be the extension to the matrix case x = u'*u, with u upper triangular, for which dx/dt = (du/dt)'*u+u'*(du/dt)
and a consistent initialization would mean to solve a Lyapunov-like matrix equation satisfied by du0 du0'*u0+u0'*du0 = q
where q is a symmetric nonnegative definite matrix and du0 is upper triangular. See also the discussion at #23.
This problem arises in the larger context of solving differential matrix Lyapunov equations with periodic coefficients, where the solution is guaranteed to be nonnegative definite. Therefore, it would be desirable to solve these equations directly for their Cholesky factors, to gain additional accuracy which is typically provided by working with square-root quantities. The following example is (probably) the simplest case which can be imagined (first order, constant coefficients):
dx/dt = -x +1, x(0) = 0, 0 <= t <= 1
which has
x(t) = 1-exp(-t)
as solution.If we express
x = u^2
, the square-root quantityu
satisfies the implicit differential equation2*u*du/dt = -u^2 + 1, u(0) = 0, 0 <= t <= 1
The following code fails to compute the solution
with the error
Perturbing the initial condition to
u0 = [0.00001]
a solution can be computed, which is however far from a "high precision" solution
I wonder if there is a way to solve the implicit differential equation to high accuracy on the whole time span. Thanks in advance for any hints.
The text was updated successfully, but these errors were encountered: