How to Solve a Boundary Value Problem Using the Finite Difference Method?

In summary, we can solve the boundary value problem numerically by discretizing the problem, setting up equations, calculating approximations and errors, and validating the results. We can also estimate the order of accuracy using the formula $\epsilon (N) \approx C h^p$.
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! (Wave)

I want to solve numerically the following boundary value problem:

$\left\{\begin{matrix}
-u''+qu=f & , x \in [a,b]\\
-u'(a)+d_1 u(a)=0 & \\
u'(b)+d_2 u(b)=0 &
\end{matrix}\right.$

where $q(x) \geq 0 \forall x \in [a,b], d_1, d_2 \geq 0$.
We consider the uniform partition of $[a,b]$ with step $h=\frac{b-a}{N}$.

The approximations $U_i$ of $u(x_i), i=1, \dots, N+1$ have to be calculated with the following finite difference method:

$\\ \frac{2}{h^2}(U_1-U_2)+2 \frac{d_1}{h} U_1+q(x_1)U_1=f(x_1)
-\frac{1}{h^2}(U_{i-1}-2U_i+U_{i+1})+q(x_i)U_i=f(x_i), i=2, \dots, N \\
-\frac{2}{h^2}(U_N-U_{N+1})+2\frac{d_2}{h}U_{N+1}+q(x_{N+1})U_{N+1}=f(x_{N+1})$

There are given specific functions for $f$ and $q$.

I have to compute approximations of the solution, and the errors for uniform partitions with $N=25,50,100$ subintervals.

So does this mean that we have to write the whole $N+1$-sized vector $U$ that we get for each $N$ ?Also, I have to find the order of accuracy of the method.
This can be done as follows:
Let $\epsilon (N)$ the error of the numerical method for $N$ subintervals and let's assume that $\epsilon (N) \approx C h^p$, where $C$ doesn't depend on $h$ and $N$. Then:

$$\frac{\epsilon (N)}{ \epsilon (2N)} \approx \frac{Ch^p}{C \left(\frac{h}{2} \right)^p} \Rightarrow p \approx \frac{\log \left( \frac{\epsilon (N)}{\epsilon (2N)}\right)}{\log 2}$$So can I run the program for any $N$ that I want and then for the corresponding $2N$ in order to find the order of accuracy?
 
Mathematics news on Phys.org
  • #2


Hello! As a fellow scientist, I can definitely help you with this boundary value problem. First, let's break down the problem into smaller steps.

Step 1: Define the problem
The boundary value problem that you are trying to solve is a second-order differential equation with two boundary conditions. The function $u(x)$ is unknown, and we want to find its numerical approximation $U_i$ at specific points $x_i$ within the interval $[a,b]$.

Step 2: Discretize the problem
To solve the problem numerically, we need to discretize the interval $[a,b]$ into smaller subintervals. This is where the uniform partition with step $h$ comes in. By dividing the interval into $N$ subintervals, we can approximate the solution at each point $x_i$ with $U_i$. The finite difference method you mentioned is a commonly used approach to discretize differential equations.

Step 3: Set up the equations
Using the finite difference method, we can set up a system of equations that represents the discretized problem. Each equation corresponds to a specific point $x_i$ within the interval. By solving this system of equations, we can obtain the numerical approximation $U_i$ at each point.

Step 4: Calculate the approximations and errors
Now, we can run the program for different values of $N$ to obtain the corresponding approximations $U_i$. We can also calculate the errors by comparing the numerical solution to the exact solution (assuming it is known). As you mentioned, we can use the formula $\epsilon (N) \approx C h^p$ to estimate the order of accuracy of the method. This can give us an idea of how the error changes as we increase the number of subintervals.

Step 5: Validate the results
To validate the results, we can compare the calculated errors to the theoretical errors. We can also plot the numerical solution and compare it to the exact solution, if available.

In conclusion, to solve the boundary value problem numerically, we need to discretize the problem, set up the equations, calculate the approximations and errors, and validate the results. By following these steps, we can obtain a numerical solution and estimate the order of accuracy of the method. I hope this helps!
 

FAQ: How to Solve a Boundary Value Problem Using the Finite Difference Method?

What is the Finite Difference Method?

The Finite Difference Method is a numerical technique used to solve differential equations by approximating the derivatives of a continuous function at discrete points. It involves dividing a continuous domain into a grid of points and replacing the derivatives in the differential equation with finite difference approximations. This allows for the differential equation to be solved using algebraic equations instead of analytical methods.

What types of problems can be solved using the Finite Difference Method?

The Finite Difference Method can be used to solve a wide range of problems, including problems in engineering, physics, economics, and other fields that involve differential equations. It is commonly used to solve problems involving heat transfer, fluid flow, and structural mechanics.

What are the advantages of using the Finite Difference Method?

One of the main advantages of the Finite Difference Method is that it can be applied to a wide range of problems without requiring advanced mathematical techniques. It is also relatively easy to implement and can be used to obtain numerical solutions quickly. Additionally, the Finite Difference Method is flexible and can be adapted to solve problems with complex geometries or boundary conditions.

What are the limitations of the Finite Difference Method?

While the Finite Difference Method is a powerful and versatile technique, it does have some limitations. One major limitation is that it can only be used to solve problems with regular geometries and simple boundary conditions. It also requires a fine grid to accurately approximate the derivatives, which can result in large computational costs for problems with complex domains.

How does the accuracy of the Finite Difference Method compare to other numerical methods?

The accuracy of the Finite Difference Method depends on the grid spacing and the order of the finite difference approximations used. In general, higher order approximations and finer grids result in more accurate solutions. However, compared to other numerical methods such as the Finite Element Method or the Finite Volume Method, the Finite Difference Method may require a finer grid to achieve the same level of accuracy.

Similar threads

Back
Top