However, of this "leftover" section, it should probably be greater than the port_width. In other words, the leftover_section should be less than internal_depth - port_width, so that it doesn't "seal" up the port. And based on the definition of the leftover_section, which was (port_width + some_length_Y + end_correction), an inequality representing it could be:

the iPart of 52.875/15.25 is 3; therefore, y would be 52.875 - 15.25*3, or
7.125

if I had chosen a depth of 10", num_sections would be
4, and y would be 9.875

However, since this selection of numbers does not satisfy the inequality of
internal_depth - y - end_correction - 2*port_width > 0; meaning that the leftover section is not longer than (internal_depth - port_width),

10 - 9.875 - 0.875 - 2*.75 > 0
-2.25 > 0

...cannot use this depth.

Another equation which must be taken into account is that the width for the port as a whole (as it spans horizontally in the box) must be big enough. In other words, the lengthwise dimension of the box would be:

some_space + length_for_sub + some_space + width_whole_port = lengthwise_dimension
some_space can be qualified as an arbitrary constant C, so we can say that the box is divided into non_port_as_a_whole_width & width_whole_port

width_whole_port can be represented by:

(num_full_sections+1_leftover_section) * (mdf_thickness + port_width)

what this means is that now, instead of the depth being dependent on the length & height, I'm saying length is dependent on depth & height. Cause the bigger the depth, the number of sections decrease, which in turn decreases the width_whole_port. The smaller the depth, the number of sections increase and in turns increases the width_whole_port.

...in order to figure out that third dimension, I could graph these different equations, filter out the ones that don't work, and select one which does.

on the TI... (window: xmin=5, xmax=20; ymin=0, ymax=20)

y1 = graph of number of sections based on depth
= iPart(52.875/(x+.75))

y3 = graph of the inequality to see if the left_over_section is less than internal_depth - 2*port_width
= x - y2(x) - 0.875 - 2*1.75
- make the style of this line with "Above"...so that it shades everything above.

so that'll give you your displacement, add that to sub displacement and Vb (1.5*1728) and that's total displacement. Divide by the two known dimensions (height & depth) and that'll give you your lengthwise dimension.

y5 = the third dimension
= (y4(x) + 1.5*1728)/13/x

However, you still have to make sure that this (lengthwise dimension - width_whole_port) is enough width for the sub.