 Site Statistics  |   Contact  |   About Us       Saturday, January 25, 2020

 "Boundary Value Solution" Second-Order Linear Differential Equation
 X Y  Exact Y
 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1 0 0.125 0.238095 0.327381 0.380952 0.386905 0.333333 0.208333 0 0 0.123047 0.234375 0.322266 0.375 0.380859 0.328125 0.205078 0

 (Suggested 8 - 50)

IMPLEMENTATION
Finite Difference Method

The following finite difference method is particularly suitable for linear equations, although, it can be used for nonlinear equations with a considerable increase in computational effort.

Consider the general second-order linear equation

 P(x)y'' + Q(x)y' + R(x)y + S(x) = 0

with boundary conditions

 y(a) = Þ, or y'(a) = Þ y(b) = ß, or y'(b) = ß

In the finite differential method we wrote, the range of intgegration (a, b) is divided into n equal subintervals of length h each. The values of the numerical solution at the mesh points are denoted by yi, i = 0,1,2..., n.

We show the implementation of a finite difference method for solving the boundary value of a second-order linear differential equation. This method is general enough to handle boundary value problems with specified y values or derivatives at the boundary.

We use the following equation

 xy'' - 2y' + 2 = 0, y(0) = y(1) = 0

so,

 P(x) = x, Q(x) = -2, R(x) = 0, S(x) = 2

and this equation has an analytical solution:

 y = x - x3.

This way we can examine the accuracy of the numerical results. Running this equation produces the results shown above. One can tell that the numerical results are fairly good compared to the analytical solution.

The accuracy is always improved by increasing the number of mesh points.

We feel giving the user instant results was better than any examples we could come up with. The reader can try variations above. Testing the FiniteDifferenceLinear Method

In order to test the FiniteDifferenceLinear method as defined above, a new TestFiniteDifferenceLinear() static method has been added and executed. All supporting code and methods is not shown.

static void TestFiniteDifferenceLinear();
{
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.yb = 0.0;
bv.n = intScore;
ListBox1.Items.Clear();
ListBox2.Items.Clear();
ListBox3.Items.Clear();
double[] x;
VectorR y = bv.FiniteDifferenceLinear2(f2, out x);
for (int i = 0; i < x.Length; i++)
{
double exact = x[i] - x[i] * x[i] * x[i];
t1 = double.Parse(t1.ToString("#0.######"));
double t2 = y[i];
t2 = double.Parse(t2.ToString("#0.######"));
double t3 = exact;
}
}

 Other Implementations...

 Object-Oriented Implementation Graphics and Animation Sample Applications Ore Extraction Optimization Vectors and Matrices Complex Numbers and Functions Ordinary Differential Equations - Euler Method Ordinary Differential Equations 2nd-Order Runge-Kutta Ordinary Differential Equations 4th-Order Runge-Kutta Higher Order Differential Equations Nonlinear Systems Numerical Integration Numerical Differentiation Function Evaluation
 You are viewing this tab ↓   Math, Analysis & More,
established expertise..."

EIGENVALUE SOLUTIONS...
Eigen Inverse Iteration
Rayleigh-Quotient Method

INTERPOLATION APPLICATIONS...
Cubic Spline Method
Newton Divided Difference

 Applied Mathematical Algorithms Complex Functions A complex number z = x + iy, where... Complex Functions Non-Linear Systems Non-linear system methods... Non Linear Systems Differentiation Construction of differentiation... Differentiation Integration Consider the function where... Integration