-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: cosmetics for NonlinearSolve #938
Comments
In the constructor we can just do |
|
Thanks @YingboMa. |
Because |
using ModelingToolkit, NonlinearSolve
var = collect(@variables x, y)
par = collect(@parameters θ)
eqs = [ 2.0x ~ 15.2, 5.2 ~ x + y,] #
ns = NonlinearSystem(eqs, var, par)
guess = ones(length(var))
ps = [ θ=>0.45; ]
julia> prob = NonlinearProblem(structural_simplify(ns),guess,ps) #
ERROR: ArgumentError: States (0) and initial conditions (2) are of different lengths.
Stacktrace:
[1] process_NonlinearProblem(constructor::Type, sys::NonlinearSystem, u0map::Vector{Float64}, parammap::Vector{Pair{Num, Float64}}; version::Nothing, jac::Bool, checkbounds::Bool, sparse::Bool, simplify::Bool, linenumbers::Bool, parallel::Symbolics.SerialForm, eval_expression::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit ~\.julia\packages\ModelingToolkit\7KM6m\src\systems\nonlinear\nonlinearsystem.jl:215
[2] process_NonlinearProblem
@ ~\.julia\packages\ModelingToolkit\7KM6m\src\systems\nonlinear\nonlinearsystem.jl:208 [inlined]
[3] (NonlinearProblem{true, isinplace, P, F, K} where {isinplace, P, F, K})(sys::NonlinearSystem, u0map::Vector{Float64}, parammap::Vector{Pair{Num, Float64}}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit ~\.julia\packages\ModelingToolkit\7KM6m\src\systems\nonlinear\nonlinearsystem.jl:243
[4] (NonlinearProblem{true, isinplace, P, F, K} where {isinplace, P, F, K})(sys::NonlinearSystem, u0map::Vector{Float64}, parammap::Vector{Pair{Num, Float64}})
@ ModelingToolkit ~\.julia\packages\ModelingToolkit\7KM6m\src\systems\nonlinear\nonlinearsystem.jl:243
[5] NonlinearProblem(::NonlinearSystem, ::Vector{Float64}, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit ~\.julia\packages\ModelingToolkit\7KM6m\src\systems\nonlinear\nonlinearsystem.jl:225
[6] NonlinearProblem(::NonlinearSystem, ::Vector{Float64}, ::Vararg{Any, N} where N)
@ ModelingToolkit ~\.julia\packages\ModelingToolkit\7KM6m\src\systems\nonlinear\nonlinearsystem.jl:225
[7] top-level scope
@ REPL[193]:1 |
|
Issue 1:
Currently we need to write:
It would be great not to require 0 on the LHS:
Issue 2:
Currently we need to repeat
x, y
when declaring vars/NonlinearSystem()/guess :It would be really great if we had the option not to repeat things:
The text was updated successfully, but these errors were encountered: