dynamically generating options
- To: mathgroup at smc.vnet.net
- Subject: [mg126072] dynamically generating options
- From: Jason <jasonhsteffen at gmail.com>
- Date: Sat, 14 Apr 2012 03:13:56 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I would like to generate options for the differential equation solver dynamically. For example, in an n-body system where I don't know ahead of time how many bodies are in the system---the equations for the integrator are generated based upon how long the list of objects is. I would like to create the following option in NDSolve: Method->{"EventLocator", "Event"->{x[1][t],x[2][t],...,x[n][t]}, "Direction"->{1,1,1,...}, "EventAction":>{Sow[{1,t}],Sow[{2,t}],...,Sow[{n,t}]} But, after many different attempts I'm stumped. The delayed rule causes some problems, the "Sow" or "AppendTo" (which I used before) also causes problems because it evaluates when I generate the table for the "EventAction" I can't get this to work and am currently just doing it by hand on a case-by-case basis (which is not ideal). Any help is appreciated.
- Follow-Ups:
- Re: dynamically generating options
- From: Christoph Lhotka <christoph.lhotka@fundp.ac.be>
- Re: dynamically generating options