MathGroup Archive 2005

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

Search the Archive

NDSolve/InterpolatingFunction and vectors


Hi all,

For numerous reasons (such as dot products), I would like to use NDSolve 
with vector-valued functions.

For example, the Sine and Cosine could be defined as
soln=NDSolve[{
       xx'[t]\[Equal]{{0,1},{-1,0}}.xx[t],xx[0]\[Equal]{{0},{1}}
       },xx,{t,0,10}]

Then I have the multi-valued function
f[t_]=(xx/.soln[[1]])[t]

such that f[Pi] is roughly {{0},{-1}} as expected.

The trouble comes when trying to extract scalar values from f[t].
f[3.14][[1,1]] ~= 0 but f[t][[1,1]] throws an error.
Likewise, Plot[f[t],{t,0,10}]  pukes because f[t] doesn't return a 
scalar when evaluated.

My current solution uses dot products to extract values.
{1,0}.f[t] doesn't error since it holds until f is evaluated.
Plot[{{1,0},{0,1}}.f[t],{t,0,10}] still bombs, but
Plot[{{1,0}.f[t],{0,1}.f[t]},{t,0,10}] works fine.

Can anyone suggest a better overall method for embedding dot products in 
NDSolve?  The system I have looks something like
{p'[t]=dp[p]+(p[t]-a[s[t]]).dads[s[t]], s'[t]=p'[t].dads[s[t]]/...)
where a[s] is given.  t and s[t] are scalar; the other variables are of 
dimension 4 (or more).

Thanks,
Daniel


  • Prev by Date: Re: TableForm and MatrixForm
  • Next by Date: Re: element selection
  • Previous by thread: Re: Preventing Times[x,x] from becoming Power[x,2]
  • Next by thread: Re: NDSolve/InterpolatingFunction and vectors