HP Forums

Full Version: Math Challenge I could not solve
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Some time ago a colleague gave me a math challenge that he could not solve, and according to him others had huge problems getting it solved. I tried, and could not really come to a satisfying solution, so I am calling the forum's help. Due to lack of regular exercise own math shape is really bad ...

I would like to end up with a formula or part of a program (for HP41 or WP43s preferably) to find a solution.

The problem is the following:

A farmer has a perfectly circular piece of land with a give radius R. He wants to sell half of it to his neighbour, by putting a pole on the edge of the piece of land, and, using a wire of a certain length L tied to the pole, marks off a part of the farmers land. The pole is the center of a new circle segment. The result is a lens-shaped piece of land wich has half the area of this lens-shaped part is half of the original piece of land. The big question: how long is the rope L depending on the original radius R.

Looking forward to your responses ....


The result is a lens-shaped piece of land wich has half the area ((of this lens-shaped part is half)) of the original piece of land.

Suggest deleting the words between the (added) double parentheses.


I'm no maths expert, but this may help:

Equation 14 gives the expression for the lens area. It simplifies when you place the centre of the second circle on the perimeter of the first circle by setting d=R.

Hope that helps,

I get L = about 1.37R .

Yes, I could give ten digits as calculated by my 15C, but first I want to know whether I'm in the right ballpark. Incidentally, it didn't require a calculator until the final step to numerically evaluate an expression involving roots.

Edited: If I'm in a ballpark, it's the wrong one.

Edited: 3 Jan 2013, 9:33 p.m.

Simple answer: The Goat Problem.


You could use the HP-42S and combine the solver with the numeric integration.

I'm cutting the lens-shaped piece vertically into two circular segments that are integrated.

Then I use the solver to make sure that the area is half of the circle with radius 1.

Using the following definitions I end up with this equation:

Now I define the two functions f(t) and g(t):

00 { 16-Byte Prgm }
01 LBL "f(t)"
02 MVAR "t"
03 RCL "t"
05 SIN
06 END

00 { 24-Byte Prgm }
01 LBL "g(t)"
02 MVAR "r"
03 MVAR "t"
04 RCL "r"
05 X^2
06 RCL "t"
07 X^2
08 -
10 END

With this program the equation is calculated:

00 { 94-Byte Prgm }
02 MVAR "x"
03 RCL "x"
04 2
05 *
06 COS
08 1
10 PRGMINT "f(t)"
11 INTEG "t"
12 STO "F"
13 1
14 RCL - "LLIM"
16 RCL "x"
17 SIN
18 2
19 *
20 STO "r"
22 PGMINT "g(t)"
23 INTEG "t"
24 RCL + "F"
25 2
26 *
27 PI
28 2
29 /
30 -
31 END

Solve this equation for the variable x and you end up with x = 0.617948.

Use r = 2 sin(x) and you will get r = 1.158728.

This result is in accordance with the aforementioned page of the Goat Problem.

Kind regards


Edited: 3 Jan 2013, 7:44 p.m.

For those who prefer to use the HP-15C:

001 - 42,21,11  LBL A            020 -       20  x                
002 - 44 0 STO 0 021 - 43 26 PI
003 - 2 2 022 - 2 2
004 - 20 x 023 - 10 /
005 - 24 COS 024 - 30 -
006 - 44 2 STO 2 025 - 43 32 RTN
007 - 1 1 026 - 42,21, 0 LBL 0
008 - 42,20, 0 INTEGRATE 0 027 - 43 24 ACOS
009 - 44 3 STO 3 028 - 23 SIN
010 - 1 1 029 - 43 32 RTN
011 - 45,30, 2 RCL- 2 030 - 42,21, 1 LBL 1
012 - 45 0 RCL 0 031 - 45 1 RCL 1
013 - 23 SIN 032 - 43 11 x^2
014 - 2 2 033 - 34 x<>y
015 - 20 x 034 - 43 11 x^2
016 - 44 1 STO 1 035 - 30 -
017 - 42,20, 1 INTEGRATE 1 036 - 11 SQRT
018 - 45,40, 3 RCL+ 3 037 - 43 32 RTN
019 - 2 2

  • LBL 0: f(x)
  • LBL 1: g(x)
  • REG 0: x
  • REG 1: r
  • REG 2: d
  • REG 3: F





First of all, congratulations! It is a very clever reduction/synthesis.

Just for the records: after running the program, how long did it take to find the answer? Did you use a regular HP42S or an emulator?


Luiz (Brazil)

I used Free42 on an iPhone and the answer comes almost immediately. As for the HP-15C I used ClassicRPN on the iPhone as well. It took about 37 seconds, but I have no idea how this relates to the original calculator. In both cases the result is correct to 6 decimal places.

And then I tried to use WolframAlpha but ran out of time ...



This same program and procedure works on the 34S, although slowly (probably the solver again). It gives 1.158728473020422 and is incorrect by one in the 12th digit. The correct answer being 1.1587284730181215...

I also suspect that calculating would be faster done directly instead of as SIN(COS-1(t)).

- Pauli

Edited: 3 Jan 2013, 10:33 p.m.

Or to avoid extinction when x is close to 1:

On the Free42 you can set the variable "ACC" to 1e-20 and you will end up with 25 correct places. Though I wonder what we could do with these.



Edited: 3 Jan 2013, 11:35 p.m.

Yes, that is a better way to calculate it -- wasn't really thinking about stability when I wrote my note.

- Pauli

As you may know the HP-34C (and all successors) uses a Romberg method with nodes that are spaced nonuniformly using a substitution:

Details can be found in this section of William M. Kahan's article:

What Method Underlies the Integrate Key?

Second, can be calculated efficiently when
or where g(u) is
everywhere a smooth function, without any of the expedients
that would otherwise be required to cope with the infinite
values taken by the derivative f'(u) at u = x or u = y. Such integrals are encountered often during calculations of areas enclosed by smooth closed curves. For example, the area of a circle of radius 1 is

which consumes only 60 seconds when evaluated in SCI 5
and only 110 seconds to get 3.141592654±1.4x10-9
in SCI 9.

So it appears HP's numeric integration is well suited for this challenge.

Kind regards


Edited: 4 Jan 2013, 1:23 a.m.

This would be link below for those of you who, like me, primarily use a handheld device to read this site and cannot easily cut and paste:


All the best...

This same program and procedure works on the 34S, although slowly (probably the solver again). It gives 1.158728473020422 and is incorrect by one in the 12th digit.

Strange. I just tried the same on a (hardware) 34s and I finally got 1,158728473018121 - which is exact within 1 ULP. The calculator was set to ALL mode, of course.


Build number? Program listing? There must be reasons for the different results, so I'd appreciate getting these data from you and Pauli.


Version = 3.1 3325, and the program was the same as the 15C version posted in this thread. OK, I used LBL B, 55 and 66 instead. ;-)


Edited: 4 Jan 2013, 1:57 p.m.

I was running 3.1 3225 -- 100 revisions older. I've been slack and not updated that one for ages.

- Pauli

Now, that's even stranger. I still have an emulator with version 3.1 3225 here. Entered the same program, got the same (exact) result: 1,158728473018121. So something else must be different. Which display mode did you set?


Unknown anymore, I've been making changes to the display code this morning. It was probably ALL something. I was running in single precision.

- Pauli

Thank you all for your responses!


Let me thank you for the challenge. And Dieter for pointing out that this is the "Goat Problem". I'm always amazed by this forum. The last time I posted a challenge: zing and the answer was that this is "Kaprekar's constant". Never heard of that before.

Kind regards


That's how I saw the problem:

In the lens-shaped piece you can see an isosceles triangle with sides (1,1,r) and angles (a,a,pi-2*a).

Divided in two right-angled triangles, it leads to 1*cos(pi-2*a)=d and r*cos(a)=1-d => d=1-r*r/2.

The grazed surface can then be expressed as


But we know that integ(sqrt(r*r-x*x),x)=x/2*sqrt(r*r-x*x)+r*r/2*arcsin(x/r).

So developing and simplifying S naturally leads to


(It's just another way to the same formula as in the http://mathworld.wolfram.com/GoatProblem.html web site).

Solving S=pi/2 on r also :) leads to r=1.15872847...