I was jolted awake at 6am this morning with a violent muscle cramp in my leg. Three ibuprofen, two bananas, and a quart of gatorade later, it’s still so sore I can’t even walk on it more than a few steps. So *sigh* I’m going to have to cancel class for today.
So here’s your marching orders for class today, which can earn you and a partner up to +3XP or even +6XP:
- Go into the classroom at the usual time, and find someone to pair up with. If things don’t work out evenly, a group of 3 is okay. (A group of 1 is not.)
- Your goal for this activity is to remedy the following shortcoming with the road trip program. In that simulation, you’ll recall, the randomly-chosen speeds were extremely “jumpy”: they could be 10 mph in one interval followed by 95 mph the next interval followed by 0 the next one. In real life, of course, your car speed doesn’t change herky-jerky like that. (The original simulation, which you should start with, does admittedly have a 1-hour Δx, and it’s true that with that coarse-grained a model, one’s speed could actually change that drastically hour-to-hour. But it’s the principle that’s at stake here. In general, we want speeds to be smoothly varying, not generated brand new and afresh every interval.)
- Your job is to brainstorm with your partner how you might modify the original simulation code to avoid this herky-jerkiness. In particular, your solution must have the following features:
- It must generate speeds randomly each time it’s run, just like it does now.
- It must still be possible to reach speeds of 100 mph, or even higher.
- However, no speed should change from the previous speed more than 10 mph up or down.
- The average speed must still be about 50 mph.
There’s a trick to it which I think you’ll figure out if you brainstorm long enough. It’s actually a most illuminating trick, which we’ll discuss on Thursday (leg willing).
- You and your partner should decide between the +3XP and +6XP options:
- For +3XP, compose together a one-paragraph English description of how you would go about generating speeds that satisfy the above four criteria.
- For +6XP, actually make those changes to the original version of the simulation (not to any modified version that you or your partner may have already made for your homework assignment), verify that they work, and produce a couple of plots from sample runs of the simulation.
You have 75 minutes (normal class time) to complete this. When you are done, to claim your points, send me an email with subject line “DATA 420 leg cramp turnin“, making sure to Cc: your partner(s) on the email. If you chose the +3XP option, put your paragraph either in the body of the email, or as an attachment in PDF format. If you chose the +6XP option, put a paragraph describing the approach in the body of the email, and attach your modified roadtrip.py file plus two .png files that depict a couple of random runs of the simulation.
This email is due to my inbox at 3:15pm today. Good luck, and happy driving!