Skip to content

Operation vs Variable #433

@YingboMa

Description

@YingboMa

I think it might be a good idea to use Operations everywhere. This should solve #415. The problem is that the states are variables but the equations can have an Operation that behaves like a "variable", i.e.

julia> sys = ODESystem(eqs, t, [u,Dk(u)], [k])
ODESystem(Equation[Equation(derivative(u(t), t), -k * u(t)), Equation(derivative(derivative(u(t), k), t), -(u(t)) - k * derivative(u(t), k))], t, Variable[u, uˍk], Variable[k], Base.RefValue{Array{Expression,1}}(Expression[]), Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), Symbol("##ODESystem#294"), ODESystem[])

julia> sys.eqs
2-element Array{Equation,1}:
 Equation(derivative(u(t), t), -k * u(t))
 Equation(derivative(derivative(u(t), k), t), -(u(t)) - k * derivative(u(t), k))

julia> sys.states
2-element Array{Variable,1}:
 u
 uˍk

Though this could break A LOT OF internal assumptions, and it will take some time to do this refactoring.

Metadata

Metadata

Assignees

No one assigned

    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