Teaser 3230: Polytunnel
From The Sunday Times, 18th August 2024 [link] [link]
I have extended my market garden by the addition of a polytunnel. The polyethylene cover is supported at intervals by identical sets of three vertical pillars supporting metal arcs, of negligible thickness, resting on the level ground on both sides. In each set, the highest pillar is in the middle of the cross-section, at the highest point of the tunnel. The other two pillars are of equal height, being three quarters of the height of the central pillar. These shorter pillars are positioned on each side, 2/11 of the ground-level width of the tunnel from each edge.
Each metal arc is part of a circle (less than a semicircle), and the highest point is exactly 3m above the ground.
What is the ground-level width of the polytunnel in cm?
[teaser3230]
Jim Randell 5:36 am on 18 August 2024 Permalink |
By considering two right-angled triangles we can derive a linear equation for the depth of the centre of the arc below ground level (x), from which the width of the polytunnel (2w) can be determined.
The triangles are indicated in the following diagram:
This Python program (appropriately enough) uses the [[
Polynomial()]] class from the enigma.py library to perform the calculations.It runs in 76ms. (Internal runtime is 139µs).
Run: [ @replit ]
from enigma import (Rational, Polynomial, sq, sqrt, printf) Q = Rational() # suppose the polytunnel has ground-level semi-width w # and the centre of the circle is a distance x below ground # we have: # # r = x + 300 # r^2 = w^2 + x^2 # r^2 = (7w/11)^2 + (225 + x)^2 fx = Polynomial('x') # depth of origin fr = fx + 300 # radius of arc f1 = sq(fr) - sq(fx) # = w^2 f2 = sq(fr) - sq(fx + 225) # = (7w/11)^2 f = sq(Q(7, 11)) * f1 - f2 # equate values of w^2 # solve f(x) = 0 for positive real x for x in f.roots(domain='F', include='0+'): # calculate width W = sqrt(f1(x)) * 2 printf("polytunnel width = {W:g} cm [x = {x:g}]")Solution: The width of the polytunnel at ground level is 660 cm.
The polynomial to determine the depth of the centre of the circular arc simplifies to:
From which we easily find the depth of the centre and the radius of the circle:
And from these we calculate the semi-width of the polytunnel:
So the total width of the polytunnel is 660 cm.
LikeLike
Frits 11:24 am on 18 August 2024 Permalink |
I made my narrowing down routine from scratch.
Of course there are more efficient ways to do this (I don’t know them by heart).
from sys import float_info eps = float_info.epsilon # r = x + 300 # the centre of the circle is a distance x below ground # 49.w^2 - 117600.x - 17_640_000 = 0 # 49.w^2 - 72600.x - 19_057_500 = 0 f1 = lambda x: 17_640_000 + 117_600 * x f2 = lambda x: 19_057_500 + 72_600 * x mode = "" x = 100 # choose an arbitrarily starting value delta = 5 # increment/decrement value for variable x # find a value for "x" where both f1(x) and f2(x) are (almost) the same while True: v1, v2 = f1(x), f2(x) # do we have an solution where both values are (almost) the same? if abs(v2 - v1) <= eps: w = (2_400 * x + 360_000)**.5 print(f"answer: ground-level width = {round(w, 2)} cm") break if v1 < v2: if mode == "more": delta /= 2 x += delta mode = "less" else: if mode == "less": delta /= 2 x -= delta mode = "more"LikeLike
Frits 11:34 am on 18 August 2024 Permalink |
The program was only made if you don’t want to analyse the problem till a solution is found.
LikeLike
GeoffR 6:23 pm on 18 August 2024 Permalink |
LikeLike