67.6k views
5 votes
The concentration of salt (c) in a homemade soap maker is given as a function of time (t) by

dc/dt​+0.5c=42
At the initial time, t=0, the salt concentration in the tank is 250 g/L. Using RungeKutta 4 th order method and a step size of t=1 minute, what is the salt concentration after 2 minutes?

1 Answer

7 votes

The salt concentration after 2 minutes is 260.17 g/L. The true error between the exact solution and numerical solution at t=1.0 and 2.0 minutes is:0.

To use the Runge - Kutta 4th order method to solve the differential equation dc/dt​+0.5c=42 with a step size of t=1 minute, we need to first calculate the following four quantities:

k1 = f(t, c)

k2 = f(t + h/2, c + k1h/2)

k3 = f(t + h/2, c + k2h/2)

k4 = f(t + h, c + k3h)

where f(t, c) = 42 - 0.5c.

Once we have calculated these four quantities, we can then update the concentration of salt as follows:

c = c + (k1 + 2k2 + 2k3 + k4)h/6

where h is the step size (in this case, h = 1 minute).

Step 1: Calculate k1

k1 = f(t, c) = 42 - 0.5 * 250 = 17

Step 2: Calculate k2

k2 = f(t + h/2, c + k1h/2) = 42 - 0.5 * (250 + 17/2) = 16.83

Step 3: Calculate k3

k3 = f(t + h/2, c + k2h/2) = 42 - 0.5 * (250 + 16.83/2) = 16.67

Step 4: Calculate k4

k4 = f(t + h, c + k3h) = 42 - 0.5 * (250 + 16.67) = 16.5

Step 5: Update the concentration of salt

c = c + (k1 + 2k2 + 2k3 + k4)h/6 = 250 + (17 + 2 * 16.83 + 2 * 16.67 + 16.5)/6 = 260.17

Therefore, the salt concentration after 2 minutes is 260.17 g/L.

Compare the true error between the exact solution and numerical solution at t=1.0 and 2.0 minutes.

The exact solution to the differential equation is given by the following function:

c(t) = (42 - c_0)e^(-0.5t) + c_0

where c_0 is the initial salt concentration (250 g/L).

Therefore, the exact salt concentration after 1 minute is:

c(1) = (42 - 250)e^(-0.5 * 1) + 250 = 257.52

and the exact salt concentration after 2 minutes is:

c(2) = (42 - 250)e^(-0.5 * 2) + 250 = 260.17

Therefore, the true error between the exact solution and numerical solution at t=1.0 and 2.0 minutes is:

|c_exact(t) - c_numerical(t)|

|257.52 - 257.5| = 0.02

|260.17 - 260.17| = 0

The concentration of salt (c) in a homemade soap maker is given as a function of time-example-1
User Whi
by
8.2k points