There are many different ways to write a computer or calculator program that will perform the calculations needed to estimate the values of a solution to a differential equation with an initial or boundary condition. Here are two examples in BASIC that illustrate the simplicity of such programs.

**Example IV.Y.1.**

Suppose y' = x^{ 2} with y(0) = 3.

Estimate the values of y using Euler's method for x_{ i} =
i / 10 where i =1 to 10.

**Solution: **The following program will perform the desired estimation
and display the results in a table showing the values of x_{ i}
and the estimates for f(x_{ i}) as well as the corresponding values
of f '(x_{ i}) and f '(x_{ i})^{ . }dx .

10 LET X = 0

20 LET Y = 3

30 LET DX = .1

40 DEF FNP(X)=X^2

50 FOR N = 1 TO 11

60 PRINT X, Y, FNP(X), FNP(X)*DX

70 LET Y = Y + FNP(X)*DX

80 LET X = X + DX

100 NEXT N

1000 END

**Example IV.Y.2. **Suppose **y' = x - y with y(0) = 3**. Estimate
the values of y using Euler's method for x_{ i} = i / 10 where
i = 1 to 10.

**Solution: **The following program which is quite similar to the
previous example will perform the desired estimation and display the results
in a table showing not only the values of x _{i} and the
estimates for f(x_{ i}) but also the corresponding values of f
'(x_{ i}, y_{ i}) and f '(x_{ i}, y_{ i})^{
. }dx . Only lines 40, 60, and 70 have been changed to allow the derivative
to depend on both X and Y.

10 LET X = 0

20 LET Y = 3

30 LET DX = .1

40 DEF FNP(X,Y) = X -Y

50 FOR N = 1 TO 11

60 PRINT X , Y , FNP(X,Y), FNP(X,Y)*DX

70 LET Y = Y + FNP(X,Y)*DX

80 LET X = X + DX

100 NEXT N

1000 END