We have shown the finite difference method to secondorder differential equations. In fact, the finite difference
method is a very general numerical method for solving various types of differential equations. It can easily be applied
to higherorder differential equations.
Consider the general fourthorder linear equation:
Two boundary conditions are specified at each end of the solution domain [a, b].
Type I: y(a) = y_{a}, y'(a) = v_{a} or
Type II: y'(a) = v_{a}, y'''(a) = g_{a}

Many sets of boundary conditions are possible. However, one must take care when specifying boundary
conditions, because some combinations of boundary conditions may not work for the fourthorder finite difference method.
For example,
the combination of y_{(a)} and y'''_{a} or y'_{(a)}
and y''_{a} will not work.
It is possible to solve the fourthorder linear differential equation using the method we implemented under the secondorder
differential equation shown before. See "SecondOrder Finite Differential Equations".
Consider the following equation
y^{(4)} = y sin x + x, y(0) = y'(0) = 0, y'(1) = 0, y'''(1) = 5

so,
Running this example produces the results shown above. The accuracy is improved by increasing the number of mesh
points. As before, we feel the user has better participation by running realtime instead of showing samples of its
implementation.The reader can try variations above.
Testing the FiniteDifferenceLinear4 Method
In order to test the FiniteDifferenceLinear4 method as defined above, a new TestFiniteDifferenceLinear4()
static method has been added and executed. All supporting code and methods are not shown.
static void TestFiniteDifferenceLinear4();
{
BoundaryValue bv = new BoundaryValue();
string strScore;
int intScore;
strScore = txtInput.Text;
intScore = Int32.Parse(strScore);
bv.xa = 0.0;
bv.xb = 1.0;
bv.ya = 0.0;
bv.va = 0.0;
bv.vb = 0.0;
bv.gb = 5;
bv.n = intScore;
ListBox1.Items.Clear();
ListBox2.Items.Clear();
double[] x;
VectorR y = bv.FiniteDifferenceLinear4(f5, out x);
for (int i = 0; i < x.Length; i++)
{
double t2 = x[i];
t1 = double.Parse(t1.ToString("#0.######"));
ListBox1.Items.Add(" " + t1);
double t2 = y[i];
t2 = double.Parse(t2.ToString("#0.######"));
ListBox2.Items.Add(" " + t2);
}
}
static VectorR f5(double x);
{
VectorR result = new VectorR(2);
result[0] = Math.Sin(x);
result[1] = x;
return result;
}
