# 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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...

29. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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.