Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Suggestions for objective function #31

Open
@ivarne

Description

@ivarne

Currently Julia performs poorly with anonymous functions, and the sorting system has used a funny trick with types to pass a different comparison function. After reading @mauro3's comment about implicit objective functions in #30, I got an idea for a proposal for how to solve 3 problems in a somewhat cluncky way.

immutable Density <: ODEImplicit 
    mu::Float64
end

function ode_fun(typ::Density, y, y_t, t)
    return (typ.mu .* y .* t) - y_t
end

t_out, y_out = ode_xx(Density(1.091), y0, [0. 1.])

This would of be in addition to the normal F(y,t) = y', system currently proposed. This approach has 3 main advantages.

  1. It uses types instead of anonymous functions. That enables the use of Julia's dispatch and inference system to generate specific code for each ODE problem. Better performance will probably be the result.
  2. It gives a nice way to access system properties inside the differentiation function. If you do not need system properties, you can define the immutable/type as empty.
  3. It gives a natural way to tag different problem specifications in a way that encourages multiple dispatch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions