From 4514152eee53fd571366e4b628ddf97b993327da Mon Sep 17 00:00:00 2001 From: n0rbed Date: Thu, 28 Mar 2024 13:52:37 +0200 Subject: [PATCH] isaffine errors for some differential equations, catched these errors in case they happen, so now the function relies on linear_expansion for these cases --- src/linear_algebra.jl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/linear_algebra.jl b/src/linear_algebra.jl index ba020d69e..43906f34c 100644 --- a/src/linear_algebra.jl +++ b/src/linear_algebra.jl @@ -101,13 +101,19 @@ function solve_for(eq, var; simplify=false, check=true) # scalar case if eq isa AbstractArray for eqᵢ in eq - islinear &= Symbolics.isaffine(eqᵢ.lhs-eqᵢ.rhs, var) + try + islinear &= Symbolics.isaffine(eqᵢ.lhs-eqᵢ.rhs, var) + catch e + end end else - islinear &= Symbolics.isaffine(eq.lhs-eq.rhs, [var]) + try + islinear &= Symbolics.isaffine(eq.lhs-eq.rhs, [var]) + catch e + end end - islinear || return nothing + if !islinear return nothing end # a * x + b = 0 if eq isa AbstractArray && var isa AbstractArray x = _solve(a, -b, simplify)