Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

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.




  • Prev by Date: Re: Integrating an InterpolatingFunction times another function
  • Next by Date: Re: Integrating an InterpolatingFunction times another function
  • Previous by thread: Re: Why the loop gain no result?
  • Next by thread: Re: dynamically generating options