Home Login  |   Contact  |   About Us       Tuesday, May 17, 2022   

j0110924 - Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE ›   Finite Boundary ›  ~ Finite 2nd-Order



Skip Navigation Links.



"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, the range of intgegration (a, b) is divided into n equal sub-intervals of length h each. The values of the numerical solution at the mesh points are denoted by yi, i = 0,1,2..., n.

This implementation shows 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.

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.


Testing the FiniteDifferenceLinear Method

In order to test the FiniteDifferenceLinear method as defined above, a new TestFiniteDifferenceLinear() static method has been added and executed. Supporting code and methods are 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

Consulting Services - Back to Home
Home

Home Math, Analysis,
  expertise..."

EIGENVALUE
SOLUTIONS...


> Rayleigh-Quotient Method

> Cubic Spline Method

 

Applied Mathematical Algorithms

Home

ComplexFunctions

Home

NonLinear
Home

Differentiation
Home

Integration
About Us


KMP Software Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.
Areas of
Expertise


SpecialFunctions
VectorsMatrices
OptimizationMethods
ComplexNumbers
Interpolation
CurveFitting
NonLinearSystems
LinearEquations
DistributionFunctions
NumericalDifferentiation
NumericalIntegration
DifferentialEquations
Smalltalk
FiniteBoundary
Eigenvalue
Graphics
Understanding
Mining


MiningMastery
MineralNews
MineralCommodities
MineralForum
Crystallography
Services


NumericalModeling
WebServices
MainframeServices
OutsourceServices

LINKED IN
KMP ARTICLES
Brand





Home

Login

Contact
Since 2006 All Rights Reserved  © KMP Software Engineering LINKS | PRIVACY POLICY | LEGAL NOTICE