diff --git a/src/solver/ia_main.jl b/src/solver/ia_main.jl index 0c7e5710d..c1f998a4f 100644 --- a/src/solver/ia_main.jl +++ b/src/solver/ia_main.jl @@ -23,10 +23,10 @@ function isolate(lhs, var; warns=true, conditions=[]) return roots, conditions end - isequal(old_lhs, lhs) && (warns && - (@warn("This expression cannot be solved with the methods available to ia_solve. Try \ - a numerical method instead."); - return nothing) || return nothing) + if isequal(old_lhs, lhs) + warns && @warn("This expression cannot be solved with the methods available to ia_solve. Try a numerical method instead.") + return nothing + end old_lhs = deepcopy(lhs) @@ -173,8 +173,7 @@ function attract(lhs, var; warns = true) if sqrt_poly return attract_and_solve_sqrtpoly(lhs, var), conditions else - warns && - @warn("This expression cannot be solved with the methods available to ia_solve. Try \ + warns && @warn("This expression cannot be solved with the methods available to ia_solve. Try \ a numerical method instead.") return nothing, conditions end diff --git a/src/solver/main.jl b/src/solver/main.jl index 5158cd405..1ad5bb4f9 100644 --- a/src/solver/main.jl +++ b/src/solver/main.jl @@ -132,9 +132,10 @@ function symbolic_solve(expr, x::T; dropmultiplicity = true, warns = true) where for i in eachindex(expr) expr[i] = expr[i] isa Equation ? expr[i].lhs - expr[i].rhs : expr[i] check_expr_validity(expr[i]) - !check_poly_inunivar(expr[i], x) && (warns && - (@warn "Solve can not solve this input currently"; return nothing) || - return nothing) + if !check_poly_inunivar(expr[i], x) + warns && @warn("Solve can not solve this input currently") + return nothing + end end expr = Vector{Num}(expr) end @@ -148,9 +149,10 @@ function symbolic_solve(expr, x::T; dropmultiplicity = true, warns = true) where isequal(sols, nothing) && return nothing else for i in eachindex(expr) - !check_poly_inunivar(expr[i], x) && (warns && - (@warn("Solve can not solve this input currently"); return nothing) || - return nothing) + if !check_poly_inunivar(expr[i], x) + warns && @warn("Solve can not solve this input currently") + return nothing + end end sols = solve_multipoly( expr, x, dropmultiplicity = dropmultiplicity, warns = warns) @@ -164,11 +166,10 @@ function symbolic_solve(expr, x::T; dropmultiplicity = true, warns = true) where if !expr_univar && !x_univar for e in expr for var in x - !check_poly_inunivar(e, var) && - ((warns && - @warn("This system can not be currently solved by solve."); - return nothing) || - return nothing) + if !check_poly_inunivar(e, var) + warns && @warn("This system can not be currently solved by solve.") + return nothing + end end end @@ -276,7 +277,8 @@ function solve_multipoly(polys::Vector, x::Num; dropmultiplicity = true, warns = polys = unique(polys) if length(polys) < 1 - warns && (@warn("No expressions entered"); return nothing || return nothing) + warns && @warn("No expressions entered") + return nothing end if length(polys) == 1 return solve_univar(polys[1], x, dropmultiplicity = dropmultiplicity)