-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Poly chaos #27
base: main
Are you sure you want to change the base?
Poly chaos #27
Conversation
…st generate a dict in the beginnign?)
…R to PolyChaos since that is really awkward
…lerkin projection
Hey, any thoughts on this @ChrisRackauckas @bowenszhu? The basic functionality of generating PCE moment equations works quite nicely and robustly for polynomial explicit ODE models (see example above). In the future, it would be good to explore the following extensions (importance vaguely in descending order):
@bowenszhu already contacted me and would like to help with some of the PCE efforts going forward as well, so it would be nice to get a pair of eyes on this as soon as possible. Aside: Along the way of creating this, I found that working with PolyChaos.jl is extremely cumbersome. Among many things, the type structure underpinning PolyChaos.jl makes it particularly difficult to extend. For now I decided to work around that but we may wanna consider making changes to PolyChaos itself (I can go into more detail if we have any interest in that). Flemming |
""" | ||
$(TYPEDSIGNATURES) | ||
|
||
Generate moment equations of an `ODESystem` from a given `PCE`-Ansatz via Galerkin projection. | ||
""" | ||
function moment_equations(sys::ODESystem, pce::PCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this interface, users can set the PCE of their own choice, which is fantastic!
I think we can make it more powerful by doing this step for our users.
My idea is as follows
- asking users to add the probability distributions of stochastic parameters as symbolic metadata. See ModelingToolkit.jl - Symbolic metadata - Probability distributions.
- we internally set the corresponding appropriate orthogonal polynomials according to the given probability distributions.
I would be happy to adapt this PR if you think this is feasible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great to me. And at least for canonical distributions it not only should be feasible but even very easy to do. That said, I am unsure how easy it would be to support more obscure distributions. With the current implementation it is very easy. So for now, I would keep this and add the interface you are proposing for canonical distributions as well. There seems to be no harm in keeping both and they both address valid use cases.
Remove unused type variable
Fix typo "and" -> "an"
Resolve `independent_variables` deprecated warning
Remove unnecessary import in runtests.jl
Generate code of `bump_degree` for AbstractOrthoPoly subtypes
Change to use `Symbolics.variables` to create an array of symbolic vars
Hey,
I need #8 going forward and so I prepared a first draft. Specifically, this implementation addresses the generation of moment equations for polynomial models via Galerkin projection.
Extending it for non-polynomial terms is left for future work as non-polynomial terms need to be handled approximately and accordingly there are many different approaches to do that approximation. Any polynomial basis as supported by PolyChaos.jl is supported. That means that a large subset of polynomials from the Askey scheme and some additional useful ones are available (including polynomials wrt user-defined weighting/density functions). That said, it also means that currently only dense polynomial bases with equal degree in all dimensions are supported. While that wouldn't be strictly necessary and this implementation could be adjusted for more liberty in that regard, it is not natural with the way PolyChaos.jl is constructed and I think we should change PolyChaos.jl itself to accommodate sparse polynomial bases. That change would probably be less involved. The generalization would then carry over automatically.
I will add a tutorial style example to showcase potential usage soon.
Flemming