Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts

09022019, 11:32 PM
(This post was last modified: 09042019 02:49 AM by jlind.)
Post: #1




Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
Note:
There’s a limit to the number of images allowed in a posting. I’ve had to break this up into three parts to cope with that . . . This is Part I of III Just recently acquired the HP Prime G2. It's a different beast compared to the TI and other HP calculators I have, including a TI Nspire CX II CAS. Best way I've found to work through using a new calculator is to solve some nontrivial problems with it. Started with the "Hallway Pole Problem" which involves having to move a rigid pole horizontally around a right angle corner between two hallways of different widths. If they were the same width, the problem would be trivial with a trivial solution, and the astute would see it immediately. Presuming the hallways are long enough that the limiting factor is the length that can fit around the corner, the goal is to find the longest pole that can be moved though the corner. The pole is too heavy to lift to tilt it and must be pushed through. Those who have moved furniture in and out of homes and apartments  and sometimes inside a home to different rooms  will recognize the nature of this problem, especially with long and heavy couches. Big king size mattresses and box springs can also be a challenge. Following shows a view of the problem as seen from above (aka the Plan View): I posted this problem elsewhere and someone immediately asked what the height of the hallway is, even though the problem statement excluded being able to tilt the pole upward from floor to ceiling. Nevertheless, I responded the ceiling in both hallways is 8 feet above the floor, with ceiling and floor both level and parallel planes throughout the problem space. It should be noted that adding height and considering being able to tilt the pole upward allows a longer pole, but it's a trivial addon, as one is now moving a right triangle of uniform height around the corner, the other leg of which is the hypotenuse of the first triangle shown in the Plan View. More on that later. ;) There are two equations that can define all the possible lengths of "C" in a single independent variable:
a = x + 5. Since the larger and smaller triangles are similar, the ratios of their similar sides are equal: b/a = 10/x, the most relevant ratio to setting up the equation. b = 10*a/x b = 10*(x+5)/x, by substitution b = 10 + 50/x, simplifying the equation From the Pythagorean Theorem: c^2 = a^2 + b^2 c^2 = (x+5)^2 + (10 + 50/x)^2 c = ((x+5)^2 + (10 + 50/x)^2)^(1/2), c > 0 As these are similar triangles, the angle θ between sides "a" and "c" is the same as the angle between the larger hallway width 10 and c1. Likewise it's the same angle between the narrower hallway width 5 and c2. Thus, all the trigonometric relationships, Sine, Cosine, Tangent and Cotangent using the ratios of the sides are equal. Cosθ = 10/c1 c1 = 10/Cosθ Sinθ = 5/c2 c2 = 5/Sinθ c = (5/Sinθ) + (10/Cosθ), 0 < θ < 90 degrees, or π/2 radians I will use degrees for this problem, even though I'd normally use radians, as most can relate better visually to degrees. The general approach to finding the longest pole length is finding the shortest length of "c" that among all the possible right triangles formed by the two outer walls and the inner corner. To do that:
In the "old days" of working these problems by hand using pencil, an engineering pad, slide rule and the CRC Handbook of Mathematical Tables, the latter using trigonometry was much, much simpler. It's how I worked problems like this when I was taking University Calculus as an undergrad (the HP 35 hadn't been released yet). This problem can be worked in several ways with a CAS capable calculator.
Method 1: Differentiating the Pythagorean equation using the "chain rule": c' = f'(x) = (1/2)*((x+5)^2 + (10 + 50/x)^2)^(1/2) * 2(x+5) + 2*(10 + 50/x)*(1)*(50/x^2) Don't think I want to try to find the root to this one . . . let's try differentiating the trig equation. ;) c' = f'(θ) = (5/(Sinθ)^2)*(Cosθ) + (10/(Cosθ)^2)*(Sinθ) Much simpler! To find the zero, set c'=0: (5/(Sinθ)^2)*(Cosθ) + (10/(Cosθ)^2)*(Sinθ) = 0 Move the first half of this to the other side of the equal sign and start reducing: (10/(Cosθ)^2)*(Sinθ) = (5/(Sinθ)^2)*(Cosθ) 2 * (Sinθ) = ((Cosθ)^3/(Sinθ)^2) 2 = ((Cosθ)/(Sinθ))^3 2 = (Cotθ)^3; (Note: Cos(x)/Sin(x) = Cot(x), a trig identity) Cotθ = 2^(1/3) θ = ArcCot(2^(1/3)), or θ = ArcTan ((2)^(1/3)), since many calculators have Tan and ArcTan, but not Cot or ArcCot. θ = ArcTan ((0.5)^(1/3)) θ ~= 38.44 degrees c ~= 5/Sin(38.44 degrees) + 10/Cos(38.44 degrees) c ~= 20.81 feet Having memorized the differentials of the common transcendentals, and some basic trig identities reduced this relatively quickly using the angle and trig functions. If I'd tried to use the first derivative of the Pythagorean equation I'd probably still be working on it, wanting to break the pencil in half. Screen capture showing the calculation with calculator set for RPN entry. I hit the enter key a couple times to put some of the intermediate numbers further up the stack so they wouldn't disappear. Shows the one entry that will be divided by 2 giving 0.5, followed by taking its cube root, and then the ATan of that in degrees. Last entry is the use of that angle in the original trig equation to get the max length. Note that it's not 45 degrees, which it would be if the hallways were the same width, with an Isosceles right triangle and the pole would be 2*(hallway width)*sqrt(2), a trivial solution the astute would immediately see. Method 2: Now I use the HP Prime's Function application, its Plot capability, and the Extremum Function within the Plot. Entering the Function Symbolic View, the trig function is entered as a function of "X" which is convenient. Next the Plot view is invoked by pressing the Plot button, and we have the cursor on a point along the curve. We're in the first "quadrant" of angle which > 0 and < 90 degrees. It's obvious there's a local minimum for the length of "c", which is what I'm seeking. The Plot view has a function for finding the nearest Extremum (local maximum or minimum); it's number 7 on the menu . . . It finds the minimum instantly and there's an option to highlight it as I've done with the yellow dashed lines. As calculated above doing it by hand, the angle at which the shortest "c" occurs is about 38.44 degrees. This gives the same longest pole length of approximately 20.81 feet. There's little doubt in my mind now why the calculator is banned on some tests because it has CAS capability, and why it has a "test mode" that can limit or block these capabilities. One wouldn't need to understand the underlying calculus concepts for finding critical points: maxima, minima and inflections. Plug and chug in a graph and Bob's your uncle, you've got the answer. Not what you'd want for someone who's supposed to be mastering calculus. For what it's worth, a similar solution method is used in the Math/Utilities Library Module for my TI58, although it can take a while to churn away finding the critical point of interest (will also tell you if it's a local max or min  can't find inflections  and has an option to continue onward to the next one). Requires writing a short program for the function itself. Likewise, my TI85 and TI86 use the same or similar method, and also require writing a short program containing the function, so the calculator can loop through it as it chases down a critical point. The DM42 has a similar program in its FAT library (also requires writing a program for the equation). To be Continued in Part II . . . John John Pickett: N4ES, N600 TI: 58, 30III, 30x Pro MathPrint, 36x Solar, 85, 86, 89T, Voyage 200, Nspire CX II CAS HP: 50g, Prime G2, DM42 

09022019, 11:38 PM
(This post was last modified: 09032019 12:11 AM by jlind.)
Post: #2




Learning How to Use the Prime G2  Hallway Pole Problem  Part II of III
Note:
There’s a limit to the number of images allowed in a posting. I’ve had to break this up into three parts to cope with that . . . This is Part II of III Method 3: This uses the Prime's CAS and calculus functions to solve the problem. Going back to the Function applications Symbolic View I'm making use of the equation entered before as the starting point. Going to the Function application's CAS View (using the CAS button), the function can be called by its variable name "F1(X)" in the calculator that was assigned when it was entered into the Symbolic View. The first task is finding its first differential, aka F'(X), or dF(X)/dX. In the CAS view the function for it is first pulled up using the white Toolbox button. This isn't intuitively obvious. Under the CAS tab I'm going to use "Calculus" which is number 2 on the menu. That will bring up a submenu on which I'm going to use "Differentiate" which is the first option listed. This puts "diff()" function on the calculation entry line. Inside the parentheses I enter "F1(X)" referring back to the equation entered in the Symbolic View, and the equation's variable I want to differentiate for, "X". It is case sensitive. Pressing the "Enter" key instantaneously returns the first differential. Going back to the Symbolic View, F2(X) is highlighted so F'(X) can be entered there. Using the black "Menu" button brings up the option to get an equation from CAS, which is where we left the F'(X) result. This brings up a window of calculations and results in CAS. The F'(X) differentiation result is highlighted. The highlighting can be moved up and down to get the desired equation. It's the last one calculated, so it's automatically highlighted. Once pulled in, the equation is on the equation entry line in the Symbolic View. Highlighting the space for F2(X) and hitting the enter key puts it into F2(X). To find the root (or zero) of F'(X), I return to the CAS view and use the toolbox again. This time I use the Solve submenu. While the "Zero" would be the intuitive choice, it will return more than one zero. I need to specify the 0 to 90 degree domain which the "Zero" function won't allow. For that, I need to use the Numeric Solve, which is number 6 on the Solve submenu. This puts the "fsolve" function on the entry line. F2(X) with the X variable are entered in, and the next option, "0..90", specifies the domain over which it's to be solved, 0  90 degrees, which are the outside limits on the angle in this problem. Hitting the "Enter" key calculates the root as X ~= 38.44 degrees, which is what was found before doing it by hand, and then using the graphing Extremum finder. To be continued and finished in Part III . . . John John Pickett: N4ES, N600 TI: 58, 30III, 30x Pro MathPrint, 36x Solar, 85, 86, 89T, Voyage 200, Nspire CX II CAS HP: 50g, Prime G2, DM42 

09022019, 11:42 PM
(This post was last modified: 09032019 06:30 AM by jlind.)
Post: #3




Learning How to Use the Prime G2  Hallway Pole Problem  Part III of III
Note:
There’s a limit to the number of images allowed in a posting. I’ve had to break this up into three parts to cope with that . . . This is Part III of III At the end of Part II, I had solved for the root of the first derivative and found the angle. From there, it's a simple matter to type in F1(X) on the entry line. This uses the angle, which is now stored in "X", it finds the longest pole length, c ~= 20.81 feet, which matches what was found using the first two methods. While it's a certainty this is the answer from all that's been calculated and graphed thus far, showing that it's a local minima needs the second derivative, F''(X). To find it, the same process as the first derivative is used on it to get the second derivative. The second derivative is quite messy, but that's OK as it's only needed with the angle found to see if it's positive, negative or zero. I believe some of that messiness is using degrees instead of radians. It will be a "plug and chug" calculation: In using the second derivative test:
As with F'(x) before, F''(X) is imported from CAS into the Symbolic view, and it's stored in F3(X). Now I can go back to the CAS view and enter in F3(X) to show that it's positive for the critical point found. I can also put in F2(X) to show the slope at the local minimum. It should theoretically be zero, but ~2.1E12 is close enough, likely due to (cumulative) rounding errors with the approximation of the local minimum. Finally, all three functions, F(x) in blue, F'(X) in red, and F''(X) in green graphed with the F(x) minimum marked. The curve for F'(X) shows the intersection, albeit muddled with the Xaxis tick marks. Looking at it almost obviates bothering with F''(X) test as its slope is always increasing; it never changes direction even though its slope is very shallow around the F(X) minimum. Epilogue: Finally, a word about the ceiling and tilting the pole. Doing so changes the problem from moving a line around the corner to moving a vertical triangle around the corner. The pole is now a hypotenuse on that triangle. Its horizontal leg is the hypotenuse, "c" in the problem presented. For a uniform height ceiling (I put it at the common eight feet found in many homes), the vertical leg never changes. So, if one is able to tilt the pole, with an eight foot high ceiling, the longest pole becomes: p^2 = c^2 + 8^2 p = (~20.82^2 + 64)^0.5 p ~= 22.3 feet Only about 18 inches longer. Less than a 10% increase; not as much as most would think. The Doubting Thomas types are invited to work it with an equation that tilts the pole from floor to ceiling (which I've done) to verify it's a trivial addon. Had to wander in the wilderness of the Prime's documentation for a while to get a handle on how to use it for problems like this one. Reminded me of how much I hate PDFs for documentation. Give me a printed book. Much easier to for me use. Spent a considerable amount of time experimenting with various menus and the tools residing in them. The Zeros function ran me around in circles for a while trying to figure out how to limit the domain it would use to 090 degrees (0 to Pi/2). If there's a disappointment, it's in HP's documentation and the lack of real problem examples. Contains a ton of information, but found it quite difficult to use. Hope walking through the Hallway Pole problem and how I worked it is of help to someone else coping with the HP Prime's learning curve. Normally I'd work a problem like this using the angle in radians, not in degrees, and leave the calculator set to radians, but most people relate better to angles in degrees, without having to remember 45 degrees is roughly 0.785 radians. John Footnote: I've proofread this several times but I'm not perfect. If I find an error, I'll do an edit to fix it. John Pickett: N4ES, N600 TI: 58, 30III, 30x Pro MathPrint, 36x Solar, 85, 86, 89T, Voyage 200, Nspire CX II CAS HP: 50g, Prime G2, DM42 

09032019, 07:23 AM
Post: #4




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
That's really interesting question. will go through, and try solving that. Thank you ;)


09032019, 06:00 PM
Post: #5




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
JLind,
you have a gift for explaining topics, and if HP would hire you to write a manual for the nextgen calculator (or a brand new book for the HP Prime) I would definitely consider the purchase, but I need to know a thing: Who's Bob, and why does it matter whether he's your uncle or not! 

09042019, 12:53 AM
(This post was last modified: 09042019 01:13 PM by Albert Chan.)
Post: #6




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
(09022019 11:32 PM)jlind Wrote: Nice post. To minimize c, you just need to minimize c^2 (Actually, it does not matter. c' = (c^2)' / (2c)) \(\large (c^2)'= 2(x+5) + 2(10+ {50 \over x})({50 \over x^2}) = 2(x+5)  {1000(x+5) \over x^3} = { 2(x+5) (x^3500) \over x^3} \) \(\large (c^2)'=0 → x = 5 \sqrt[3]4 ≈ 7.93701 \) \(\large \min(c) = 5(1+ \sqrt[3]4)^{3/2} ≈ 20.80969 \) 

09042019, 02:42 AM
(This post was last modified: 09042019 02:43 AM by jlind.)
Post: #7




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
(09032019 06:00 PM)JoJo1973 Wrote: JLind, Thanks! "Bob's your uncle" is a British phrase for something that's very simple and easily accomplished with little effort. Learned it from the British Army when I was stationed in Europe. It was a favorite used by a young lieutenant  same rank as a US 1st Lt. Wasn't hard to figure out from context, but finally asked him for the back story. Allegedly a Prime Minister whose first name was "Robert", aka "Bob", appointed his nephew to a key post in the British government of Ireland in the late 19th Century (before the Irish Free State), the equivalent of its Secretary of State and its de facto daytoday governor. It was a very high visibility and unpopular act of nepotism. Notwithstanding whatever qualifications and merits the nephew might have had otherwise, "Bob's your uncle" was perceived as the one that got him the posting. "And that's the rest of the story." John John Pickett: N4ES, N600 TI: 58, 30III, 30x Pro MathPrint, 36x Solar, 85, 86, 89T, Voyage 200, Nspire CX II CAS HP: 50g, Prime G2, DM42 

09042019, 04:10 AM
Post: #8




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
Starting from 5/sin(x) + 10/cos(x) = ct. Then I solved the value of x where the derivative of ct to x is 0. I found x = 2.47, and 0.67, so only the positive value is applicable. Then put x=0.67 in ct, then we have ct = 20.81.


09042019, 09:17 AM
(This post was last modified: 09042019 09:18 AM by jlind.)
Post: #9




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
(09042019 04:10 AM)teerasak Wrote: Starting from 5/sin(x) + 10/cos(x) = ct. Then I solved the value of x where the derivative of ct to x is 0. I found x = 2.47, and 0.67, so only the positive value is applicable. Then put x=0.67 in ct, then we have ct = 20.81. This is approximately the method I used with a TI Voyage 200, doing the first derivative and finding its positive root simultaneously in one entry. The Zeros function on the Voyager 200 (and TI89T) allow bounding the domain. Your "x" is in radians. I will have to try how you did this and find where the menu system has the functions you used. Part of my challenge has been wandering around through the menus. Thanks John John Pickett: N4ES, N600 TI: 58, 30III, 30x Pro MathPrint, 36x Solar, 85, 86, 89T, Voyage 200, Nspire CX II CAS HP: 50g, Prime G2, DM42 

09122019, 04:03 PM
Post: #10




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
As a comparison  I used a TI58 and the Math/Utilities Library Module's MiniMax Program (MU16) to solve this problem using the trig equation. Similar to the older HP's, it requires programming in the equation for the MiniMax program to use. It was able to solve the problem in under 40 minutes, first finding the angle (a minimum, in Grads ;) ) and then the maximum pole length, in feet, using that angle. Following is a video of it with substantial cuts made to reduce it to just over a minute. ;) Anyone thinking a current generation calculator takes too long should appreciate the time required 40 years ago.
First number entered is the "Delta" increment to use in seeking minima and maxima. Second number is the starting point. Since it's in Grads, starting with 2 Grad is well under the angle we're seeking and 0.1 as an increment will give substantial precision. A similar Delta and starting point would be good for degrees. Had it been in Radians, I'd have used significantly different values for the Delta and starting point. Enjoy the video . . . John John Pickett: N4ES, N600 TI: 58, 30III, 30x Pro MathPrint, 36x Solar, 85, 86, 89T, Voyage 200, Nspire CX II CAS HP: 50g, Prime G2, DM42 

09132019, 04:16 PM
Post: #11




RE: Learning How to Use the Prime G2  Hallway Pole Problem  In Three Parts
John  that's amazing! Considering timeline of TI58. I would say that it is really capable to handling this kind of calculation! Thank you for sharing.


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)