Questions tagged [finite-difference-method]

Tag for the usage of "FiniteDifference" Method embedded in NDSolve and implementation of finite difference method (fdm) in mathematica.

Filter by
Sorted by
Tagged with
0
votes
1answer
39 views

Solving System of Equations

I want to solve a huge system of equations which is generated using the Finite-Difference-Method. The Problem with that system is that it is badly conditioned and so ...
6
votes
3answers
325 views

Time dependent Schrödinger equation in 2D

I have the following Schrödinger equation in $2D$: \begin{cases} \partial_t \Psi(x,t) = V(x,t) \Psi(x,t) \quad x \in [-10,10]^2\\ \Psi(x,0)=\exp( \frac{1}{2} (-x^2+y^2)) \end{cases} where the ...
5
votes
2answers
176 views

NonLinear system for chemotaxis

I want to solve the chemotaxis mode, given by the next non-linear system: It is taken from Murray's book: equation (11.30) at pag. 408 $$\frac{\partial n}{\partial t} = D \frac{\partial^2 n}{\partial ...
2
votes
1answer
71 views

Solving the PDE $\partial_t u = \partial_x (u^2 \partial_xu)$

I'm trying to use Mathematica to solve the following equation $$\partial_t u = \partial_x (u^2 \partial_xu)$$ with $$u(0,t)=u(1,t)=0$$ and $$u_0(x)=\sin(\pi x)$$ in order to check a numerical method I ...
0
votes
0answers
26 views

ItoProcess with WhiteNoiseProcess

Is there a way to use ItoProcess with a white noise process, instead of the usual WienerProcess? If I just naively use ...
2
votes
2answers
141 views

How to solve Nonlinear coupled ODEs using DSolve

I cannot solve such a system of coupled ODEs in MMA 12.1 using DSolve. i.e. output is equal to the input equations ... (see the attached figure) Here, each solution is labeled according to the name of ...
6
votes
1answer
185 views

How to solve system of PDE's with complicated initial and boundary conditions

I am trying to solve the Cavity problem given in Paper by Mansour et al. with a physical model . System of PDE and B.C are . How can I impose boundary conditions like this? Code ...
5
votes
1answer
152 views

1-D PDE with nonlinear ODE as boundary condition

Recently, I am trying to solve a 1-D PDE with a nonlinear boundary condition using the function NDSolveValue. However, it seems that MMA (12) cannot solve it directly with some computational issues. ...
3
votes
0answers
205 views

Problem computing a cylindrical Heat equation with a parameter alpha

i have been struggling to compute a particular instance of cylindrical 3D heat equation. Here is my code : ...
1
vote
2answers
185 views

Finite difference method for 1D wave equation

I want to solve the following 1D wave equation: utt = uxx with t > 0, 0 <= x <= 5 and ...
1
vote
1answer
151 views

Finite difference method for 1D heat equation

I have solve the following 1D heat equation: ut=uxx, t>0,0<=x<=5, with ic=u(x,0)=x^2, and bcs:u(0,t)=2t;u(5,t)=2t+25: ...
0
votes
0answers
131 views

Problem with definition of boundary problem

My procedure for solving coupled 1 + 1 (spatial + temporal) PDE system: (Note: I have graphs of the correct solution with which I compare my result. See figure below text.) 1) I determine the ...
1
vote
1answer
155 views

Finite difference method for 1D Poisson equation with mixed boundary conditions [duplicate]

I have solved the following 1D Poisson equation using finite difference method: u'' = 6 x; u'(0) = 0; u(1) = 1; where h = 1/3; i.e., I found u(0), u(1/3) and u(...
5
votes
2answers
160 views

Finite difference method for 1D Poisson equation

I want to solve the following 1D Poisson equation using finite difference method: $$u'' = 6 x,\ u' (0) = 0,\ u (1) = 1$$ where $h=1/3$ i.e I need to find $u(0)$, $u(1/3)$ and $u(2/3)$. I construct ...
1
vote
1answer
125 views

Symbolic solution of an iterative system

I am not an expert in Mathematica. I want to keep off from tedious calculation I want to solve (in symbolic sens) this system: $\quad AU^{j+1}+BU^{j}=F^{j}$ where: $*$ ${U}^{j}$ a $(N;1)$ vector $\...
2
votes
1answer
169 views

Error in the solution of PDE with NDsolve and method of lines [closed]

I am trying to solve a system of the partial differential equation with the help of NDSolve and method of lines. Mathematica code for the above-described problem is ...
8
votes
1answer
224 views

Nonlinear elasticity PDE in Mathematica 12

Mathematica 12, Windows 10. I am trying to solve a PDE in one spatial dimension $R$ and time $t$. I need a solution for displacement $r(R,t)$, radial Cauchy stress $T_{RR}(R,t)$, and radial growth $\...
0
votes
0answers
34 views

Getting the form of a recursively defined function [duplicate]

Here is my iterative relationship: ...
1
vote
2answers
92 views

Testing the accuracy of numerically computed derivatives

I am calculating approximate derivatives by using NDSolve`FiniteDifferenceDerivative, so this works: ...
1
vote
0answers
69 views

Noisy numerical finite difference calculated by NDSolve`FiniteDifferenceDerivative [closed]

I met a problem when playing with the numerical difference provided by mathematica. My aim is to test the accuracy of the high-order numerical derivative. The code is below ...
1
vote
1answer
63 views

Elimination of numerical error in initial data

Elimination of numerical error in initial data can be crucial for its subsequent evolution. In the following simple example ...
3
votes
1answer
66 views

TemporalDiscretization in MethodOfLines

When solving ODE's one can use options like MaxStepFraction to control the number of grid points. When solving PDE's ...
0
votes
1answer
139 views

PDE-DirichletCondition needs to be linear

I am trying to solve the following multi-field problem in MMA 12, however, this probelm cannot be solved, i.e., error: DirichletCondition [...] needs to be linear. I attached the code here: <...
2
votes
1answer
219 views

Solving multi-field problems in MMA 11.3

Based on the PDE model proposed by @Schumacher Solving a second order coupled PDE system, the one dimensional multi-field Problem I would like to solve such benchmark test: namely: u(x): ...
1
vote
1answer
152 views

Solving IDE system using FDM based on NDSolve`FiniteDifferenceDerivative

I wanted to solve the following system of integro-differential equations (IDEs) using finite difference method (FDM). $y_1''(t)+t^2y_1(t)-y_2''(t)+\int\limits_0^t[(t-x)y_1(x)+y_2(x)]\mathrm{d}x=(2+t^...
1
vote
1answer
91 views

Solidification Problems in MMA

can we define such intial value and BCs for a solidification problem in MMA using Finite Element: 1.) initial value:=1 for a plate 2.) in this plate we have to define dirichlet bcs for a whole ...
1
vote
1answer
69 views

Random intial conditions using finite element method

How can we define the initial value for Cahn-Hilliard problem (links) using FEM in MMA? Complete test code (I am using MIXED formulation for C1 Problem): ...
19
votes
3answers
446 views

Generate coefficient array from general formula of linear equation system

This is a problem coming out in the implementation of finite difference method (FDM). Here is a toy example. Suppose we want to solve the boundary value problem (BVP) $$y''(x)=\sin(x),\ y(0)=0,\ y(1)=...
6
votes
2answers
266 views

Solving linear coupled PDEs by FDM

I am trying to solve some linear, coupled PDEs for perturbative analysis (first order in time, 3rd order in space), for which I then plan to take the global spatial maxima of their magnitudes and plot ...
4
votes
1answer
362 views

Solution of Burgers equation with some initial data

Consider the Burgers equation $$\partial_t u + \partial_x\left(u^2/2 \right) = 0, \quad u(0, x) = u_0(x).$$ eq = D[u[t, x], t] + D[u[t,x]^2/2, x] == 0 How ...
8
votes
3answers
486 views

New things and limitations in Version 12 numerical differential equation solver?

This question is intended to be a place to summarize users' exemplary experience in solving differential equation with the NDSolve family in MMA’s latest version 12....
6
votes
2answers
640 views

Numerical methods to solve a continuity equation

What numerical methods can be used to study the initial value problem for the continuity equation where $ u = u(t, x) $ $$ u_t + \nabla\cdot(\boldsymbol b u) = 0, \qquad t \in [0,T], \quad x=(x_1,x_2)...
3
votes
2answers
354 views

NDSolve error in 2-D heat equation

I'm trying to solve the following PDE by Mathematica in 2-D case in the unit disk using polar cordinates, where $\Omega$ is a bounded domain of $\mathbb{R}^n$, $\Gamma =\partial \Omega$ is the ...
10
votes
1answer
284 views

FiniteElement v.s. TensorProductGrid: which is reliable for Schrödinger equation with periodic b.c.?

This is a problem comes up in the discussion under this post and I think it's worth starting a new question for it. I suspect the underlying issue is the same as in this post, but not sure. Consider ...
1
vote
1answer
111 views

Solution of differential equation and then draw a graph

I have two differential equations: $da/dt = a (.3 a^{-3} + .7)^{1/2}$ and $d \tau /dt = 1/a$. The initial conditions are $t = 0$; $a = 1$ and $\tau = 0$, respectively. How can I solve the ...
1
vote
1answer
186 views

How can solve this partial differential equation (PDE) and plot?

How can plot and solve this partial differential equation in mathematica? $$ K \frac{\partial^2 T}{\partial x^2}- h (T-T_m) = \frac{\partial T}{\partial t} $$ $ Tm = 25 $ $ k= 47 $ $ h= 1.5 $ ...
8
votes
1answer
505 views

Solve PDEs with finite difference scheme by modifying NDSolve-based solver

Motivation As discussed here, NDSolve uses different difference orders for various spatial derivatives and the implicit design could cause trouble in certain cases....
2
votes
1answer
208 views

Using NIntegrate in Finite Difference Derivative method

I'm trying to solve a second order differential equation using the code given by @xzczd here which is based on this. What this ...
9
votes
1answer
304 views

How to find the differentiation matrix based on FEM?

Assume that I have a non-equidistant grid of $n$ nodes, as follows: ClearAll["Global`*"]; n = 10; SeedRandom[123]; nx = Sort@RandomReal[{-1, 6}, n] If I want to ...
10
votes
2answers
661 views

Stiff BVP of nonlinear ODE, alternative/ enhancement to shooting method

Question: I have been trying to solve this coupled ODE set. \begin{align} ( \frac{ \mu^2}{B} +1 ) \Phi^2 + \frac{1}{A} {\Phi^{\prime 2}} + \frac{1}{2}\lambda \Phi^4 - \frac{A'}{r A^...
5
votes
1answer
159 views

How to control DifferenceOrder in NDEigenvalue for an ODE?

I am trying to solve the eigenvalue problem of a 1st-order ODE system using NDEigenvalue. It should be finite difference method for ODE. And I want to tune the the ...
2
votes
1answer
214 views

Oscillations on solution of finite difference equation

In a previous post on the solution of an ODE with a boundary conditon at infinty I had some excelent help from xzczd and am now returning with a further problem along the same lines. I have used the ...
1
vote
1answer
102 views

How to invert Differences[list, order] with order >1?

Differences order 1 can be invert using FoldList[], but does not work with higher orders. For Example ...
4
votes
1answer
664 views

Schemes for nonlinear advection equation

I am working in the traffic flow problem using the Lighthill-Whitham-Richards model together with the Greenshields equation. The equation of that model is this: $$ \frac{\partial\rho}{\partial t}+v_{...
3
votes
2answers
358 views

Why ODE's naive finite difference matrix works well for different boundary conditions

We know finite difference method (FDM) can replace $y''(x)$ as $\frac{1}{h^2}[y(x+h)+y(x-h)-2y(x)]$ or so. The naive way to write down the matrix of the differential operator is like the following, ...
2
votes
0answers
658 views

Derivative of list of points: DifferentiatorFilter versus DerivativeFilter

I need to calculate the derivative from a list of experimental points. Mathematica has two functions which seem to do this: DifferentiatorFilter and DerivativeFilter. Which one is better for ...
1
vote
0answers
70 views

Optimizing finding the offset diagonals for a 2D Finite Difference Method

It is possible to collapse a conventional 2D PDE (in our case the Schrödinger equation) into one dimension by having each set of points be taken as a one dimensional list of $n$ lattice points and the ...
2
votes
1answer
335 views

2D inhomogeneous biharmonic equation with wedged edge

I'm solving bending of rectangular plate while, boundary conditions are I have found similar problem solved: datavoreconsulting.com/programming-tips/numerically-solving-pdes-mathematica-finite-...
3
votes
0answers
633 views

NDSolve`FiniteDifferenceDerivative how does it work? [closed]

I'm referring to Paritosh Mokhasi's blog post, where he uses, along with some other things, the...let's call it a function (?)... NDSolve`FiniteDifferenceDerivative. I was able to use it exactly the ...
2
votes
0answers
235 views

Solving nonlinear diffusion equation by NDSolve

I have checked all issues regarding to solving nonlinear PDE numerically. I however try to solve following equation via NDSolve function and get some troubles. And this is my code for above-...