# Khan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Fetching contributors…

Cannot retrieve contributors at this time

81 lines (78 sloc) 4.72 kb
 Rate problems 1
11 + rand(9) 41 + rand(9) 31 + rand(9) 1 + rand(9) AVG * TIME (SPEED1 * SPEED2 * TIME - DIST * SPEED2) / (SPEED1 - SPEED2) DIST - DIST2

person(1) traveled by vehicle(1) at an average speed of SPEED1 miles per hour.

Then, he(1) traveled by vehicle(2) at an average speed of SPEED2 miles per hour.

In total, he(1) traveled DIST miles for plural(TIME, "hour").

How many miles did person(1) travel by vehicle(1)? (Round to the nearest mile.)

round(DIST1)

d_vehicleVar(1) = round(DIST1) miles

How many miles did person(1) travel by vehicle(2)? (Round to the nearest mile.)

round(DIST2)

d_vehicleVar(2) = round(DIST2) miles

How many minutes did person(1) travel by vehicle(1)? (Round to the nearest minute.)

round(DIST1 / SPEED1 * 60)

t_vehicleVar(1) = round(DIST1 / SPEED1 * 60) minutes

How many minutes did person(1) travel by vehicle(2)? (Round to the nearest minute.)

round(DIST2 / SPEED2 * 60)

t_vehicleVar(2) = round(DIST2 / SPEED2 * 60) minutes

Remember that d = r * t, or written another way, t = d / r.

d_vehicleVar(1) = distance that person(1) traveled by vehicle(1)

d_vehicleVar(2) = distance that person(1) traveled by vehicle(2)

Total distance: d_vehicleVar(1) + d_vehicleVar(2) = DIST

Total time: t_vehicleVar(1) + t_vehicleVar(2) = TIME

t_vehicleVar(1) = (d_vehicleVar(1) / SPEED1) and t_vehicleVar(2) = (d_vehicleVar(2) / SPEED2)

Substitute the blue equations for: (d_vehicleVar(1) / SPEED1) + (d_vehicleVar(2) / SPEED2) = TIME

Multiply the above equation by -1 * SPEED1: -d_vehicleVar(1) - (SPEED1 / SPEED2) * d_vehicleVar(2) = -SPEED1 * TIME

Add the two orange equations for: (SPEED2 - SPEED1 / SPEED2) * d_vehicleVar(2) = DIST - (SPEED1 * TIME)

Calculating all variables (and then rounding to the nearest integer):
d_vehicleVar(2) = roundTo( 4 , DIST2 ) (round(DIST2)) miles
d_vehicleVar(1) = roundTo( 4 , DIST1 ) (round(DIST1)) miles
t_vehicleVar(1) = roundTo( 4 , DIST1 / SPEED1 * 60 ) (round(DIST1 / SPEED1 * 60)) minutes
t_vehicleVar(2) = roundTo( 4 , DIST2 / SPEED2 * 60 ) (round(DIST2 / SPEED2 * 60)) minutes

Something went wrong with that request. Please try again.