[Tutor] Fwd: Math Question

Alan Gauld alan.gauld at freenet.co.uk
Tue Mar 22 23:59:00 CET 2005

OK, No fancy math here, so thee might be a cleaner way, but here
is how I'd do it.

> (Note the patient only has 5mg tabs, which they can split to make
> adjust my 2.5)

OK< so we are dealing with a unit size of 2.5mg. Convert the total
dosage into 2.5mg units. 35mg = 35/2.5 = 14 units

Divide the number of units by the number of days using integer

divmod(14,7)   -> 2,0

that tells us you need 2 units per day and no adjustment

Add 10% => 14 + 1.4 = 15.4 units. YOu must decide to either
round up or down, lets say you round up to 16 units

divide the doze as before

divmod(16,7)   -> 2,2

that says 2 units per day and on 2 days an extra unit.
(Which was your guestimate)

If you rounded down to 15

divmoid(15,7)  -> 2,1

which is 2 units/day and 1 day with an extra unit.

> How would I solve this using math instead of geustimating it.
> What kind of math am I talking about here?

integer math with a hint of quantum techniques thrown in

If the above didn't make sense just shout and we can explain
in more detail.

Alan G
Author of the Learn to Program web tutor

More information about the Tutor mailing list