Questions tagged [finite-difference-methods]

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

Numerically approximating the second order derivative at the end points of a closed interval

I have approximate the second order derivative of some function $f(x)$ on some interval $[a,b]$. Let $ h =\frac{b-a}{n}$ for some positive integer $n$, the discretization of $[a, b]$ will be the ...
0
votes
0answers
5 views

Finding Shortley-Weller approximation for mixed partial derivatives

I am working of discretizing partial differential equation and one if their terms is u_{xy} and I know some formulas for the approximations like the central difference formula, but I am hoping to find ...
0
votes
1answer
48 views

Finite Difference: Non-linear diffusion coefficient

$$ u_t = \nabla \cdot (k(u) \nabla u) $$ I have read some posts on FDM for $k=k(x)$. How does the method extend in the non-linear case: $k = k(u)$. I have attempted the following: \begin{align*} \...
4
votes
2answers
91 views

Finite differences second derivative as successive application of the first derivative

The finite difference expressions for the first, second and higher derivatives in the first, second or higher order of accuracy can be easily derived from Taylor's expansions. But, numerically, the ...
0
votes
0answers
28 views

Finite-difference method: Hints on how to solve this system of 1D differential equations?

I am trying to solve the following differential equation describing the steady-state carrier density and photon density in a laser diode: $$AN(z)+BN(z)^2+CN(z)^3=\frac{\eta_iI}{qV}-v_gg(N)(S^+(z)+S^-(...
0
votes
0answers
18 views

Discretization of inhomogeneous Dirichlet boundary conditions for 2D heat equation

We have the following PDE on $\Omega = [0,1] \times [0,1]$: \begin{equation} \begin{split} \partial_t u &= \Delta u \; \; \text{for} \; \; (x,y) \in \Omega \\ u &= -1 \; \; \text{on} \; \; \...
0
votes
0answers
22 views

Numerical grid generation for non-rectangular grids for solving the Poisson equation using finite difference method.

I am trying to solve the Poisson equation using a central difference scheme on a non-rectangular domain. $$ \Delta u = f$$ I came across an online article which has outlined the following method for ...
1
vote
1answer
33 views

Solving Boundary Value Problem using the Finite Difference Method - What Values to Substitute for $y'$?

I am given a boundary value problem of the form $y'' = f(y', y, x)$ and asked to solve the system subject to boundary conditions using the finite difference method. I proceed to develop a system of ...
0
votes
0answers
24 views

Pricing options on several underlying assets using FDM

When implementing a finite difference method to price a European call option where the underlying stock follows the dynamics $dS_t=r S_tdt+\sigma S_tdW_t$ we get a tridiagonal matrix from the finite ...
0
votes
0answers
28 views

How to determine the minimum number of grid points for successful FDM solution?

I am trying to solve the following BVP using the Finite Difference Method: $$y'' - y' + y = 0; \hspace{1em} y(0) = 1; \hspace{1em} y(10) = 5$$ I am using 3 points for each approximation. Using the 3-...
0
votes
0answers
20 views

Ghost point scaling - Neumann Boundary

Please see the Equation 8 and 9 within this set of lecture notes for full details. Given a PDE with a Neumann boundary condition, the ghost point method allows one to eliminate the psuedopoints on the ...
0
votes
1answer
23 views

Error term for backward differentiation formula

I am trying to derive the error term for the backward differentiation formula $f'(x) \approx \frac{3f(x)-4f(x-h)+f(x-2h)}{2h}$. By Taylor expansion $f(x-h)=f(x)-hf'(x)+\frac{h^2}{2}f''(x)-\frac{h^3}...
1
vote
1answer
57 views

Truncation error in finite difference approximation of mixed derivative

In a textbook (https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119083405.app1) I came across a way of deriving a finite-difference discretization of the mixed derivative $\frac{\partial^2 f}{\...
0
votes
0answers
11 views

Solving Fokker-Planck equation using finite difference

Will a fully implicit finite difference scheme (Crank-Nicolson) automatically provide noramalized probability distribution? How can I see if my solution is noramalized?
0
votes
0answers
21 views

Explicit method that could be used for the Schrödinger type equation.

I have the following exercise from Gustafson's time dependence methods and finite difference first edition. Exercise2.7.1; what explicit method could be used for the Schrödinger type equation $u_t=...
1
vote
1answer
70 views

Maxwell's Equation in Empty Space

Consider Maxwell's equation $$ \begin{cases} \frac{\partial B}{\partial t} = - \text{c} \cdot \text{curl} (E), \\ \frac{\partial E}{\partial t} = \text{c} \cdot \text{curl} (B), \\ \text{div} (E) = 0, ...
0
votes
0answers
23 views

How do I apply the finite difference method to a torsion equation?

So I've previously used the method to determine temperature across a thin plate. But my textbook doesn't what to do when the second derivates of space (x and y) are equal to a function. I'm trying to ...
0
votes
0answers
15 views

If I want to calculate derivatives at a point using finite difference method, how to set rhs in Matlab so it computes correctly?

This question involves Matlab code, but is more about mathematics, so I post it here. My code that calculates derivatives at a given point using finite difference method doesn't work and I think it's ...
2
votes
0answers
34 views

Geometric mean of finite difference upwind and downwind

For numerical approximation of a first derivative of some function $f$, there are three standard finite difference schemes: the upwind $(f(x+h)-f(x))/h$, downwind $(f(x)-f(x-h))/h$, and central $(f(x+...
0
votes
1answer
21 views

Why is ODE15s ignoring my boundary conditions for the Fishers equation?

I'm attempting to solve the Fishers PDE on $(x,t) \in (0,1)\times (0,T)$ by spatially discretising (method of lines) and then feeding the time derivative to ODE15s (therefore creating a system of ODEs)...
0
votes
0answers
35 views

Book for numerical differentiation

I am searching for a good textbook that deals with numerical differentiation. I am particularly interested in a book that talks about multivariate numerical differentiation and if it incudes modern ...
0
votes
0answers
48 views

Finding the first and second derivative of a spline (only from data, function unknown)

I have received data values for a spline (which was already fit to some ndvi data). I just have only the data points of the spline and do not know the function that the spline follows. My goal is to ...
1
vote
1answer
22 views

How to find the difference of two arrays.

I am working to find if a list has changed in python. The list contained a list inside each of its elements. Like this, [[0,1,2,3],[2,7,3,4]] Now image the list is longer and much bigger than this. ...
0
votes
0answers
40 views

Eigenvalues of Laplace operator under Neumann boundary conditions

I'm trying to numerically calculate the eigenvalues of the Laplace operator under Neumann boundary conditions utilising a 5 point stencil approximation scheme. Starting with the case of Dirichlet ...
0
votes
0answers
17 views

Finite difference method for nonlinear ODE $1$

I am trying to solve the ODE by using the finite difference method $$\frac{d^2 i y(x))}{dx^2} = e^x$$ for the boundary conditions: $$y(0)=1, y(1)=e$$
1
vote
1answer
78 views

Convergence of finite difference scheme for conservation law

I am currently studying for a test and came across this problem. The PDE is given by $$u_t + f(u)_x = 0 $$ where $f(u) = u^2/2$ , $u$ is periodic with period $2 \pi$ in $x$, and $u(x,0) =u_0(x)$ is a ...
1
vote
1answer
73 views

Finite Difference Method for the second order ODE $y''=\frac{y}{y+1}$

I would like to solve a non-linear second order ODE for $y \in (0,1)$ using a numerical method, preferably finite differences. The ODE is $$ \frac{d^2 y}{d x^2} = \frac{y}{y+1}, \quad y(0)=\alpha, \ ...
0
votes
0answers
148 views

Numerically solving a partial differential equation in python with Runge Kutta 4

I'm supposed to solve the following partial differential equation in python using Runge-Kutta 4 method in time. $$ \frac{\partial}{\partial t}v(y,t)=Lv(t,y) $$ where $L$ is the following linear ...
0
votes
0answers
13 views

Devising Convergent Schemes for Parabolic Equations

Consider the equation $$u_t = b_1 u_{xx}+b_2 u_{yy} $$ $b_1, b_2 > 0,$ to be solved in the unit square $0 \leq x,y \leq 1,$ with $t > 0$. Assume the initial data $$u(x,y,0) = \phi(x,y) $$ is ...
1
vote
1answer
98 views

How to solve nonlinear reaction-diffusion PDE using implicit finite difference method?

I want to solve a reaction-diffusion PDE, for example $$ \frac{\partial s}{\partial t} = D\frac{\partial^2s}{\partial x^2}+Ks^2+f(x), x, t\in[0,1]\\ s(0,t)=s(1,t)=s(x,0)=0 $$ where $s$ is a function ...
3
votes
0answers
22 views

How to use finite difference in this situation?

I want to compute Dupire's local volatility, but I'm struggling since several days. Here is the formula to get the local variance, with $y=\ln \left(\frac{ K}{F} \right)$ and $w=\sigma_{BS}^2\,T$, and ...
2
votes
1answer
186 views

Numerical method for steady-state solution to viscous Burgers' equation

I am reading a paper in which a specific partial differential equation (PDE) on the space-time domain $[-1,1]\times[0,\infty)$ is studied. The authors are interested in the steady-state solution. ...
0
votes
0answers
21 views

Stability in the Finite Difference Method where we have source $f$

I was studying the finite difference scheme: $$u^{n+1}_j=\frac{u^{n}_{j+1}+u^{n}_{j-1}}{2}-\frac{c\delta t}{2 \delta x}(u^{n}_{j+1}+u^{n}_{j-1})+\delta t f^n_j.$$ for $n\in \mathbb{N}$ and $j \in \...
0
votes
2answers
38 views

Finite difference approximation of linear, autonomous second-order ODE

What would be a suitable finite-difference approximation of the boundary value problem $$y^{\prime \prime} + 3y^{\prime} + 2y = 0, \quad y(0) = y^{\prime}(0) = 1 \quad ? $$
3
votes
2answers
314 views

Error in Crank-Nicolson scheme for diffusion equation

I'm solving the diffusion equation $$\frac{\partial u}{\partial t}=D\frac{\partial^2u}{\partial^2x}$$ subject to the BCs $\partial_xu(x=0)=0$ and $u(x)=1$, using the Crank Nicolson scheme. For the ...
1
vote
1answer
223 views

Amplification factor of Crank Nicolson scheme in cylindrical coordinates

When one considers the 1-D diffusion equation in cartesian coordinates $$\frac{\partial u}{\partial t}=\chi\frac{\partial^2u}{\partial x^2},$$ one finds that the amplification factor for the Crank ...
1
vote
0answers
503 views

How to implement Finite Difference Method ODE Boundary Value Problem in Python?

I implemented the Finite Differences Method for an ODE with Boundary Value Problem. Here is the approximations I used for the FDM: And here is the balk problem: with u(0) = u(L) = 0 (attached on ...
1
vote
1answer
41 views

Truncation error when applying a finite difference scheme to solve $u_t +Au_x = 0$

The wave equation in one space dimension is given as $$ u_t + Au_x = 0 $$ where $$ u := \begin{bmatrix} v(x,\, t) \\ w(x,\, t) \end{bmatrix}, \quad A = \begin{bmatrix} 0 & -1 \\ -1 & 0 \end{...
0
votes
0answers
30 views

Solving fourth order diffusion type equation using Finite Difference method

I am trying to solve a fourth order partial differential equation $$ {\partial u\over \partial t} = i{\partial^4 u\over \partial x^4} $$ where $i=\sqrt{-1}$ and periodic boundary conditions. I tried ...
1
vote
1answer
30 views

Derivation Sought for Solution of 1D Finite-Difference Equation

Context: This question arises from https://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/Chapter11.pdf (specifically problem 26 on page 427). The problem asks one to prove ...
2
votes
1answer
72 views

Intuition behind convergence and consistency

What is the definition of consistency? I have seen a proof that shows a finite difference scheme is consistent, where they basically plug a true solution $u(t)$ into a finite difference scheme, and ...
1
vote
1answer
48 views

Finite difference stability problem

My apologies for the title I'm not quite sure how to title a problem like this. I need to show the following result: $$u_j^{n+1} = e^{\Delta t\partial/\partial t}u_j^n$$ Where $u_j^n$ is the ...
0
votes
1answer
109 views

$k$th order backward difference reduces $k$th degree polynomial

$X_t$ is a degree $k$ polynomial at $t$. How to deduce that $\triangledown ^kX_t$ is a constant?
2
votes
1answer
19 views

Simplifictaion: Taylor series expansion $U(x,t)$ about point $\bigg(x+\frac{1}{2}h , t\bigg)$

I am required to expand the $\partial_x^2U(x,y)$ in terms of a finite difference expression about the point (x+\frac{h}{2},t) instead of the usual $(x,t)$ point. This means one will get: $$ \partial_x^...
2
votes
1answer
344 views

Discretization of second order nonlinear ODE using finite difference approximation not correct

I have the differential equation $$y'' + x(y^2)' - 2y^2 = g(x) \Longleftrightarrow y'' + x2yy'-2y^2 = g(x).$$ Using finite-difference approximations $$y''(x_m) \approx \frac{Y_{m-1} - 2Y_m + Y_{m+1}}{...
0
votes
1answer
38 views

2 Layer Finite Difference Scheme PDE

I have this PDE, and I need to build a 2 layer Finite Difference scheme for it. $\frac{∂^2}{∂x^2}(k(x,t) \frac{∂^2U(x,t)}{∂t^2})=0$ k is just a parameter, which is dependent on x and t. The problem ...
0
votes
0answers
66 views

finite difference method to the delayed damped wave equation

I want to do the numerical simulations in MATLAB for the following partial delay differential equations with Dirichlet boundary condition. I need to know the simplest method to do that. \begin{...
0
votes
1answer
132 views

Approximation of first derivative at $x_0$ using Five-point endpoint formula

Find the $f'(x=0)$ using Five-point endpoint formula. where $f$ is a long vector of length $n$, say $n=11$. ...
1
vote
0answers
154 views

discretizing the convection-diffusion equation using finite difference method

I am new to to the finite difference method and I want to understand how a convection-diffusion equation is discretized in 2-D by using central differences: $$\nabla\cdot(\rho \vec{v} \Phi)=\nabla\...
0
votes
1answer
70 views

Finite Differences for Boundary Value Problems

I was presented with the following equation that has to be solved using Finite Difference Method in MATLAB. However, I am very lost here. I can't really figure it out how to put this in a matrix and ...