{"id":9889,"date":"2014-11-27T20:29:39","date_gmt":"2014-11-27T12:29:39","guid":{"rendered":"http:\/\/www.intmath.com\/blog\/?p=9889"},"modified":"2014-12-09T16:17:40","modified_gmt":"2014-12-09T08:17:40","slug":"math-cross-wind-landing-vectors-applet","status":"publish","type":"post","link":"https:\/\/www.intmath.com\/blog\/mathematics\/math-cross-wind-landing-vectors-applet-9889","title":{"rendered":"Math in cross-wind landing vectors applet"},"content":{"rendered":"<p>I recently updated the <a href=\"https:\/\/www.intmath.com\/vectors\/4-adding-vectors-2-dimensions.php\">cross-wind landing applet<\/a>, which is an introductory activity for the section on adding vectors in 2 dimensions in the Vectors chapter. The applet now works on tablet devices. <\/p>\n<p>Here's a screen shot of the applet: <\/p>\n<p><a href=\"https:\/\/www.intmath.com\/vectors\/4-adding-vectors-2-dimensions.php\"><img loading=\"lazy\" src=\"\/blog\/wp-content\/images\/2014\/11\/crosswind-vector-activity.png\" alt=\"crosswind vector activity\" width=\"224\" height=\"253\" \/><\/a><\/p>\n<p>Pilots need to be very aware of the effects of wind in all stages of flight - from takeoff (where they need to point into wind), during flight (where a tail wind means you get there quicker, so it's cheaper) and during landing (where once again, you need to land into wind, and if there is a cross wind, it can make the landing a bit more challenging). <\/p>\n<p>Flying is  an interesting real-world application of vector addition.<\/p>\n<h2>The cross wind applet<\/h2>\n<p>The idea behind this applet is that students should be given an opportunity to investigate mathematical concepts with some real-life (or simulated) activity. By thinking about what they have discovered, they are more likely to be able to connect the dots when it comes to later applications.<\/p>\n<p>The applet encourages you to fly around and to land the Cessna with a significant cross wind.<\/p>\n<p>You'll hopefully notice that you travel across the ground much faster when the wind is behind the aircraft (2 positive vectors added together), and slower when the wind is towards you (addition of one positive and one negative vector). <\/p>\n<p>There's some interesting math going on in the programming behind the applet, so let's have a look at some of it.<\/p>\n<h2>Trigonometry<\/h2>\n<p>Velocity vectors in 2 dimensions are made up of 2 components - one vector in the <span class=\"math\"><em>x<\/em><\/span>-direction (usually written <span class=\"math\"><em>v<\/em><sub><em>x<\/em><\/sub><\/span>) and the second in the <span class=\"math\"><em>y<\/em><\/span>-direction (usually written <span class=\"math\"><em>v<\/em><sub><em>y<\/em><\/sub><\/span>). <\/p>\n<p>To move the aircraft around, I used the following code: <\/p>\n<blockquote>\n<pre>xspeed = Math.cos((90-dir)*Math.PI\/180)*speed + wind;\r\nyspeed = (Math.sin((90-dir)*Math.PI\/180)*speed);<\/pre>\n<\/blockquote>\n<p>where:<\/p>\n<blockquote>\n<p>xspeed = <span class=\"math\"><em>v<\/em><sub><em>x<\/em><\/sub><\/span> (the <em class=\"math\">x<\/em>-component of the velocity) <\/p>\n<p>yspeed = <span class=\"math\"><em>v<\/em><sub><em>y<\/em><\/sub><\/span> (the <em class=\"math\">y<\/em>-component of the velocity) <\/p>\n<p>dir = the direction the plane is heading, in degrees (In navigation, 0&deg; = North and is at the top of the graph, and angles are measured clockwise)<\/p>\n<p>speed = the airspeed of the aircraft <\/p>\n<p>wind = the magnitude of the wind (In the applet, since the wind is from only due East or due West, we only need to add the wind component to xspeed. <\/p>\n<\/blockquote>\n<p>In javascript, the trigonometric functions are calculated using <a href=\"https:\/\/www.intmath.com\/trigonometric-functions\/7-radians.php\">radians<\/a>, while my input angle &quot;dir&quot; is in degrees.<\/p>\n<p>So I needed to convert my degrees to radians by multiplying by pi and dividing by 180.<\/p>\n<p>The above 2 lines just work out the 2 components of the vector, and move the aircraft to the appropriate position in time. <\/p>\n<h2>Vectors<\/h2>\n<p>Of course, I'm using the concepts of vector addition throughout the applet.<\/p>\n<p><img loading=\"lazy\" src=\"\/blog\/wp-content\/images\/2014\/11\/vector-cross-wind.png\" alt=\"crosswind vectors\" width=\"143\" height=\"121\" \/><\/p>\n<p>In the above screen shot, the Cessna is pointing in the direction of the blue vector (this is called the aircraft's &quot;heading&quot;). The wind is from the East (the black vector) and the result is the plane is moving across the ground in the direction of the <strong>red<\/strong> vector. <\/p>\n<p>Notice the red (resultant) vector is longer than the blue (heading) vector, and this represents greater speed. The wind is helping in this case, as it is behind the plane, but at an angle. We work out the size of this resultant vector by using the parallelogram you can see in the diagram.<\/p>\n<p>In this next screen shot, we see the wind is blowing from due East, and the aircraft is trying to head East, but is being slowed down resulting in a shorter resultant vector. <\/p>\n<p><img loading=\"lazy\" src=\"\/blog\/wp-content\/images\/2014\/11\/vectors-east2.png\" alt=\"resultant vectors - subtraction\" width=\"175\" height=\"42\" \/> <\/p>\n<p>Next, we see the case when the wind is behind us (from the West) and it is helping us (the resultant vector is longer). <\/p>\n<p><img loading=\"lazy\" src=\"\/blog\/wp-content\/images\/2014\/11\/vectors-west2.png\" alt=\"resultant vectors - addition\" width=\"203\" height=\"42\" \/> <\/p>\n<p>No matter what direction the plane is pointing, the length of the blue vector is constant, since the plane's airspeed is constant in the applet. <\/p>\n<p>The point at the end of the blue vector follows the path of a circle in <a href=\"https:\/\/www.intmath.com\/plane-analytic-geometry\/7-polar-coordinates.php\">polar coordinates<\/a>,<\/p>\n<blockquote>\n<p class=\"math\">(<em>r<\/em> cos <em>&theta;<\/em>, <em>r<\/em> sin <em>&theta;<\/em>)<\/p>\n<\/blockquote>\n<p>where <em>r<\/em> is the radius of the circle, and &theta; is the angle at the center of the circle.  <\/p>\n<h2>Absolute value<\/h2>\n<p>To determine whether the Cessna is close to the landing spot (the number &quot;36&quot; at the end of the runway), and pointing in an appropriate direction for a landing, I used this expression:<\/p>\n<blockquote>\n<pre>if(Math.abs(cessX) &lt; 2 &amp;&amp; Math.abs(cessY - 65) &lt; 3 \r\n  &amp;&amp; (dir &lt; 30 || dir &gt; 330) ) {\r\n ... \r\n}     <\/pre>\n<\/blockquote>\n<p>where<\/p>\n<blockquote>\n<p>cessX = the current <em>x<\/em>-position of the aircraft<\/p>\n<p>cessY = the current <em>y<\/em>-position of the aircraft<\/p>\n<\/blockquote>\n<p>The expression &quot;Math.abs(cessX)&quot; means &quot;find the absolute value of the current <em>x<\/em>-position&quot;. It then tests if that value is less than 2, and if it is, regard it as an acceptable value for the landing.<\/p>\n<p>Another way of writing this (using normal math notation) is:<\/p>\n<blockquote>\n<p class=\"math\">| cessX | &lt; 2 <\/p>\n<\/blockquote>\n<p>and this means<\/p>\n<blockquote>\n<p class=\"math\">&minus;2 &lt; cessX &lt; 2 <\/p>\n<\/blockquote>\n<p>That is, we can be within these limits for a landing (we will be on the runway).<\/p>\n<p>As for the <em>y<\/em>-value, we have:<\/p>\n<blockquote>\n<p>Math.abs(cessY - 65) &lt; 3<\/p>\n<\/blockquote>\n<p>(The start of the runway is 65 units from the origin point in the applet.) <\/p>\n<p>In normal math notation, this is:<\/p>\n<blockquote>\n<p><span class=\"math\">| cessY &minus; 65 | &lt; 3 <\/span><\/p>\n<\/blockquote>\n<p>We could write this as:\n  <\/p>\n<blockquote>\n<p><span class=\"math\">62 &lt;  cessY  &lt; 68 <\/span><\/p>\n<\/blockquote>\n<p>This means as long as we are lined up and pass close enough to the end of the runway, we'll land OK. <\/p>\n<p>For the direction, we have: <\/p>\n<blockquote>\n<p>dir &lt; 30 || dir &gt; 330<\/p>\n<\/blockquote>\n<p>The 2 vertical lines &quot;||&quot; mean &quot;or&quot; in most programming languages.<\/p>\n<h2>Mobile device considerations<\/h2>\n<p>Most smart phones and tablets have accelerometer sensors which determine the tilt angle of the device in 3 dimensions, relative to when the device is lying flat on a table.<\/p>\n<p>(See more on the <a href=\"https:\/\/www.intmath.com\/vectors\/6-3-dimensional-space.php\">3-dimensional coordinate system<\/a>.) <\/p>\n<p>These angles (usually denoted alpha, beta and gamma) are measured in the up-down, left-right and rotate-left, rotate-right directions. <\/p>\n<p>I'm using one direction only to  change the direction of the aircraft when used on a tablet. It's the &quot;beta&quot; direction, which roughly correspnds with a &quot;steering wheel&quot; movement of the tablet. <\/p>\n<blockquote>\n<pre>window.addEventListener('deviceorientation', \r\n  function(eventData) {\r\n    tilt = eventData.beta;\r\n  } <\/pre>\n<\/blockquote>\n<p>It's not as smooth as I'd like, but it works OK - albeit rather slowly on a tablet. <\/p>\n<h2>Conclusion<\/h2>\n<p>Math education should be less about plugging numbers into formulas and should get students to investigate phenomena through an activity. This cross wind landing applet aims to do just that. Students get the concepts (through some light-hearted activity) before worrying about the algebra.<\/p>\n<p class=\"alt\">See the <a href=\"https:\/\/www.intmath.com\/blog\/mathematics\/math-cross-wind-landing-vectors-applet-9889#comments\" id=\"comms\">2 Comments<\/a> below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/www.intmath.com\/blog\/mathematics\/math-cross-wind-landing-vectors-applet-9889\"><img loading=\"lazy\" src=\"\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/11\/crosswind-vector-activity_th.png\" alt=\"Here's some math behind the cross wind landing app in the vectors chapter\" width=\"128\" height=\"100\" class=\"imgRt\" \/><\/a><br \/>\nHere we look at some of the math behind the cross wind landing applet in the section on adding 2D vectors.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mo_disable_npp":""},"categories":[4],"tags":[109,130,127],"_links":{"self":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/9889"}],"collection":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/comments?post=9889"}],"version-history":[{"count":0,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/9889\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/media?parent=9889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/categories?post=9889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/tags?post=9889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}