[Date Index]
[Thread Index]
[Author Index]
Re: NDSolve -- indexing of dependent variable that is arbitrary list
*To*: mathgroup at smc.vnet.net
*Subject*: [mg112238] Re: NDSolve -- indexing of dependent variable that is arbitrary list
*From*: Greylander <greylander at gmail.com>
*Date*: Mon, 6 Sep 2010 04:14:48 -0400 (EDT)
*References*: <i5vnsi$2es$1@smc.vnet.net>
I have found a workaround for this problem, but I am interested if
there is a more straightforward way.
Instead of using Part[], as in y[t][[i]] and y''[t][[i]] (see previous
examples quoted below), I can use "y[i]" as a dependent variable.
This allows my dependent variable to effectively have arbitrary
structure based on the indexing: "y[i,j,k...]".
In my example, the differential equations would be constructed with
Table[ y[i]''[t] == Sum[ f[ y[i][t], y[j][t] ], {j ,1, N} ], {i ,
1, N} ]
If f above is an inverse square force law, then the above could be a 1-
dimensional N-body problem with interaction force f. For a 3-
dimensional N-body problem, with interaction force f, I could use:
Table[ y[i,k]''[t] == Sum[ f[k][ { y[i,1][t], y[i,2][t], y[i,
3] }, { y[j,1][t], y[j,2][t], y[j,3] } ], {j, 1, N} ], {i, 1, N} ],
{k, 1, 3} ]
where the 3D coordinates of each body are given by { y[i,1], y[i,2],
y[i,3] }, and the vector force function f[a,b]:={f[1][a,b],f[2]
[a,b],f[3][a,b]}.
The above technique allows for arbitrary structure to the independent
variable, but without ever using "y" as a variable that has list-
structure. This is not obvious and not elegant.
I wonder if someone can show me a way to do this for arbitrary list
structure that would not require the y[i,k] notation, where I can set
up the equation starting with
y''[t] == ...?
However, this is now an academic question, because I now have a way to
achieve the desired results.
On Sep 5, 5:28 am, Greylander <greylan... at gmail.com> wrote:
> 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.
Prev by Date:
**Re: NDSolve -- n-body indexing ([[]]) problem**
Next by Date:
**Re: NDSolve -- n-body indexing ([[]]) problem**
Previous by thread:
**NDSolve -- indexing of dependent variable that is arbitrary list**
Next by thread:
**Mathlink problem in C**
| |