{"id":95,"date":"2021-08-30T12:33:07","date_gmt":"2021-08-30T11:33:07","guid":{"rendered":"http:\/\/stormappsonline.co.uk\/blog\/?p=95"},"modified":"2021-08-30T12:33:07","modified_gmt":"2021-08-30T11:33:07","slug":"part-3-some-maths","status":"publish","type":"post","link":"https:\/\/stormappsonline.co.uk\/blog\/2021\/08\/30\/part-3-some-maths\/","title":{"rendered":"Part 3 &#8211; Some Maths"},"content":{"rendered":"\n<p>Or should that be &#8220;Some Math&#8221;? But I am from the UK!<br><br>As explained on the BBC Micro:bit MicroPython pages, overall acceleration can be calculated using Pythagoras&#8217; rule <a href=\"https:\/\/microbit-challenges.readthedocs.io\/en\/latest\/tutorials\/accelerometer.html\">here (under Advanced Functions)<\/a>.<br><br>To recap, if you just had accelerations along two dimensions (the x and y axis say),<img decoding=\"async\" loading=\"lazy\" width=\"514\" height=\"246\" class=\"wp-image-99\" style=\"width: 400px;\" src=\"http:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous1-1.jpg\" alt=\"\" srcset=\"https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous1-1.jpg 514w, https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous1-1-300x144.jpg 300w\" sizes=\"(max-width: 514px) 100vw, 514px\" \/><br><br>the overall acceleration can be found using the equation:<br><img decoding=\"async\" loading=\"lazy\" width=\"267\" height=\"148\" class=\"wp-image-97\" style=\"width: 150px;\" src=\"http:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous2.jpg\" alt=\"\"><br>Similarly, if the acceleration is in the three dimensions, (x, y and z axis), the overall acceleration can be found using the equation:<br><img decoding=\"async\" loading=\"lazy\" width=\"346\" height=\"182\" class=\"wp-image-98\" style=\"width: 150px;\" src=\"http:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous3.jpg\" alt=\"\" srcset=\"https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous3.jpg 346w, https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/pythagorous3-300x158.jpg 300w\" sizes=\"(max-width: 346px) 100vw, 346px\" \/><br>In python, the code looks like this:<br><img decoding=\"async\" loading=\"lazy\" width=\"405\" height=\"197\" class=\"wp-image-101\" style=\"width: 600px;\" src=\"http:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/program3.jpg\" alt=\"\" srcset=\"https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/program3.jpg 405w, https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/program3-300x146.jpg 300w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><br>If we subtract 1000 from the z-value (to remove the effect of gravity) and use the python function round( ) to round the number down (and remove the decimal places *)<br><img decoding=\"async\" loading=\"lazy\" width=\"454\" height=\"190\" class=\"wp-image-103\" style=\"width: 600px;\" src=\"http:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/program3b-1.jpg\" alt=\"\" srcset=\"https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/program3b-1.jpg 454w, https:\/\/stormappsonline.co.uk\/blog\/wp-content\/uploads\/2021\/08\/program3b-1-300x126.jpg 300w\" sizes=\"(max-width: 454px) 100vw, 454px\" \/><br>we now find that the overall output (\u201csum:\u201d) is consistently between -1 and 7 when the device is left resting on the table. If you hit the table, the acceleration will change. If I move the device up and down, then I can see the numbers change on the screen, and they go upto 800.<br><br>It is hard to see the exact link between how fast you start to move the micro:bit and the numbers on the sceen, especially with a short connecting lead as I have.  Finding a way of displaying this information will be looked at next time.<br><br>* strictly speaking rounding numbers down might be a small inaccurracy, but we can ignore this at the moment<br><br><em>Micro:bit to the Moon is Storm Educational&#8217;s contribution to helping children be interested in coding\/STEM. Code can be freely downloaded, adapted and used. But if a school could mention our software for primary\/elementary students we would be very grateful stormeducational.co.uk (with free online demos at stormedapps.co.uk).<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Or should that be &#8220;Some Math&#8221;? But I am from the UK! As explained on the BBC Micro:bit MicroPython pages, overall acceleration can be calculated using Pythagoras&#8217; rule here (under Advanced Functions). To recap, if you just had accelerations along two dimensions (the x and y axis say), the overall acceleration can be found using&hellip; <a class=\"more-link\" href=\"https:\/\/stormappsonline.co.uk\/blog\/2021\/08\/30\/part-3-some-maths\/\">Continue reading <span class=\"screen-reader-text\">Part 3 &#8211; Some Maths<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19,20,12,21],"tags":[],"_links":{"self":[{"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/posts\/95"}],"collection":[{"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":3,"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":105,"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions\/105"}],"wp:attachment":[{"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stormappsonline.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}