A weekend quickie - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: A weekend quickie (/thread-237726.html) A weekend quickie - Valentin Albillo - 01-25-2013 Hi, all: A nice quickie for the weekend (though I don't think it will take most of you more than a few minutes to solve): Write a program, procedure, or keystroke sequence for your favorite HP calculator to find the length "d" in the following diagram: There are a gazillion ways to attack it: using trigonometrics or not, computing intersections or not, etc. I quickly solved it in my HP-71B using an intuitive (but far-from-optimum) approach that involves solving a couple of very simple systems of non-linear equations, let's see how you do it. Oh, and the correct value for d is somewhat surprising ! ... 8-) Best regards from V. ``` ``` Re: A weekend quickie - Paul Dale - 01-25-2013 Using the 34S and its standard library triangle solver kind of makes this one easy, although the keystroke count is high: ``` XEQ'TRI' R/S 23 R/S 16 R/S 30 R/S R/S R/S R/S R/S R/S R/S R/S Got the angle we're after finally SIN 16 * Perpendicular height from base to the lower end of d (12.1160...) STO 19 XEQ'TRI' R/S 27 R/S 22 R/S 30 R/S R/S R/S R/S R/S R/S R/S R/S SIN 22 * Perpendicular height from base to the upper end of d (19.1004) RCL- 19 And the answer..... ``` I don't however recognise the surprise :-( - Pauli Re: A weekend quickie - Valentin Albillo - 01-25-2013 Quote: Using the 34S and its standard library triangle solver kind of makes this one easy, although the keystroke count is high: ``` * Perpendicular height from base to the lower end of d (12.1160...) ... * Perpendicular height from base to the upper end of d (19.1004) RCL- 19 And the answer..... ``` I don't however recognise the surprise :-( Thanks for your interest, Pauli. If you don't see the "surprise" it might be the case that your value for "d" isn't the correct one. Perhaps some slightly wrong assumption on your part ? ... 8-) Best regards from V. ``` ``` Re: A weekend quickie - Paul Dale - 01-25-2013 Ahhh, I see the mistake now :-( - Pauli Re: A weekend quickie - Paul Dale - 01-25-2013 And I managed to guess & then verify the correct answer :-) - Pauli Re: A weekend quickie - Jean-Michel - 01-25-2013 Hello, perhaps should you mention that the figure is not contractual in its current state, somewhat confusing. Kind regards. Re: A weekend quickie - Valentin Albillo - 01-25-2013 Quote: And I managed to guess & then verify the correct answer :-) Have a nice weekend, Pauli ! Best regards from V. ``` ``` Re: A weekend quickie - Gerson W. Barbosa - 01-25-2013 Hello Valentin, I've resorted to Heron's formula:( http://en.wikipedia.org/wiki/Heron's_formula ) ```p1 = (27 + 23 + d)/2 p2 = (22 + 16 + d)/2 p3 = (16 + 23 + 30)/2 = 69/2 p4 = (30 + 22 + 27)/2 = 79/2 ``` The respective areas are ```A1 = 1/4*sqrt(2516*d2 - d4 - 40000) A2 = 1/4*sqrt(1480*d2 - d4 - 51984) A3 = 64/4*sqrt(111) A4 = 5/4*sqrt(52535) ``` Then, using the equality ```A4 = A1 + A2 + A3 ``` on the hp 50g in exact mode we get this equation ```%%HP: T(3)A(R)F(,); '1/4*\v/-(d^4-1480*d^2+51984)+1/4*\v/-(d^4-2516*d^2+40000)+69/4*\v/111=5/4*\v/52535' ``` which can easily be solved for d, giving a surprising result indeed! Thanks and Best regards, Gerson. P.S.: Edited so that the surprise is not ruined. This is not the kind of solution you are looking for, however. Edited: 25 Jan 2013, 9:49 a.m. Re: A weekend quickie - C.Ret - 01-25-2013 Hi, Here my humble contribution to this W.-E. Quickie. It is for my prefered HP advanced calculator. ```« 30 -> ab // ab is base length (distance frrom point A to point B) « « SQ -> a b // define subroutine XYPos which compute (x,y) coordinate (complex) // positive intersection point at distances a from A and b from B « ab SQ a b - + 2 / ab / ABS // -compute x a OVER SQ - ABS SQRT // -compute y R->C // Convert to (x,y) » » -> XYPos « 27 SQ 22 XYPos EVAL // Compute complexe coordinates of first intersection point 23 SQ 16 XYPos EVAL // Compute complexe coordinates of second intersection point - ABS // Compute length d between first and second intersection » » » ``` I am just curious of versions for others calculators, especially RPN ones as well as the HP-39gII ! Have a nice Week-End. Spoiler: As the end of the week-end approves: I1= (19.0833,19.1004) I2= (19.5500,12.1160) d = 7 Edited: 27 Jan 2013, 9:28 a.m. after one or more responses were posted Re: A weekend quickie - Jean-Michel - 01-25-2013 Hi, here is an HP-41 version: Assuming R01=27 R02 = 30 R03 = 22 R04 = 23 R05 = 16 LBL "?" RCL 05 RCL 02 RCL 04 XEQ 01 STO 00 RCL 02 RCL 03 RCL 01 XEQ 01 RCL 00 - COS RCL 03 RCL 05 * * ST+ X RCL 03 X^2 RCL 05 X^2 + X<>Y - SQRT RTN LBL 01 X^2 CHS X<>Y STO T X^2 + X<>Y ST* Z X^2 + X<>Y ST+ X / ACOS END 57 bytes XEQ "?" gives ... the answer ! Best wishes, JMB. Re: A weekend quickie - Walter B - 01-25-2013 Using good old Euklidian and Pythagorean mathematics, I get: The height of the small (bottom) triangle is hs= 23 x 16 / 30. And the corresponding left part of the hypotenuse is cs= 23 x 23 / 30. The height of the big (outer) triangle is hb= 27 x 22 / 30.And the corresponding left part of the hypotenuse is cb= 27 x 27 / 30. Thus I have two points (cs; hs) and (cb; hb), and d is the distance of those. Using my WP 34S (what else?) I calculate: ```CL[Sigma] 23 ENTER 16 x 23 ENTER x [Sigma]+ 27 ENTER 22 x 27 ENTER x [Sigma]- SUM ->POL 30 / ``` ... and get d but don't get a surprise :-? Re: A weekend quickie - fhub - 01-25-2013 Result with Derive: Franz Re: A weekend quickie - fhub - 01-25-2013 Quote: Using good old Euklidian and Pythagorean mathematics, I get: The height of the small (bottom) triangle is hs= 23 x 16 / 30. And the corresponding left part of the hypotenuse is cs= 23 x 23 / 30. The height of the big (outer) triangle is hb= 27 x 22 / 30.And the corresponding left part of the hypotenuse is cb= 27 x 27 / 30. That would only be true for right-angled triangles. That's why you don't get a surprise ... ;-) Franz Re: A weekend quickie - Walter B - 01-25-2013 Oooh - rats! That's the consequence of my blind belief in Euklid :-( Re: A weekend quickie - Gerson W. Barbosa - 01-25-2013 I used to believe in Euclides myself. He was my math teacher in high-school for two years :-) Re: A weekend quickie - Walter B - 01-25-2013 ... I should have used TRI for the triangular calculations :-I F... ambition :-( OK, with the angle alpha and the side c of the bottom triangle I get x and y for point s via ->REC returning (19.550; 12.116). Put it into statistic registers via [Sigma]+. Same for the outer triangle, returning (19.083 ; 19.100) for point b. Calculating the distance via [Sigma]- , SUM, and ->POL returns 7. Re: A weekend quickie - Walter B - 01-25-2013 :-) Re: A weekend quickie - Maximilian Hohmann - 01-25-2013 Quote:->POL returns 7. I cheated and used this website to get the same result: http://www.mathepower.com/dreieck.php Maybe the website is hosted on an HP-computer ;-) Re: A weekend quickie - Gerson W. Barbosa - 01-25-2013 Hi Franz, The old saying "there is more than a way to skin a cat" still holds :-) When the images above are eventually gone, just submit `solve [1/4*sqrt(-d^4+1480*d^2-51984)+1/4*sqrt(-d^4+2516*d^2-40000))+69/4*sqrt(111)-5/4*sqrt(52535)==0] for d` to Wolfram|Alpha. Gerson. Re: A weekend quickie - fhub - 01-25-2013 Quote: The old saying "there is more than a way to skin a cat" still holds :-) That's right, Gerson. ;-) But I guess that more people would know the cosine-rule than Heron's area formula, and it's certainly easier to give a solution with a simple formula instead of having to solve a quartic equation. Of course your equation gives the same solution, but the exact Wolfram-Alpha result is much more complicated than the one I get with Derive - I know why Derive is still my favourite CAS (at least for daily use). :-) Franz Re: A weekend quickie - Gerson W. Barbosa - 01-25-2013 You're right! I didn't mean to say "mineisbetter" :-) One of these days I was reading about Heron's formula (and Brahmaguta's) in a book written by a local electrical engineer, so it was the first thing I thought of when I saw the problem. The quadratic equation would be really somewhat difficult to solve by hand, but that's an easy job for the HP solver. These many ways of solving the problem, including yours, is what makes this topic very interesting! Best regards, Gerson. Re: A weekend quickie - Dieter - 01-25-2013 It can be done with three "TRI" calls ...and virtually no mathematical knowledge at all. ;-) ```XEQ"TRI" R/S 22 R/S 27 R/S 30 R/S R/S R/S R/S R/S R/S R/S R/S STO 20   XEQ"TRI" R/S 16 R/S 23 R/S 30 R/S R/S R/S R/S R/S R/S R/S R/S STO- 20   XEQ"TRI" R/S R/S 27 R/S 23 R/S RCL 20 R/S R/S R/S R/S ``` Et voilà... Dieter Edited: 25 Jan 2013, 3:27 p.m. Re: A weekend quickie - fhub - 01-25-2013 Quote: It can be done with three "TRI" calls ...and virtually no mathematical knowledge at all. ;-) Well, that's exactly the method I showed with my Derive output. And the 'mathematical knowledge' needed is already packed into my program "TRI". ;-) Franz Edited: 25 Jan 2013, 3:37 p.m. Re: A weekend quickie + Similar Problems - Jean-Michel - 01-25-2013 ``` Here are 2 similar problems: 1°) ABC is an equilateral triangle: AB = BC = CA = x M is a point such that AM = 57 , BM = 65 , CM = 73 -> Calculate x 2°) ABCD is a regular tetraedron: AB = BC = CD = AC = AD = BD = x M is a point such that AM = 56 , BM = 59 , CM = 69 , DM = 79 -> Calculate x Enjoy, JM. P.S: I think the problem may generalized to a regular simplex... ``` Re: A weekend quickie - Gilles Carpentier - 01-25-2013 Here is a solution for HP39GII which use the TRIANGLE "Apps" : ```EXPORT TRI(a,b,c,d,f) BEGIN L1:=SSS(a,d,f)-SSS(a,b,c); L1:=SAS(b,L1(3),d); L1(1); END; ``` TRI(30,23,16,27,22) returns ... the answer ;) SSS Uses the lengths of the three sides of a triangle to calculate the measures of the three angles SAS Uses the length of two sides and the measure of the included angle to calculate the length of the third side and the measures of the other two angles. Nota : There is a mistake in the documentation. these functions doesn't returns a list all 6 values but only the 3 unknows. But I like the "integrated" help (in french ;) on this calculator (for triangle you have AAS ASA SAS SSA SSS) Edited: 25 Jan 2013, 5:44 p.m. Re: A weekend quickie + Similar Problems - fhub - 01-26-2013 Quote: ```1°) ABC is an equilateral triangle: AB = BC = CA = x M is a point such that AM = 57 , BM = 65 , CM = 73 -> Calculate x ``` Franz Re: A weekend quickie + Similar Problems - Gerson W. Barbosa - 01-26-2013 ```Quote: 1°) ABC is an equilateral triangle: AB = BC = CA = x M is a point such that AM = 57 , BM = 65 , CM = 73 -> Calculate x ``` Let the Cartesian coordinates of the points A, B, C and M be ```A(0,0), B(0,x), C(x/2,x*sqrt(3)/2), M(a,b) ``` Then``` AM = sqrt(a^2 + b^2) = 57 => a^2 + b^2 = 3249 (1) BM = sqrt((a-x)^2 + b^2) = 65 => (a-x)^2 + b^2 = 4225 (2) CM = sqrt((a - x/2)^2 + (b - x*sqrt(3)/2)^2) = 73 => (a - x/2)^2 + (b - x*sqrt(3)/2)^2 = 5329 (3) ``` Expanding (2) ```a^2 - 2*a*x + x^2 + b^2 = 4225 ``` and replacing a^2 + b^2 with 3249, from (1), gives ```x^2 - 2*a*x - 976 = 0 x = a + sqrt(a^2 + 976) (4) ``` From (1) ```b = sqrt(3249 - a^2) (5) ``` Plugging (4) and (5) into (3) gives ```(a - (a+sqrt((a^2 + 976)))/2)^2 + (sqrt(3249 - a^2) - (a + sqrt((a^2 + 976)))*sqrt(3)/2)^2 - 5329 = 0 ``` When solving ```%%HP: T(3)A(R)F(,); '(a-(a+\v/(a^2+976))/2)^2+(\v/-(a^2-3249)-(a+\v/(a^2+976))*\v/3/2)^2-5329=0' ``` on the HP 50g we get ```a = 51.6428571428 ``` The fractional part suggests this is the rational number 723/14 Replacing it in (4) finally gives ```x = 723/14 + sqrt((723/14)^2 + 976) x = 723/14 + 845/14 = 1568/14 x = 112 ``` This is actually a numerical solution in disguise, however. Gerson. Re: A weekend quickie - C.Ret - 01-26-2013 Good catch Gilles ! Bien joué. Re: A weekend quickie - Mike Reed - 01-26-2013 This is only absolutely true IF the figure is two dimensional (all 4 points lie in the same plane) If the figure is 3 dimensional (a tetrahedron) then the correct length has a range where the minimum is 7. What is the maximum? :o) mike Re: A weekend quickie - Dave Shaffer (Arizona) - 01-26-2013 If you have complete freedom to move one of the apexes around, you should move it to the other side - in other words, flip one of the triangles top to bottom (or, rotate 180 degrees around the length 30 side). The result is planar again, but I think that will maximize d. I get a value of 31.219918836 for that (with my HP35S, using Heron's rule to find the areas and then the heights of the triangles to ascertain the coordinates of the two corners connected by d). Re: A weekend quickie - George Litauszky - 01-27-2013 Here is a geometry solution.It's true: The calculator isn't a HP. It's a TI-92Plus with the Geometer's Sketchpad flash application. The graph's scale is 3:1, so every pixel value must be divided by 3. AB= 90/3= 30 AC= 81/3= 27 BC= 66/3= 22 AD= 69/3= 23 BD= 48/3= 16 CD= 21/3= 7 pixels. I tried to download the Bernard Parisse's 50g Geometry from here but I got an error message. Any ideas? Re: A weekend quickie - Walter B - 01-27-2013 Interesting solution. How large is the quantisation error in this context? Re: A weekend quickie - George Litauszky - 01-27-2013 It seems in this case nothing. I can move the cursor pixel by pixel horizontally and vertically and I get integer coordinate values. In diagonal direction these values are decimal fractions but I can't write a needed exact value directly from the keyboard. :( Re: A weekend quickie + Similar Problems - Jean-Michel - 01-27-2013 ```Hi, very good solutions ! The 2nd problem ( regular tetrahedron ) may be solved in the same ways: 1°) Using the coordinates of the 5 points leads to a 4x4 non-linear system. 2°) We can also write that the sum of the volumes of the 4 tetrahedrons MABC + MBCD + MACD + MABD = the volume of ABCD ( with Francesca's formula ) 3°) A 3rd approach is: Sum of the 4 trihedral angles MABC + MBCD + MACD + MABD = 720° -But there is a "magic" formula that solves both problems and probably more: If ABC is an equilateral triangle and AM = a , BM = b , CM = c 3(a^4+b^4+c^4+x^4) = (a^2+b^2+c^2+x^2)^2 -This can be proved using the coordinates of the 4 points, like Gerson's solution. If ABCD is a regular tetrahedron and AM = a , BM = b , CM = c , DM = d 4(a^4+b^4+c^4+d^4+x^4) = (a^2+b^2+c^2+d^2+x^2)^2 -I must say I have not proved this formula but it would be surprising if it were wrong ! -Whence the conjecture: If A1 A2 ... An is a regular simplex ( edge length = x ) and MA1 = a1 , MA2 = a2 , ........ , MAn = an n [ (a1)^4 + ........ + (an)^4 + x^4 ] = [ (a1)^2 + ......... + (an)^2 + x^2 ]^2 -It works at least with n = 3 and n = 4 -So we just have to solve a quadratic equation to find x^2 ! -Here is an HP41-program: 01 LBL "WST" 02 RCL 00 03 0 04 ENTER^ 05 LBL 01 06 RCL IND Z 07 X^2 08 ST+ Z 09 X^2 10 + 11 DSE Z 12 GTO 01 13 R^ 14 RCL 00 15 - 16 * 17 X<>Y 18 X^2 19 + 20 RCL 00 21 * 22 SQRT 23 ST+ Z 24 - 25 RCL 00 26 1 27 - 28 ST/ Z 29 / 30 SQRT 31 X<>Y 32 SQRT 33 END ( 46 bytes ) -Store n in R00 , a1 in R01 , ..... , an in Rnn and XEQ "WST" 1°) In the 1st problem it yields x = 112 X<>Y x = 16.09347694 -The first value corresponds to a point inside the equilateral triangle -The second value corresponds to a point outside the triangle. 2°) In the 2nd problem it yields x = 105 X<>Y x = 26.85144316 -The first value corresponds to a point inside the regular tetrahedron -The second value corresponds to a point outside the tetrahedron. -Here, 112 and 105 are ( exact ) integers Perhaps will you find a simple proof for the general case ? Best regards, Jean-Marc. ``` Re: A weekend quickie + Similar Problems - Gerson W. Barbosa - 01-27-2013 Quote:``` n [ (a1)^4 + ........ + (an)^4 + x^4 ] = [ (a1)^2 + ......... + (an)^2 + x^2 ]^2 -It works at least with n = 3 and n = 4 ``` It works also when n = 2: ```2*(a^4 + (x - a)^4 + x^4) = (a^2 + (x - a)^2 + x^2)^2 = 4*a^4 - 8*a^3*x + 12*a^2*x^2 - 8*a*x^3 + 4*x^4 ``` When n = 8 and the point M is located in the center we should expect x = ai. I have no idea what a 7-simplex looks like, however. Best regards, Gerson. ---------------- P.S.: The latter is is not correct. made a mistake when testing the original equation on the HP-50g (I used n = 8 when it should have been 7). The ration between x and ai is 1.5275 in this case (it appears to tend to sqrt(2) when n increases). Here are my RPN programs for three calculators: HP-41: ```01 LBL 'SX 02 'ENTER aI 03 PROMPT 04 CLSIGMA 05 LBL 00 06 X^2 07 SIGMA+ 08 STOP 09 X>0? 10 GTO 00 11 1 12 + 13 RCL 12 14 * 15 RCL 11 16 X^2 17 + 18 RCL 16 19 * 20 SQRT 21 STO Y 22 RCL 11 23 X<>Y 24 ST- Y 25 RCL 11 26 + 27 RCL 16 28 1 29 - 30 / 31 X<>Y 32 LASTX 33 / 34 SQRT 35 X<>Y 36 SQRT 37 END ``` Example: Let's find x when a(1) = 56, a(2) = 59, a(3) = 69, a(4)= 79, as in your second problem. ``` Keystrokes Display XEQ ALPHA SX APHA ENTER aI 56 R/S 1.000000000 59 R/S 2.000000000 69 R/S 3.000000000 79 R/S 4.000000000 CHS -4.000000000 ; CHS is used to indicate there are no more ai to be entered R/S 105.0000000 ; 1st solution x<>y 28.85144316 ; 2nd solution ``` 1) It is assumed the statistical registers are at their default locations (Otherwise SIGMAREG 11 is necessary); 2) In case one ai = 0 then is has to be entered first. ```HP-42S: 00 { 65-Byte Prgm } 01 LBL "SX" 02 "Enter a(i)" 03 PROMPT 04 CLSIGMA 05 LBL 00 06 X^2 07 SIGMA+ 08 STOP 09 X>=0? 10 GTO 00 11 1 12 + 13 RCL 11 14 RCL+ ST X 15 LASTX 16 X^2 17 RCL 12 18 RCL* 16 19 - 20 X<> ST Z 21 +/- 22 STO/ ST Z 23 / 24 2 25 / 26 STO ST Z 27 X^2 28 + 29 SQRT 30 RCL+ ST Y 31 X<>Y 32 RCL- ST L 33 SQRT 34 X<>Y 35 SQRT 36 END WP34S: 001 LBL B 002 CLalpha 003 alpha'ENT' 004 alpha'ER' ; I have yet to discover how to enter the space character in the wp 34S 005 CLx6 006 PROMPT 007 CLSIGMA 008 x^2 009 SIGMA+ 010 STO 011 x>=0? 012 BACK 004 013 INC X 014 SIGMAx 015 x^2 016 SIGMAx^2 017 nSIGMA 018 * 019 - 020 SIGMAx 021 STO+ X 022 x<> Y 023 SLVQ 024 SQRT 025 x<> Y 026 x<> Y 027 Y 028 END ``` Edited: 28 Jan 2013, 9:59 a.m. after one or more responses were posted Re: A weekend quickie + Similar Problems - Jean-Michel - 01-28-2013 Hi Gerson, you're right: the formula also works if n = 2 But I don't understand why do you expect x = ai if n = 8 and M is located at the center: With, say all ai = 1, "WST" gives x = 4/sqrt(7) = 1.511857892 The volume of this 7-simplex is 0.0008955426448 ( in fact (4/sqrt(7))^7/4/7! ) which is exactly 8 times the volume of each "face" like MA1...A7 So, I am more and more convinced that the formula is true for all n It could probably be proved by a clever handling of Cayley-Menger determinants. Best wishes, Jean-Marc. Re: A weekend quickie + Similar Problems - Gerson W. Barbosa - 01-28-2013 Hello Jean-Marc, I've made a mistake (Please see my edited post above). I believe your conjecture is true, but proving it is certainly beyond my limited stills. But I have added my own version of the program (which can be of course improved :-) Best regards, Gerson. Edited: 28 Jan 2013, 10:05 a.m. Re: A weekend quickie + Similar Problems - Jean-Michel - 01-28-2013 Hi Gerson I've read your post: good programs ! ( I don't have an HP-42S or a WP34S, only an HP-41 and an HP-48 ) Don't worry, at least until now, I also fail to prove the conjecture... Best regards, Jean-Marc. Re: A weekend quickie - George Litauszky - 01-28-2013 This is an other solution for HP 15C. (DM-15CC) The 15C is new for me, this is my first keystroke programming calculator. So the program maybe not too optimized. The method: First I calculated an angle with the solver from 2 eqations. If the larger triangle's points are: A= left, B=rigt, C=top. Angles are: CAB= a, ABC=b. 1. AC*sin(a)=BC*sin(b) 2. AC*cos(a)=AB-BC*cos(b) From (1): a= sin-1((BC*sin(b))/AC) And from this the solver's equation, if AC is in R1, BC is in R2 and AB is in R3 is: R1*cos(sin-1((R2*sin(X))/R1)+R2*cos(X)-R3=0 With this method was calculated the smaller (A,B,D) triangle's left angle (ABD) too. And because with the Sigma+(-) I got incorrect result, the CD distance was calculated in complex mode. The program not too fast. The run time is 23 sec in 12 Mhz and 6 sec in 48 Mhz. It takes a lot of minutes on an original 15C, I think. Use: First fill the registers: 30->R3, 27->R4, 22->R5, 23->R6, 16->R7 then call the program: GSB 5. ```------------ Main program ------------ 001 LBL 5 4 STO I GSB 6 STO 8 6 STO I GSB 6 STO 9 SF 8 RCL 5 RCL 8 I ->R RCL 7 RCL 9 I ->R - ->P CF 8 022 RTN ----------- Solver call ----------- 023 LBL 6 RCL (i) STO 1 1 STO+I RCL (i) STO 2 SOLVE 7 031 RTN -------------- Solver routine -------------- 032 LBL 7 SIN RCL*2 RCL/1 SIN^-1 COS RCL*1 x<>y COS RCL*2 + RCL-3 044 RTN ``` Edited: 28 Jan 2013, 4:33 p.m. Re: A weekend quickie + Similar Problems - Paul Dale - 01-28-2013 Quote: 004 alpha'ER' ; I have yet to discover how to enter the space character in the wp 34S h-shift 0 (zero) in alpha mode. - Pauli Re: A weekend quickie + Similar Problems - Walter B - 01-28-2013 Please see pp. 61 and 123 in the manual. d:-) Re: A weekend quickie + Similar Problems - Gerson W. Barbosa - 01-28-2013 Please count me in for the printed manual, if still available :-) Re: A weekend quickie + Similar Problems - Walter B - 01-28-2013 Don't be afraid, sales didn't start yet. d:-) Re: A weekend quickie + Similar Problems - Gerson W. Barbosa - 01-28-2013 A shorter HP-42S version: ```00 { 61-Byte Prgm } 01 LBL "SX" 02 "Enter a(i)" 03 PROMPT 04 CLSIGMA 05 LBL 00 06 X^2 07 SIGMA+ 08 STOP 09 X>=0? 10 GTO 00 11 RCL* 12 12 RCL+ 12 13 RCL 11 14 X^2 15 + 16 RCL* 16 17 SQRT 18 RCL 11 19 RCL- ST Y 20 LASTX 21 RCL+ ST Z 22 RCL 16 23 1 24 - 25 / 26 X<>Y 27 RCL/ ST L 28 SQRT 29 X<>Y 30 SQRT 31 END ``` Re: A weekend quickie + Similar Problems - Gerson W. Barbosa - 01-28-2013 Thanks, Pauli & Walter :-) Re: A weekend quickie + Similar Problems - Paul Dale - 01-28-2013 I almost wrote that the space is clearly printed on the overlay :-) - Pauli Re: A weekend quickie - Gerson W. Barbosa - 01-30-2013 Quote: Of course your equation gives the same solution, but the exact Wolfram-Alpha result is much more complicated than the one I get with Derive You're quite right, Franz! I'd actually forgotten about this one, but being bored and nothing better to do I decided to do it again using only elementary school math and my hp 50g in exact mode: ```h1^2 = 23^2 - (30 - a)^2 h1^2 = 16^2 - a^2 23^2 - 30^2 + 60*a - a^2 = 16^2 - a^2 a = (16^2 + 30^2 - 23^2)/60 a = 209/20 => h1 = sqrt(16^2 - (209/20)^2) h1 = sqrt(58719)/20 ``` Likewise, ```h2^2 = 27^2 - (30 - b)^2 h2^2 = 22^2 - b^2 27^2 - 30^2 + 60*b - b^2 = 22^2 - b^2 b = (22^2 + 30^2 - 27^2)/60 b = 131/12 => h2 = sqrt(22^2 - (131/12)^2) h2 = sqrt(52535)/12 ``` Now, d can be calculated as: ```d = sqrt((h2 - h1)^2 + (b - a)^2) d = sqrt(((sqrt(52535)/12 - sqrt(58719)/20))^2 + (131/12 - 209/20)^2) d = sqrt(((5*sqrt(52535) - 69*sqrt(111))/60)^2 + (7/15)^2) d = sqrt((920923 - 345*sqrt(111)*sqrt(52535))/1800 + 49/225) d = sqrt((61421 - 23*sqrt(5831385))/120)d = 7.00000008574 ``` Regards, Gerson. Re: A weekend quickie - Gerson W. Barbosa - 01-30-2013 Quote: I get a value of 31.219918836 for that This is one of the positive roots of ```900*x^4 - 921315*x^2 + 42983536 = 0 ``` The other is the answer to the original problem. Re: A weekend quickie - Valentin Albillo - 01-31-2013 Quote: Now, d can be calculated as: ```d = sqrt((h2 - h1)^2 + (b - a)^2) d = sqrt(((sqrt(52535)/12 - sqrt(58719)/20))^2 + (131/12 - 209/20)^2) d = sqrt(((5*sqrt(52535) - 69*sqrt(111))/60)^2 + (7/15)^2) d = sqrt((920923 - 345*sqrt(111)*sqrt(52535))/1800 + 49/225) d = sqrt((61421 - 23*sqrt(5831385))/120)d = 7.00000008574 ``` Nice, Gerson. Actually, the minimal polynomial for d is: P(x) = 900*x8 - 3600*x7 - 924915*x6 + 3682560*x5 + 46667896*x4 - 169170199*x3 - 171012829*x2 - 128950608*x - 42983536 The root of this polynomial near 7 is: x = 7.000000085736748328572881969310250391260161759... Just for the record, this polynomial has 6 real roots and two complex conjugate ones, which can be readily found to full 12-digit accuracy with this HP-71B code snippet: ```>LIST 10 DESTROY ALL @ OPTION BASE 0 @ DIM C(8) @ COMPLEX R(7) 20 DATA 900,-3600,-924915,3682560,46667896,-169170199,-171012829,-128950608,-42983536 30 READ C @ MAT R=PROOT(C) @ MAT DISP R; >RUN (-.47410255668,0) (-.233336163303,-.610295507019) (-.233336163303,.610295507019) (4.94077488329,0) (-7.00000008574,0) (7.00000008574,0) (31.2199188361,-0) (-31.2199188361,0) ``` Best regards from V. Re: A weekend quickie - Dave Shaffer (Arizona) - 01-31-2013 Quote:Oh, and the correct value for d is somewhat surprising ! ... 8-) Other than being so close to 7, is there something else surprising? Re: A weekend quickie - Gerson W. Barbosa - 01-31-2013 Hello Valentin, Quote: Actually, the minimal polynomial for d is: P(x) = 900*x8 - 3600*x7 - 924915*x6 + 3682560*x5 + 46667896*x4 - 169170199*x3 - 171012829*x2 - 128950608*x - 42983536 The root of this polynomial near 7 is: x = 7.000000085736748328572881969310250391260161759... Another root is d when the outer triangle is turned 180 degrees along the common base. I fail to see what the other the other positive real roots might be, however. Any idea? Best regards, Gerson. Re: A weekend quickie - Valentin Albillo - 02-01-2013 Quote: Other than being so close to 7, is there something else surprising? Not really. What would it take to surprise you, Dave ? Have a nice weekend. V. ``` ``` Re: A weekend quickie - Valentin Albillo - 02-01-2013 Quote: I fail to see what the other the other positive real roots might be, however. Any idea? I don't expect the other roots to have any physical meaning at all, it's just that the nested square roots in the closed-form expression for d do require an 8th-degree minimal polynomial (no lesser degree will do) and, unavoidably, it must have 7 other spurious roots, that's all. Should the closed-form expression have included three nested square roots, a 16th degree minimal polynomial would have been likely and then you'd have 15 spurious roots, several of them complex. Surely you wouldn't expect all of them to be geometrically significant for the simple original problem. When mathematically modeling physical or geometrical problems it's frequently the case that the resulting equations do have a number of spurious solutions and only one (or a few of them) are physically relevant. Thanks for your interest, Gerson, have a nice weekend. V. Re: A weekend quickie - fhub - 02-01-2013 Quote: I don't expect the other roots to have any physical meaning at all, it's just that the nested square roots in the closed-form expression for d do require an 8th-degree minimal polynomial (no lesser degree will do) and, unavoidably, it must have 7 other spurious roots, that's all. I don't understand how you got an 8th-degree minimal polynomial!? Gerson's formula was this: d = sqrt((61421 - 23*sqrt(5831385))/120) 1) squaring this equation removes the first sqrt: d^2=61421/120-23*sqrt(5831385)/120 2) isolating the sqrt on the right side gives: d^2-61421/120=-23*sqrt(5831385)/120 3) now squaring again removes the last sqrt: (14400*d^4-14741040*d^2+3772539241)/14400=205653511/960 Simplifying this equation results in: 900*d^4-921315*d^2+42983536=0 So I get only a 4th-degree minimal polynomial - in fact it's even simpler, because it's only a bi-quadratic polynomial (I hope it's called so also in English), and thus there are only 4 solutions: d = +/-7.000000085736748 and d = +/-31.21991883610556 Franz Re: A weekend quickie - Walter B - 02-01-2013 Using the WP 34S solver, I get d = ±7.000000085736749 ±1 ULP and d = ±31.21991883610557 ±1 ULP, FWIW. d:-) Re: A weekend quickie - fhub - 02-01-2013 20-digit precision: d = +/-7.0000000857367483285 or d = +/-31.219918836105561685 Edited: 1 Feb 2013, 12:19 p.m. Re: A weekend quickie - Walter B - 02-01-2013 OK, this is equivalent within the error limits stated :-) But how about extending the competition to 34 digits precision? The WP 34S results are: d = ± 7.000 000 085 736 748 328 572 881 969 310 250 and d = ± 31.219 918 836 105 560 168 517 182 990 245 632 d:-) Re: A weekend quickie - fhub - 02-01-2013 Quote: But how about extending the competition to 34 digits precision? No problem, how about 100 digits? d = +/-7.000000085736748328572881969310250391260161759083199434052434930386213592541808806752093242226512477 or d = +/-31.21991883610556168517182990245632682927734827487395701597688042475928826555370142626280811851260271 Not enough? Well, how many do you want? ;-) Re: A weekend quickie - Thomas Klemm - 02-01-2013 Quote: I don't understand how you got an 8th-degree minimal polynomial!? 900x8 - 3600x7 - 924915x6 + 3682560x5 + 46667896x4 - 169170199x3 - 171012829x2 - 128950608x - 42983536 = (x4 - 4x3 - 4x2 - 3x - 1) (900x4 - 921315 x2 + 42983536) Cheers Thomas Re: A weekend quickie - Dave Shaffer (Arizona) - 02-01-2013 Quote:What would it take to surprise you, Dave ? I thought maybe we were after something like e^pi or pi^e or some other exotic combination of various constants! Re: A weekend quickie - fhub - 02-01-2013 Quote: 900x8 - 3600x7 - 924915x6 + 3682560x5 + 46667896x4 - 169170199x3 - 171012829x2 - 128950608x - 42983536 = (x4 - 4x3 - 4x2 - 3x - 1) (900x4 - 921315 x2 + 42983536) Hi Thomas, that doesn't answer my question. I wanted to know why Valentin got an 8th-degree minimal polynomial, when in fact a 4th-degree is enough? Franz Re: A weekend quickie - Walter B - 02-01-2013 I guess you're cheating and using unfair means like PCs or other appalling stuff ;-) Re: A weekend quickie - Thomas Klemm - 02-01-2013 True. It just shows how the two equations are related. Quote: I quickly solved it in my HP-71B using an intuitive (but far-from-optimum) approach that involves solving a couple of very simple systems of non-linear equations, let's see how you do it. My assumption is, that he used a different set of equations than Gersons solution: ```d = sqrt((61421 - 23*sqrt(5831385))/120) ``` Quote: it's just that the nested square roots in the closed-form expression for d do require an 8th-degree minimal polynomial (no lesser degree will do) I don't understand why he insisted on that when it's obviously wrong. The degree of the minimal polynomial of d is 4. But yes, I'd be interested in the answer to your question as well. Cheers Thomas Re: A weekend quickie - Valentin Albillo - 02-01-2013 Quote: I don't understand how you got an 8th-degree minimal polynomial!? Gerson's formula was this: d = sqrt((61421 - 23*sqrt(5831385))/120) [...] Simplifying this equation results in: 900*d^4-921315*d^2+42983536=0 So I get only a 4th-degree minimal polynomial [...] Absolutely correct, Franz. I used an on-line PSLQ algorithm on a 100-digit approximation to the value and though it correctly found an integer relation regrettably it wasn't the lowest-degree, minimal polynomial I expected it to find. Your biquadratic polynomial is a factor of the 8th-degree one I gave, of course, and it does contain the correct value as a root. So much for trusting free online tools without checking ... :) Thanks for pointing it out and have a nice weekend. V. ``` ``` Re: A weekend quickie - Gerson W. Barbosa - 02-01-2013 The answer to the problem in the OP belongs in the realm of the near-integer (or almost integer). I've found this one involving pi only: And another involving e: Surprising, interesting, futile? You decide :-) Gerson.