### No More Worries!

Our orders are delivered strictly on time without delay

### Paper Formatting

• Double or single-spaced
• 1-inch margin
• 12 Font Arial or Times New Roman
• 300 words per page

### No Lateness!

Our orders are delivered strictly on time without delay

### Our Guarantees

• Free Unlimited revisions
• Guaranteed Privacy
• Money Return guarantee
• Plagiarism Free Writing

# Web Programming

In real life we are never given a differential equation to solve. We must find the differential equation based
on what we know about the process and physical laws. Let’s look at the tank problem that we did in Week
8, but this time with a slight twist.
Two tanks with capacities of 10 liters initially contain 2 grams of salt and 1 liter of water. Water containing
1 g/L of salt enters the first tank at a rate of 2 L/hour, and the well-mixed solution flows out of the first tank
into the second tank at a rate equivalent to the volume of the first (i.e., V1 L/Hr). None of the brine flows
out of the second tank.
To model the process follow the steps in the lecture for each tank separately. Notice that the rate for the
second tank will depend on the first.
(1) Model the problem for the volume in liters as an IVP(s) and by using ode45 (for MATLAB) or
solve_ivp (for Python) solve the IVP (ODE + IC) for the volume of water in the tanks. Solve from
time t = 0 to t = 6 with ∆t = 0.01. Save the volume of the first tank at each time as a 601 ×1 column
vector named A1 and the volume of the second tank at each time as a 601 × 1 column vector named
A2.
(2) At what time to the nearest integer does the water start overflowing (hint: use the round function)?
Save this integer value as A3. And which tank does it overflow from (1 or 2)? Save this integer value
as A4.
(3) Model the problem for the amount of salt in grams as an IVP(s) and by using ode45 (for MATLAB)
or solve_ivp (for Python) solve the IVP (ODE + IC) for the amount of salt in the tanks. Solve from
time t = 0 to t = 6 with ∆t = 0.01. Save the amount of salt of the first tank at each time as a 601 × 1
column vector named A5 and the amount of salt of the second tank at each time as a 601 × 1 column
vector named A6.
(4) What is the salt concentration when tank that overflowed in part (b) is completely full of brine? Save
this salt concentration (remember it’s amount/volume) as A7.
Problem 2
Suppose the initial probability of finding a quantum particle on the line from x = −1 to x = 1 is a compact
Gaussian. The particle has equal probability of going to the left or to the right, and has the ability to leave
the region. What is the probability that the particle is located at x = 0.5 at t = 1?
This can be solved via the following PDE:
∂P
∂t =

2P
∂x2
; P(t = 0, x) = exp
1 −
1
1 − x
2

; P(t, x = −1) = P(t, x = 1) = 0. (1)
We will use the Crank-Nicolson scheme to numerically solve the problem.
(1) Following the finite difference process we used in lecture, use a second order difference scheme to
approximate Pxx and rewrite this as a linear system of equations Ax = b. Here the matrix A will
be the usual tridiagonal matrix from finite differences, and the vector b will change at each timestep.
Use ∆t = 0.01 and ∆x = 0.01. Save a copy of A in a variable named A8. Save a copy of b as a 199×1
column vector after the first iteration in a variable named A9.
Solve this linear system at each time t = [0:0.01:1] using Gaussian elimination (the backslash
operator in MATLAB or the solve function in python). Save a copy of b as a 199 × 1 column vector
after the last iteration in a variable named A10.
Save the probability of finding the particle at x = 0.5 at t = 1 as A11. Find the exact probability of
finding the particle at x = 0.5 at t = ∞ and save it as A12 (Hint: do you see a pattern as you iterate
the problem?)

Sample Solution

### 12% Discount

• Research Paper Writing
• Essay Writing
• Dissertation Writing
• Thesis Writing

### Why Choose Us

• Money Return guarantee
• Guaranteed Privacy
• Written by Professionals
• Paper Written from Scratch
• Timely Deliveries
• Free Amendments