Help to a beginner...
- To: mathgroup at yoda.physics.unc.edu
- Subject: Help to a beginner...
- From: frazao at dsc.ufpb.br (Pos. COPIN Ronaldo Martins Nascimento Frazao (Prof. Bruno))
- Date: Mon, 24 Jan 94 10:13:24 EDT
Dear Reader,
I'm a beginner on the use of the "Mathematica" and I'm couldn't resolve the EDO system that follows (on Math notation).
m := {1, 1, 1, 0}
p := 0.5
r := { {0, 0, 0, 0}, {1, 0, 0, 0}, {1, 0, 0, 0}, {0, 1, 1, 0} }
d := { {0, 0, 0, 0}, {5, 0, 0, 0}, {4, 0, 0, 0}, {0, 3, 2, 0} }
int := {3, 5}
fq[ { i_, j_, t_ } ] := If[ t > d[[i]],
Evaluate[ q[ j ][ t - d[[i]] ],
Evaluate[ q[ j ][ t ]
];
fm[ { i_, t_ } ] := If[ t >= int[[1]] && t =< int[[2]],
m[[i]],
0
];
eq = Join[
Table[ q'[i][t] == fm[ { i, t } ] +
Sum[ r[[i, j]] * fq[ {i, j, t} ], {j, 1, 4} ],
{i, 1, 4}
],
Table[ q[i][0] == 2, {i, 1, 4}
]
]
sol = NDSolve[ eq, Table[ q[i], {i, 1, 4} ], {t, 0, 10} ]
Plot[ Evaluate[ Table[ q[i][t], {i, 1, 4} ] /. sol ], {t, 0, 10} ]
And it doesn't work...
For your understanding:
1. The function fm is equal to m in the interval int = {3,5} and is equal to zero outside this domaine.
2. The function fm was defined to represent the function q[i][t] witch is equal to q[i][t] for t =< d[[i]] and is equal to q[i][ t - d[[i]] ] for
t > d[[i]].
The specification #1 has worked well, but when I introduced the function fq the NDSolve no more was capable to resolve the system.
I suppose that the problem is that in the first case ( the use of fm) the substitution is done for a value that is an element of an array ( m[[i]] ), whereas on the second case the substitution is done for the specification of a function.
How it can be resolved this kind of problem?
I ask you, if possible, to reply this mail as soon as possible, because I depends onthe solution of this problem to conclude a paper that I'm my work on and I have a deadline to do this.
My best regards,
Ronaldo Frazao