Mathematical Modeling UAB/EdGrid Graduate Assistants: Clinton Curry Brent Shivers John C. Mayer UAB/Mathematics Mathematical Modeling • Creates a mathematical representation of some phenomenon to better understand it. • Matches observation with symbolic representation. • Informs theory and explanation. The success of a mathematical model depends on how easily it can be used, and how accurately it predicts and how well it explains the phenomenon being studied. UAB 2 Mathematical Modeling • A mathematical model is central to most computational scientific research. • Other terms often used in connection with mathematical modeling are – – – – Computer modeling Computer simulation Computational mathematics Scientific Computation UAB 3 Mathematical Modeling and the Scientific Method • How do we incorporate mathematical modeling/computational science in the scientific method? UAB 4 Mathematical Modeling Problem-Solving Steps • Identify problem area • Conduct background research • State project goal • Define relationships • Develop mathematical model UAB • Develop computational algorithm • Perform test calculations • Interpret results • Communicate results 5 Syllabus: MA 261/419/519 Spring, 2006 Syllabus: MA 261/419/519 Introduction to Mathematical Modeling • Prerequisite: Calculus 1 • Goals • Learn to build models • Understand mathematics behind models • Improve understanding of mathematical concepts • Communicate mathematics • Models may be mathematical equations, spreadsheets, or computer simulations. UAB 7 Contact Information • Instructor: Dr. John Mayer - CH 490A – mayer@math.uab.edu - 934-2154 – ?? • Assistant: Mr. Robert Cusimano - CH 478B – rob5236@uab.edu - 934-2154 – ??MW 4:00 – 5:30 PM (computer lab CB 112) • Assistant: Ms. Jeanine Sedjro – ?? – ?? – ??MW 6:45 – 8:00 PM (computer lab CB 112) UAB 8 Class Meetings • Lectures. – Monday and Wednesday – 5:30 – 6:45 PM – CB15 112. UAB • Computer lab. – Monday and Wednesday – 4:00 – 5:30 PM – 6:45 – 8:00 PM – CB15 112. 9 Software Tools • Spreadsheet: • Microsoft EXCEL • Compartmental Analysis and System Dynamics programming: • Isee Systems STELLA UAB 10 Computer Lab • The only computer labs that have STELLA installed are CB15 112 and EDUC 149A. • Always bring a formatted 3.5” diskette to the lab. • Label disk: “Math Modeling, Spring, 2006, Your Name, Math Phone Number: 934-2154” UAB 11 Assignments • One or two assignments every week. • First few assignments have two due dates. – Returned next class. – Re-Graded for improved grade. • Written work at most two authors. – You may work together with a partner on the computer. UAB 12 Midterm Tests • Two tests, one about every 5 weeks. • Given in the computer lab. • Basic building blocks relevant to the kinds of models we are constructing. • Mathematics and logic behind the computer models. UAB 13 System Dynamics Stories and Projects • System Dynamics Stories. – Scenarios describing realistic situations to be modeled. – Entirely independent work – no partners. – Construct model and write 5-10 page technical paper (template provided). • Project due date to be announced. – Begin work about middle of term. – Preliminary evaluation three weeks prior to due date. UAB 14 Grading MA 261 MA 419 MA 519 Assignments 40% 30% 30% Tests (2) 30% 30% 25% Model 1 10% 10% 10% Model 2 na na 10% 20% 20% 15% na 10% 10% Paper Lesson Plan UAB 15 A Course Sampler Topics for Tools • Spreadsheet Models – Data analysis: curve fitting. – Recurrence Relations and difference equations. – Cellular Automata: nearest-neighbor averaging. UAB • Compartmental Models – Introduction to System Dynamics. – Applications of System Dynamics. – System Dynamics Stories (guided projects). 17 Spreadsheet Models: Excel • Curve fitting – introduction to (linear) regression • Difference Equations: modeling growth • Nearest-neighbor averaging UAB 18 Morteville by Doug Childers • Anthrax detected in Morteville • Is terrorism the source? • Infer geographic distribution from measures at several sample sites UAB • Build nearest neighbor averaging automaton in Excel • Form hypothesis • Get more data and compare • Revise hypothesis 19 Morteville View 1 UAB 0.2 0 2.1 4.1 6.3 8.4 9 9.7 11 12 13 14 14 0.3 0.9 2.2 4 6.3 10 9 9.4 10 12 13 15 14 0 0.9 1.9 3.3 5 6.7 7.4 8.6 10 11 12 13 13 0.3 0.7 1.2 2.4 3.5 4.5 5.3 7.6 10 11 12 13 12 0.3 0.3 0 1.4 2.3 2.6 1.5 6.6 12 10 11 13 11 0.3 0.3 0.3 0.8 1.6 2.2 2.9 5.1 7.2 7.8 8.2 8.6 8.5 0.2 0.2 0.2 0 1.1 1.8 2.6 3.6 4 5.3 5.5 4.9 5.5 0.1 0.1 0.2 0.4 0.9 1.4 2.1 2.9 3.5 4.1 3.6 0 3 0.1 0 0.2 0.4 0.6 0.9 1.6 2.2 3 4.1 4.8 3.4 3.6 0.1 0.1 0.2 0.3 0.3 0 1 1.6 2.2 4.3 8 5.2 4.5 0.2 0.2 0.2 0.3 0.3 0.4 0.7 0.8 0 3 5 4.8 4.6 0.2 0.2 0.3 0.3 0.4 0.5 0.7 0.9 1.2 2.8 4.1 4.5 4.5 20 Anthrax Distribution 1 UAB 21 Compartmental Modeling • How to Build a Stella Model • Simple Population Models • Generic Processes UAB • Advanced Population Models • Drug Assimilation • Epidemiology • System Stories 22 Population Model •Stella Model •Equations •Graphical Output Population(t) = Population(t - dt) + (Births Deaths) * dt INIT Population = 100000 {people} UAB INFLOWS: Births = Population*Fraction_That_Are_Female*Reprodu cing_Females*Births_per_Rep_Female {people/year} OUTFLOWS: Deaths = Population*Death_Fraction {people/year} Births_per_Rep_Female = 66/1000 {people/1000 rep females/year} Fraction_That_Are_Female = 0.5 {females/people} Reproducing_Females = .45 {rep females/female} Death_Fraction = GRAPH(Population) (120000, 0.01), (125000, 0.011), (130000, 0.013), (135000, 0.015), (140000, 0.017), (145000, 0.019), (150000, 0.02) 23 Generic Processes T yp ewrite rs i n ware ho use • Linear model with external resource • Exponential growth or decay model Emp lo ye es T yp ewrite rs ma de pe r e mpl o yee T em perature Cool ing cool i ng rate Weight • Convergence model weight gained weight gain per month UAB T yp ewrite rs ma de p er we ek weight lost weight loss rate 24 Calculus Example STELLA Diagram Stock X Flow 1 Flow is proportional to X. STELLA Equations: Constant a UAB Stock_X(t) = Stock_X(t - dt) + (Flow_1) * dt INIT Stock_X = 100 Flow_1 = Constant_a*Stock_X Constant_a = .1 25 Connecting the Discrete to the Continuous • Stock_X(t) = Stock_X(t - dt) + (Flow_1) * dt • (Stock_X(t) - Stock_X(t - dt))/dt = Flow_1 • Flow_1 = Constant_a*Stock_X(t – dt) • (X(t) - X(t - dt))/dt = a X(t - dt) • Let dt go to 0 • dX/dt = a X(t) (a Differential Equation) UAB 26 Solution to DE • • • • • • dX/dt = a X(t) dX/X(t) = a dt Integrate log (X(t)) = at + C X(t) = exp(C) exp(at) X(t) = X(0) exp(at) UAB 27 System Dynamics Stories and Projects System Dynamics Stories and Projects • Scenarios describing realistic situations to be modeled. • Fully independent work. • Construct model. • Write 5-10 page technical paper (template provided). UAB 29 Modeling a Dam 2 Boysen Dam UAB • Boysen Dam has several purposes: It "provides regulation of the streamflow for power generation, irrigation, flood control, sediment retention, fish propagation, and recreation development." The United States Bureau of Reclamation, the government agency that runs the dam, would like to have some way of predicting how much power will be generated by this dam under certain conditions. – Clinton Curry 30 Powe r Ge ne … Powe r Ge ne ra ted h ei gh t o f h ea dwate r Dam Ca pa ci ty T urb in e Flo w ~ Spi l l m od ifi er ~ ~ h ei gh t o f tai l water h ei gh t o f h ea dwate r Perce nt ful l Ri ver flo w Ini ti al val u es h ei gh t o f tai l water ~ T urb in e Flo w T ai l water ? Wa ter Vo l ume ~ T ai l water El im in ati on Spi l l wa y Fl o w ? T urb in e Cap acity Ri ver flo w T arg et Wate r ~ Vol u me Perce nt T en Ye ar Avera ge T arg et Wate r Hei g ht T urb in e mu l ti p li e r~ ~ Spi l l wa y Rel ea se Cap acity Cal cu l ati ng Sp il l … Spi l l m od ifi er Ini ti al Wate r Hei g ht Ma xi mu m He i gh t ~ ~ Ini ti al Wate r Vol u me Perce nt Mi n im um Hei g ht Mi n im um Hea d UAB Dam Ca pa ci ty ~ Wa ter Vo l ume T arg et Wate r Vol u me Perce nt 31 Boysen Dam UAB 32 Tot a l o rigina l Modeling a Smallpox Epidemic • One infected terrorist comes to town • How does the system handle the epidemic under different assumptions? – Alicia Wilson immu n e su p pr e ssed immu n e su p pr e ssed p ro b ab ility o f mo rt ality r at e c at c hing sma llp o x immu n e immu n e su p pr e ssed su p p re sse d h ave sma llpo x c ur re n t e xp o su r e immu n e su p pr e ssed immu n e su p pr e ssed mo rt ality d ea t hs p ro b ab ility c or re c tion immu n e su p pr e ssed immu n e su p pr e ssed Tot a l d e at h s h ave sma llpo x n ew ex p o su re s re c e nt ly n ew ex p o su re s va c c in at e d p er u n va c cina t ed h ave sma llpo x sick p e rso n immu n e su p pr e ssed su r viva l Unva cc in a te pd op u la tion Tot a l n e ve r in fe c te d p e op le mu ltiple ex p o su re g et ting sma llp o x p op u la tion Tot a l p e op le su r vivo rs wit h sma llp o x o ld er vac c in a te d n ew esp osu re s h ave sma llpo x p er vac c in a te d e xp o su r e u nva cc in a te d p ro b a bilit y p ro b ab ility o f c a tc h in g sma llpo x u nva cc in a te d u nva cc in a te d u nva cc in a te d Unva cc in a te d su sce p tible sick p e rso n d ea t h ra te immu n e su p pr e ssed h ave sma llpo x mo rt ality h ave sma llpo x u nva cc in a te d d ea t hs n ew ex p o su re s p er o ld e r va cc in a te d sick p e rso n u nva cc in a te d u nva cc in a te d g et ting sma llp o x va c c in at io n s Rec e n tly Vac c in a tio n su r vivo rs n ew ex p o su re s re c e nt ly va c c in at e d va c c in at e d va c c in at e d ra t e su r viva l re c e nt ly u nva cc in a te d p er immu n e su p p re sse d mo rt ality h ave sma llpo x Rec e n tly sick p e rso n va c c in at e d d ea t hs re c e nt ly va c c in at e d re c e nt ly g et ting sma llp o x Reva cc in a tion s p ro b ab ility o f ra t e re c e nt ly su r viva l e xp o su r e c at c hing sma llp o x p ro b ab ility o ld er vac c in a te d re vac c in a tio n re c e nt ly va c c in at e d va c c in at e d Rec e n t va cc in a tion o ld er h ave sma llpo x su r vivo rs va c c in at e d d ea t h ra te o ld er vac c in a te d mo rt ality o ld er vac c in a te d va c c in at e d d ea t hs o ld er vac c in a te d g et ting sma llp o x d ea t hs Rec e n tly su r vivo rs d ea t h ra te Unva cc in a te d u nva cc in a te d h ave sma llpo x su sce p tible re c e nt ly va c c in at e d d ea t hs o ld er vac c in a te d o ld er va c c in at e d su sce p tibilit y u nva cc in a te d o ld er vac c in a te d su r viva l o ld er vac c in a te d va c c in at e d Tot a l d e at h s h ave sma llpo x o ld er vac c in a te d d ea t hs o ld er vac c in a te d h ave sma llpo x Rec e n tly Tot a l p e op le va c c in at e d wit h sma llp o x Tot a l n e ve r in fe c te d p e op le o ld er va c c in at e d immu n e su p pr e ssed d ea t hs UAB immu n e su p pr e ssed immu n e h ave sma llpo x su p p re sse d 33