Suppose a particle is subject to a force f(v) .       ForceIntegration.htm      9/12/02

Open a blank worksheet and in cell A1 type Force.xls as the name of the worksheet.

Save the worksheet someplace as Force.xls.

We are calculating behavior in a force field F = -k m v, where the acceleration  = - k v

In cell A4 type t step.     In cell A5 type half t step     In cell A6 type In cell A7 type v_0

Now name the various cells.  This makes it easier to refer to the cells, and gives them an absolute address.

Select cell B4. Under Insert/Name/Define it will show t_step; click OK unless you want a different name.
Select cell B5. Under Insert/Name/Define it will show half_t_step; click OK unless you want a different name.
In cell B6, name the cell k, like you did the others. Ditto for cell B7.

Now set up the numerical integration.
(RK2 requires derivatives to be evaluated at the half-step, and then bringing the values forward a full step using the half-step derivatives.)

In cell A11 type Full Step, in A12 type t, in B12 type x, in C12 type v, and in D12 type a.
In cell E11 type Half Step, in E12 type t, in F12 type x, in G12 type v, and in H12 type a.

In cell A13, type 0, in cell B13 type 0, in cell C13 type =v_0, in cell D13 type =-k*C13.
In E13 type = a13+half_t_step, in F13 type =b13+c13*half t_t_step,
in G13 type =C13+D13*half_t_step in H13 type = -k*G13

In cell A14 type =A13+t_step, in cell B14 type =B13+t_step*G13.
In C14 type =C13+t_step*H13, in D14 type = - k*C14.
Select cells E13 through H13 and copy them down into cells E14..H14.
Select cells A14..H14. Copy them down through cells A213..H213

This completes a 200-step integration for a particle under the given force.
To plot v vs x, select B12..C212, then use the wizard to create the graph.

Now go to View/Toolbars and select Control Toolbox. You are going to insert a 'scroll bar' .
See attached sheet for inserting a scroll bar. Click the scroll bar and drag it into the region of  D1-F1
Set the Linked Cell to C1, and Max to 200, and Large Change to 5.
Click on the architect's triangle in the toolbox to exit Design Mode. In cell C2 type 0.001.
In cell B4 (the t_step cell) type =C1*C2.  This connects your scroll bar and the time step.
Now when you adjust the scroll bar value, the time step changes too, and the graph will change!