Comments (7)
I pretty much always use callable types for this, except in cases where I know I want to change the enclosed types due to dual numbers. One thing I have to note is that supporting it as .F
makes it less generic, which can be rough to deal with with optimizers (requiring code looping over or generating over getfield
). These days I like everything being uniform via ParameterizedFunction(f,params)
, which is a callable type that encloses a function, and sticks all of the parameters into one thing. If the user wants names for parameters, they can use something like a NamedTuple to hold the parameters, or you can do that behind the scenes here.
from dynamicalsystems.jl.
I haven't perfectly understood you, which makes me think I probably was not clear enough.
First things first: DynamicalSystems
will not care about the parameters or change them internally. Why are you saying that .F
makes it less generic? This will only ever be done from the users, e.g.:
using DynamicalSystems
ds = Systems.lorenz() # this is a line from the package
for β in 2:0.1:10
ds.eom!.β = β # this is NOT from the package
λ = lyapunov(ds, 10) # this a line from the package
end
Secondly, to use ParameterizedFunction
I would have to do an explicit interfaces that allows for one extra argument (params
) for any function call. Or not? Because if I use pf.p = ...
(as in the documentation for ParameterizedFunctions`, then is this any different than the above case?
Thirdly, how will ParameterizedFunction
avoid this optimization obstacles that you mentioned (if it does). Is it worth it here for my case? I read through the README, but it is not so obvious to me as to which are the advantages of using pf
in the current case. Of course it is obvious for DiffEq since parameter estimation is a big deal etc.
Thanks for the comments by the way! Appreciate it!
from dynamicalsystems.jl.
No, I wasn't saying you should used ParameterizedFunction
s for this. I was saying a similar strategy (which is not the macro btw).
First things first: DynamicalSystems will not care about the parameters or change them internally.
Then .F
and all of that is fine. Callable types is the right way to go then.
from dynamicalsystems.jl.
Great thanks for the feedback. I was also thinking about it for months and I was always displeased with the current approach (the fact that change of parameter requires a direct re-construction of a type).
I will implement this now, and change all the example system and the docs. let's see how long it will take...
from dynamicalsystems.jl.
On another note, do you still stand that for e.g. a Jacobian having something like pf(Type{Val{:jac}}, args...)
is the way to go?
Since jacobians are also crucial, I was thinking allowing the users to do:
stuct Syststem
a::Float64
end
function (f::System)(du::Vector, u::Vector)
# here are eom
end
function (f::System)(J::Matrix, u::Vector)
# here is the jacob
end
I am aware that this cannot allow states that are matrices, but this is in general impossible for DynamicalSystems.
from dynamicalsystems.jl.
No, I am instead building a type for functions in the future.
https://github.com/JuliaDiffEq/DiffEqBase.jl/blob/master/src/diffeqfunction.jl
SciML/DiffEqBase.jl#52
It's very involved and likely overkill for your case.
from dynamicalsystems.jl.
This is implemented and also the suggested behavior as of version 0.7
from dynamicalsystems.jl.
Related Issues (20)
- need support for Interactive Trajectory Evolution in unpredefined systems HOT 1
- integrator-using functions should return NaN on non-successful integrator steps HOT 24
- FYI: font glitches - a very minor issue and probably slightly off-topic... HOT 2
- basins_of_attraction fails at simple system (easy fix) HOT 22
- Extreme events functionality /ies HOT 14
- Delayed Differential Equations HOT 1
- produce_orbitdiagram problem. HOT 7
- PSA: DynamicalSystems.jl will become a multirepo on v3.0 HOT 3
- t0 definition leads to unexpected behaviour with trajectory() HOT 2
- Method `recursivecopy!(::Matrix{Float64}, ::Vector{SVector{2, Float64}})` does not exist HOT 2
- Yes: again: "Failed to precompile due to DiffEqBase #163" HOT 15
- reinit! error for parallel integrator and in-pace equations of motion HOT 2
- Unclear description of Joint recurrence plot functions (in RecurrenceAnalysis.jl) HOT 4
- GPU and FPGA support? HOT 4
- Passing a ModelingToolkit system to a ContinuousDynamicalSystem HOT 5
- Error on clean install on apple silicon mac HOT 2
- Update interactive_poincaresos to v3 HOT 3
- Integration with ModelingToolkit(/Catalyst) HOT 11
- Ecosystem-wide move from Roots.jl to NonlinearSolve.jl
- Remove old versions of the docs from being discoverable on websearches
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamicalsystems.jl.