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

j0182018 - Back to Home
   Skip Navigation LinksHOME › AREAS OF EXPERTISE › Finite Boundary Value Solutions › ~ Finite Difference Linear

"Boundary Value Solution"
Second-Order Linear Differential Equation
X Y  Exact Y

(Suggested 8 - 50)

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


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;
                 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.######"));
                    ListBox1.Items.Add(" " + t1);
                    double t2 = y[i];
                    t2 = double.Parse(t2.ToString("#0.######"));
                    ListBox2.Items.Add(" " + t2);
                    double t3 = exact;
                    ListBox3.Items.Add(" " + t3);

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 ↓
Skip Navigation Links.

Consulting Services - Back to Home

Home Math, Analysis & More,
  established expertise..."

Eigen Inverse Iteration
Rayleigh-Quotient Method

Cubic Spline Method
Newton Divided Difference


Applied Mathematical Algorithms

     Home Complex Functions
A complex number z = x + iy, where...

Complex Functions
     Home Non-Linear Systems
Non-linear system methods...

Non Linear Systems
     Home Differentiation
Construction of differentiation...

     Home Integration
Consider the function where...

  KMP Engineering  
 Location: 2461 E Orangethorpe Ave. 
 Fullerton, CA 92631 USA Email:info@keystoneminingpost.com

Since 2006 All rights reserved © KMP Engineering