RK4 and Modeling Radiovirotherapy

Fall 2021

1. Instructions

This is the semester project and is due by midnight on the day of the final exam. I encourage

you all to work together on it, but do not simply copy one another. You must turn in all your

code and plots via Canvas.

2. RK4 Algorithm

Assume that the solution u(t) is approximated by y(t). That is, yj ≈ u(tj). To approximate the

solution of the nth-order system of first-order IVPs given by

(3) For current t, compute the following for each yj with j = 1, . . . , n

Create a solver and run file that will successfully implement the RK4 method for systems of

differential equations for n = 2 and n = 3. Your solver should do the following:

(1) The single solver should have an input option to run either RK4 with n = 2 or n = 3. I

recommend you code them individually first and then combine them into a single solver.

(2) Plot the approximate solution for each yj and the exact solution u(tj) on the same set

of axes.

(3) Show a table in the command window that records the absolute error at each t-value for

each uj when the exact solution is known. Otherwise, it should just show a table in the

command window that shows the yj value at each t-value.

3. Part 1: Model Problems

(1) Run your code on the following 2 test codes. For the n = 2 case, numerically approximate

the solution to the differential equation given below.

u′1 = ?4u1 + 3u2 + 6

u′2 = ?2.4u1 + 1.6u2 + 3.6

with u1(0) = 0 and u2(0) = 0. The exact solutions are given by

u1(t) = ?3.375e?2t + 1.875e?0.4t + 1.5

u2(t) = ?2.25e?2t + 2.25e?0.4t

Use N = 5. Check that your results agree with the table below.

tj y1,j y2,j |u1(tj)? y1,j| |u2(tj)? y2,j|

0.000000 0.000000 0.000000 0.000000 0.000000

1.00000E-01 5.38260E-01 3.19630E-01 8.70680E-06 5.80370E-06

2.00000E-01 9.68500E-01 5.68780E-01 1.42570E-05 9.50280E-06

3.00000E-01 1.31070E+00 7.60730E-01 1.75080E-05 1.16700E-05

4.00000E-01 1.58130E+00 9.06320E-01 1.91110E-05 1.27380E-05

5.00000E-01 1.79350E+00 1.01440E+00 1.95580E-05 1.30350E-05

For the n = 3 case, numerically approximate the solution to the differential equation

given below.

u′1 = u2

u′2 = ?u1 ? 2et + 1

u′3 = ?u1 ? et + 1

with u1(0) = 1, u2(0) = 0, and u3(0) = 1 for 0 ≤ t ≤ 2 and h = 0.5. The actual solutions

are given by

u1(t) = cos t+ sin t? et + 1

u2(t) = ? sin t+ cos t? et

u3(t) = ? sin t+ cos t.

Check that your results agree with the table below.

tj y1,j y2,j y3,j |u1(tj)? y1,j| |u2(tj)? y2,j| |u3(tj)? y2,j|

0 1 0 1 0 0 0

5.00000E-01 7.07870E-01 -1.24990E+00 3.98850E-01 4.16070E-04 6.77620E-04 6.91590E-04

1.00000E+00 -3.36920E-01 -3.01760E+00 -2.99320E-01 4.08990E-04 1.80870E-03 1.84570E-03

1.50000E+00 -2.41330E+00 -5.40520E+00 -9.23470E-01 1.29540E-04 3.21410E-03 3.28910E-03

2.00000E+00 -5.89480E+00 -8.70970E+00 -1.32050E+00 1.11540E-03 4.79500E-03 4.93260E-03

4. Part 2: Application to Cancer Radiovirotherapy*

This portion of the project is subject to variability for each student. If you would like to apply

your RK4 code to some other type of application, contact your instructor prior to 1 month

before the due date (midnight of the day of the final). Otherwise, you will complete (1) through

(3) below.

(1) Read the paper titled Mathematical modeling of cancer radiovirotherapy by Dingli et al.

(2) Write 3-4 paragraph summary of the work. You do not need to understand everything

in the paper, but give the “big picture” idea.

(3) Use your solver to recreate figures 5 and 6. You will need to sift through the paper to

find the parameters used in their work. Your plots should include appropriate titles and

legends.

版权所有：留学生编程辅导网 2020 All Rights Reserved 联系方式：QQ:99515681 电子信箱：99515681@qq.com

免责声明：本站部分内容从网络整理而来，只供参考！如有版权问题可联系本站删除。