Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/examples/modelingtoolkitize_index_reduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Specifically, for a pendulum with unit mass and length $L$, which thus has
kinetic energy $\frac{1}{2}(v_x^2 + v_y^2)$,
potential energy $gy$,
and holonomic constraint $x^2 + y^2 - L^2 = 0$.
The Lagrange multiplier related to this constraint is equal to half of $T$,
The Lagrange multiplier related to this constraint is equal to half of $T$,
and represents the tension in the rope of the pendulum.

As a good DifferentialEquations.jl user, one would follow
Expand Down
5 changes: 3 additions & 2 deletions src/systems/systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ function __structural_simplify(sys::AbstractSystem, io = nothing; simplify = fal
end

noise_eqs = StructuralTransformations.tearing_substitute_expr(ode_sys, noise_eqs)
return SDESystem(full_equations(ode_sys), noise_eqs,
return SDESystem(Vector{Equation}(full_equations(ode_sys)), noise_eqs,
get_iv(ode_sys), unknowns(ode_sys), parameters(ode_sys);
name = nameof(ode_sys), is_scalar_noise, observed = observed(ode_sys))
name = nameof(ode_sys), is_scalar_noise, observed = observed(ode_sys), defaults = defaults(sys),
parameter_dependencies = parameter_dependencies(sys))
end
end
5 changes: 3 additions & 2 deletions test/dde.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ prob = SDDEProblem(hayes_modelf, hayes_modelg, [1.0], h, tspan, pmul;
constant_lags = (pmul[1],));
sol = solve(prob, RKMil(), seed = 100)

@variables x(..)
@variables x(..) delx(t)
@parameters a=-4.0 b=-2.0 c=10.0 α=-1.3 β=-1.2 γ=1.1
@brownian η
τ = 1.0
eqs = [D(x(t)) ~ a * x(t) + b * x(t - τ) + c + (α * x(t) + γ) * η]
eqs = [D(x(t)) ~ a * x(t) + b * x(t - τ) + c + (α * x(t) + γ) * η, delx ~ x(t - τ)]
@mtkbuild sys = System(eqs, t)
@test ModelingToolkit.has_observed_with_lhs(sys, delx)
@test ModelingToolkit.is_dde(sys)
@test !is_markovian(sys)
@test equations(sys) == [D(x(t)) ~ a * x(t) + b * x(t - τ) + c]
Expand Down
Loading