Skip to content

Improve printing/display of XSystem parameters #2651

@TorkelE

Description

@TorkelE

Currently, if we have a XProblem:

using Catalyst

@parameters p d
@variables t X(t)
D = Differential(t)
eq = D(X) ~ p - d*X
@mtkbuild osys = ODESystem([eq], t)

u0 = [X => 1.0]
ps = [p => 2.0, d => 0.5]
oprob = ODEProblem(osys, u0, (0.0, 1.), ps)

we can look at its parameters using

println(oprob.p) # Gives [2.0, 0.5]
println(oprob.ps) # Gives a very long structure.

However, neither of these are very useful. The first depends on order to tell us which parameter is which (which we should not do since I don't know when). The second doesn't tell us any information at all.

Wouldn't it make sense to at least for one of these display something like

p => 2.0
d => 0.5

This creates an easy way for the user what parameter values they have in a problem.

It would be good to have something similar for u. However, I realise oprob.u0 might just be a normal vector, in which case this might not be possible. However, at least for oprob.ps this should be possible.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions