Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
2020:genesee_friction_activity_snippets [2020/02/12 07:37]
wellerd
2020:genesee_friction_activity_snippets [2020/02/12 13:49] (current)
wellerd
Line 3: Line 3:
 Here is a link to the google doc where you can find more details on the activity: [[https://​docs.google.com/​document/​d/​1yGWHwJ3tRL8yq5J3BD2bIPrBk04dghvQxNl029No9xY/​edit?​usp=sharing | GISD Workday Activity]] Here is a link to the google doc where you can find more details on the activity: [[https://​docs.google.com/​document/​d/​1yGWHwJ3tRL8yq5J3BD2bIPrBk04dghvQxNl029No9xY/​edit?​usp=sharing | GISD Workday Activity]]
  
-Below we have provided some snippets of code you can use by copying into your own glowscript window, modifying the code, and running the program. Any code with a # in front of it is simply a comment (or an editor'​s note) that defines what the line will make the computer do. The first line of a Glowscript code must always be...+Below we have provided some snippets of code you can use by copying into your own Glowscript program, modifying the code, and running the program. Any code with a # in front of it is simply a comment (i.e., an editor'​s note) that defines what the line will make the computer do. The first line of a Glowscript code must always be...
  
 <​code>​ <​code>​
Line 47: Line 47:
     t = t + dt     t = t + dt
 </​code>​ </​code>​
- 
- 
-==== Acceleration ==== 
- 
-Here is some code you can repurpose to add acceleration to your simulation. Ultimately, this could be used to make objects slow down using friction (after defining some other variables and calculations). 
- 
-<​code>​ 
-#While loop to iterate over time 
-while t < tf: 
- 
-    #Keeps animation slow enough to view 
-    rate(100) 
-    ​ 
-    #Velocity update step to predict velocity of box after a time-step dt 
-    v = v + a*dt 
-    ​ 
-    #Position update step to predict location of box after a time-step dt 
-    MyBox.pos = MyBox.pos + v*dt 
-    ​ 
-    #Update the time to go on to the next time-step after the position update 
-    t = t + dt 
-</​code>​ 
- 
  
 ==== Graphing ==== ==== Graphing ====
Line 82: Line 59:
 while t < tf: while t < tf:
     ​     ​
-    #Keeps animation slow enough to view+    #Rate keeps animation slow enough to view
     rate(100)     rate(100)
     ​     ​
  • 2020/genesee_friction_activity_snippets.1581493036.txt.gz
  • Last modified: 2020/02/12 07:37
  • by wellerd