Skip to content

Commit 1260f41

Browse files
Complete NLEq API
1 parent cd6280a commit 1260f41

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/systems/nonlinear/nonlinear_system.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ struct NLEq
55
rhs::Expression
66
end
77
function Base.convert(::Type{NLEq}, eq::Equation)
8-
isequal(eq.lhs, Constant(0)) || throw(ArgumentError("nonzero lhs received"))
8+
isequal(eq.lhs, Constant(0)) || return NLEq(eq.rhs - eq.lhs)
99
return NLEq(eq.rhs)
1010
end
1111
Base.convert(::Type{Equation}, eq::NLEq) = Equation(0, eq.rhs)
12+
Base.:(==)(a::NLEq, b::NLEq) = a.rhs == b.rhs
13+
get_args(eq::NLEq) = Expression[eq.rhs]
1214

1315
struct NonlinearSystem <: AbstractSystem
1416
eqs::Vector{NLEq}

0 commit comments

Comments
 (0)