Inner Tube River Crossing

Activity Information

Learning Goals

  • Use vectors to mathematically determine:
    • Relative velocity within inner tube-river system
    • Launch angle
  • Use code to model relative motion

Prior Knowledge Required

  • Relative velocity
  • Vector addition
  • Vector decomposition
    • sin and cos functions
    • arctan function

Code Manipulation

  • Interpret code
  • Modify variables within existing code

Activity

Handout

Inner Tube River Crossing

Part 1

It is a hot summer day, and you are meeting your friends for a picnic lunch down by the river. When you get to the river, you discover you are on the wrong side, 20 meters from the picnic site. As an experienced inner tuber, you know that you can paddle your tube at a speed of 2.0 m/s. Additionally, you know the river moves westward at a speed of 1.5 m/s. Your friends have already started the grill and your meal will be ready in 15 seconds.

You have an app that lets you enter your velocity and the velocity of the river to determine your net velocity. For the following questions, calculate the answer and check your results with the code.

  1. If you were to get in the river and begin paddling directly across, what velocity (magnitude and direction) do your friends see you moving relative to the shore?
  2. How long does it take to cross the river? If the river had a faster current, how would this affect the time it takes you to get across?
Part 2

You would like to paddle across the river to get to your friends at the picnic site, but you don't want to hike back upriver once you paddle across.

  1. At what angle with the shore must you paddle in order to get directly across the river to the picnic area?
  2. How long will this take? Why is this different from your answer in Part 1?
Part 3

After lunch, you decide to cool off by floating in the river. You want to chat with your friends on the shore while you float, so you need to paddle in such a way that you remain stationary.

  1. How might you modify your code so that you model the scenario of floating in the center of the river, in front of the picnic site?
Part 4

Coding questions:

  1. What is a while loop, and what quantities/values must go inside a while loop?
  2. What does “dt” stand for (line 37)? What happens when you make “dt” larger?
  3. Why is the width of the river divided in half in “tube = ring(pos=vector(0,-w/2,0)…” (line 16)?
  4. What is the purpose of “w/2” in “while tube.pos.y<w/2:” (line 46)?
  5. If you modified you code correctly in Part 3, the text “time to cross” and “tube velocity” will not appear. Why?

Code

Link

  1. GlowScript 2.7 VPython
  2. get_library('https://rawgit.com/perlatmsu/physutil/master/js/physutil.js')
  3.  
  4. #Window setup
  5. scene.range = 20
  6. scene.width = 900
  7. scene.height = 500
  8. scene.background=vector(0,0.7,0.1)
  9.  
  10.  
  11. #Objects
  12. w=20
  13. river = box(pos=vector(0,0,-1), length=200, height=w, width=1, color=color.blue, texture=textures.rough)
  14. #southshore = box(pos=vector(0,-100,0), length=600, height=50, width=1, color=vector(0.4,0.6, 0.2))
  15. #northshore = box(pos=vector(0,100,0), length=600, height=50, width=1, color=vector(0.4,0.6, 0.2))
  16. tube = ring(pos=vector(0,-w/2,0), axis=vector(0,0,180), radius=2, thickness=0.8, color=color.black, make_trail=False,)
  17. #target= text(text='X', align='center', color=color.red)
  18. label(pos=vec(tube.pos.x,w/2,0), text='picnic site', color=color.black )
  19. label(pos=vec(-10,-10,0), text='click to run', color=color.black )
  20.  
  21.  
  22. #Parameters and Initial Conditions
  23. tubes=0
  24. riverv = vector(0.5,0,0)
  25. degrees=0
  26. theta=degrees*pi/180
  27. tubesx=tubes*sin(theta)
  28. tubesy=tubes*cos(theta)
  29. tubev=vec(tubesx,tubesy,0)
  30. scale=1.0
  31.  
  32.  
  33.  
  34. #Time and time step
  35. t = 0
  36. tf = 3
  37. dt = 0.01
  38.  
  39. tubeMotionMapx = MotionMap(tube, tf, 2, markerScale=scale, markerColor=color.blue, labelMarkerOrder=False)
  40. tubeMotionMapy= MotionMap(tube, tf, 2, markerScale=scale, markerColer=color.red, labelMarkerOrder=False, )
  41. tubeMotionMapr= MotionMap(tube, tf, 2, markerScale=scale, markerColor=color.green, labelMarkerOrder=False)
  42.  
  43. ev = scene.waitfor('click')
  44.  
  45. #Calculation Loop
  46. while tube.pos.y<w/2:
  47. rate(500)
  48.  
  49. tube.pos = tube.pos + tubev*dt
  50. tube.pos = tube.pos + riverv*dt
  51.  
  52. #Set up motion map
  53. relv = riverv + tubev
  54. tubeMotionMapr.update(t, relv)
  55. tubeMotionMapx.update(t, tubev)
  56. tubeMotionMapy.update(t, riverv)
  57.  
  58.  
  59. t = t + dt
  60.  
  61. #determine angle
  62. angle=atan(mag(riverv)/mag(tubev))*(180/pi)
  63.  
  64. #label
  65. print("time to cross =", t , "s")
  66. print("tube velocity=",mag(relv),"m/s at", angle, "degrees")

Answer Key

Handout

Part 1

  1. You can determine your velocity with respect to the shore through vector addition:
    1. $\vec{v}_{tube/shore}=\vec{v}_{river/shore}+\vec{v}_{tube/river}$
    2. $\vec{v}_{tube/shore}= < -1.5, 0, 0>+<0, 2, 0> = < -1.5, 2, 0>$ m/s
      1. $\text{Magnitude}=\sqrt{(-1.5)^2+(2^2)}=\sqrt{6.25}=2.5$ m/s
      2. $\text{Angle}=\arctan(\dfrac{1.5}{2})=36.9°$
  2. The movement of the tube in the y-direction is completely independent of the river's movement in the x-direction. Because of this, we just have to look at the y-coordinate of the tube's velocity in order to calculate how long it takes to cross
    1. $\text{Time}=\dfrac{\text{Distance}}{\text{Velocity}}$
    2. $t=\dfrac{20\text{m}}{2.0\text{m/s}}=10\text{s}$
Part 2

  1. The goal to solving this problem is understanding that in order to go straight across the river, the x-component of the tube velocity must be equal and opposite to the velocity of the river, leaving just a positive y-component of the tube velocity. Therefore, you must paddle so that the x-component of your velocity is +1.5 m/s Using this fact, you can create a right triangle where the legs represent the x and y-components of the tube's velocity and the hypotenuse is the magnitude of the velocity (2.0 m/s). Knowing some trigonometry, we can find the angle with respect to the shore that you must launch in order to paddle straight across:
    1. $\cos(\theta)=\dfrac{1.5\text{m/s}}{2.0\text{m/s}}$
    2. $\arccos(\cos(\theta))=\theta=\arccos(\dfrac{1.5\text{m/s}}{2\text{m/s}})=41.4°$
  2. We can find the time it takes to cross using the same method that we used in Part 1 Problem 2, but this first requires we find the y-component of the velocity. We can accomplish this in two ways:
    1. Method 1: Because we know two of the three side lengths of our velocity triangle, we can use the Pythagorean Theorem to find the last final side:
      1. $1.5^2 + y^2 = 2.0^2$
      2. Rearranging to solve for y: $y=\sqrt{2.0^2-1.5^2}=1.323 \text{m/s}$
    2. Method 2: Since we calculated the angle you must launch with respect to the shore, we can use a trigonometric relationship to solve for the y-component of velocity:
      1. $\sin(41.4°)=\dfrac{y}{2.0}$
      2. Rearranging to solve for y: $y=2.0*\sin(41.4°)=1.323 \text{m/s}$
    3. Now we simply divide the river width by this velocity to calculate the time it takes to cross
      1. $t=\dfrac{20\text{m}}{1.323\text{m/s}}=15.1\text{s}$. It makes sense that this value is higher than in Part 1 because the y-component of your velocity is smaller
Part 3

  1. In order for the tube to remain stationary with respect to the shore, the velocity vector of the tube must point in the exact opposite direction as the river's velocity vector. Using vector addition, this will sum to 0. This can be done by making sure the magnitude of “tubes” (line 23) matches the magnitude of “riverv” (line 24). In order for the directions to match, “degrees” (line 26) must equal 90; this makes the y-component of velocity equal to 0 and the x-component of velocity equal to “tubes”
Part 4
  1. A while loop allows for repeated calculations. This is what creates the motion of the river and the tube when you run the code. The quantities that go inside a while loop are those that need to be updated/changed; in this case that is the position of the tube
  2. dt represents a tiny change in time. As dt gets larger, the motion of the tube becomes jumpier/less smooth
  3. The width of the river is divided in half to keep the tube on the edge of the river
  4. The “w/2” term in the while loop tells the while loop to stop once the the position of the tube reaches “w/2,” which is the other side of the river
  5. They never appear because these prompts only show once the while loop is completed. Since the tube never crosses the river, the while loop never stops

Code

Link
Note: No lines of code are added, only modified on a problem-to-problem basis, and these are what are highlighted below.

  1. GlowScript 2.7 VPython
  2. get_library('https://rawgit.com/perlatmsu/physutil/master/js/physutil.js')
  3.  
  4. #Window setup
  5. scene.range = 20
  6. scene.width = 900
  7. scene.height = 500
  8. scene.background=vector(0,0.7,0.1)
  9.  
  10.  
  11. #Objects
  12. w=20 #the width of the river
  13. river = box(pos=vector(0,0,-1), length=200, height=w, width=1, color=color.blue, texture=textures.rough)
  14. #southshore = box(pos=vector(0,-100,0), length=600, height=50, width=1, color=vector(0.4,0.6, 0.2))
  15. #northshore = box(pos=vector(0,100,0), length=600, height=50, width=1, color=vector(0.4,0.6, 0.2))
  16. tube = ring(pos=vector(0,-w/2,0), axis=vector(0,0,180), radius=2, thickness=0.8, color=color.black, make_trail=False,)
  17. #target= text(text='X', align='center', color=color.red)
  18. label(pos=vec(tube.pos.x,w/2,0), text='picnic site', color=color.black )
  19. label(pos=vec(-10,-10,0), text='click to run', color=color.black )
  20.  
  21.  
  22. #Parameters and Initial Conditions
  23. tubes=2 #the magnitude of the tube's velocity
  24. riverv = vector(-1.5,0,0) #the velocity of the river
  25. degrees=0 #the launch angle with respect to the shore
  26. theta=degrees*pi/180
  27. tubesx=tubes*sin(theta)
  28. tubesy=tubes*cos(theta)
  29. tubev=vec(tubesx,tubesy,0)
  30. scale=1.0
  31.  
  32.  
  33.  
  34. #Time and time step
  35. t = 0
  36. tf = 3
  37. dt = 0.01 #adjusts the smoothness of motion
  38.  
  39. tubeMotionMapx = MotionMap(tube, tf, 2, markerScale=scale, markerColor=color.blue, labelMarkerOrder=False)
  40. tubeMotionMapy= MotionMap(tube, tf, 2, markerScale=scale, markerColer=color.red, labelMarkerOrder=False, )
  41. tubeMotionMapr= MotionMap(tube, tf, 2, markerScale=scale, markerColor=color.green, labelMarkerOrder=False)
  42.  
  43. ev = scene.waitfor('click')
  44.  
  45. #Calculation Loop
  46. while tube.pos.y<w/2:
  47. rate(500)
  48.  
  49. tube.pos = tube.pos + tubev*dt
  50. tube.pos = tube.pos + riverv*dt
  51.  
  52. #Set up motion map
  53. relv = riverv + tubev
  54. tubeMotionMapr.update(t, relv)
  55. tubeMotionMapx.update(t, tubev)
  56. tubeMotionMapy.update(t, riverv)
  57.  
  58.  
  59. t = t + dt
  60.  
  61. #determine angle
  62. angle=atan(mag(riverv)/mag(tubev))*(180/pi)
  63.  
  64. #label
  65. print("time to cross =", t , "s")
  66. print("tube velocity=",mag(relv),"m/s at", angle, "degrees")

See Also

  • repository/inner_tube_river_crossing.txt
  • Last modified: 2021/02/18 19:54
  • by porcaro1