What is Finite difference method: Definition and 64 Discussions

In numerical analysis, finite-difference methods (FDM) are a class of numerical techniques for solving differential equations by approximating derivatives with finite differences. Both the spatial domain and time interval (if applicable) are discretized, or broken into a finite number of steps, and the value of the solution at these discrete points is approximated by solving algebraic equations containing finite differences and values from nearby points.
Finite difference methods convert ordinary differential equations (ODE) or partial differential equations (PDE), which may be nonlinear, into a system of linear equations that can be solved by matrix algebra techniques. Modern computers can perform these linear algebra computations efficiently which, along with their relative ease of implementation, has led to the widespread use of FDM in modern numerical analysis.
Today, FDM are one of the most common approaches to the numerical solution of PDE, along with finite element methods.

View More On Wikipedia.org
  1. person123

    My Python Library For Finite Difference Method

    I recently made a Python library for modelling (very basic) finite difference problems. The Github readme goes into details of what it does and how it works, and I put together a Google Colab with some examples (diffusion, advection, water wave refraction) with interactive visuals. I'd love to...
  2. yashabyadav

    A Need help implementing finite difference method for BPM

    I am trying to apply finite difference scheme for Beam propagation method by following this paper. I was wondering if anyone can share their code if they have implemented this method. I can share my code which is not working as expected and can get some insights if possible.
  3. Z

    Tackling Boundary Conditions in Python (Griffins Example)

    How to run a numerical simulation of Laplace equation if one of the boundary condition is like this: $$V(x,y) = 0 \text{ when } x \to \infty$$ I am trying to use Python to plot the solution of this Example 3.5. in Griffins EM
  4. T

    Matlab report help please (Finite Difference Method)

    We have to submit a Matlab (my worst module) assignment to show the heat transfer on a plate. However, I have the 2 codes almost done but I am struggling to write the report. To calculate the temperature on a 2D aluminum plate we need to use the Explicit Finite Difference Method. The problem...
  5. person123

    I Boundary Conditions For Modelling of a Fluid Using Euler's Equations

    Hi! I want to use Euler's equations to model a 2 dimensional, incompressible, non-viscous fluid under steady flow (essentially the simplest case I can think of). I'm trying to use the finite difference method and convert the differential equations into matrices to be solved using MATLAB. I set...
  6. L

    Finite difference method for the diffusion-advection equation

    So for my scheme I obtained ##\frac{\mu}{h^2} U_{p}+(\frac{v_{1}}{2 h}-\frac{\mu}{h^2})U_{E}+(\frac{v_{2}}{2 h} - \frac{\mu}{h^2})U_{N} - (\frac{v_{1}}{2 h}+\frac{\mu}{h^2})U_{W} - (\frac{v_{2}}{2 h} + \frac{\mu}{h^2})U_{N} + \tau = f## however I am not sure this is correct. I am quite new to...
  7. patrykh18

    I Numerical solution to the Schrodinger eqn. using Finite Difference Method

    As part of my project I was asked to use the finite difference method to solve Schrodinger equation. I see how you can turn it into a matrix equation, but I don't know how to solve it if the energy eigenvalues are unknown. Are there any recommended methods I can use to determine those...
  8. C

    MATLAB_Quantum Well_Finite Difference Method

    Homework Statement Hi, I am new to MATLAB and have an assignment where I have to construct a Hamiltonian matrix, apply boundary conditions, then find corresponding eigenvalues and eigenvectors for the electron in a box problem. I am stumped where to start. From our class we learned that you...
  9. yecko

    Conduction - finite difference method

    Homework Statement Homework Equations Finite difference method The Attempt at a Solution I have tried two different approaches, but still i am wrong in the question. Can anyone guide me how to attempt this question? Thank you
  10. T

    Finite difference method; finding the 'Stencil'

    Homework Statement Determine the Finite Difference Method stencil for approximating a second derivative u''(x) at a discrete set of nodes with maximum accuracy for stencil of sizes (0,4) (off-centered). My questions: I think I am able to answer the question I am just not sure about what is...
  11. S

    A How to find the partial derivatives of a composite function

    Hello, dear colleague. Now I'm dealing with issues of modeling processes of heat and mass transfer in frozen and thawed soils. I am solving this problems numerically using the finite volume method (do not confuse this method with the finite element method). I found your article: "Numerical...
  12. Riverbirdy

    Finite difference Method of Wave Equation

    Hi, Physics forum! Just a little push of my doubts I hope somebody could help me with my confusion of one of our home works. I know that all boundary conditions are zero. My doubt is how do I interpret (x,y,0)=0.01 source in the figure? Where is it located in the grid. I am hoping someone...
  13. F

    Finite difference method derivation PDE

    Homework Statement Which algebraic expressions must be solved when you use finite difference approximation to solve the following Possion equation inside of the square : $$U_{xx} + U_{yy}=F(x,y)$$[/B] $$0<x<1$$ $$0<y<1$$ Boundary condition $$U(x,y)=G(x,y)$$ Homework Equations Central...
  14. A

    I Finite difference method for Schrödinger equation

    Suppose I want to solve the time-independent Schrödinger equation (ħ2/2m ∂2/∂x2 + V)ψ = Eψ using a numerical approach. I then discretize the equation on a lattice of N points such that x=(x1,x2,...,xN) etc. Finally I approximate the second order derivative with the well known central difference...
  15. M

    I Difference Equation Boundary Conditions0.

    This question is inspired by Gilbert Strang's Course on Computational Science and Engineering, MIT 18.085. Consider the three matrices Fixed-Fixed $$K=\begin{bmatrix} 2 &-1 & 0 &0 \\ -1&2 & -1 &0 \\ 0 & -1 &2 & -1 \\ 0 & 0 & -1 & 2 \\ \end{bmatrix} $$ Free-Fixed $$T=\begin{bmatrix} 1 &-1 & 0 &0...
  16. F

    MATLAB Finite difference numerical integration or ode45?

    I'm trying to numerically solve the time dependent Schrödinger equation and I've been told that the best approach is to numerically integrate using a finite difference method, however I don't understand why I couldn't just use ode45 to solve it?! Is the finite difference (interpolation) method...
  17. Federico Navarrete

    FDM for a 3 metal layers 3D, heat transfer

    Dear members, Some days ago, I received the following exercise but I have never studied thermodynamics before and I don't know very well where to start, the exercise is about Heat Transfer and the Finite Difference Method and I must program the solution using Petsc and C++. About the Finite...
  18. evinda

    MHB How is the Finite Difference Method Applied in Wave Approximation?

    Hello! (Wave) We consider the finite difference method for the approximation $\left\{\begin{matrix} -u''(x)+q(x)u(x)=f(x)\\ u'(a)=u'(b)=0 \end{matrix}\right.$ and let $K$ be the $(N+2) \times (N+2)$ matrix of the method. Let $v \in \mathbb{R}^{N+2}, v=\begin{pmatrix} v_0\\ v_1\\ \dots\\...
  19. I

    Finite difference method to solve first-order, multivariable

    I'm trying to replicate the model presented in this [paper](http://www.sciencedirect.com/science/article/pii/S1359431103000474), which is basically to model heat and mass transfer along a one-dimensional duct. There are four characteristic equations for this problem : Momentum conservation...
  20. evinda

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

    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...
  21. N

    Finite Difference Method for non-square grid

    Hi, I have written some codes for the finite difference solution of diffusion equation (\frac{\partial c}{\partial t}= D {\nabla^2 c}, where c is the species concentration and D is the diffusion coefficient) as follows: DO k= 1, tsteps+1 DO i = 2, zsteps DO j = 2, rsteps...
  22. Last-cloud

    Finite difference method nonlinear PDE

    i want to solve a nonlinear PDE with finite difference method ,but using just discretization like in linear PDE , it will lead to nowhere , what's the right way to use FDM to solve nonlinear PDE or could someone provide me with book's titles or articles that can help me solving a nonlinear pdf...
  23. R

    Poisson equation with finite difference method

    Hi guys , i am solving this equation by Finite difference method. (dt2/dx2 + dt2/dy2 )= -Q(x,y) i have developed a program on this to calculate the maximum temperature, when i change the mesh size the maximum temperature is also changing, Should the maximum temperature change with mesh...
  24. M

    Finite Difference method to solve diffusion equation

    Homework Statement Plot the transient conduction of a material with k = 210 w/m K, Cp = 350 J/kg K, ρ = 6530 kg/m3 Where the material is a cylinder, with constant cross sectional area and is well insulated. The boundary conditions for the cylinder: T(0,t) = 330K T(l,t) = 299K...
  25. M

    MHB Implicit finite difference method

    Hey! :o I have a implicit finite difference method for the wave equation. At step 0, we set: $W_j^0=v(x_j), j=0,...,J$ At the step 1, we set: $W_j^1=v(x_j)+Dtu(x_j)+\frac{Dt^2}{2}(\frac{v(x_{j-1})-2v(x_j)+v(x_{j+1})}{h^2}+f(x_j,0)), j=0,...,J$ Can that be that at the step 1 $j$ begins from...
  26. M

    MHB The finite difference method for the heat equation-error

    Hey! :o I am implementing in a program the finite difference method for the heat equation. The problem is the following: $$u_t(x,t)=(g(x,t)u_x(x,t))_x+f(x,t), \forall (x,t) \in [0,1]x[0,1]$$ $$u(0,t)=u(1,t)=0, \forall t \in [0,1]$$ $$u(x,0)=0, \forall x \in [0,1]$$ where $f(x,t)=\pi x...
  27. E

    Using finite difference method for solving an elliptic PDE with MATLAB

    Homework Statement Given that we the following elliptic problem on a rectangular region: \nabla^2 T=0, \ (x,y)\in \Omega T(0,y)=300, \ T(4,y)=600, \ 0 \leq y \leq 2 \frac{\partial T}{\partial y}(x,0)=0, \frac{\partial T}{\partial y}(x,2) = 0, \ 0\leq x \leq 4 We want to solve this problem...
  28. S

    Five point scheme Finite Difference Method

    For possion equation $$u_{xx}+u_{yy}=f$$ I know the general five point scheme is in the form $$a_{1}U_{i,j-1}+a_{2}U_{i-1,j}+a_{3}U_{i,j}+a_{4}U_{i+1,j}+a_{5}U_{i,j+1}=f_{i,j}$$ But , is there have the form...
  29. W

    Finite Difference Method, Leapfrog (2,4) CFL Condition

    Hi. I'm trying to determine the CFL condition for the fourth-order leapfrog scheme. I'm finding 2 as what's published, which does not match what I'm getting. Does anyone know where I can find a von Neumann (or Fourier) stability analysis of the leapfrog (2,4) scheme (so I can compare my work)...
  30. A

    Solving by finite difference method

    hi; I have 3 hyperbolic electrodes ,one as a ring and 2 others as endcap electrodes which have potential v and 0 respectively.(quadrupole ion trap) I want to solve potential inside the trap by finite difference method. I don't know how general equations for unshaped materials will change...
  31. E

    Use finite difference method to solve for eigenvalue E

    Use finite difference method to solve for eigenvalue E from the following second order ODE: - y'' + (x2/4) y = E y I discretize the equation so that it becomes yi-1 - [2 + h2(x2i/4)] yi + yi+1 = - E h2 yi where xi = i*h, and h is the distance between any two adjacent mesh points. This...
  32. E

    MATLAB Use finite difference method to solve for eigenvalue E in Matlab

    Use finite difference method to solve for eigenvalue E from the following second order ODE: - y'' + (x2/4) y = E y I discretize the equation so that it becomes yi-1 - [2 + h2(x2i/4)] yi + yi+1 = - E h2 yi where xi = i*h, and h is the distance between any two adjacent mesh points. This is my...
  33. A

    Finite Difference Method - clarification of a term

    Homework Statement I'm doing a class on Numerical Solutions of DE and I have my first assignment. The problem is stated: Consider the following second order boundary value problem: \epsilon \frac{d^{2}y}{dx^{2}} + \frac{1}{2+x-x^{2}} \frac{dy}{dx}-\frac{2}{1+x}y = 4sin(3x), y(0) = 2, y(2) =...
  34. N

    Finite difference method for even potential in QM

    Hello to everyone, while solving homework course Nanotechnology and Nanocomponents, I have encountered a problem in FD method that is applied in even potential. In my homework assignment it is explicitly said that it must be done only in x>0 part of the domain, where my problem starts with...
  35. H

    Nonlinear PDE finite difference method

    Hello I want to resolve a nonlinear partial differential equation of second order with finite difference method in matlab. the equation is in the pdf file attached. Thanks
  36. I

    Difference between Central Difference Method and Finite Difference Method

    Hello all, I am in the process of solving a finite elements problem involving obtaining deflection of a simple mass-spring-damper 2nd order ODE system with a defined forcing function. While going through my class notes, I came across the idea of the central difference method, which is...
  37. R

    Taylor series and the forward finite difference method

    Given a partial differential equation, how would one go about implementing the forward finite difference method to the Taylor series?
  38. N

    Circuler grid need to be solved by Finite difference method pls help me

    Circuler grid need to be solved by Finite difference method! pls help me... hi this is the picture of the problem.. i have studied the rectangular grid but not the circular grid... now pls someone help me to find out the way to solve a heat conduction problem for circle using finite difference...
  39. A

    Help With Finite Difference Method in Solving Second Order Differenial Equation

    Homework Statement y'' + 3y' + 2y = 0, y(0) = 1, y'(0) = 0 Homework Equations Finite Difference Approximations: y'' = (y(ii+1) - 2y(ii) + y(ii-1))/h^2 y' = (y(ii+1) - y(ii-1))/(2h) where h is the finite difference. The Attempt at a Solution I wrote the MATLAB code (just to try...
  40. I

    Finite Difference method to solve PDEs

    Hello: I am looking to solve a set of 1D PDEs. I thought the finite difference method would be a good way to go about it. So I decided to pick a simple first order forward difference scheme to obtain preliminary results. I just have 1 question: According to my scheme, at the last node...
  41. C

    Solving Diffusion PDE By Finite difference Method in fortran

    Hey, I want to solve a parabolic PDE with boundry conditions by using FINITE DIFFERENCE METHOD in fortran. (diffusion) See the attachment for the problem The problem is that there is a droplet on a leaf and it is diffusing in the leaf the boundry conditions are dc/dn= 0 at the upper...
  42. C

    Solving Diffusion Equation By Finite difference Method in fortran

    Hey, I want to solve a parabolic PDE with boundry conditions by using FINITE DIFFERENCE METHOD in fortran. (diffusion) See the attachment for the problem The problem is that there is a droplet on a leaf and it is diffusing in the leaf the boundry conditions are dc/dn= 0 at the upper...
  43. A

    Finite difference method, coupled wave equations, chickens & eggs

    I'm reading a book (Numerical Techniques in Electromagnetics by Sadiku) & just finished the section on finite difference methods. As what I thought would be an easy exercise, I tried to apply what I'd learned to the telegraphers equations that describe the voltage, V(x, t), and current, I(x, t)...
  44. 1

    MATLAB Finite difference method with matlab- square grid, cavity inside

    Hi, I'm here for help and hope somebody could give a hand on this because I'm noob in this. I'm now constructing a MATLAB program to find Electrical field and potential within a square grid mesh with square cavity inside. like the picture above. I only manage up to this...
  45. T

    Solving a fourth order PDE by finite difference method by matlab

    Homework Statement how can i solve this problem by MATLAB? pls help me A (d4y/dx4) - B(d2y/dt2) = Cy A=E*I B=p*sin(w*t) c=p*w2 conditions are 1.at x=0, dy/dx=0 2.at x=0,y=0 3.at x=L d2y/dx2=0 4. at x=L d3y/dx3=p (p is a function of t here) x=0 and x=L...
  46. E

    Using Finite Difference Method In Excel

    ------Question------ a) Research the three finite difference approximations mentioned above (forward, backward and central). Use a spreadsheet to demonstrate each of these numerical methods for the function below. y=x3 −x2 +0.5x Investigate the derivative over the range x = [0,1], using...
  47. S

    Solving Fick's Law by Finite Difference Method

    Hi, i need help in solving a Fick's Law [ (∂c_k)/∂t = D_k (∂^2 c_k)/(∂x^2 ) ] by Finite Difference Method. Previously, I tried solving the Fick's Law by using the Separation of Variable method but that was not the correct way as told by my Prof as the correct way is to use Finite Difference...
  48. A

    Finite difference method in fortran

    1. I have problem numerical solving of PDE with finite difference method in fortran. it is about optical fibers. At the beginning of the fiber the delta impuls is inserted, and I need function at the end of the fiber. 2. The equation is given in attachement as the code in fortran...
  49. B

    Finite difference method help (bvp)

    Hi, I'm currently writing a code to solve a steady-state boundary problem across multiple layers of a system. The system involves diffusion-reaction of various species in a porous medium. I am simply using central finite differences to model this setup, which says that essentially -div*J+Q = 0...
  50. S

    Plotting Solutions Using Finite Difference Method with M = N = 20

    How do I use the finite difference method with M = N = 20 to obtain a plot of the solution of \nabla2u = 1, 0 < x < 1, 0 < y < 1, u(x,0) = x(1-x), u(x,1) = x(1-x), 0 \leq y \leq 1, u(0,y) = 0, u(1,y) = 0, 0 \leq y \leq 1.