[Date Index]
[Thread Index]
[Author Index]
Re: NDSolve/InterpolatingFunction and vectors
*To*: mathgroup at smc.vnet.net
*Subject*: [mg53676] Re: [mg53657] NDSolve/InterpolatingFunction and vectors
*From*: DrBob <drbob at bigfoot.com>
*Date*: Sat, 22 Jan 2005 03:52:11 -0500 (EST)
*References*: <200501211137.GAA01428@smc.vnet.net>
*Reply-to*: drbob at bigfoot.com
*Sender*: owner-wri-mathgroup at wolfram.com
interp = xx /.
First@NDSolve[{
xx'[t] == {{0, 1}, {-1, 0}}.xx[t], xx[0] == {0, 1}}, xx, {t, 0, 10}];
Clear[f, s, t]
limits = 0 <= t <= 10;
f[t_?NumericQ] /; limits := interp[t]
c[t_?NumericQ] /; limits := {0, 1}.f[t]
s[t_?NumericQ] /; limits := {1, 0}.f[t]
Plot[{c[t], s[t]}, {t, 0, 10}];
Plot[{1, -1}.f[t], {t, 0, 10}];
Bobby
On Fri, 21 Jan 2005 06:37:09 -0500 (EST), D Herring <dherring at at.uiuc.dot.edu> wrote:
> 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
>
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
Prev by Date:
**Superellisoid**
Next by Date:
**Re: Re: TableForm and MatrixForm**
Previous by thread:
**NDSolve/InterpolatingFunction and vectors**
Next by thread:
**Re: NDSolve/InterpolatingFunction and vectors**
| |