Tuesday, August 11, 2009

Wheels and Friction Demo

Since I don't know how to write Java applets or Flash animations, I'm starting my demos in Mathematica. I'd wanted to publish Mathematica notebooks directly to the web, but I realized I can't do that in blogspot and I'd also need a web server, which I don't have. So the best I can do is upload notebooks to Skydrive. You can play these notebooks in Mathematica 7 if you have a copy or Mathematica player, which you can get for free from Wolfram.

My attempt at generating a playable Mathematica notebook to illustrate wheel motion under friction was more frustrating than I'd imagined. While I'm a big fan of Mathematica, I have to express my dissatisfaction with its dynamic capabilities. First, I could not figure out how to update a dependent variable only after changing an independent variable and not continuously. Second, inserting legends increases lag, which is already undesirably high. Third, changing user-controlled variables does not automatically update the variable controls. Fourth, I could not figure out how to maintain sizes of frames being animated. You'd think specifying the frame's dimensions explicitly should work, but somehow changing the frame's ticks' labels still changes the frame size slightly, causing the frame animation to be unpleasantly jerky. Anyway, here's the best I could do.

I should probably learn Java or Action script...

Edit: had to switch to MediaFire because Skydrive link is impermanent.

Edit: the notebook has been optimized courtesy of Nick Lariviere of Wolfram support. Also, I've made the changes promised in part 3. Finally, I learnt that Mathematica cannot play nbp files meant for Mathematica player, so Mathematica users please download the nb file here.

2 comments:

  1. We'd love for a chance to assist you with this. Could you please contact me with your license number?

    Sincerely,
    Carol Cronin
    Wolfram Research
    carol_cronin@wolfram.com

    ReplyDelete