I attempted to solve a system of SDE as in the form below. But I am struggeling with a persisting error message as shown below.
A replicated SDE is as follows:
Here A, B, C, and D are sparse matrices with size NxN; u is a vector of length N; and dw[i] is ith Wiener process forall i in {B,C,D}.
For implementation purpose, SDE will be restructured as in the form
The following is an example code (based on a post that generates a WARNING "There is either an error in your model specification or the true solution is unstable"
.
using DifferentialEquations, SparseArrays
# Parameters
N = 10;
tspan = (0.0, 10.0);
ntraj = 2;
# Matrices and initial value
A = sprand(N, N, 0.5); B = sprand(N, N, 0.5); C = sprand(N, N, 0.5); D = sprand(N, N, 0.5)
u0= rand(N);
# Deterministic and stochastic functions
function f!(Au, u, p, t)
Au .= A*u
nothing
end
function g!(Gu, u, p, t)
Gu[:,1] = B * u
Gu[:,2] = C * u
Gu[:,3] = D * u
nothing
end;
# Construct SDE problem with three Wiener processes
prob = SDEProblem(f!, g!, u0, tspan, noise_rate_prototype=sparse(zeros(N,3)));
# Solve the equation of motion for an arbitrary number of trajectories
# sol = solve(EnsembleProblem(prob), LambaEM(), save_everystep=false, EnsembleThreads(),trajectories=ntraj)
sol = solve(EnsembleProblem(prob), LambaEulerHeun(), save_everystep=false, EnsembleThreads(),trajectories=ntraj)
Here is the warning message:
I was wondering why this error message pops up: Is it because of an error in the model or anyting else?
Any help or suggestion is appreciated.