NDSolve -- indexing of dependent variable that is arbitrary list
- To: mathgroup at smc.vnet.net
- Subject: [mg112226] NDSolve -- indexing of dependent variable that is arbitrary list
- From: Greylander <greylander at gmail.com>
- Date: Sun, 5 Sep 2010 05:28:55 -0400 (EDT)
Hello, this is related to my previous question about NDSolve -- n-
body problem. The question is the generalized version of that
question, and hopefully I am expressing the question better ere.
If your dependent variable, y[t] (for example), has arbitrary list
structure (list of lists of lists..), how can you set up an equation
such as
y''[t] = f(y[t])
where f(y[t]) is any arbitrary function of the elements of y[t]?
The simple examples provided in the documentation only show cases of
f(y[t]) that use vector or matrix operations that operate on y[t] as a
whole without explicitly referencing any elements of y[t]. Any form
of using Part[] that i have tried always acts on the literal "y[t]"
instead of 'waiting' until to act on y[t] that have been given a value
(i.e. y[0] is properly initialized with the full list structure. I
would, for example, like to create an equation or set of equations,
for NDSolve like this:
Table[ y''[t][[i]] == Sum[ f[ y[t][[i]], y[t][[j]] {j ,1, N} ],
{i ,1, N} ],
y'[0] = Table[ g[i], {i, 1, N} ],
y[0] = Table[ h[i], {i, 1, N} ]
or
y''[t] = Table[ Sum[ f[ y[t][[i]], y[t][[j]] {j 1 N} ], {i 1
N} ],
y'[0] = Table[ g[i], {i, 1, N} ],
y[0] = Table[ h[i], {i, 1, N} ]
But neither of the above will work because the [[i]] or [[j]] indexing
is applied to the literal y''[t] and y[t], and not to the list
structure they should have later.
Thanks for any help.