Question: Cannot substitute initial data (in ODE) in a loop

In my system initial data is changed on every iteration. I find new equation, then find when some condition is met, calculate new initial data and go on with it. But there are errors in the very beginning.

Example:

ODE := diff(diff(x(t), t), t)+.2*(diff(x(t), t))-x(t) = 0.8*sin(t)
t[1] := 0;
ics[1] := x(t[1]) = .2, (D(x))(t[1]) = 5
X[1] := dsolve({ODE, ics[1]})

I encounter two problems:

1. If I use "ics" instead of "ics[1]" then Maple understands it well, output:

ics := x(0) = .2, (D(x))(0) = 5

But when I use "ics[1]", an error is thrown:

"Error, invalid assignment (x(0) = .2, (D(x))(0) = 5)[1] := x(0) = .2, (D(x))(0) = 5; cannot assign to an expression sequence"

2. And even when I use "ics", ODE is not solved:

ODE := diff(diff(x(t), t), t)+.2*(diff(x(t), t))-x(t) = .8*sin(t);
t[1] := 0;
ics := x(t[1]) = .2, (D(x))(t[1]) = 5;
X[1] := dsolve({ODE, ics[1]});

Output:

ODE := ....
t1 := 0
ics := x(0) = 0.2, D(x)(0) = 5
Error, (in dsolve) found the following equations not depending on the unknowns of the input system: {x(0) = 1/5}

And when I use "ics[1]" with dsolve together, I get both errors:

ODE := diff(diff(x(t), t), t)+.2*(diff(x(t), t))-x(t) = .8*sin(t);
t[1] := 0;
ics[1] := x(t[1]) = .2, (D(x))(t[1]) = 5;
X[1] := dsolve({ODE, ics[1]});

         
Output:

ODE:=...
t1 := 0
Error, invalid assignment (x(0) = .2, (D(x))(0) = 5)[1] := x(0) = .2, (D(x))(0) = 5; cannot assign to an expression sequence
Error, (in dsolve) found the following equations not depending on the unknowns of the input system: {x(0) = 1/5}

What am I doing wrong? =)
Thanks again.

 

Please Wait...