Question: if statement: Error, cannot determine if this expression is true or false

December 04 2012 reemeaaaah 45
Maple

3

Hello,

I am trying to add an if statement to maple code for example if U(tk) less or equal to 4 then 
the initial condition=0 else the initial condition=value .
 
I am getting this error:
Error, cannot determine if this expression is true or false: U(365)

restart;

 k := 0; B[1] := 0.001/365; B[2] :=0.002/365:

ode := diff(U(t), t) = -(A[1]+A[2]*U(t))*U(t);

ic[0] := U(365*k) = 1000;

sol[0] := dsolve({ic[0], subs(A[1] = B[1], A[2] = B[2], ode)}, U(t), numeric);

sigma := .5;

for k to 4 do 

ode1 := diff(U(t), t) = -(A[1]+A[2]*U(t))*U(t): 

tk := 365*k; 

V := rhs(sol[k-1](tk)[2]); 

if  U(tk) <= 4 then ic[k] := U(tk) =0;

else ic[k] := U(tk) = sigma*V;

end if; 

sol[k] := dsolve({ic[k], subs(A[1] = B[1], A[2] = B[2], ode)}, U(t), numeric);

end do;

 
Please help or advise 
Thank you
Please Wait...