Chapter 1

Blood Alcohol Project

In this section we create the blood alcohol analysis.

Initial six-pack consumption situation:

That's a relatively unrealistic scenario, but it's equivalent to someone coming in with six beers worth of alcohol in him (which is far more frequent, I'm sure).

Clear[pop,n,Years];
Minutes=420;
prop=.68;

pounds=180;
kilos=pounds/2.2046;

(* kilos=80; *)
kilos=80;

fluids=prop*kilos;
alcoholinit=6*13.6;

pop[0]=alcoholinit;

step[n_] := If[n > 0, 1, -1]
in[n_]:=0;
out[n_]:=12;
dt=1/60;

pop[n_]:=pop[n]=pop[n-1]+(in[n-1]-out[n-1])*dt;

BA=Table[{n,.8},{n,0,Minutes}];
BAC=Table[{n,pop[n]/fluids},{n,0,Minutes}];

(* BAC//TableForm *)

pBA=ListPlot[BA,PlotJoined->True,AxesLabel->{"Minutes", "BAC"}, PlotStyle->Thickness[0.005]]
pBAC=ListPlot[BAC,PlotJoined->True,AxesLabel->{"Minutes", "BAC"}, PlotStyle->Thickness[0.01]]
Show[pBA,pBAC];

six-pack consumption over an hour:

Clear[pop,n,Years];
Minutes=420;
prop=.68;

pounds=180;
kilos=pounds/2.2046;

(* kilos=80; *)
kilos=80;

fluids=prop*kilos;
alcoholinit=6*13.6;

pop[0]=0;

step[n_] := If[n > 0, 1, 0]
in[n_]:=alcoholinit*step[60-n];
out[n_]:=12;
dt=1/60;

pop[n_]:=pop[n]=pop[n-1]+(in[n-1]-out[n-1])*dt;

BA=Table[{n,.8},{n,0,Minutes}];
BAC=Table[{n,pop[n]/fluids},{n,0,Minutes}];

(* BAC//TableForm *)

pBA=ListPlot[BA,PlotJoined->True,AxesLabel->{"Minutes", "BAC"}, PlotStyle->Thickness[0.005]]
pBAC=ListPlot[BAC,PlotJoined->True,AxesLabel->{"Minutes", "BAC"}, PlotStyle->Thickness[0.01]]
Show[pBA,pBAC];

six-pack over an hour, with a couple of shots:

Clear[pop,n,Years];
Minutes=420;
prop=.68;

pounds=180;
kilos=pounds/2.2046;

(* kilos=80; *)
kilos=80;

fluids=prop*kilos;
alcoholinit=6*13.6;

pop[0]=0;

step[n_] := If[n > 0, 1, 0];
shot[n_,t_] := If[n == t, 12/dt, 0];
in[n_]:=alcoholinit*step[60-n] + shot[n,60] + shot[n,120];
out[n_]:=12;
dt=1/60;

pop[n_]:=pop[n]=pop[n-1]+(in[n-1]-out[n-1])*dt;

BA=Table[{n,.8},{n,0,Minutes}];
BAC=Table[{n,pop[n]/fluids},{n,0,Minutes}];

(* BAC//TableForm *)

pBA=ListPlot[BA,PlotJoined->True,AxesLabel->{"Minutes", "BAC"}, PlotStyle->Thickness[0.005]]
pBAC=ListPlot[BAC,PlotJoined->True,AxesLabel->{"Minutes", "BAC"}, PlotStyle->Thickness[0.01]]
Show[pBA,pBAC];