Ask Your Question

wonder's profile - activity

2017-09-12 07:20:23 -0500 commented answer The interval I(u,v) between a pair of vertices u,v in graph

seems like just removing the u!=w and v!=w conditions would fix that

2016-03-05 05:09:15 -0500 received badge  Popular Question (source)
2015-01-05 18:35:06 -0500 answered a question coupled ode's

You can do something like

var('t x y z')
As = [ A.subs( *{ k:v for k,v in zip( (t, x, y, z), pt } ) for pt in list_of_points ]

to get a list of values of $A$, evaluated at each of those points.

You probably need to do that to each entry in the matrix, since subs() doesn't work directly on a whole matrix.

2015-01-05 17:08:51 -0500 answered a question Using matrix elements as arguments

I guess

H = f.hessian().function(x,y)
H(z[0,0],z[1,0])

would also work

2015-01-05 16:13:45 -0500 answered a question Design of classes for dynamical systems

I guess a Bindings is a morphism from SR to itself, that can be coerced more or less trivially to operate on vectors, vector fields, dynamical systems, etc. I don't know whether it would be useful to represent it that way somehow.

2015-01-05 14:47:38 -0500 received badge  Editor (source)
2015-01-05 14:45:15 -0500 asked a question Design of classes for dynamical systems

I have an ongoing project using Sage to process some dynamical systems (ODEs, that is), and along the way I've been developing some classes to generalize the process of storing an ODE system and working with it. I'd be interested in contributing the work to Sage if it's helpful, and in understanding what's a "sage-like" way to do it.

So here I'm wondering about what would be worth trying to contribute to Sage, and asking whether people would do the design differently.

I have a central class called ODEsystem, which is built around a dictionary encoding the flow function, e.g. if the system is

$$dx/dt = -ax-by$$ $$dy/dt = -cx-dy$$

the flow is a dictionary { x:-ax-by, y:-cx-dy } whose keys are variables and values are symbolic expressions. The object has methods to write itself out in LaTeX form, to integrate the dynamics from initial conditions, to find its equilibria and their stability, to make bifurcation diagrams under certain conditions, and a few other things. My intention is to allow room for a class hierarchy of models to develop, including difference equations, stochastic dynamics, PDEs, etc. There's also room to create subclasses and functions that derive specific models from general ones, simple models as limit cases of complex models, etc.

Another class that may be of use to others is Bindings, which binds variables to specific values in various expressions. For example, if I write

var('a, b')
generic_system = ODESystem( { x:a-bx }, vars=[x] )
specific_bindings = Bindings( a=1, b=2 )
latex( generic_system.bind( specific_bindings ) )

I'll get $dx/dt = 1-2x$. This is a wrapper for substitute() and substitute_function(), of course, but adds convenience and flexibility. (Note ODEsystem uses 'vars' to define the order of state variables. It's not logically necessary but it's useful in multiple dimensions.)

Code for those two classes is at https://github.com/worden-lee/SageDyn..., and there's some more stuff in other files there. Example output is at http://lalashan.mcmaster.ca/theobio/w....

Questions:

  • Could something like this become a useful part of Sage
  • Would people want it to be designed differently
  • Different situations call for different choices of integration routines. One strategy is to provide different ODEsystem classes that use different numerical integrators, and another one is to uncouple the integration from the class that represents the system. I'm not sure what would be better.
  • Would it be good to represent the ODE as an element of a ring of vector fields on an appropriate manifold, with some extra methods added? It seems like that would provide some power, but I don't know the system well enough to go there right now.
  • Should I send this to sage-devel or something instead of posting here