Client Account:   Login
Home Site Statistics   Contact   About Us   Tuesday, May 23, 2017

users on-line: 2 | Forum entries: 6   
j0182084- 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)

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.######"));
                    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
Skip Navigation Links.

Home

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

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

INTERPOLATION APPLICATIONS...
  Cubic Spline Method
  Newton Divided Difference

 

Applied Mathematical Algorithms

    Home Complex Functions
A complex number z = x + iy, where...
     Home Non-Linear Systems
Non-linear system methods...
     Home Numerical Differentiation
Construction of numerical differentiation...
     Home Numerical Integration
Consider the function I = ah f(x)dx where...
 

2006-2017 © Keystone Mining Post  |   2461 E. Orangethorpe Av., Fullerton, CA 92631 USA  |   info@keystoneminingpost.com