Skip to main content
Tweeted twitter.com/StackMma/status/1518379332795781123
edited tags
Link
user21
  • 40.7k
  • 8
  • 114
  • 170
edited tags
Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
Rewrite the description of the PDE with LaTeX.
Source Link
M=8; NN=8; m = M - 1; n = NN - 1; alpha = 5.; 
beta = 4.; c = 0.05; T = 2.; h = (1. - 0.)/M; 
k =T/NN

The problemequation is Subscript[u, t] + u Subscript[u, x] = c Subscript[u, xx]

$$\frac{\partial u(x,t)}{\partial t}+u(x,t) \frac{\partial u(x,t)}{\partial x}=c \frac{\partial ^2u(x,t)}{\partial x^2}$$

with initial condition

Subscript[u, x, 0] = (2. c beta Pi Sin[Pi Subscript[x, i]])
                   / (alpha + beta Cos[Pi Subscript[x, i]]) 

$$u(x,0)=\frac{2 \pi \beta c \sin (\pi x)}{\alpha +\beta \cos (\pi x)}$$

and boundary conditionconditions

Subscript[u, 0, t] = 0; Subscript[u, 1, t] = 0;

$$u(0,t)=u(1,t)=0$$

I tried the backward finite difference (FD) for Subscript[u, t]$\frac{\partial u(x,t)}{\partial t}$ and the central FD for the others. I wrote the following code, but I think there are some gaps in it. Because, the approximate solutions do not match the exact one

u[x_, t_] := (2 c beta Pi Exp[-c Pi^2 t] Sin[Pi x])
            / (alpha + beta Exp[-c Pi^2 t] Cos[Pi x]);

$$u(x,t)=\frac{2 \pi \beta c e^{-c \pi ^2 t} \sin (\pi x)}{\alpha +\beta e^{-c \pi ^2 t} \cos (\pi x)}$$

Note that Subscript[w, i, j] stands for the approximation in the grid point $(x_i,t_j)$.

M=8; NN=8; m = M - 1; n = NN - 1; alpha = 5.; 
beta = 4.; c = 0.05; T = 2.; h = (1. - 0.)/M; 
k =T/NN

The problem is Subscript[u, t] + u Subscript[u, x] = c Subscript[u, xx] with initial condition

Subscript[u, x, 0] = (2. c beta Pi Sin[Pi Subscript[x, i]])
                   / (alpha + beta Cos[Pi Subscript[x, i]]) 

and boundary condition

Subscript[u, 0, t] = 0; Subscript[u, 1, t] = 0;

I tried the backward finite difference (FD) for Subscript[u, t] and the central FD for the others. I wrote the following code, but I think there are some gaps in it. Because, the approximate solutions do not match the exact one

u[x_, t_] := (2 c beta Pi Exp[-c Pi^2 t] Sin[Pi x])
            / (alpha + beta Exp[-c Pi^2 t] Cos[Pi x]);

Note that Subscript[w,i,j] stands for the approximation in the grid point $(x_i,t_j)$.

The equation is

$$\frac{\partial u(x,t)}{\partial t}+u(x,t) \frac{\partial u(x,t)}{\partial x}=c \frac{\partial ^2u(x,t)}{\partial x^2}$$

with initial condition

$$u(x,0)=\frac{2 \pi \beta c \sin (\pi x)}{\alpha +\beta \cos (\pi x)}$$

and boundary conditions

$$u(0,t)=u(1,t)=0$$

I tried the backward finite difference (FD) for $\frac{\partial u(x,t)}{\partial t}$ and the central FD for the others. I wrote the following code, but I think there are some gaps in it. Because, the approximate solutions do not match the exact one

$$u(x,t)=\frac{2 \pi \beta c e^{-c \pi ^2 t} \sin (\pi x)}{\alpha +\beta e^{-c \pi ^2 t} \cos (\pi x)}$$

Note that Subscript[w, i, j] stands for the approximation in the grid point $(x_i,t_j)$.

deleted 1 characters in body
Source Link
Faz
  • 1.8k
  • 1
  • 14
  • 19
Loading
added 5 characters in body
Source Link
rcollyer
  • 34.1k
  • 7
  • 94
  • 194
Loading
formatted code
Source Link
rcollyer
  • 34.1k
  • 7
  • 94
  • 194
Loading
added 24 characters in body
Source Link
Faz
  • 1.8k
  • 1
  • 14
  • 19
Loading
deleted 40 characters in body
Source Link
Faz
  • 1.8k
  • 1
  • 14
  • 19
Loading
deleted 40 characters in body
Source Link
Faz
  • 1.8k
  • 1
  • 14
  • 19
Loading
edited title
Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75
Loading
Source Link
Faz
  • 1.8k
  • 1
  • 14
  • 19
Loading