Car Race
Author: LFS, http://mathcasts.org/mtwiki
Date: 7, септември 2008

Click on the Start/Stop button to animate.

km

hours

Manual Animation

Show Red Car Position

Show Blue Car Position

*

Show Red Line

*

Show Blue Line

Speed of RED Car

Start of RED Car

Speed of BLUE Car

Start of BLUE Car

t0 = 0 (slider from 0 to 1, step 0.03333333333333333)
manual = false
hour = 6
t: hour * t0
Tpoint: (t, 0)
redspeed = 20 (slider from 0 to 50, step 1)
redstart = 60 (slider from 0 to 100, step 1)
rc = Function(redspeed * x + redstart, 0, 6.01)
Rpoint: (t, rc(t))
bluespeed = 36 (slider from 0 to 50, step 1)
bluestart = 0 (slider from 0 to 100, step 1)
bc = Function(bluespeed * x + bluestart, 0, 6.01)
Bpoint: (t, bc(t))
scale = 150
redposB = true
blueposB = true
redline = true
blueline = true
SL: (-1 * 6, -1 * 1.3 * scale)
SR: (-1 * x(SL), y(SL))
s = Segment(SL, SR)
TickNumber = 6
TickSpace: (-1 * x(SL) / TickNumber, 0)
TickLength: (0, scale / 4)
s0 = Segment(SL + 0 * TickSpace - TickLength, SL + 0 * TickSpace)
text0: "0" + dis
s1 = Segment(SL + TickSpace - TickLength / 2, SL + TickSpace)
text1: "25" + dis
s2 = Segment(SL + 2 * TickSpace - TickLength, SL + 2 * TickSpace)
text2: "50" + dis
s3 = Segment(SL + 3 * TickSpace - TickLength / 2, SL + 3 * TickSpace)
text3: "75" + dis
s4 = Segment(SL + 4 * TickSpace - TickLength, SL + 4 * TickSpace)
text4: "100" + dis
s5 = Segment(SL + 5 * TickSpace - TickLength / 2, SL + 5 * TickSpace)
text5: "125" + dis
s6 = Segment(SL + 6 * TickSpace - TickLength, SL + 6 * TickSpace)
text6: "150" + dis
s7 = Segment(SL + 7 * TickSpace - TickLength / 2, SL + 7 * TickSpace)
text7: "175" + dis
s8 = Segment(SL + 8 * TickSpace - TickLength, SL + 8 * TickSpace)
text8: "200" + dis
s9 = Segment(SL + 9 * TickSpace - TickLength / 2, SL + 9 * TickSpace)
text9: "225" + dis
s10 = Segment(SL + 10 * TickSpace - TickLength, SL + 10 * TickSpace)
text10: "250" + dis
s11 = Segment(SL + 11 * TickSpace - TickLength / 2, SL + 11 * TickSpace)
text11: "275" + dis
s12 = Segment(SL + 12 * TickSpace - TickLength, SL + 12 * TickSpace)
text12: "300" + dis
carscale: 4 * x(TickSpace) / 100
BRC: (x(SL) + rc(t) * carscale, y(SL) + 60)
BBC: (x(SL) + bc(t) * carscale, y(SL) + 10)
textRed: "RED CAR:  y = " + redspeed + "x+" + redstart
textBlue: "BLUE CAR:  y = " + bluespeed + "x+" + bluestart
textTime: "At Time: " + t + " hours"
textRCPos: "Red Car at: " + (rc(t)) + dis
textBCPos: "Blue Car at: " + (bc(t)) + dis
A: (-1 * 10, -1 * 2.5 * scale)
B: (-1 * 0.5, y(A))
D: (-1 * 10, 2.5 * scale)
B1: (9, y(A))
D1: (-1 * 10, -1 * scale / 2)
AY: SL - (1.5, scale / 2)
BY: SR - (-1, scale / 2)
DY: SL - (1.5, -1 * scale / 1.4)
M: (0, 0.9 * scale)
AR: (-1 * 7.5, 1.35 * scale)
BR: (-1, y(AR))
DR: (-1 * 7.5, 2.15 * scale)
AB: AR - M
BB: BR - M
DB: DR - M
AP: AR - 2 * M
BP: BR - 2 * M
DP: DR - 2 * M