Little explorations with HP calculators (no Prime) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Little explorations with HP calculators (no Prime) (/thread-7955.html) |
RE: Little explorations with the HP calculators - pier4r - 03-23-2017 01:23 PM (03-23-2017 12:19 PM)Joe Horn Wrote: I see no bug here. Variables which are assigned values should never be used where formal variables are required. Managing them is up to the user. Ok (otherwise a variable cannot just be feed in a function from a program) but then how come that when I set the flags, that let the function return reals, the variable is purged? The behavior could be more consistent. Nothing bad, just a quirks like this, when not clear to spot, may lead to other solutions (see the advice of John Keit that I followed) RE: Little explorations with the HP calculators - pier4r - 03-24-2017 01:45 PM Quote:Brilliant.org Is there a way to solve this without using a wrapping program? (hp 50g) I'm trying around some functions (e.g: MSLV) with no luck, so I post this while I dig more on the manual, and on search engines focused on "site:hpmuseum.org" or "comp.sys.hp48" (the official hp forums are too chaotic, so I won't search there, although they store great contributions as well). edit: I don't mind inserting manually new starting values, I mean that there is a function to find at least one solution, then the user can find the others changing the starting values. Edit. It seems that the numeric solver for one equation can do it, one has to set values to the variables and then press solve, even if one variable has already a value (it was not so obvious from the manual, I thought that variables with given values could not change it). The point is that one variable will change while the others stay constant. In this way one can find all the solutions. RE: Little explorations with the HP calculators - pier4r - 03-24-2017 03:23 PM Quote:Same site as before. This can be solved with multiple applications of SOLVEVX (hp 50g) on parts of the equation with proper observations. So it is not that difficult, just I found it nice and I wanted to share. RE: Little explorations with the HP calculators - pier4r - 03-24-2017 10:04 PM How do you solve this using a calculator to compute the number? I solved it translating it in a formula after a bit of thinkering, and I got a number that I may write as "x + 0.343 + O(0.343)" if I'm not mistaken. I used the numeric solver on the hp 50g as helper. I also needed to prove to myself that the center on the circle is on a particular location to proceed to build the final equation. RE: Little explorations with the HP calculators - Dieter - 03-24-2017 10:54 PM (03-24-2017 10:04 PM)pier4r Wrote: How do you solve this using a calculator to compute the number? I think a calculator is the very last thing required here. (03-24-2017 10:04 PM)pier4r Wrote: I solved it translating it in a formula after a bit of thinkering, and I got a number that I may write as "x + 0.343 + O(0.343)" if I'm not mistaken. I used the numeric solver on the hp 50g as helper. Numeric solver? The radius can be determined with a simple closed form solution. Take a look at the diagonal through B, O and D which is 6√2 units long. So 6√2 = 2√2 + r + r√2. Which directly leads to r = 4 / (1 + 1/√2) = 2,343... Dieter RE: Little explorations with the HP calculators - pier4r - 03-25-2017 08:17 AM (03-24-2017 10:54 PM)Dieter Wrote: I think a calculator is the very last thing required here. As always, first comes the mental work to create the formula or the model, but to compute the final number one needs a calculator most of the time. Quote:Numeric solver? The radius can be determined with a simple closed form solution. Take a look at the diagonal through B, O and D which is 6√2 units long. I used the numeric solver because instead of grouping r on the left, I just used the formula of one step before - the one without grouping - to find the value. Anyway one cannot just use the diagonal because the picture is well done, one has to prove to himself that O is on the diagonal (nothing difficult, but required), otherwise it may be a step taken for granted. RE: Little explorations with the HP calculators - pier4r - 03-27-2017 12:14 PM Quote:Brilliant.org This one defeated me at the moment. My rusty memory about mathematical relations did not help me. At the end, having the hp50g, I tried to use some visual observations to write down the cartesian coordinates of the points defining the inner square, or observing the length of the sides, so if the side of the inner square is 2r so the sides of the triangle are "s+2r" and "s" from which one can say that "s^2+(s+2r)^2=1" . This plus the knowledge that 4 times the triangles plus the inner square add up to 1 as area. Still, those were not enough for a solution (with or without the hp50g). I end in too ugly/tedious formulae. RE: Little explorations with the HP calculators - Thomas Okken - 03-27-2017 12:54 PM Consider a half-unit circle jammed into the corner of the first quadrant (so its center is at (0.5, 0.5)). Now consider a radius of that circle sweeping the angles from 0 to pi/2. The tangent on the circle where it meets that radius will intersect the X axis at 1 + tan(phi), and the Y axis at 1 + cot(phi) or 1 + 1 / tan(phi). The triangle formed by the X axis, the Y axis, and this tangent, is like the four triangles in the puzzle, and the challenge is to find phi such that X = Y + 1 (or X = Y - 1). The answer to the puzzle is then obtained by scaling everything down so that the hypotenuse of the triangle OXY becomes 1, and then the diameter of the circle is 1 / sqrt(X^2 + Y^2). EDIT: No, I screwed up. The intersections at the axes are not at 1 + tan(phi), etc., that relationship is not quite that simple. Back to the drawing board! Second attempt: Consider a unit circle jammed into the corner of the first quadrant (so its center is at (1, 1)). Now consider a radius of that circle sweeping the angles from 0 to pi/2. The point P on the circle where that radius intersects it is at (1 + cos(phi), 1 + sin(phi)). The tangent on the circle at that point will have a slope of -1 / tan(phi), and so it will intersect the X axis at Px + Py * tan(phi), or (1 + sin(phi)) * tan(phi) + 1 + cos(phi), and it will intersect the Y axis at (1 + cos(phi)) / tan(phi) + 1 + sin(phi). The triangle formed by the X axis, the Y axis, and this tangent, is like the four triangles in the puzzle, and the challenge is to find phi such that X = Y + 2 (or X = Y - 2). The answer to the puzzle is then obtained by scaling everything down so that the hypotenuse of the triangle OXY becomes 1, and then the radius of the circle is 1 / sqrt(X^2 + Y^2). Because of symmetry, sweeping the angles from 0 to pi/2 is actually not necessary; you can restrict yourself to 0 through pi/4 and the case that X = Y - 2. RE: Little explorations with the HP calculators - pier4r - 03-27-2017 02:27 PM (03-27-2017 12:54 PM)Thomas Okken Wrote: Consider a unit circle jammed into the corner of the first quadrant (so its center is at (1, 1)). Now consider a radius of that circle sweeping the angles from 0 to pi/2. The point P on the circle where that radius intersects it is at (1 + cos(phi), 1 + sin(phi)). I'm a bit blocked. http://i.imgur.com/IW4QIeU.jpg Would be possible to add a quick sketch? RE: Little explorations with the HP calculators - Thomas Okken - 03-27-2017 03:44 PM (03-27-2017 02:27 PM)pier4r Wrote:(03-27-2017 12:54 PM)Thomas Okken Wrote: Consider a unit circle jammed into the corner of the first quadrant (so its center is at (1, 1)). Now consider a radius of that circle sweeping the angles from 0 to pi/2. The point P on the circle where that radius intersects it is at (1 + cos(phi), 1 + sin(phi)). OK; I attached a sketch to my previous post. RE: Little explorations with the HP calculators - pier4r - 03-27-2017 03:55 PM (03-27-2017 03:44 PM)Thomas Okken Wrote: OK; I attached a sketch to my previous post. Thanks and interesting approach. On brilliant.org there were dubious solutions (that did not prove their assumptions) and just one really cool making use of a known relationship with circles enclosed in right triangles. RE: Little explorations with the HP calculators - pier4r - 03-27-2017 05:29 PM Quote:Brilliant.org For this I wrote a quick program, remembering some quality of the mean that after enough iterations it stabilizes. (I should find the right statement though). Code:
But i'm not sure about the correctness of the approach. Im pretty sure there is a way to compute this with an integral ad then a closed form too. Anyway this is the result at the moment: RE: Little explorations with the HP calculators - Dieter - 03-27-2017 06:01 PM (03-27-2017 12:14 PM)pier4r Wrote: ...so if the side of the inner square is 2r so the sides of the triangle are "s+2r" and "s" from which one can say that "s^2+(s+2r)^2=1" . This plus the knowledge that 4 times the triangles plus the inner square add up to 1 as area. Still, those were not enough for a solution Right, in the end you realize that both formulas are the same. ;-) The second constraint for s and r could be the formula of a circle inscribed in a triangle. This leads to two equations in two variables s and r. Or with d = 2r you'll end up with something like this: (d² + d)/2 + (sqrt((d² + d)/2) + d)² = 1 I did not try an analytic solution, but using a numeric solver returns d = 2r = (√3–1)/2 = 0,36603 and s = 1/2 = 0,5. Edit: finally this seems to be the correct solution. ;-) Dieter RE: Little explorations with the HP calculators - pier4r - 03-27-2017 06:14 PM (03-27-2017 06:01 PM)Dieter Wrote: Right, in the end you realize that both formulas are the same. ;-) How? One should be from the Pythagoras' theorem, a^2+b^2=c^2 (where I use the two sides of the triangle to get the hypotenuse) the other is the composition of the area of the square, made up from 4 triangles and one inner square. To me they sound as different models for different measurements. Could you explain me why are those the same? Anyway to me it is great even the numerical solution (actually the one that I search with the hp50g) but I cannot tell you if it is right or not because I did not solve it by myself, other reviewers are needed. Edit, anyway I remember that a discussed solution mentioned the relationship of a circle inscribed in a triangle, so I guess your direction is right. RE: Little explorations with the HP calculators - Han - 03-27-2017 06:30 PM (03-27-2017 06:14 PM)pier4r Wrote:(03-27-2017 06:01 PM)Dieter Wrote: Right, in the end you realize that both formulas are the same. ;-) Just do the math. On the one hand, \( s^2 + (s + 2r)^2 = 1\) from Phythagorus' Theorem as you observed. And your other observation is that \[ 4 \cdot \underbrace{\frac{1}{2} \cdot s \cdot (s+2r)}_{\text{area of }\Delta} + \underbrace{(2r)^2}_{\text{area of } \Box} = 1 \] Simplify the left hand side: \[ \begin{align} 4 \cdot \frac{1}{2} \cdot s \cdot (s+2r) + (2r)^2 & = 2s^2+4rs + 4r^2 \\ & = s^2 + s^2 + 4rs + 4r^2 \\ & = s^2 + (s+2r)^2 \end{align} \] Hence, both formulas are the same. RE: Little explorations with the HP calculators - pier4r - 03-27-2017 06:57 PM (03-27-2017 06:30 PM)Han Wrote: -cut- Thanks, I did not worked on the formula, I was more stuck (and somewhat still stuck) on the fact that they should represent different objects/results. But then again, the square build on the side, it is the square itself. So now I see it. I wanted to see it in terms of "represented objects (1)" not only formulae. RE: Little explorations with the HP calculators - Han - 03-27-2017 07:07 PM (03-27-2017 06:57 PM)pier4r Wrote:(03-27-2017 06:30 PM)Han Wrote: -cut- Are you familiar with the geometric proofs of Phythagorus' Theorem? What I wrote above is just a variation of one of the geometric proofs using areas of regular polygons (triangles, rectangles, squares). A few geometric proofs: http://www.cut-the-knot.org/pythagoras/ RE: Little explorations with the HP calculators - pier4r - 03-27-2017 07:22 PM (03-27-2017 07:07 PM)Han Wrote: Are you familiar with the geometric proofs of Phythagorus' Theorem? What I wrote above is just a variation of one of the geometric proofs using areas of regular polygons (triangles, rectangles, squares). Maybe my choice of words was not the best. I wanted to convey the fact that if I try to model two different events (or objects in this case) and I get the same formula, for me it is not immediate to say "oh, ok, then they are the same object", I have to, how can I say, "see it". So in the case of the problem, I saw it when I realized that the 1^2 is not only equal to the area because also the area is 1^2, it is exactly the area because it models the area of the square itself. (I was visually building 1^2 outside the square, like a duplicate) Anyway the link you shared is great. I looked briefly and I can say: - long ago I saw the proof #1 - in school I saw the proof #9 - oh look, the proof #34 would have helped, as someone mentioned - how many! Great! RE: Little explorations with the HP calculators - Joe Horn - 03-27-2017 07:24 PM (03-27-2017 05:29 PM)pier4r Wrote:Quote:Brilliant.org After running 100 million iterations several times in UBASIC, I'm surprised that each run SEEMS to be converging, but each run ends with a quite different result: 10 randomize 20 T=0:C=0 30 repeat 40 T+=sqr((rnd-rnd)^2+(rnd-rnd)^2):C+=1 50 until C=99999994 60 repeat 70 T+=sqr((rnd-rnd)^2+(rnd-rnd)^2):C+=1 80 print C;T/C 90 until C=99999999 run 99999995 0.5214158234249566646569152059 99999996 0.5214158242970253667174680247 99999997 0.5214158240318481570747604814 99999998 0.5214158247892039896051570164 99999999 0.5214158253601312510245695897 OK run 99999995 0.5213642776110289008920452545 99999996 0.5213642752079475043717958065 99999997 0.52136427197858201293861314 99999998 0.5213642744828552963477424429 99999999 0.5213642759132547792130043215 OK run 99999995 0.5213770659191193073147616413 99999996 0.5213770610000764506616015052 99999997 0.5213770617149058467216528505 99999998 0.5213770589414874167694264508 99999999 0.5213770570854305903944611055 OK So it SEEMS to be zeroing on something close to -LOG(LOG(2)), but I give up. RE: Little explorations with the HP calculators - pier4r - 03-27-2017 07:35 PM (03-27-2017 07:24 PM)Joe Horn Wrote: 99999999 0.5213770570854305903944611055 Interestingly your number is quite different from mine. Ok that you have a couple of iterations more, but my average was pretty stable for the first 3 digits. I wonder why the discrepancy. Moreover if you round to the 4th decimal place, you always get 0.5214 if the rounding is adding a "+1" to the last digit in the case the first digit to be excluded is higher than 5. |