# 22: Races¶

## Example number 22.1, Page number 22.3¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
bt=9;       #beat time(sec)
st=0;       #start time(sec)
bd=36;      #beat distance(m)
sd=0;       #start distance(m)
L=1000-36;   #loser's distance(m)

#Calculation
At=(bt+st)*L/(bd+sd);     #A's time over the course(sec)

#Result
print "A's time over the course is",At,"sec"

A's time over the course is 241.0 sec


## Example number 22.2, Page number 22.4¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
V=1;     #assume
A=4/3;   #speed of A relative to B
d=30;    #distance(m)

#Calculation
L=d/(V-(1/A));      #length of race of winning post(m)

#Result
print "length of race of winning post is",L,"m"

length of race of winning post is 120.0 m


## Example number 22.3, Page number 22.4¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
bt=0;       #beat time(sec)
st=10;       #start time(sec)
bd=0;      #beat distance(m)
L=250;   #loser's distance(m)
W=1000;    #winner's distance(m)

#Calculation
x=L/W;
sd=((bt+st)/x)-bd;    #start distance(m)

#Result
print "start distance is",sd,"m"

start distance is 40.0 m


## Example number 22.4, Page number 22.4¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
bt=10;       #beat time(sec)
st=0;       #start time(sec)
sd=0;      #start distance(m)
L=300;   #loser's distance(m)
W=100;    #winner's distance(m)

#Calculation
x=L/W;
bd=((bt+st)/x)-sd;    #beat distance(m)

#Result
print "beat distance is",round(bd,2),"m"
print "answer given in the book is wrong"

beat distance is 3.33 m
answer given in the book is wrong


## Example number 22.5, Page number 22.4¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
L=100;    #length of race(m)
x12=2;    #A beats C by(m)
x13=4;    #A beats B by(m)

#Calculation
x23=L*(x13-x12)/(L-x12);      #C would beat B by(m)

#Result
print "C would beat B by",round(x23,2),"m"

C would beat B by 2.04 m


## Example number 22.6, Page number 22.5¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
L=1000;    #length of race(m)
x12=50;    #A beats C by(m)
x13=69;    #A beats B by(m)

#Calculation
x23=L*(x13-x12)/(L-x12);      #C would beat B by(m)

#Result
print "C would beat B by",x23,"m"

C would beat B by 20.0 m


## Example number 22.7, Page number 22.5¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
As=2;       #speed of A(m/s)
bt=10;       #beat time(sec)
st=0;       #start time(sec)

#Calculation
t=bt+st;

#Result
print "speed of B is",Bs,"m/s"

speed of B is 1.6 m/s


## Example number 22.8, Page number 22.5¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
Bd=330;     #distance of B(m)
Bt=44;      #time of B(sec)
sd=30;      #start distance(m)
A=41;       #time taken for A(sec)

#Calculation
B=Bt*(Bd-sd)/Bd;    #time taken for B(sec)
T=A-B;     #B wins by(s)

#Result
print "B wins by",T,"s"

B wins by 1.0 s


## Example number 22.9, Page number 22.5¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
L=200;    #length of race(m)
x12=40;    #A beats C by(m)
x13=50;    #A beats B by(m)
Tc=2;      #time for C(sec)

#Calculation
x23=L*(x13-x12)/(L-x12);      #C would beat B by(m)
C=Tc*L/x23;       #time taken for C(sec)
B=C-Tc;         #time taken for B(sec)
A=B*(L-x12)/L;   #time taken for A(sec)

#Result
print "time taken for A is",A,"sec"
print "answer given in the book is wrong"
print "time taken for B is",B,"sec"
print "time taken for C is",C,"sec"

time taken for A is 24.0 sec
answer given in the book is wrong
time taken for B is 30.0 sec
time taken for C is 32.0 sec


## Example number 22.10, Page number 22.6¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
L=1000;    #length of race(m)
x12=40;    #A beats C by(m)
x23=25;    #A beats B by(m)

#Calculation
x13=(x23*(L-x12)/L)+x12;      #A can give C a start of(m)

#Result
print "A can give C a start of",x13,"m"

A can give C a start of 64.0 m


## Example number 22.11, Page number 22.6¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
L=400;    #length of race(m)
L1=600;   #full length of race(m)
L2=500;   #length of another race(m)
x12=60;    #A beats B by(m)
x23=25;    #A beats C by(m)

#Calculation
x12=x12*L/L1;    #A beats B by(m)
x23=x23*L/L2;    #A beats C by(m)
x13=(x23*(L-x12)/L)+x12;      #A will beat C by(m)

#Result
print "A will beat C by",x13,"m"

A will beat C by 58.0 m


## Example number 22.12, Page number 22.7¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
L=400;    #length of race(m)
Bt1=50/7;   #time taken by B more than A(sec)
Bt2=5;      #time taken by B with lesser distance(sec)
d=15;       #lesser distance(m)

#Calculation
Bt=Bt1-Bt2;   #time taken for B(sec)
Bs=d/Bt;      #speed of B(m/s)
VA=L/((L/Bs)-Bt1);    #speed of A(m/s)

#Result
print "speed of A is",VA,"m/s"
print "speed of B is",Bs,"m/s"

speed of A is 8.0 m/s
speed of B is 7.0 m/s