Evaluate RHS

Help
whir
2013-06-26
2013-11-04
  • whir
    whir
    2013-06-26

    Hello,

    often I want to just plot the right-hand-sides of the
    odes as functions of the variables. Nowadays I do it
    by keeping a 2nd version of these functions and
    then reference every parameter out of the pars dictionary.
    This is kinda awkward, especially for big systems.
    I want sth like ode.fnspecs(x0,x1,x2,..)

    Thx and Greets,
    Gregor

     
  • Rob Clewley
    Rob Clewley
    2013-06-26

    There is ode.Rhs(t, xdict, pdict=None, asarray=True) - you can leave t=0 for an autonomous system, pdict can be empty if params are already defined and asarray=False will return a dictionary that you can select from. This way, though, it will only return one value at a time. There are similar functions for the auxiliary variables, Jacobian, Mass Matrix etc.

     
  • whir
    whir
    2013-06-26

    Hey Rob,

    thx for that quick answer…I dont get why I dont see the method Rhs when I do a
    print dir(ode), whereas ode is a generator of course.

     
  • Rob Clewley
    Rob Clewley
    2013-06-26

    Since it starts with a capital letter it appears at the top of the dir() output list, above all the underscore-led names. An alternative that I provide is:

    print API(gen)

    but it doesn't show any underscored names (and I don't guarantee that it works perfectly as it's still test code).