Open a blank worksheet and in cell A1 type Integral.xls as the name of the worksheet.
Save the worksheet someplace as Integral.xls.
[In what follows, column C is actually
superfluous.
We don't need dg/dx at the full step, only at the half-step.]
In cell A3 type f = 3 x^2 (This is just text to let you know what you are integrating)
In cell A4 type Steps.
In cell A5 type x1
In cell A6 type x2
In cell A7 type x step
In cell A8 type half step, In cell
A9 type Integral
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 Steps; click OK unless you want a different name.
Select cell B5. When you go to select x1
as a name it says it is illegal. Change it to x_1 and it will like
it.
Ditto for cell B6. For cell B7
it will put in an underscore and prompt you with x_step. Same for
cell B8.
Now for values in the cells. In Steps (B4),
put 100, in x_1 (B5) put 0,
in x_2 (B6) put 2, in x_step (B7)
put =(x_2-x_1)/Steps
In half_step (B8) put =x_step/2 .
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 x, in B12 type g, in C12
type dg/dx.
In cell D11 type Half Step, in
D12
type x, and in E12
type dg/dx
In cell A13, type 0, in cell B13 type 0, in cell C13 type =3*A13^2, in cell D13 type =A13+half_step, and in E13 type =3*D13^2.
In cell A14 type =A13+x_step, in
cell B14 type =B13+x_step*E13.
Select cells C13 through E13
and copy them down into cells C14..E14.
Select cells A14..E14. Copy them down through cells A113..E113
In cell B9 type =B113 . This is the value of the integral between the limits x1 and x2.