- Details
- Parent Category: Mathematics Assignments' Solutions

# We Helped With This Differential Equations Homework: Have A Similar One?

Category | Math |
---|---|

Subject | Differential Equations |

Difficulty | Undergraduate |

Status | Solved |

More Info | Differential Equations Help |

## Short Assignment Requirements

## Assignment Description

**Exercise**

We consider a model with diffusion and
convection for some concentration *C*:

*.*

with initial condition *C*(*t *= 0*,x*)
= 1 for 2 ≤ *x *≤ 3 and *C*(*t *= 0*,x*) = 0 otherwise. We
use boundary conditions *C*(*t,x *= 0) = *C*(*t,x *= 6) =
0, but *C*(*t,x *= 0) = 1 for 4 ≤ *t *≤ 5. This is a partial
differential equation where *C *depends on both time *t *and space *x*.
It cannot be solved easily analytically. Let us make a numerical solution with
forward-Euler. For this, we are going to discretize this system as follows. We
compute the solution *C *at discrete points *x _{i }*in space
only. These points lie at a distance

*h*, so

*x*=

_{i }*ih*with

*i*= 0

*,*1

*,*2

*,...,N*with

*N*= 6

*/h*. With this notation we can write

*C*=

_{i }*C*(

*t,x*). Then we approximate the spatial derivatives with the following formulas

_{i} *, *

• Write down the
differential equations for *C*_{1}*,C*_{2}*,C*_{3}*,C*_{4}*,C*_{5 }if *h *= 1. Do this in a matrix form *C*^{0 }= *AC *+ *b *so that *C *= (*C*_{1}*....C _{N}*

_{−1}). That is, give the matrix

*A*and vector

*b*. Also specify the initial condition

*C*(

*t*= 0).

• Use *dt *=
0*.*25 to simulate the system for 0 ≤ *t *≤ 10. Make a contourplot of
your solution with *t *and *x *on the axes. Also plot the solution
for *t *= 1*,*5*,*10.

• Now use *h *= 0*.*25 and simulate the system for 0 ≤ *t *≤
10. You cannot use the same *dt*, but need a smaller value. Experiment
with smaller values until your simulation makes sense. Hint: you may for-loops
to initialize the matrix *A *once. Make the same plots as before.

1