1 of 8

Lesson III: Naive Modeling

July 31, 2020

Water, Chemicals and more with Computers for Chemistry (WC3m)

  • Predict positions and velocity
  • One-dimensional spring
  • Pseudo-code
  • Try it yourself!

Rohit Goswami and Amrita Goswami

2 of 8

Recap:

  1. A movie is ‘glitchy’ without enough frames.
  2. Similarly, it is not reasonable to try to predict new positions from old positions if the time step (time difference) between them is too large. You will lose important information!
  3. At each step, we use a rule to predict new positions from the previous positions. Spoiler alert! Newton’s laws of motion are used...but that’s not so important. It’s just a set of steps or a recipe to the computer.

Trajectories

Programming

We talked about how a program views variables. Each variable has a type, a value and a label (name).

3 of 8

Our Goal

4 of 8

Programming Goals and Tools

What did we learn and use?

  • Loops
  • Variables
  • Functions (programming)

We can mimic observed behaviour with programming languages

5 of 8

Have we done any physics?

  • Can we predict what would happen with this?
    • Say at a different time?
  • Where is time anyway?
  • Can the model tell us about the behaviour of multiple turtles?
  • What are we trying to do?
  • What is our model?
  • What do we expect from it?
  • What is the mathematical representation of our program?

6 of 8

Problem: Simulating a Turtle Constrained by a Spring!

Imagine that the turtle (let’s call him Yoda) is attached to a point (called the origin) by an invisible string. Every time Yoda moves away from the origin, Yoda misses home and goes back towards the origin. We want to write a simulation predicting Yoda’s movements in this situation.

7 of 8

Why?

A solid “model” built of springs and balls

A representation of the system we just simulated

8 of 8

References

  • Youtube
  • Google Slide Pictures