The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

A weekend quickie
Message #1 Posted by Valentin Albillo on 25 Jan 2013, 5:47 a.m.

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
Message #2 Posted by Paul Dale on 25 Jan 2013, 6:22 a.m.,
in response to message #1 by Valentin Albillo

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
Message #3 Posted by Valentin Albillo on 25 Jan 2013, 6:33 a.m.,
in response to message #2 by Paul Dale

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
Message #4 Posted by Paul Dale on 25 Jan 2013, 6:37 a.m.,
in response to message #3 by Valentin Albillo

Ahhh, I see the mistake now :-(

- Pauli

                        
Re: A weekend quickie
Message #5 Posted by Paul Dale on 25 Jan 2013, 6:44 a.m.,
in response to message #4 by Paul Dale

And I managed to guess & then verify the correct answer :-)

- Pauli

                              
Re: A weekend quickie
Message #6 Posted by Valentin Albillo on 25 Jan 2013, 7:42 a.m.,
in response to message #5 by Paul Dale

Quote:
And I managed to guess & then verify the correct answer :-)

Have a nice weekend, Pauli !

Best regards from V.

            
Re: A weekend quickie
Message #7 Posted by Dieter on 25 Jan 2013, 3:23 p.m.,
in response to message #2 by Paul Dale

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
Message #8 Posted by fhub on 25 Jan 2013, 3:37 p.m.,
in response to message #7 by Dieter

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
Message #9 Posted by Jean-Michel on 25 Jan 2013, 6:54 a.m.,
in response to message #1 by Valentin Albillo

Hello,

perhaps should you mention that the figure is not contractual in its current state, somewhat confusing. Kind regards.

      
Re: A weekend quickie
Message #10 Posted by Gerson W. Barbosa on 25 Jan 2013, 9:04 a.m.,
in response to message #1 by Valentin Albillo

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
Message #11 Posted by C.Ret on 25 Jan 2013, 9:13 a.m.,
in response to message #1 by Valentin Albillo

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
Message #12 Posted by George Litauszky on 27 Jan 2013, 6:12 a.m.,
in response to message #11 by C.Ret

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
Message #13 Posted by Walter B on 27 Jan 2013, 6:18 a.m.,
in response to message #12 by George Litauszky

Interesting solution. How large is the quantisation error in this context?

                        
Re: A weekend quickie
Message #14 Posted by George Litauszky on 27 Jan 2013, 6:45 a.m.,
in response to message #13 by Walter B

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
Message #15 Posted by George Litauszky on 28 Jan 2013, 4:27 p.m.,
in response to message #12 by George Litauszky

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
Message #16 Posted by JMBaillard on 25 Jan 2013, 10:32 a.m.,
in response to message #1 by Valentin Albillo

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
Message #17 Posted by Walter B on 25 Jan 2013, 10:46 a.m.,
in response to message #1 by Valentin Albillo

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
Message #18 Posted by fhub on 25 Jan 2013, 11:31 a.m.,
in response to message #17 by Walter B

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
Message #19 Posted by Walter B on 25 Jan 2013, 11:57 a.m.,
in response to message #18 by fhub

Oooh - rats! That's the consequence of my blind belief in Euklid :-(

                        
Re: A weekend quickie
Message #20 Posted by Gerson W. Barbosa on 25 Jan 2013, 12:22 p.m.,
in response to message #19 by Walter B

I used to believe in Euclides myself. He was my math teacher in high-school for two years :-)

                              
Re: A weekend quickie
Message #21 Posted by Walter B on 25 Jan 2013, 12:47 p.m.,
in response to message #20 by Gerson W. Barbosa

:-)

                        
Re: A weekend quickie
Message #22 Posted by Walter B on 25 Jan 2013, 12:46 p.m.,
in response to message #19 by Walter B

... 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
Message #23 Posted by Maximilian Hohmann on 25 Jan 2013, 1:03 p.m.,
in response to message #22 by Walter B

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
Message #24 Posted by fhub on 25 Jan 2013, 11:04 a.m.,
in response to message #1 by Valentin Albillo

Result with Derive:

Franz

            
Re: A weekend quickie
Message #25 Posted by Gerson W. Barbosa on 25 Jan 2013, 1:22 p.m.,
in response to message #24 by fhub

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
Message #26 Posted by fhub on 25 Jan 2013, 1:47 p.m.,
in response to message #25 by Gerson W. Barbosa

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
Message #27 Posted by Gerson W. Barbosa on 25 Jan 2013, 2:47 p.m.,
in response to message #26 by fhub

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 + Similar Problems
Message #28 Posted by JMBaillard on 25 Jan 2013, 3:38 p.m.,
in response to message #27 by Gerson W. Barbosa

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 + Similar Problems
Message #29 Posted by fhub on 26 Jan 2013, 5:42 a.m.,
in response to message #28 by JMBaillard

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
Message #30 Posted by Gerson W. Barbosa on 26 Jan 2013, 9:33 a.m.,
in response to message #28 by JMBaillard

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 + Similar Problems
Message #31 Posted by JMBaillard on 27 Jan 2013, 4:28 p.m.,
in response to message #30 by Gerson W. Barbosa

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
Message #32 Posted by Gerson W. Barbosa on 27 Jan 2013, 6:41 p.m.,
in response to message #31 by JMBaillard

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
Message #33 Posted by JMBaillard on 28 Jan 2013, 8:52 a.m.,
in response to message #32 by Gerson W. Barbosa

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
Message #34 Posted by Gerson W. Barbosa on 28 Jan 2013, 10:04 a.m.,
in response to message #33 by JMBaillard

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
Message #35 Posted by JMBaillard on 28 Jan 2013, 3:58 p.m.,
in response to message #34 by Gerson W. Barbosa

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 + Similar Problems
Message #36 Posted by Paul Dale on 28 Jan 2013, 4:28 p.m.,
in response to message #32 by Gerson W. Barbosa

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
Message #37 Posted by Walter B on 28 Jan 2013, 4:39 p.m.,
in response to message #36 by Paul Dale

Please see pp. 61 and 123 in the manual.

d:-)

                                                                  
Re: A weekend quickie + Similar Problems
Message #38 Posted by Gerson W. Barbosa on 28 Jan 2013, 5:36 p.m.,
in response to message #37 by Walter B

Please count me in for the printed manual, if still available :-)

                                                                        
Re: A weekend quickie + Similar Problems
Message #39 Posted by Walter B on 28 Jan 2013, 5:41 p.m.,
in response to message #38 by Gerson W. Barbosa

Don't be afraid, sales didn't start yet.

d:-)

                                                                              
Re: A weekend quickie + Similar Problems
Message #40 Posted by Gerson W. Barbosa on 28 Jan 2013, 5:54 p.m.,
in response to message #39 by Walter B

Thanks, Pauli & Walter :-)

                                                                                    
Re: A weekend quickie + Similar Problems
Message #41 Posted by Paul Dale on 28 Jan 2013, 5:58 p.m.,
in response to message #40 by Gerson W. Barbosa

I almost wrote that the space is clearly printed on the overlay :-)

- Pauli

                                                      
Re: A weekend quickie + Similar Problems
Message #42 Posted by Gerson W. Barbosa on 28 Jan 2013, 5:49 p.m.,
in response to message #32 by Gerson W. Barbosa

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
Message #43 Posted by Gerson W. Barbosa on 30 Jan 2013, 11:10 p.m.,
in response to message #26 by fhub

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
Message #44 Posted by Valentin Albillo on 31 Jan 2013, 6:19 a.m.,
in response to message #43 by Gerson W. Barbosa

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
Message #45 Posted by Dave Shaffer (Arizona) on 31 Jan 2013, 11:30 a.m.,
in response to message #44 by Valentin Albillo

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
Message #46 Posted by Valentin Albillo on 1 Feb 2013, 3:29 a.m.,
in response to message #45 by Dave Shaffer (Arizona)

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
Message #47 Posted by Dave Shaffer (Arizona) on 1 Feb 2013, 1:28 p.m.,
in response to message #46 by Valentin Albillo

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
Message #48 Posted by Gerson W. Barbosa on 1 Feb 2013, 6:17 p.m.,
in response to message #47 by Dave Shaffer (Arizona)

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:

(pi^34 - (pi/3)*10^12)/10^16

And another involving e:

2*(e - atan(e))

Surprising, interesting, futile? You decide :-)

Gerson.

                                    
Re: A weekend quickie
Message #49 Posted by Gerson W. Barbosa on 31 Jan 2013, 10:34 p.m.,
in response to message #44 by Valentin Albillo

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
Message #50 Posted by Valentin Albillo on 1 Feb 2013, 3:37 a.m.,
in response to message #49 by Gerson W. Barbosa

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
Message #51 Posted by fhub on 1 Feb 2013, 11:39 a.m.,
in response to message #50 by Valentin Albillo

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
Message #52 Posted by Walter B on 1 Feb 2013, 11:59 a.m.,
in response to message #51 by fhub

Using the WP 34S solver, I get d = ±7.000000085736749 ±1 ULP and d = ±31.21991883610557 ±1 ULP, FWIW.

d:-)

                                                            
Re: A weekend quickie
Message #53 Posted by fhub on 1 Feb 2013, 12:17 p.m.,
in response to message #52 by Walter B

20-digit precision:

d = +/-7.0000000857367483285 or d = +/-31.219918836105561685

Edited: 1 Feb 2013, 12:19 p.m.

                                                                  
Re: A weekend quickie
Message #54 Posted by Walter B on 1 Feb 2013, 1:01 p.m.,
in response to message #53 by fhub

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
Message #55 Posted by fhub on 1 Feb 2013, 1:10 p.m.,
in response to message #54 by Walter B

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
Message #56 Posted by Walter B on 1 Feb 2013, 1:44 p.m.,
in response to message #55 by fhub

I guess you're cheating and using unfair means like PCs or other appalling stuff ;-)

                                                      
Re: A weekend quickie
Message #57 Posted by Thomas Klemm on 1 Feb 2013, 1:27 p.m.,
in response to message #51 by fhub

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
Message #58 Posted by fhub on 1 Feb 2013, 1:37 p.m.,
in response to message #57 by Thomas Klemm

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
Message #59 Posted by Thomas Klemm on 1 Feb 2013, 2:34 p.m.,
in response to message #58 by fhub

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
Message #60 Posted by Valentin Albillo on 1 Feb 2013, 2:57 p.m.,
in response to message #51 by fhub

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
Message #61 Posted by Mike Reed on 26 Jan 2013, 2:17 p.m.,
in response to message #24 by fhub

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
Message #62 Posted by Dave Shaffer (Arizona) on 26 Jan 2013, 5:21 p.m.,
in response to message #61 by Mike Reed

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
Message #63 Posted by Gerson W. Barbosa on 30 Jan 2013, 11:43 p.m.,
in response to message #62 by Dave Shaffer (Arizona)

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.

http://www.wolframalpha.com/input/?i=simplify+%5Bsqrt%28%28%28sqrt%2852535%29%2F12+-+sqrt%2858719%29%2F20%29%29%5E2+%2B+%28131%2F12+-+209%2F20%29%5E2%29%5D

      
Re: A weekend quickie
Message #64 Posted by Gilles Carpentier on 25 Jan 2013, 5:04 p.m.,
in response to message #1 by Valentin Albillo

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
Message #65 Posted by C.Ret on 26 Jan 2013, 10:29 a.m.,
in response to message #64 by Gilles Carpentier

Good catch Gilles ! Bien joué.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall