i have a bunch of commands as follows, seperated by shift+return. after the last command, a return ofcourse. Then I execute these commands by a return. it will give a result, but next time I enter return again, it gives another result. What's wrong? You can test in maple. I will change value of x. when x=400, command tau := fsolve(S(t)=c,t, 0..infinity); returns no solution. but start from x=500 and larger, it has solution. The problem is, when I change x, the value of tau doesn't change (sometimes it may change, but sometimes it wouldn't). I don't know if it is because the assignment of S,H,F. Currently I manually change x. Ultimately I want to use a loop, let, say, x=200..9000. Becasue i put these commands into a loop, the question i posted must be solved first. =========================== A := 100; v := 80; rho := 0.996; r := 0.9; theta := 0.993; x := 800; # I will change this value c := 200; m := 100000; l := 5000; R := 50000; tau := -1; cost := -1; largestNegative := -1; S := 0; H := 0; F := 0; solution := dsolve([diff(s(t),t) = A - A * rho^((1 - r^(theta * t)) * x) - v, diff(f(t),t)=((c - s(t)) / l) * m + x, diff(h(t),t) = x, f(0) = 0, s(0) = 0, h(0) = 0], numeric, output = listprocedure); S := eval(s(t), solution); H := eval(h(t), solution); F := eval(f(t), solution); tau := fsolve(S(t)=c,t, 0..infinity); cost := F(tau); largestNegative := S(solve(A-A*rho^((1-r^(theta*t­))*x) = v,t)); printf("x=%d, tau=%f, cost=%f, largestNegative=%f,", x, tau, cost, largestNegative); plots[odeplot](solution,[[t, 100 * s(t), color = green], [t, 100 * c, color = green, linestyle = DOT], [t, f(t), color = red], [t, h(t), color = blue]], 0..87); =====================

Please Wait...