{"id":656,"date":"2021-12-31T19:18:14","date_gmt":"2021-12-31T19:18:14","guid":{"rendered":"https:\/\/www.msuperl.org\/wp\/icsam\/?page_id=656"},"modified":"2022-02-05T19:46:22","modified_gmt":"2022-02-05T19:46:22","slug":"bowling","status":"publish","type":"page","link":"https:\/\/www.msuperl.org\/wp\/icsam\/computational-activities\/bowling\/","title":{"rendered":"Bowling"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"105\" src=\"https:\/\/www.msuperl.org\/wp\/icsam\/wp-content\/uploads\/sites\/6\/2022\/01\/image-1.png\" alt=\"\" class=\"wp-image-661\" srcset=\"https:\/\/www.msuperl.org\/wp\/icsam\/wp-content\/uploads\/sites\/6\/2022\/01\/image-1.png 777w, https:\/\/www.msuperl.org\/wp\/icsam\/wp-content\/uploads\/sites\/6\/2022\/01\/image-1-300x41.png 300w, https:\/\/www.msuperl.org\/wp\/icsam\/wp-content\/uploads\/sites\/6\/2022\/01\/image-1-768x104.png 768w\" sizes=\"auto, (max-width: 777px) 85vw, 777px\" \/><\/figure>\n\n\n\n<p class=\"has-large-font-size\">Activity Information<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Learning Goals<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Interpret, edit, and add to the code of a computational model of a bowling ball<\/li><li>Apply the momentum principle to an object in motion<\/li><li>Apply the principles of rotational kinematics to an object in motion<\/li><li>Use mathematical representations to support the claim that\u00a0the total momentum of\u00a0a system of objects\u00a0is conserved when there is no net force on the system (<a href=\"https:\/\/www.nextgenscience.org\/pe\/hs-ps2-2-motion-and-stability-forces-and-interactions\" target=\"_blank\" rel=\"noreferrer noopener\">HS-PS2-2<\/a>)<\/li><\/ul>\n\n\n\n<p class=\"has-medium-font-size\">Prior Knowledge Required<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Vectors<\/li><li>Momentum Principle<\/li><li>Kinematics (linear and rotational)<\/li><\/ul>\n\n\n\n<p class=\"has-medium-font-size\">Code Manipulation<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Create code from mathematical equations<\/li><li>Copy \/ Paste code<\/li><li>Create if \/ else statements<\/li><\/ul>\n\n\n\n<p class=\"has-large-font-size\">Activity<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Handout &#8211; Bowling<\/p>\n\n\n\n<p>Your team at Bowl &amp; Co. (a very real and not made up company) has been tasked with finishing a bowling simulation stolen from your rival Bowl Bros Ltd. (another very real company).<\/p>\n\n\n\n<p>The stolen code can be found <a rel=\"noreferrer noopener\" href=\"https:\/\/trinket.io\/glowscript\/d148fc7175\" target=\"_blank\">here<\/a>. (click remix to save your own version)<\/p>\n\n\n\n<p>The blue region of the lane is frictionless, but the wooden section has a coefficient of kinetic friction of 0.2 with the bowling ball.<\/p>\n\n\n\n<p>Your code should realistically show the motion of the ball through its movement on the lane. It should start out with no rotation and start to turn once it is on the wooden surface. Remember, if the tangential rotational velocity is the same as the translational velocity, there will no longer be friction.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.glowscript.org\/docs\/VPythonDocs\/rotation.html\">Thi<\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/www.glowscript.org\/docs\/VPythonDocs\/rotation.html\" target=\"_blank\">s<\/a><a href=\"https:\/\/www.glowscript.org\/docs\/VPythonDocs\/rotation.html\"> link<\/a> might be helpful for getting the ball to rotate.<\/p>\n\n\n\n<p>Your code should also create two graphs, one of the linear and angular velocities of the ball vs time, and one of the translational, rotational, and total energies of the ball vs time.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Code<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/trinket.io\/glowscript\/d148fc7175\" target=\"_blank\">Link<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GlowScript 3.0 VPython\n#setting the scene - these can be changed as necessary for your screen size\nscene.width = 1200\nscene.height = 800\nscene.range = 2                 #set the scale of the view - smaller number zoom in, bigger numbers zoom out\n\n#define some variables\nr = 0.10                        #radius of ball in meters\nm1 = 7                          #mass of ball in kg\nv1 = -10                        #initial horizontal velocity of ball\nd = 4                           #horizontal position of ball at the start in meters\ns = 7                           #half-length of friction portion of lane\ng = 10                          #gravitational field strength - N\/kg\nt = 0                           #initialize value for time in seconds\ndt = 0.001                      #value of the time-step in seconds\nrte = 400                       #value for the \"rate\" in the loops\nmuk = 0.2                       #coeffiecient of kinetic friction\nalpha = (5*muk*g\/(2*r))         #angular acceleration of ball (moment of inertia for solid sphere - 2\/5mr***2)\nFfric = m1 * g * muk            #frictional force on ball\nrotvel = 0                      #initialize the rotational velocity of ball\n\n\n#create some objects\nground1 = box(pos = vec(d\/2,-r\/4,0), size = vec(d,r\/2,d\/4), color = vec(0,0,4), texture = textures.wood)        #create the lane for the ball to slide on without friction\nground2 = box(pos = vec(-s,-r\/4,0), size = vec(2 * s,r\/2,d\/4), texture = textures.wood)                         #create the lane for the ball to slide with friction\nball = sphere(pos = vec(d,r,0), radius = r, mass = m1, velocity = vec(v1,0,0), texture=textures.gravel)        #create ball with a texture to be able so see the rotation\nscene.camera.follow(ball)                                                                                      #have the camera follow the ball\n\n\n# define graph of motion\ngrph = graph(title='Velocity vs Time', xtitle='Time (s)', ytitle='Velocity')            #create graph\nvelgraph = gcurve(color=color.red,  width = 5, label='Linear Velocity (m\/s)')           #define the curve for linear velocity\nrotgraph = gcurve(color=color.blue,   width = 5, label='Angular Velocity (rad\/s)')      #define the curve for angular velocity\n\n#calculate the momentum of the ball\nball.p = ball.mass * ball.velocity                                      #initial momentum of ball\n\n\n#get loopy to make things happen!\nwhile ball.pos.x &gt;= -(2 * s) + r:                                       #do this loop while the ball is on the lane\n    rate(rte)                                                           #set the rate\n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt                       #calculate the position of ball based on its momentum and the time increment\n\n    velgraph.plot(t, -mag(ball.p\/ball.mass))                            #graph of linear velocity vs time\n    rotgraph.plot(t, rotvel)                                            #graph of rotational velocity vs time - counterclockwise is positive\n    \n    t = t + dt            <\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\">Answer Key<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Handout<\/p>\n\n\n\n<p><strong>Detecting when the ball is on the wood surface<\/strong><\/p>\n\n\n\n<p>To do this we can add an if statement in the while loop that is only true when the ball is on the wooden section of the lane:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while ball.pos.x &gt;= -(2 * s) + r:                                       \n    rate(rte)                                                            \n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt  \n                      \n <strong>   if ball.pos.x &lt;= 0<\/strong>: \n<\/code><\/pre>\n\n\n\n<p><strong>Changing the linear momentum<\/strong><\/p>\n\n\n\n<p>We know that a change in linear momentum is equal to the net force multiplied by time. In this case, the frictional force is the only force that is present, so multiplying that by dt will give us our change in linear momentum for each iteration of the loop:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nwhile ball.pos.x &gt;= -(2 * s) + r:                                       \n    rate(rte)                                                            \n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt         \n               \n <strong>   <\/strong>if ball.pos.x &lt;= 0: \n\n         <strong>ball.p = ball.p + vec((Ffric * dt),0,0)<\/strong>\n<\/code><\/pre>\n\n\n\n<p><strong>Adding Rotation<\/strong><\/p>\n\n\n\n<p>The change in rotational (or angular) velocity is given by the initial angular velocity plus the angular acceleration (alpha) times time. In the code that looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\nwhile ball.pos.x &gt;= -(2 * s) + r:                                       \n    rate(rte)                                                            \n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt         \n               \n <strong>   <\/strong>if ball.pos.x &lt;= 0: \n\n         ball.p = ball.p + vec((Ffric * dt),0,0)\n         <strong>rotvel = rotvel + alpha * dt<\/strong>\n<\/code><\/pre>\n\n\n\n<p>Now we need to use this rotational velocity to rotate the ball. To do this we will use obj.rotate. We want it to rotate with respect to the the z-axis so we will use axis = vec(0,0,1). The angle that the ball should rotate will be the rotational velocity times time, which is similar to how the ball&#8217;s change in position is calculated:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nwhile ball.pos.x &gt;= -(2 * s) + r:                                       \n    rate(rte)                                                            \n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt         \n               \n <strong>   <\/strong>if ball.pos.x &lt;= 0: \n\n         ball.p = ball.p + vec((Ffric * dt),0,0)\n         rotvel = rotvel + alpha * dt\n         <strong>ball.rotate(axis = vec(0,0,1), angle = rotvel * dt )<\/strong>\n<\/code><\/pre>\n\n\n\n<p>The ball now starts to move as we expect, but ends up rotating to quickly by the time its at the end of the lane. To fix this, we can add an if-else statement in the loop, nested within the first if statement:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\nwhile ball.pos.x &gt;= -(2 * s) + r:                                       \n    rate(rte)                                                            \n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt         \n               \n <strong>   <\/strong>if ball.pos.x &lt;= 0: \n         \n        <strong> if rotvel * r &gt;= -ball.p.x\/ball.mass:<\/strong>\n              ball.rotate(axis = vec(0,0,1), angle = rotvel * dt )\n\n        <strong> else:<\/strong>\n\n              ball.p = ball.p + vec((Ffric * dt),0,0)\n              rotvel = rotvel + alpha * dt\n              ball.rotate(axis = vec(0,0,1), angle = rotvel * dt )\n<\/code><\/pre>\n\n\n\n<p>rotvel  * r represents the tangential velocity of the ball from rotation and ball.p.x\/ball.mass represents the translational velocity of the ball.<\/p>\n\n\n\n<p><strong>Adding Graphs<\/strong><\/p>\n\n\n\n<p>The velocity graph is already done, so we can copy the syntax from that to initialize an energy graph:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>egrph = graph(title='Energy vs Time', xtitle='Time (s)', ytitle='Energy (J)')    \nkegraph = gcurve(color=color.red, width = 5, label='Translational Kinetic Energy (J)')\nrotkegraph = gcurve(color=color.blue, width = 5, label='Rotational Kinetic Energy (J)')\ntotalgraph = gcurve(color=color.green, width = 5, label='Total Energy (J)')<\/code><\/pre>\n\n\n\n<p>Lastly we need to calculate the translational kinetic energy, rotational kinetic energy, and total energy and plot them, all in the while loop:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tke = 0.5*ball.mass*(mag(ball.p\/ball.mass))**2                       #translational kinetic energy = 1\/2mv^2\n    rke = 0.5*((2\/5)*(ball.mass*r**2))*((rotvel)**2)                     #rotational kinetic energy = 1\/2Iw^2\n    kegraph.plot(t, tke)                                                 #translational kinetic energy\n    rotkegraph.plot(t, rke)                                              #graph of rotational kinetic energy\n    totalgraph.plot(t, tke+rke)   <\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Code<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/trinket.io\/glowscript\/68fb15e404\" target=\"_blank\">Link<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GlowScript 3.0 VPython\n#setting the scene - these can be changed as necessary for your screen size\nscene.width = 1200\nscene.height = 800\nscene.range = 2.5               #set the scale of the view - smaller number zoom in, bigger numbers zoom out\n\n#define some variables\nr = 0.10                        #radius of ball in meters\nm1 = 7                          #mass of ball in kg\nv1 = -10                        #initial horizontal velocity of ball\nd = 4                           #horizontal position of ball at the start in meters\ns = 7                           #half-length of friction portion of lane\ng = 10                          #gravitational field strength - N\/kg\nt = 0                           #initialize value for time in seconds\ndt = 0.001                      #value of the time-step in seconds\nrte = 400                       #value for the \"rate\" in the loops\nmuk = 0.2                       #coeffiecient of kinetic friction\nalpha = (5*muk*g\/(2*r))         #angular acceleration of ball (moment of inertia for solid sphere - 2\/5mr**2)\nFfric = m1 * g * muk           #frictional force on ball\nrotvel = 0                      #initialize the rotational velocity of ball\n\n\n#create some objects\nground1 = box(pos = vec(d\/2,-r\/4,0), size = vec(d,r\/2,d\/4), color = vec(0,0,4), texture = textures.wood)        #create the lane for the ball to slide on without friction\nground2 = box(pos = vec(-s,-r\/4,0), size = vec(2 * s,r\/2,d\/4), texture = textures.wood)                         #create the lane for the ball to slide with friction\nball = sphere(pos = vec(d,r,0), radius = r, mass = m1, velocity = vec(v1,0,0), texture=textures.gravel)        #create ball with a texture to be able so see the rotation\nscene.camera.follow(ball)                                                                                      #have the camera follow the ball\n\n\n# define graph of motion\ngrph = graph(title='Velocity vs Time', xtitle='Time (s)', ytitle='Velocity')            #create graph\nvelgraph = gcurve(color=color.red,  width = 5, label='Linear Velocity (m\/s)')           #define the curve for linear velocity\nrotgraph = gcurve(color=color.blue,   width = 5, label='Angular Velocity (rad\/s)')      #define the curve for angular velocity\n\negrph = graph(title='Energy vs Time', xtitle='Time (s)', ytitle='Energy (J)')           #create a second graph for energy\nkegraph = gcurve(color=color.red, width = 5, label='Translational Kinetic Energy (J)')  #define curve for kinetic energy\nrotkegraph = gcurve(color=color.blue, width = 5, label='Rotational Kinetic Energy (J)') #define curve for rotational kinetic energy\ntotalgraph = gcurve(color=color.green, width = 5, label='Total Energy (J)')             #define curve for rotational kinetic energy\n\n#calculate the momentum of the ball\nball.p = ball.mass * ball.velocity                                      #initial momentum of ball\n\n\n#get loopy to make things happen!\nwhile ball.pos.x &gt;= -(2 * s) + r:                                        #do this loop while the ball is on the lane\n    rate(rte)                                                            #set the rate\n    ball.pos = ball.pos + (ball.p\/ball.mass) * dt                        #calculate the position of ball based on its momentum and the time increment\n\n    if ball.pos.x &lt;= 0:                                                  #check to see if the ball is in the portion of the lane where there is friction\n\n        if rotvel * r &gt;= -ball.p.x\/ball.mass:                            #test to see if angular velocity matches the linear velocity - if so:\n            ball.rotate(axis = vec(0,0,1), angle = rotvel * dt )         #ball rotates\n\n        else:                                                            #have the rotation rate of the ball increase and the velocity of the ball decrease:\n            ball.p = ball.p + vec((Ffric * dt),0,0)                     #kinetic friction force acting on ball as it slides changing the momentum of ball\n            rotvel = rotvel + alpha * dt                                 #increment the angular velocity using the angular acceleration\n            ball.rotate(axis = vec(0,0,1), angle = rotvel * dt )         #determine how much the ball rotates\n\n    velgraph.plot(t, mag(ball.p\/ball.mass))                              #graph of linear velocity vs time\n    rotgraph.plot(t, rotvel)                                             #graph of rotational velocity vs time - counterclockwise is positive\n    \n    \n    tke = 0.5*ball.mass*(mag(ball.p\/ball.mass))**2                       #translational kinetic energy = 1\/2mv^2\n    rke = 0.5*((2\/5)*(ball.mass*r**2))*((rotvel)**2)                     #rotational kinetic energy = 1\/2Iw^2\n    kegraph.plot(t, tke)                                                 #translational kinetic energy\n    rotkegraph.plot(t, rke)                                              #graph of rotational kinetic energy\n    totalgraph.plot(t, tke+rke)                                          #total energy\n    \n\n    t = t + dt                                                           #increment the time\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Activity Information Learning Goals Interpret, edit, and add to the code of a computational model of a bowling ball Apply the momentum principle to an object in motion Apply the principles of rotational kinematics to an object in motion Use mathematical representations to support the claim that\u00a0the total momentum of\u00a0a system of objects\u00a0is conserved when &hellip; <a href=\"https:\/\/www.msuperl.org\/wp\/icsam\/computational-activities\/bowling\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Bowling&#8221;<\/span><\/a><\/p>\n","protected":false},"author":11,"featured_media":0,"parent":29,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-656","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/pages\/656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/comments?post=656"}],"version-history":[{"count":8,"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/pages\/656\/revisions"}],"predecessor-version":[{"id":768,"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/pages\/656\/revisions\/768"}],"up":[{"embeddable":true,"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/pages\/29"}],"wp:attachment":[{"href":"https:\/\/www.msuperl.org\/wp\/icsam\/wp-json\/wp\/v2\/media?parent=656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}