MathGroup Archive 2005

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

Search the Archive

NDSolve/InterpolatingFunction and vectors

  • To: mathgroup at
  • Subject: [mg53657] NDSolve/InterpolatingFunction and vectors
  • From: D Herring <dherring at>
  • Date: Fri, 21 Jan 2005 06:37:09 -0500 (EST)
  • Sender: owner-wri-mathgroup at

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

Then I have the multi-valued function

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).


  • 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