I am trying to initialize a collection of abstract functions $\theta_k(t)$ in a variable $t$ where $1\leq k\leq n$.
I cannot define them explicitely; the entire point is that I want to numerically solve an ODE I can define with their derivatives. It's clear how I can do this if I had the array, but I don't know how to initialize the array.
If I only cared about a particular value for $n$, I could declare an array of functions explicitly like this:
thetas = Array[{theta1[t_], theta2[t_], ... , thetan[t_]}]
There should be a away to initialize an array of abstract functions in the variable $t$. Once I have such an array, thetas
, I can likewise initialize a second array, derivs
such that
For[i=0,i<n, ++i,
derivs[[i]]=Sum[matrix[[i,j]]Sin[Abs[thetas[[j]]-thetas[[i]]]],{j,0,n}]
]
and then use NDSolve
as suggested in the comments:
NDSolve[derivs, thetas[0] = myInitialCondition, thetas, {t,0,reallyBigNumber}]
NDSolve
can directly handle it, see 3rd example in section Scope -> Ordinary Differential Equations of document ofNDSolve
. $\endgroup$For
loop: mathematica.stackexchange.com/q/134609/1871 $\endgroup$