1

We have a project at work where we are required to lay out network cable to multiple points along a number of benches, connected in a row. I have determined that any length of conduit is large enough to hold enough cable to supply 4 benches. If we are going to join more than 4 benches in a row, then we must run additional conduit.

For example, to run 6 benches, we would need 10 pieces of conduit. 4 for the first 4 benches, and 6 for the last two. For 10 benches, we would require 22 pieces. It shall increase in this recursive fashion.

I am attempting to create a mathematical formula to represent this. I believe the answer is a combination between a linear and a quadratic function. I have graphed out the lengths up to 28 benches, and have managed to fit a quadratic curve that intersects at every 4th bench.

Graph representing length of required conduit

Curve: $0.125x^2+1.25x$

However naturally this curve does not accurately represent the linear steps of the graph.

I am wondering how I may go about creating a formula to accurately represent the length.

The data with which I have generated the graphs:

0   0
1   1
2   2
3   3
4   4
5   9
6   10
7   11
8   12
9   21
10  22
11  23
12  24
13  37
14  38
15  39
16  40
17  57
18  58
19  59
20  60
21  81
22  82
23  83
24  84
25  109
26  110
27  111
28  112
Shane
  • 113

1 Answers1

1

Say there are $n$ benches.

First consider the whole groups of $4$ benches. There are $k=\lfloor\frac{n}{4}\rfloor$ such groups (where $\lfloor x\rfloor$ is the largest integer smaller than $x$). For the first group you need $4$ pieces, for the next group you need $8$ pieces, etc. For all the groups you need $p$ pieces with

$$p=4(1+2+\dots+k)=2k(1+k)$$

Now the remaining benches, if any. There remains $n-4k$ benches, for which you need $n$ pieces.

All in all, the number of pieces is

If $n$ is divisible by $4$: $$N=2k(1+k)=2\lfloor\frac{n}{4}\rfloor(\lfloor\frac{n}{4}\rfloor+1)$$

Otherwise: $$N=2k(1+k)+n=2\lfloor\frac{n}{4}\rfloor(\lfloor\frac{n}{4}\rfloor+1)+n$$

If you want a unique expression for all cases, the number of pieces $N$ can also be written:

$$N=\frac1{16}\left(2n^2+14n-5+(1-2n)\cos(n\pi)+4(1-n)\cos(n\frac{\pi}{2})+4n\sin(n\frac{\pi}{2})\right)$$

  • Wow, that's way beyond my understanding... But I can confirm it works. Amazing, thank you! Also, it looks pretty good on a graph :) – Shane Apr 18 '19 at 00:44
  • Very elegant solution, for sure. – Claude Leibovici Apr 18 '19 at 05:06
  • @Shane It's related to the discrete Fourier transform (the transform of $[1,0,0,0]$ is $[1,1,1,1]$ and you get that $(1+(-1)^n+i^n+(-i)^n)/4$ is a 4-periodic sequence with period $[1,0,0,0]$. Then convert this to trig to get rid of complex numbers, shift the sequence to get $[0,1,0,0]$ and the other two, then build a combination of the four sequences that captures the behavior for $4n$, $4n+1$, $4n+2$ and $4n+3$. This allows to remove both the "if" (on $n$ modulo $4$) and the floor function. Then simplify. Cumbersome, but easy. – Jean-Claude Arbaut Apr 18 '19 at 06:14