Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9647

dynamically generating options

From Jason <jasonhsteffen@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject dynamically generating options
Date 2012-04-14 07:17 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jmb89l$r6p$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

dynamically generating options Jason <jasonhsteffen@gmail.com> - 2012-04-14 07:17 +0000
  Re: dynamically generating options David Bailey <dave@removedbailey.co.uk> - 2012-04-16 10:10 +0000

csiph-web