Joining InterpolatingFunctions into Piecewise - doman?
- To: mathgroup at smc.vnet.net
- Subject: [mg83505] Joining InterpolatingFunctions into Piecewise - doman?
- From: janos <janostothmeister at gmail.com>
- Date: Wed, 21 Nov 2007 05:58:12 -0500 (EST)
I would like to solve a diff eq on a very large interval, therefore I
solve it on successive intervals.
When putting the results together I get a _relatively_ good figure and
an error message.
Note that there is a hole on the graph of the function. Any other
solution to join InterpolatingFunction objects would be appreciated.
Thank you, Janos
f[ini_, tlast_] :=
Module[{from = tlast, to = tlast + 1,
X}, {X = (x /.
NDSolve[{x'[t] == -0.5 x[t], ini}, x, {t, from, to }])[[1]],
to, X[to]}]
nl = NestList[f[x[#[[2]]] == #[[3]], #[[2]]] &, {zzz, 0, 2.0}, 3];
full[t_] :=
Piecewise[
Transpose[{Table[nl[[k, 1]][t], {k, 2, 4}],
Table[k <= t < k + 1, {k, 0, 2}]}]]
Plot[full[t], {t, 0, 3}]