(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 39870, 1272]*) (*NotebookOutlinePosition[ 41405, 1330]*) (* CellTagsIndexPosition[ 41218, 1319]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Drug Dosages: Are They Effective? Are They Safe?", "Title", PageWidth->PaperWidth], Cell["\<\ Chapter 6, Section 4 (Chapter 5, Section 4 in Early Transcendentals)\ \>", "Text", PageWidth->PaperWidth, FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(Off[General::spell1]; Off[General::spell];\)], "Input", Editable->False, CellOpen->False, InitializationCell->True], Cell[CellGroupData[{ Cell["Introduction", "Section", PageWidth->PaperWidth], Cell[TextData[{ "OBJECTIVE: Use ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve differential equations related to drug concentrations in the \ blood when the drug is administered by a single injection, intravenously, or \ by periodic injections.\n\nYou will learn how a simple mathematical model and \ ", StyleBox["Mathematica", FontSlant->"Italic"], " can be used to regulate the concentration of a prescribed drug in the \ blood. You will use ", StyleBox["Mathematica", FontSlant->"Italic"], "'s differential equation solver to obtain solutions for the drug \ concentration in the blood when the drug is administered by a single \ injection, intravenously, or by a series of periodic injections. You will \ also develop drug dosage regimens to keep the concentration of the drug \ within the safe and effective concentration limits." }], "Text", PageWidth->PaperWidth], Cell[CellGroupData[{ Cell["Technology Guidelines", "Subsection", PageWidth->PaperWidth, CellDingbat->"\[LightBulb]"], Cell[TextData[{ StyleBox["NOTE: If you have just finished a module, restart ", CellFrame->True, Background->None], StyleBox["Mathematica", CellFrame->True, FontSlant->"Italic", Background->None], StyleBox[" before executing a new module.\nTO OPEN CELLS, put your cursor \ on the right cell bracket and double click.", CellFrame->True, Background->None], "\nINITIALIZATION CELLS\n\tWhen asked if you want to \". . . automatically \ evaluate all the initialization cells in the notebook . . . ,\" respond by \ pressing the \"Yes\" button.\nTO STOP AN EXECUTION\n\tSelect the ", StyleBox["Kernel", FontSlant->"Italic"], " pull-down menu and click on ", StyleBox["Abort Evaluation.\n", FontSlant->"Italic"], "ORDER OF EXECUTION\n\tExecute cells in the order given. Do not skip any \ Input cells within a given notebook.\nSAVING NOTEBOOKS\n\tYou can save \ anytime to any directory you choose, and it is wise to save often.\n\t \ However, before you do your final save, delete all your output by selecting \ the \n\t ", StyleBox["Delete All Output", FontSlant->"Italic"], " selection under the ", StyleBox["Kernel", FontSlant->"Italic"], " pull-down menu.\nEXPERIENCING MAJOR PROBLEMS\n\tSave if appropriate, and \ then shut down ", StyleBox["Mathematica", FontSlant->"Italic"], " and start it up again." }], "Text", PageWidth->PaperWidth] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Part I: A Single Dose", "Section", PageWidth->PaperWidth], Cell[CellGroupData[{ Cell["An Initial Value Problem and its Solution", "Subsection", PageWidth->PaperWidth], Cell[TextData[{ "When a certain drug is administered by injection, the body absorbs it \ quickly so that the concentration of the drug in the blood rises to a peak \ value shortly after the drug is given. At the same time, the kidneys work to \ remove the drug from the blood, and the rate of removal is proportional to \ the drug concentration in the blood. This process is modeled by the initial \ value problem ", Cell[BoxData[ FormBox[ RowBox[{ FractionBox[ StyleBox[ RowBox[{ StyleBox["d", FontWeight->"Bold"], StyleBox["c", FontSlant->"Italic"]}]], StyleBox[ RowBox[{ StyleBox["d", FontSlant->"Plain"], "t"}]]], "=", \(\(-k\)\ c\)}], TraditionalForm]]], " with ", Cell[BoxData[ FormBox[ RowBox[{\(c(0)\), "=", StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]]}], TraditionalForm]]], ", where ", Cell[BoxData[ \(TraditionalForm\`c(t)\)]], " is the drug concentration in the blood at time ", StyleBox["t", FontSlant->"Italic"], ", and ", Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]], TraditionalForm]]], " is the initial concentration when the injection is given at time ", Cell[BoxData[ \(TraditionalForm\`t = 0\)]], ". This model assumes that at the time of the injection, the drug is \ immediately absorbed into the blood.\n\nEven though we know that ", Cell[BoxData[ FormBox[ RowBox[{\(c(t)\), "=", RowBox[{ StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]], " ", \(e\^\(-kt\)\)}]}], TraditionalForm]]], " is the solution of the initial value problem, we will use ", StyleBox["Mathematica", FontSlant->"Italic"], "'s ", StyleBox["DSolve[ ] ", FontWeight->"Bold"], "command to obtain this solution." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{ \(\(Clear[c, k, c0];\)\), "\[IndentingNewLine]", \(soln = DSolve[{\(c'\)[t] \[Equal] \(-k\)*c[t], c[0] \[Equal] c0}, c[t], t]\)}], "Input", PageWidth->PaperWidth], Cell[BoxData[ \(soln = Flatten[soln]\)], "Input", PageWidth->PaperWidth], Cell[BoxData[ ButtonBox[ ButtonBox[ RowBox[{ StyleBox["\[MathematicaIcon]", FontSize->14, FontWeight->"Bold", FontColor->RGBColor[0.792981, 0.777356, 0.144533], FontVariations->{"CompatibilityType"->0}], StyleBox[" ", FontSize->14, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["About", FontSize->14, FontWeight->"Bold", FontColor->RGBColor[0.500008, 0, 0.500008]], StyleBox[" ", FontSize->14, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["Mathematica", FontSize->14, FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[0.500008, 0, 0.500008]]}], ButtonStyle->"Hyperlink"], ButtonData:>"h1", ButtonStyle->"Hyperlink"]], "Input", PageWidth->PaperWidth, Evaluatable->False, CellTags->"h1b"], Cell[TextData[{ "Now we can form a function, ", StyleBox["c[t_]", FontWeight->"Bold"], ", by using the rule from the solution of the initial value problem to \ substitute the solution ", Cell[BoxData[ \(c0\ \[ExponentialE]\^\(\(-k\)\ t\)\)]], " for the expression ", StyleBox["c[t]", FontWeight->"Bold"], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(c[t_] = c[t] /. soln\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "The last command effectively replaces ", StyleBox["c[t]", FontWeight->"Bold"], " with ", Cell[BoxData[ \(c0\ \[ExponentialE]\^\(\(-k\)\ t\)\)]], " and assigns it to a redefined function, ", StyleBox["c[t_]", FontWeight->"Bold"], "." }], "Text", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ "Determining ", StyleBox["k", FontSlant->"Italic"], " and Plotting Concentrations" }], "Subsection", PageWidth->PaperWidth], Cell[TextData[{ "One hour after the drug is injected, a blood test from a particular \ patient shows that the drug concentration in the blood drops to 80% of its \ initial concentration. From this information, we can determine the value of \ ", StyleBox["k", FontSlant->"Italic"], " for this patient. We do this by setting ", StyleBox["c[t]", FontWeight->"Bold"], " equal to ", Cell[BoxData[ FormBox[ RowBox[{"0.80", StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]]}], TraditionalForm]]], " at ", Cell[BoxData[ \(TraditionalForm\`t = 1\)]], " hour, and solving for ", StyleBox["k", FontSlant->"Italic"], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(ksoln = Solve[c[1] \[Equal] 0.80*c0, k]\)], "Input", PageWidth->PaperWidth], Cell[BoxData[ ButtonBox[ ButtonBox[ RowBox[{ StyleBox["\[MathematicaIcon]", FontSize->14, FontWeight->"Bold", FontColor->RGBColor[0.792981, 0.777356, 0.144533], FontVariations->{"CompatibilityType"->0}], StyleBox[" ", FontSize->14, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["About", FontSize->14, FontWeight->"Bold", FontColor->RGBColor[0.500008, 0, 0.500008]], StyleBox[" ", FontSize->14, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["Mathematica", FontSize->14, FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[0.500008, 0, 0.500008]]}], ButtonStyle->"Hyperlink"], ButtonData:>"h2", Active->True, ButtonStyle->"Hyperlink"]], "Input", PageWidth->PaperWidth, Evaluatable->False, CellTags->{"h1b", "h2b"}], Cell[BoxData[ \(ksoln = Flatten[ksoln]\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Let's redefine ", StyleBox["c[t_]", FontWeight->"Bold"], ", substituting the value for ", StyleBox["k", FontSlant->"Italic"], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(c[t_] = c[t] /. ksoln\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Suppose an injection of the drug raises the concentration to 3 milligrams \ per liter, and then the concentration decays as time progresses. Let's plot \ the solution, substituting 3 mg/l for ", Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]], TraditionalForm]]], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(\(Plot[c[t] /. c0 \[Rule] 3, {t, 0, 24}, PlotRange \[Rule] {0, 3}, PlotStyle \[Rule] {RGBColor[0, 0, 1]}, AxesLabel \[Rule] {"\", "\"}];\)\)], "Input", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell["How Long is the Drug Effective?", "Subsection", PageWidth->PaperWidth], Cell["\<\ This particular drug is effective only when the drug concentration in the \ blood is above 1 mg/l. Let's plot the drug concentration together with the \ effective threshold concentration.\ \>", "Text", PageWidth->PaperWidth], Cell[BoxData[ RowBox[{ RowBox[{"Plot", "[", RowBox[{\({1, c[t] /. c0 \[Rule] 3}\), ",", RowBox[{"{", RowBox[{"t", ",", StyleBox["0", FontColor->RGBColor[1, 0, 0]], StyleBox[",", FontColor->RGBColor[1, 0, 0]], StyleBox["24", FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", \(PlotRange \[Rule] {0, 3}\), ",", \(PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[0, 0, 1]}\), ",", \(AxesLabel \[Rule] {"\", "\"}\)}], "]"}], ";"}]], "Input", PageWidth->PaperWidth], Cell["\<\ From the graph, can you estimate how long after the injection the drug will \ be effective for this patient?\ \>", "Text", PageWidth->PaperWidth], Cell[TextData[{ "We can determine exactly how long after an injection the drug will be \ effective, assuming no other injections are given. We do this by finding the \ time when ", Cell[BoxData[ \(TraditionalForm\`c(t)\)]], " reaches 1 mg/l." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(teff = Solve[\((c[t] /. c0 \[Rule] 3)\) \[Equal] 1, t]\)], "Input", PageWidth->PaperWidth], Cell["\<\ This solution indicates that the drug will be effective for about 4 hours and \ 55 minutes after the patient receives an injection that boosts the drug \ concentration in the blood to 3 mg/l.\ \>", "Text", PageWidth->PaperWidth] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["You Try It: On Another Patient", "Section", PageWidth->PaperWidth], Cell[TextData[{ "Another patient needs the same drug. A blood test on this new patient \ shows that after 1 hour, the drug concentration in the blood drops to 72% of \ the concentration right after the injection was given. \n\n1. Determine the \ function that gives the drug concentration in the blood, ", StyleBox["t", FontSlant->"Italic"], " hours after the injection is given. To assist you, we have copied the \ commands you need in the following cell. Change the items that are \ highlighted in red." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{\(Clear[c, k, c0, soln, ksoln];\), "\n", \(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] \(-k\)*c[t], c[0] \[Equal] c0}, c[t], t]];\), "\n", \(c[t_] = c[t] /. soln;\), "\n", RowBox[{ RowBox[{"ksoln", "=", RowBox[{"Flatten", "[", RowBox[{"Solve", "[", RowBox[{ RowBox[{\(c[1]\), "\[Equal]", RowBox[{ StyleBox["0.80", FontColor->RGBColor[1, 0, 0]], "*", "c0"}]}], ",", "k"}], "]"}], "]"}]}], ";"}], "\n", \(c[t_] = c[t] /. ksoln\)}], "Input",\ PageWidth->PaperWidth], Cell[TextData[{ "2. For the new patient, determine the initial drug concentration, ", Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]], TraditionalForm]]], ", so that the drug will remain effective for 5 hours. Assume that the \ effectiveness threshold is 1 mg/l." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ RowBox[{ StyleBox["teff", FontColor->RGBColor[1, 0, 0]], "=", RowBox[{"Flatten", "[", RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{\(c[t]\), "/.", StyleBox[\(c0 -> 3\), FontColor->RGBColor[1, 0, 0]]}], ")"}], "\[Equal]", "1"}], ",", StyleBox["t", FontColor->RGBColor[1, 0, 0]]}], "]"}], "]"}]}]], "Input", PageWidth->PaperWidth], Cell[TextData[{ "3. Plot ", StyleBox["c[t]", FontWeight->"Bold"], " using the value for ", StyleBox["c0 ", FontWeight->"Bold"], "that you found in step 2." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ RowBox[{ RowBox[{"Plot", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", RowBox[{\(c[t]\), "/.", RowBox[{ StyleBox["c0", FontColor->GrayLevel[0]], StyleBox["\[Rule]", FontColor->GrayLevel[0]], StyleBox["3", FontColor->RGBColor[1, 0, 0]]}]}]}], "}"}], ",", \({t, 0, 24}\), ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", StyleBox["3", FontColor->RGBColor[1, 0, 0]]}], "}"}]}], ",", \(PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[0, 0, 1]}\), ",", \(AxesLabel \[Rule] {"\", "\"}\)}], "]"}], ";"}]], "Input", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell["Part II: Intravenous Dosage", "Section", PageWidth->PaperWidth], Cell["\<\ Sometimes it is desirable to maintain a constant concentration of the drug in \ the blood. This can be accomplished with intravenous (IV) injection. In this \ case, the drug is continuously fed into the bloodstream at a constant rate. \ We will modify the initial value problem in Part I to model intravenous \ administration of the drug.\ \>", "Text", PageWidth->PaperWidth], Cell[CellGroupData[{ Cell["A Model for Intravenous Dosage", "Subsection", PageWidth->PaperWidth], Cell[TextData[{ "The rate of change of the drug concentration in the blood is the \ difference between the rate at which the drug concentration increases in the \ blood due to the IV, and the rate at which it is removed by the kidneys. That \ is, ", Cell[BoxData[ FormBox[ RowBox[{ FractionBox[ StyleBox[ RowBox[{ StyleBox["d", FontWeight->"Bold"], StyleBox["c", FontSlant->"Italic"]}]], StyleBox[ RowBox[{ StyleBox["d", FontSlant->"Plain"], "t"}]]], "=", \((rate\ of\ increase\ due\ to\ IV - rate\ of\ decrease\ due\ to\ kidneys)\)}], TraditionalForm]]], ". We assume that for IV administration of the drug, the rate of increase \ in the concentration of the drug due to the IV is constant and, as before, \ that the rate of removal is proportional to the concentration. Therefore, ", Cell[BoxData[ FormBox[ RowBox[{ FractionBox[ StyleBox[ RowBox[{ StyleBox["d", FontWeight->"Bold"], StyleBox["c", FontSlant->"Italic"]}]], StyleBox[ RowBox[{ StyleBox["d", FontSlant->"Plain"], "t"}]]], "=", \(r - k\ c\)}], TraditionalForm]]], ", where ", StyleBox["r", FontSlant->"Italic"], " is the constant rate of increase in the drug concentration due to the IV \ and ", StyleBox["kc", FontSlant->"Italic"], " is the rate at which the kidneys reduce the concentration. For IV \ administration, we will assume that the initial concentration is 0, that is, \ ", Cell[BoxData[ \(TraditionalForm\`c(0) = 0\)]], ". Now we can solve the initial value problem." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{ \(\(Clear[c, k, soln];\)\), "\[IndentingNewLine]", \(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] r - k*c[t], c[0] \[Equal] 0}, c[t], t] // Simplify]\)}], "Input", PageWidth->PaperWidth], Cell[BoxData[ \(c[t_] = Collect[soln[\([1, 2]\)], E^\((\(-k\)\ t)\)]\)], "Input", PageWidth->PaperWidth], Cell[BoxData[ ButtonBox[ ButtonBox[ RowBox[{ StyleBox["\[MathematicaIcon]", FontSize->18, FontWeight->"Bold", FontColor->RGBColor[0.792981, 0.777356, 0.144533], FontVariations->{"CompatibilityType"->0}], StyleBox[" ", FontSize->14, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["About", FontSize->14, FontWeight->"Bold", FontColor->RGBColor[0.500008, 0, 0.500008]], StyleBox[" ", FontSize->14, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["Mathematica", FontSize->14, FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[0.500008, 0, 0.500008]]}], ButtonStyle->"Hyperlink"], ButtonData:>"h3", ButtonStyle->"Hyperlink"]], "Input", PageWidth->PaperWidth, Evaluatable->False, CellTags->"h3b"] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ "The Steady-State Concentration, ", Cell[BoxData[ \(TraditionalForm\`c(\[Infinity])\)]] }], "Subsection", PageWidth->PaperWidth], Cell[TextData[{ "What does ", Cell[BoxData[ \(TraditionalForm\`c(t)\)]], " approach as ", Cell[BoxData[ \(TraditionalForm\`t \[Rule] \[Infinity]\)]], ", if ", StyleBox["k", FontSlant->"Italic"], " is a positive constant? The limiting value is often called the steady \ state or equilibrium solution and is denoted by ", Cell[BoxData[ \(TraditionalForm\`c(\[Infinity])\)]], ". You can also obtain this value by setting ", Cell[BoxData[ FormBox[ RowBox[{ FractionBox[ StyleBox[ RowBox[{ StyleBox["d", FontWeight->"Bold"], StyleBox["c", FontSlant->"Italic"]}]], StyleBox[ RowBox[{ StyleBox["d", FontSlant->"Plain"], "t"}]]], "=", "0"}], TraditionalForm]]], " in the differential equation and solving for ", StyleBox["c", FontSlant->"Italic"], ". What do you get for the steady-state solution when you find it the \ second way? Is it the same result that you obtained by taking the limit ", "of ", Cell[BoxData[ \(TraditionalForm\`c(t)\)]], " as ", Cell[BoxData[ \(TraditionalForm\`t \[Rule] \[Infinity]\)]], "?", "\n\nAssuming that the patient is the same person as in Part I, so that the \ ", StyleBox["k ", FontSlant->"Italic"], "value is the same, that is, ", Cell[BoxData[ \(TraditionalForm\`k = 0.223144\)]], ",", " and assuming that the rate of increase in the drug concentration due to \ the IV is 1.0 ", Cell[BoxData[ \(TraditionalForm\`\(mg/l\)\/hour\)]], ", we can plot the solution for ", Cell[BoxData[ \(TraditionalForm\`c(t)\)]], ", substituting these values for ", StyleBox["r", FontSlant->"Italic"], " and ", StyleBox["k", FontSlant->"Italic"], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(\(Plot[{1, c[t] /. {r \[Rule] 1.0, k \[Rule] 0.223144}}, {t, 0, 24}, AxesLabel \[Rule] {"\", "\"}, PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[0, 0, 1]}];\)\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Using the rules ", Cell[BoxData[ FormBox[ RowBox[{ StyleBox["{", FontWeight->"Bold"], RowBox[{ RowBox[{ StyleBox["r", FontWeight->"Bold", FontSlant->"Plain"], StyleBox["\[Rule]", FontWeight->"Bold"], StyleBox["1.0", FontWeight->"Bold"]}], StyleBox[",", FontWeight->"Bold"], StyleBox[" ", FontWeight->"Bold"], RowBox[{ StyleBox["k", FontWeight->"Bold", FontSlant->"Plain"], StyleBox["\[Rule]", FontWeight->"Bold"], StyleBox["0.223144", FontWeight->"Bold"]}]}], StyleBox["}", FontWeight->"Bold"]}], TraditionalForm]]], " to substitute values for the parameters ", StyleBox["r", FontSlant->"Italic"], " and ", StyleBox["k,", FontSlant->"Italic"], " as we did in the preceding plot command, is useful when we want to \ preserve the general form of ", StyleBox["c[t]", FontWeight->"Bold"], ". This way we can substitute other values into the general solution \ without having to redefine the function ", StyleBox["c[t]", FontWeight->"Bold"], ". We check to see that the general form of ", StyleBox["c[t]", FontWeight->"Bold"], " is preserved. " }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(c[t]\)], "Input", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell["How Long Does it Take to be Effective?", "Subsection", PageWidth->PaperWidth], Cell["\<\ Next, we determine how long it takes the drug concentration in the blood to \ reach the effective threshold value of 1 mg/l.\ \>", "Text", PageWidth->PaperWidth], Cell[BoxData[ \(Solve[\((c[t] /. {r \[Rule] 1.0, k \[Rule] 0.223144})\) \[Equal] 1, t]\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "It takes over an hour for the drug to become effective. One way to reduce \ this time is to administer a loading dose by injection at ", Cell[BoxData[ \(TraditionalForm\`t = 0\)]], ". This instantly brings the drug concentration in the blood to 1mg/l, and \ then the IV is started. The differential equation model is the same as for IV \ administration without a loading dose, but the initial condition is \ different." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{ \(\(Clear[c, k, soln];\)\), "\[IndentingNewLine]", \(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] r - k*c[t], c[0] \[Equal] 1}, c[t], t] // Simplify]\)}], "Input", PageWidth->PaperWidth], Cell[BoxData[ \(c[t_] = Collect[soln[\([1, 2]\)], E^\((\(-k\)\ t)\)]\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Let's plot ", StyleBox["c[t]", FontWeight->"Bold"], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(\(Plot[{1, c[t] /. {r \[Rule] 1.0, k \[Rule] 0.223144}}, {t, 0, 24}, AxesLabel \[Rule] {"\", "\"}, PlotRange \[Rule] {0, 5}, PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[0, 0, 1]}];\)\)], "Input", PageWidth->PaperWidth] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["You Try It: Is the Dosage Safe?", "Section", PageWidth->PaperWidth], Cell[TextData[{ "The drug is effective provided its concentration in the blood is above 1 \ mg/l, however, if the concentration exceeds 3 mg/l, the patient will have \ serious side effects from the drug. Consequently, the dosage prescriptions in \ Part II are unsafe for the patient.\n\n1. Modify the drug dosage prescription \ so that the concentration is always above the effective threshold and the \ steady-state concentration is halfway between the safe and effective \ threshold values, and plot ", StyleBox["c[t]", FontWeight->"Bold"], " over 24 hours. First use trial and error, and then use the analytic \ solution for the steady-state concentration to determine the correct value \ for ", StyleBox["r", FontSlant->"Italic"], ". To assist you we have copied the commands that you need in the following \ input cell. Change the items that are highlighted in red." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{\(Clear[c, k, soln];\), "\n", RowBox[{ RowBox[{"rvalue", "=", StyleBox["1.0", FontColor->RGBColor[1, 0, 0]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"kvalue", "=", StyleBox["0.223144", FontColor->RGBColor[1, 0, 0]]}], ";"}], "\[IndentingNewLine]", \(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] r - k*c[t], c[0] \[Equal] 1}, c[t], t] // Simplify];\), "\[IndentingNewLine]", \(c[t_] = Collect[soln[\([1, 2]\)], E^\((\(-k\)\ t)\)];\), "\[IndentingNewLine]", \(Print["\", c[t] /. {r \[Rule] rvalue, k \[Rule] kvalue}];\), "\[IndentingNewLine]", \(Print["\", rvalue/kvalue];\), "\n", RowBox[{\(Plot[{1, 3, c[t] /. {r \[Rule] rvalue, k \[Rule] kvalue}}, {t, 0, 24}, AxesLabel \[Rule] {"\", "\"}, PlotRange \[Rule] {0, 5}, PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[1, 0, 0], RGBColor[0, 0, 1]}];\), "\[IndentingNewLine]"}]}], "Input", PageWidth->PaperWidth], Cell["\<\ 2. Repeat exercise 1 for the other patient from You Try It: Part I.\ \>", "Text", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell["Part III: Maintenance Dosages at Discrete Time Intervals", "Section", PageWidth->PaperWidth], Cell[TextData[{ "An alternative method for administering the drug is to give periodic \ injections to maintain a safe and effective drug concentration in the blood. \ Again, we assume that the drug is completely absorbed as soon as it is \ administered and that the kidneys reduce the drug concentration at a rate \ proportional to the concentration ", StyleBox["c", FontSlant->"Italic"], ". The differential equation model is ", Cell[BoxData[ FormBox[ RowBox[{ FractionBox[ StyleBox[ RowBox[{ StyleBox["d", FontWeight->"Bold"], StyleBox["c", FontSlant->"Italic"]}]], StyleBox[ RowBox[{ StyleBox["d", FontSlant->"Plain"], "t"}]]], "=", \(\(-k\)\ c + d(t)\)}], TraditionalForm]]], ", where ", Cell[BoxData[ \(TraditionalForm\`d(t)\)]], " is the rate of increase in the drug concentration due to administration \ of the drug. The initial condition is the concentration of the drug in the \ blood at ", Cell[BoxData[ \(TraditionalForm\`t = 0\)]], ". If there is no loading dosage, then ", Cell[BoxData[ \(TraditionalForm\`c(0) = 0\)]], ", but if a loading dose of ", StyleBox["c", FontSlant->"Italic"], "0 is given, then ", Cell[BoxData[ FormBox[ RowBox[{\(c(0)\), "=", StyleBox[ RowBox[{ StyleBox["c", FontSlant->"Italic"], "0"}]]}], TraditionalForm]]], "." }], "Text", PageWidth->PaperWidth], Cell["\<\ First, we specify a maintenance dosage that we will administer \ periodically.\ \>", "Text", PageWidth->PaperWidth], Cell[BoxData[ \(\(maintenancedose = 2.0;\)\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Next, we use a special mathematical function called the Dirac delta to \ model the periodic injections. The Dirac delta allows us to increase the drug \ concentration in the blood by a finite amount at specified times. In the next \ cell, we show how to use the Dirac delta to model giving a maintenance dosage \ at ", StyleBox["t", FontSlant->"Italic"], " = 4 hour and then again at ", Cell[BoxData[ \(TraditionalForm\`t = 8\)]], " hours." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(dosageschedule = maintenancedose*DiracDelta[t - 4] + maintenancedose*DiracDelta[t - 8]\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Now we solve the initial value problem to determine the drug concentration \ in the blood as a function of time. We will take the loading dosage to be \ 2.0, the same as the maintenance dosage, and replace ", Cell[BoxData[ \(TraditionalForm\`d(t)\)]], " in the differential equation with ", StyleBox["dosageschedule ", FontWeight->"Bold"], "." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{ \(\(Clear[c, k];\)\), "\[IndentingNewLine]", \(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] \(-k\)*c[t] + dosageschedule, c[0] \[Equal] maintenancedose}, c[t], t]]\)}], "Input", PageWidth->PaperWidth], Cell[TextData[{ "The ", StyleBox["UnitStep[ ]", FontWeight->"Bold"], " function that appears in the solution is another special mathematical \ function. It acts like an \"on-off\" switch. The function ", StyleBox["UnitStep[t, a]", FontWeight->"Bold"], " has a value of 0 when ", Cell[BoxData[ \(TraditionalForm\`t < a\)]], ", and a value of 1 when ", Cell[BoxData[ \(TraditionalForm\`t \[GreaterEqual] a\)]], ". The unit step function is also called the Heaviside step function.\n\n\ Next, we redefine ", StyleBox["c[t_]", FontWeight->"Bold"], " and plot the solution." }], "Text", PageWidth->PaperWidth], Cell[BoxData[ \(c[t_] = c[t] /. soln\)], "Input", PageWidth->PaperWidth], Cell[BoxData[ \(\(Plot[{1, 3, c[t] /. k \[Rule] kvalue}, {t, 0, 24}, AxesLabel \[Rule] {"\", "\"}, PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[1, 0, 0], RGBColor[0, 0, 1]}];\)\)], "Input", PageWidth->PaperWidth], Cell[TextData[{ "Now we use the Dirac delta and the ", StyleBox["Sum[ ] ", FontWeight->"Bold"], "command to build a dosage maintenance schedule to use as an input function \ for the differential equation. It is apparent that the previous schedule fell \ outside the safe and effective range, so we will try something different. We \ will try 2.5 mg/l every 6 hours." }], "Text", PageWidth->PaperWidth], Cell[BoxData[{ \(\(maintenancedose = 2.5;\)\), "\n", \(\(deltat = 6;\)\), "\n", \(\(dosageschedule = Sum[maintenancedose*DiracDelta[t - n*deltat], {n, 1, 24/deltat}];\)\), "\n", \(\(Clear[c, k];\)\), "\n", \(\(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] \(-k\)*c[t] + dosageschedule, c[0] \[Equal] maintenancedose}, c[t], t]];\)\), "\n", \(\(c[t_] = c[t] /. soln;\)\), "\n", \(\(Plot[{1, 3, c[t] /. {r \[Rule] rvalue, k \[Rule] kvalue}}, {t, 0, 24}, AxesLabel \[Rule] {"\", "\"}, PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[1, 0, 0], RGBColor[0, 0, 1]}];\)\)}], "Input", PageWidth->PaperWidth], Cell["Well, that didn't work either.", "Text", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell["You Try It: Safe and Effective Drug Dosage", "Section", PageWidth->PaperWidth], Cell["\<\ 1. Try to build a drug dosage schedule that keeps the drug concentration in \ the safe and effective range, that is, between 1.0 and 3.0, and that \ maximizes patient comfort at the same time. We have copied the commands that \ you will need in the next cell. Change the items that are highlighted in red.\ \ \>", "Text", PageWidth->PaperWidth], Cell[BoxData[{ RowBox[{ RowBox[{"maintenancedosage", "=", StyleBox["2.5", FontColor->RGBColor[1, 0, 0]]}], ";"}], "\n", RowBox[{ RowBox[{"deltat", "=", StyleBox["6", FontColor->RGBColor[1, 0, 0]]}], ";"}], "\n", \(dosageschedule = Sum[maintenancedosage*DiracDelta[t - n*deltat], {n, 1, 24/deltat}]\), "\n", \(Clear[c, k];\), "\n", \(soln = Flatten[DSolve[{\(c'\)[t] \[Equal] \(-k\)*c[t] + dosageschedule, c[0] \[Equal] maintenancedosage}, c[t], t]]\), "\n", \(c[t_] = c[t] /. soln;\), "\n", \(Plot[{1, 3, c[t] /. {r \[Rule] rvalue, k \[Rule] kvalue}}, {t, 0, 24}, AxesLabel \[Rule] {"\", "\"}, PlotStyle \[Rule] {RGBColor[0, 1, 0], RGBColor[1, 0, 0], RGBColor[0, 0, 1]}];\)}], "Input", PageWidth->PaperWidth], Cell["\<\ 2. The Dirac delta function and the Heaviside step function are very useful \ in many science and engineering applications. Research more about them, and \ write a one or two page report summarizing what you find.\ \>", "Text", PageWidth->PaperWidth] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["\[MathematicaIcon]", FontWeight->"Bold", FontColor->RGBColor[0.792981, 0.777356, 0.144533], FontVariations->{"CompatibilityType"->0}], StyleBox[" ", FontWeight->"Bold", FontSlant->"Italic"], StyleBox["About", FontWeight->"Bold", FontColor->RGBColor[0.500008, 0, 0.500008]], StyleBox[" ", FontWeight->"Bold", FontSlant->"Italic"], StyleBox["Mathematica", FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[0.500008, 0, 0.500008]] }], "Section", PageWidth->PaperWidth, CellDingbat->None], Cell[TextData[{ "The ", StyleBox["Flatten[ ] ", FontWeight->"Bold"], "command removes the inner curly brackets from a list. We do this so that \ the solution is in the form of a rule inside a set of single curly brackets, \ and we can use this for substitutions in later expressions. The double curly \ brackets will not work as a list of rules. To learn more about the ", StyleBox["Flatten[ ] ", FontWeight->"Bold"], "command, pull down the Help menu, select the Help Browser, and type ", StyleBox["Flatten", FontWeight->"Bold"], ". To learn more about rules, refer to the Overview of ", StyleBox["Mathematica", FontSlant->"Italic"], " module included with this supplement or go to the Help Browser and type \ ", StyleBox["Rule", FontWeight->"Bold"], ". ", ButtonBox["Go Back.", ButtonData:>"h1b", ButtonStyle->"Hyperlink"] }], "Text", PageWidth->PaperWidth, CellTags->"h1"], Cell[TextData[{ "The error message that displays when you execute the ", StyleBox["Solve[ ]", FontWeight->"Bold"], " command is to warn you that whenever ", StyleBox["Mathematica", FontSlant->"Italic"], " uses inverse functions to solve an equation there may be some solutions \ that are missed. A good example of this is the equation ", Cell[BoxData[ \(TraditionalForm\`sin\ x = 1\)]], ". ", StyleBox["Mathematica", FontSlant->"Italic"], " will use the inverse sine function to solve this equation, giving ", StyleBox["x", FontSlant->"Italic"], " = ", Cell[BoxData[ \(TraditionalForm\`\[Pi]\/2\)]], " (with the same warning message). We all know, however, that the equation \ actually has infinitely many solutions. They are", Cell[BoxData[ \(TraditionalForm\`\(\(\ \)\(x\ = \ \((4 n + 1)\)\)\)\)]], Cell[BoxData[ \(TraditionalForm\`\[Pi]\/2\)]], ", where n can be any integer. You might try using ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve ", Cell[BoxData[ \(TraditionalForm\`sin\ x = 1\)]], ". ", ButtonBox["Go Back.", ButtonData:>"h9b", ButtonStyle->"Hyperlink"] }], "Text", PageWidth->PaperWidth, CellTags->"h9"], Cell[TextData[{ "The ", StyleBox["Collect[ ] ", FontWeight->"Bold"], "command in the preceding cell collects together all of the terms that \ include like powers of ", Cell[BoxData[ \(TraditionalForm\`e\^\(-kt\)\)]], " as factors. To learn more about the ", StyleBox["Collect[ ]", FontWeight->"Bold"], " command, pull down the Help menu, select the Help Browser, and type ", StyleBox["Collect", FontWeight->"Bold"], ". ", ButtonBox["Go Back.", ButtonData:>"h3b", ButtonStyle->"Hyperlink"] }], "Text", PageWidth->PaperWidth, CellTags->"h3"] }, Closed]] }, Open ]] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, AutoGeneratedPackage->None, WindowSize->{760, 534}, WindowMargins->{{2, Automatic}, {Automatic, 5}}, PrintingCopies->1, PrintingPageRange->{4, 4} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{ "h1b"->{ Cell[7355, 228, 1010, 31, 41, "Input", Evaluatable->False, CellTags->"h1b"], Cell[10197, 337, 1039, 32, 41, "Input", Evaluatable->False, CellTags->{"h1b", "h2b"}]}, "h2b"->{ Cell[10197, 337, 1039, 32, 41, "Input", Evaluatable->False, CellTags->{"h1b", "h2b"}]}, "h3b"->{ Cell[20270, 656, 1010, 31, 44, "Input", Evaluatable->False, CellTags->"h3b"]}, "h1"->{ Cell[37076, 1180, 931, 26, 128, "Text", CellTags->"h1"]}, "h9"->{ Cell[38010, 1208, 1240, 38, 134, "Text", CellTags->"h9"]}, "h3"->{ Cell[39253, 1248, 589, 20, 71, "Text", CellTags->"h3"]} } *) (*CellTagsIndex CellTagsIndex->{ {"h1b", 40541, 1291}, {"h2b", 40749, 1298}, {"h3b", 40864, 1302}, {"h1", 40969, 1306}, {"h9", 41047, 1309}, {"h3", 41126, 1312} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1739, 51, 90, 1, 150, "Title"], Cell[1832, 54, 155, 5, 37, "Text"], Cell[1990, 61, 141, 4, 19, "Input", CellOpen->False, InitializationCell->True], Cell[CellGroupData[{ Cell[2156, 69, 56, 1, 53, "Section"], Cell[2215, 72, 910, 20, 185, "Text"], Cell[CellGroupData[{ Cell[3150, 96, 99, 2, 47, "Subsection"], Cell[3252, 100, 1413, 36, 299, "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[4714, 142, 65, 1, 33, "Section"], Cell[CellGroupData[{ Cell[4804, 147, 88, 1, 47, "Subsection"], Cell[4895, 150, 2169, 65, 207, "Text"], Cell[7067, 217, 204, 5, 50, "Input"], Cell[7274, 224, 78, 2, 30, "Input"], Cell[7355, 228, 1010, 31, 41, "Input", Evaluatable->False, CellTags->"h1b"], Cell[8368, 261, 373, 13, 52, "Text"], Cell[8744, 276, 78, 2, 30, "Input"], Cell[8825, 280, 314, 12, 52, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[9176, 297, 151, 6, 48, "Subsection"], Cell[9330, 305, 764, 26, 90, "Text"], Cell[10097, 333, 97, 2, 30, "Input"], Cell[10197, 337, 1039, 32, 41, "Input", Evaluatable->False, CellTags->{"h1b", "h2b"}], Cell[11239, 371, 80, 2, 30, "Input"], Cell[11322, 375, 201, 9, 33, "Text"], Cell[11526, 386, 79, 2, 30, "Input"], Cell[11608, 390, 414, 12, 52, "Text"], Cell[12025, 404, 232, 4, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[12294, 413, 78, 1, 47, "Subsection"], Cell[12375, 416, 236, 5, 52, "Text"], Cell[12614, 423, 649, 16, 70, "Input"], Cell[13266, 441, 157, 4, 52, "Text"], Cell[13426, 447, 291, 8, 52, "Text"], Cell[13720, 457, 112, 2, 30, "Input"], Cell[13835, 461, 240, 5, 52, "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[14124, 472, 74, 1, 33, "Section"], Cell[14201, 475, 552, 11, 147, "Text"], Cell[14756, 488, 625, 14, 110, "Input"], Cell[15384, 504, 393, 11, 52, "Text"], Cell[15780, 517, 527, 15, 30, "Input"], Cell[16310, 534, 210, 9, 33, "Text"], Cell[16523, 545, 885, 23, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[17445, 573, 71, 1, 33, "Section"], Cell[17519, 576, 387, 7, 90, "Text"], Cell[CellGroupData[{ Cell[17931, 587, 77, 1, 47, "Subsection"], Cell[18011, 590, 1911, 53, 191, "Text"], Cell[19925, 645, 229, 5, 90, "Input"], Cell[20157, 652, 110, 2, 30, "Input"], Cell[20270, 656, 1010, 31, 44, "Input", Evaluatable->False, CellTags->"h3b"] }, Closed]], Cell[CellGroupData[{ Cell[21317, 692, 156, 5, 47, "Subsection"], Cell[21476, 699, 1918, 65, 194, "Text"], Cell[23397, 766, 269, 5, 70, "Input"], Cell[23669, 773, 1504, 49, 90, "Text"], Cell[25176, 824, 62, 2, 30, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[25275, 831, 85, 1, 47, "Subsection"], Cell[25363, 834, 173, 4, 52, "Text"], Cell[25539, 840, 135, 3, 30, "Input"], Cell[25677, 845, 485, 10, 90, "Text"], Cell[26165, 857, 229, 5, 90, "Input"], Cell[26397, 864, 110, 2, 30, "Input"], Cell[26510, 868, 119, 6, 33, "Text"], Cell[26632, 876, 304, 6, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[26985, 888, 75, 1, 33, "Section"], Cell[27063, 891, 926, 18, 185, "Text"], Cell[27992, 911, 1172, 24, 290, "Input"], Cell[29167, 937, 116, 3, 33, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[29320, 945, 100, 1, 33, "Section"], Cell[29423, 948, 1604, 48, 150, "Text"], Cell[31030, 998, 127, 4, 33, "Text"], Cell[31160, 1004, 84, 2, 30, "Input"], Cell[31247, 1008, 514, 13, 90, "Text"], Cell[31764, 1023, 160, 4, 50, "Input"], Cell[31927, 1029, 417, 11, 71, "Text"], Cell[32347, 1042, 243, 5, 110, "Input"], Cell[32593, 1049, 652, 20, 109, "Text"], Cell[33248, 1071, 78, 2, 30, "Input"], Cell[33329, 1075, 272, 5, 90, "Input"], Cell[33604, 1082, 413, 9, 90, "Text"], Cell[34020, 1093, 730, 15, 270, "Input"], Cell[34753, 1110, 71, 1, 33, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[34861, 1116, 86, 1, 33, "Section"], Cell[34950, 1119, 356, 7, 71, "Text"], Cell[35309, 1128, 879, 18, 310, "Input"], Cell[36191, 1148, 262, 5, 71, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[36490, 1158, 583, 20, 33, "Section"], Cell[37076, 1180, 931, 26, 128, "Text", CellTags->"h1"], Cell[38010, 1208, 1240, 38, 134, "Text", CellTags->"h9"], Cell[39253, 1248, 589, 20, 71, "Text", CellTags->"h3"] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)