I have a profit function in which revenue is given by the state of a variable y at each point in time t: R=y[t]-y[t]^2 and costs depend on the change in y from the previous state so that large changes are more costly C=(y[t]-y[t-1])^2.
[Edit for clarification: the model was originally given to me in discrete time as above. I changed it to continuous time by replacing the difference in the cost term with the derivative of y. After optimizing this, I got the optimal path of y as a continuous function] In this case, t goes from 0 to 2 and y is between 0.2 and 0.5. If I look at the values of the y points and the changes between them, the derivative is much larger than the actual change, depending on how small I set the time intervals (e.g. 0.1 or 0.01).
Because the derivative is much larger than the change, the costs explode and I get negative profits whereas if I calculate the change between the y the profits are always positive because changes are quite small.
Here is an example of what I am talking about, with p1 being calculated using the derivative and p2 using the change between y values:
t dy/dt y(t) p1 p2
0,00 0,60 0,20
0,01 0,59 0,21 -0,20 0,16
0,02 0,57 0,21 -0,18 0,17
0,03 0,56 0,22 -0,16 0,17
0,04 0,54 0,22 -0,14 0,17
0,05 0,53 0,23 -0,12 0,18
0,06 0,52 0,23 -0,10 0,18
0,07 0,50 0,24 -0,09 0,18
0,08 0,49 0,24 -0,07 0,18
0,09 0,48 0,25 -0,06 0,19
0,10 0,47 0,25 -0,04 0,19
Am I totally off base using the derivative for this purpose? How can I include the rate of change in the cost function in a continuous model? Is the fact that I am going back and calculating profits using the discrete function the problem or is the use of the derivative?
If it is of any help, I am using optimal control theory to try to maximize the profit function using the rate of change as the control variable. The functions that I am using are the results of that procedure.
Thanks!

The way your problem is set up, the time dimension is discrete, and $y(t)$ apparently is continuous at each $t$, NOT from $t-1$ to $t$.
$$\pi_t = R_t - C_t = y_t-y_t^2 - (y_t-y_{t-1})^2 $$
For a continuous-time formulation it should be written
$$\pi(t) = R(t) - C(t) = y(t)-y(t)^2 - \dot y(t)^2 $$
Now if your problem is set up in continuous time, and you want to make specific numerical calculations, of course you will work with discrete intervals, where the value of the derivative should be approximated. In that case, remember that $\frac {dy}{dt}$ is "the change in $y$ IF $t$ changes by 1" (so the denominator $dt=1$) - not by "one (arbitrary) unit". In your case, $t$ does not change by $1$ but by $0,01$.