Saturday, May 23rd, 2015 05:28 pm

### math people help help help help

I'm trying to enclose a rectangle of known dimensions within an ellipse and expand the ellipse thirty feet from each angle. No, Pythagorean theorum didn't work (why????????), I tried expanding the rectangle theoretically by thirty feet at all diagonals, I tried magic.

I have Pythagged, sined, cosined, tangented and right now I could pass my junior trig and geometry with a A, but I

*cannot make a fucking ellipse*that's perimeter entirely encloses a rectangle of known dimensions that is at least

**one hundred feet**from the closest point in the rectangle.

What. Do. I. Need. To. Do?

Assume all measurements in feet, m is the multiplier to get the ratio to recalculate w, h to a, b for second rectangle and expanded ellipse.

Formula to calculate an ellipse: https://www.mathsisfun.com/geometry/

Current Rectangle:

w = 2640

h = 450

d = Sqr(x) = (w ^ 2) + (h ^ 2) = 2678.0776

p of rec = 6180

p of ellipse = 5487.4475

Increasing the diagonal by 100 at all angles

d2 = 2678.0776 + (

**100***4) = 3078.0776

(Corrected 30 to 100; I couldn't make thirty work at all).

I thought it was working with this formula:

New Rectangle:

m = d2/d = 3078.0776/2678.0776 = 1.1493

a = w * m = 2640 * 1.1403 = 3034.3126

b = h * m = 450 * 1.1403 = 517.2123

p of new rect: 7.103.0501

p of new ellipse = 6304.7578

It could work, but I'm not sure, because when I start expanding the rectangle itself and apply the formula to get real ellipse and new ellipse, it doesn't work and I don't know why. The only explanation I have is that I'm changing the height and width too much, but the same results occur no matter what I do.

Second group:

w = 10560

h = 24390

d = Sqr(x) = (w ^ 2) + (h ^ 2) = 26,577.9175

p of rect = 69,900

p of ellipse = 57,070.34402

Increasing the diagonal by 100 at all angles

d2 = 26577.9175 + (100*4) = 26977.9175

I thought it was working with this formula:

m = d2/d = 26977.9175/26577.9175 = 1.015

a = w * m = 10560 * 1.015 = 10718.92893

b = h * m = 24390 * 1.015 = 24757.07165

p of rect: 70952.00116

p of new ellipse = 57,747.0583

What is wrong with my brain that this isn't working? I verified my results with google and it agrees something is wrong with either a.) my brain or b.) geometry. I think it's geometry. I get ellipse calculations are complicated, but I double checked that part a few times and it's working, I think. At least, google thinks so when I enter my numbers to get the smallest ellipse but this is making no sense why I can't get that second one to work.

I'm listening to

*country music*and not like,

*Girl in a Country Song*but stuff like

*The Dance*and

*The Thunder Rolls*and

*Straight Tequila Night*and

*The Bluest Eyes in Texas*and

*(this is the South; we like to be detailed about how you are breaking our hearts, fucker). This is*

**I'd Be Better Off (In a Pine Box) (On a Slow Train Down to Georgia)***Southern wake after the death of grandma*level shit here; this is when we drink Southern Comfort and Wild Turkey and a metric ton of margaritas (if your Southern is Texan), eat potato salad and fried

*anything*, and everyone gets drunk, talks about their rifles and family scandals and at some point one to three parents have a knock-down drag out among the funeral flowers and someone hides in the closet with a brownie and...we're not talking about my childhood, right.

...

*this is where I am right now*. Fix my geometry or I won't be understandable when I talk to anyone not in a central Texas bar; I already have too many vowels in my words and all my gerunds are missing a very important ending 'g'. I will write all my entries in the dialect of a central Texas rural farmer if I have to, and don't think I won't.

This has been a mathematical cry for help.

**ETA:**Oh God,

*I Want to Be Loved Like That*just came up on rotation. Help.

**ETA 2:**If you saw an ealirer version, I was using '30 feet' not '100 feet'; I switched when testing the formuals to 100 because thirty simply didn't work and I wanted a dramatic change. All math here is based on an increase of 100 from all angles, or an increase of 200 of each diagonal.

**ETA 3**: Aded figures worked out in pencil, verified in excel and google, cited my formulas, and still WHAT.

Answered by

**edgewitch**: Link to solution with proof!.

## no subject

fox(- reply to this
- thread
- link
)

## no subject

seperisThat's the thing--using the diagonal increase, I create the new (imaginary) rectangle that should enclose the first rectangle and create an ellipse of that one to do the ecnlosure of the first one (using the diagonal and ratio to get the sides a, b). I've verified all the pieces of this, and those work, but together they just don't.

(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

foxMy googling suggests this might be easier if you began from an ellipse that touched the edges of the rectangle (i.e., from the inside), rather than one that touched the corners (i.e., from the outside).

(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

seperisMy googling suggests this might be easier if you began from an ellipse that touched the edges of the rectangle (i.e., from the inside), rather than one that touched the corners (i.e., from the outside).I did; that's the first ellipse using w,h for a,b.

Just added it done in paper with all figures to show my work. Because God, why is this so hard.

(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

fox(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

seperis2.) Expanded the rectangle considerably and calculated the second ellipse, the largest that should fit inside the second rectnagle and should enclose the first rectangle. It's not doing that and seems to be getting smaller as time goes on.

3.) currently I'm expandiung each diagonal by 100.

(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

fox(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

seperisWord problem!

Fred has the width and height of his rectanglular thing and sets a mcguffin thirty feet from each vertex with the understanding that this is the thirty feet from the farthest point from any part of the existing rectangle, therefore it's increasing the diagonal, and needs for reasons to connect them with a ellipse.

However, due to--reasons--his original rectangle does a radical change of width and length--almost terrifying, really--but his mcguffins need to be moved fast and he's got ten minutes to get them to that thirty foot distance and create the ellipse or...

...reasons. And I want to make it universal so he can do this on the fly while running if his rectangle keeps--doing this shit for no reason.

(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

fox(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

seperis...I wonder if graphing would help? Fuck my life.

(- reply to this
- parent
- top thread
- link
)

## no subject

seperisTo get my ellipse that encloses the first rectnagle, I create a bigger rectangle by expanding both diagonals by 200 (or 100 at every vector) and get that ellipse. It should enclose the first rectangle entirely, but it doesn't

(- reply to this
- parent
- top thread
- link
)

## no subject

reginagiraffe~~30~~100 feet away from the running track? I assume that's what you mean by "expand the ellipse thirty feet from each angle".Is that the basic premise?

(- reply to this
- thread
- link
)

## no subject

seperis(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

reginagiraffeIf you figure it out, do a post!

(- reply to this
- parent
- top thread
- link
)

## no subject

miellathinkI figured out that you have two problems: One, a problem of scale, and two, you aren't calculating what you want to be calculating.What you are calculating is starting with an ellipse inside a rectangle, then making a larger ellipse still inside a larger rectangle. Your numbers work for small orders of magnitude because, to them, 100 is large enough that the increase takes you definitely outside the original. For large numbers, 100 barely makes a dent, so while your ellipse

islarger, it is still nearly inside the original rectangle. You have hardly moved at all.Fundamentally, what you WANT to do is end up with an ellipse OUTSIDE the second rectangle, which means that the endpoint of the d2 you are calculating needs to be ON the ellipse. Basically, you are calculating to find where the middle of the top and bottom of the large rectangle hit a new ellipse, but you really need to be calculating where the corners of the large rectangle hit a new ellipse. That one will be big enough and what you are looking for. To do an accurate calculation, though, I think you might have to deal with the foci.

(- reply to this
- thread
- link
)

## no subject

silveraspenmiellais right here - the equation that you're looking for to calculate the size/curve of the expanded ellipse is probably going to work best operating from the 2 foci.So, in Rectangle 1, the foci of the ellipse are at points F1 and F2, right? In rectangle 2, to have a larger ellipse that is positioned in relation to it in the same way, they will be at points F3 and F4.

Potentially (I think), if you are looking to keep the same relative position of the ellipse and rectangle of whatever size, you might be able to calculate the change of the foci in the rectangle as a constant (e.g,. if the foci are always A and B distance from the ends of the rectangle? Or -X and +X, if you figure the center of the ellipse as the center of the rectangle as well and put everything on the X axis) and then use that to generate your new ellipse when the rectangle changes size. I think.

http://colalg.math.csusb.edu/~devel/

edited at (to use variables besides x and y so as not to confuse with axial positioning!) 2015-05-24 03:40 am (UTC)(- reply to this
- parent
- top thread
- link
)

## no subject

edgewitchThe problem I see is that, given a rectangle, you can draw an

infinitenumber of ellipses that go only through the corners, it just depends on the tangent of the ellipse at the corner. We have to add another restriction. Let me try it with the restriction that the ellipse has to be the same aspect ratio as the rectangle.So we have an ellipse centered at (0,0): x

^{2}/a_{E}^{2}+ y^{2}/b_{E}^{2}=1where a

_{E}is the radius on the x axis and b_{E}is the radius on the y axisAnd we have a point(the corner of the rectangle(also centered at (0,0) )): (x

_{R}, y_{R}) = (a_{R}/2, b_{R}/2)where a

_{R}is the width of the rectangle and b_{R}is the height.Now we add the restriction that a

_{R}/b_{R}= a_{E}/b_{E}You've said we know what the length and width of the rectangle are, so a

_{R}/b_{R}= some constant, let's call it K.Now we can say that a

_{E}/b_{E}= K and therefore a_{E}= K * b_{E}With all of that, we can get the ellipse equation in terms of only one variable (b

_{E}):(a

_{R}/2)^{2}/(K * b_{E})^{2}+ (b_{R}/2^{2})/b_{E}^{2}=1Solve for b

_{E}and get:b

_{E}= Sqrt( (a_{R}/2)^{2}/K^{2}+ (b_{R}/2)^{2})Now to account for the difference between the first rectangle and the second, keeping both rectangles the same aspect ratio. Say the first rectangle is width w and height h. If we center it at (0,0) the upper right corner will be at (w/2, h/2).

The distance of this point from the origin will be d = Sqrt( (w/2)

^{2}+ (h/2)^{2}). Without figuring out the angle of the diagonal, we can still say that sin(θ) = (h/2d) and that sin(θ) = b_{R}/(2*(d+N)) where N is the distance the corner of the new rectangle needs to be from the corner of the original rectangle and b_{R}continues to be the height of the new rectangle that needs to intersect our ellipse only at the corners.Thus, h/2d = b

_{R}/(2*(d+N)) and thereforeb

_{R}= h(d+N)/dand by similar reasoning with cos(θ),

a

_{R}= w(d+N)/dPulling that all together, using your original example of a starting rectangle of width 2640 and height 450 with a desired extra distance of 30, we get

d= sqrt((2640/2)^2 + (450/2)^2) ≈ 1339

a

_{R}= 2640(1339+30)/1339 ≈ 2699b

_{R}= 450(1339+30)/1339 ≈ 460Bringing back the stuff from before:

K = 2699/460 = 5.867

b

_{E}= Sqrt( ( (2699/2)^2/5.867^2 )+ (460/2)^2 ) ≈ 325.28And so

a

_{E}= 5.867 * 325.28 ≈ 1908.41Using approximation 2 from the link,

P ≈ 3.14 * (3(1908+325) - Sqrt( (3(1908)+325) (1908+3(325)) ) ≈ 7922.22

That is, the ellipse that goes through a rectangle the same shape but 30 units larger than the rectangle that is 2640x450 AND itself fits inside an even larger rectangle that is the same shape as both previously mentioned rectangles will be about 651 units tall and 3817 units wide. The perimeter will be about 7922 units long.

Someone pls check my work, I'mma go hunt down my ADHD meds.

(- reply to this
- thread
- link
)

## no subject

seperis(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

edgewitch(- reply to this
- parent
- thread
- top thread
- link
)

## no subject

seperis(- reply to this
- parent
- top thread
- link
)

## no subject

niqaeliThe problem is, I am not sure I understand how the rectangle is expanding? Does it retain the same proportions as the original rectangle? Where is the 100 ft we're adding being measured from/to?

If I haven't fucked up my geometry hideously, if I know how the rectangle expands, I can drop those parameters into my equation for the ellipse and ratio it against the original ellipse/rectangle, and get you a multiplier?

ETA: I see you've gotten more responses since I'd last looked! That is what I get for not refreshing first. I haven't got the brain to go digging through the rest of their work, sadly! but fwiw, if you can tell me how the rectangle is expanding, I can work through the rest of the equations, later, when I am not sick and feverish, and in theory get you a general formula that'll work on any rectangle of dimensions width w and height h. Although, actually, I should also confirm -- you're looking for the perimeter of the new ellipse, right?

edited at 2015-05-25 10:24 am (UTC)(- reply to this
- link
)

## no subject

niqaeliSo the gist here is, intuitively, we can figure the ellipse with the smallest area that can enclose the rectangle is going to have the shortest perimeter. The largest area ellipse would be the circle with radius r that is the distance from the origin to one of the points of the rectangle [ie, √((w/2)

^{2}+ (h/2)^{2})], using good old pythagoras. Circumference is 2πr, which for your original rectangle of 2640x450 would be 8410. This is larger than it needs to be!)We can use some simple calculus to find the minimum possible area of an ellipse that contains the points of a given rectangle of known dimension. Once we have that, we can plug it back into the equations for an ellipse and pull out what a and b, the vertices of the major and minor axes of the ellipse, are in terms of the rectangle of known dimensions. Here is a pdf showing the derivation.

The calculus is VERY simple -- a first derivative only, and not a particularly complicated one. (And, here is a link to Wolfram Alpha's rendering of the graph of the ellipse area function. It's lacking the multiplier wh, but the shape will always be the same for positive values of w and h.) There's tidier math to do this, I would bet, but this is how I figured it out and could clearly lay out how I got there.

At the end of the derivation, I also included approximations of the perimeter of the ellipses that circumscribe both a rectangle of 2640x450 and a rectangle that was proportionally expanded from the original by 30 on all sides (ie, 2670x450). All calculations were done with significant figures in mind, because I have had too goddamn many chemistry and physics classes and they yell at you.

In case you don't want to suffer through the derivation:

BOTTOM LINEThe smallest ellipse that circumscribes a rectangle of width w and height h will have vertices a, b such that:

a = w/√(2)

b = h/√(2)

You can use those vertices in any approximation for the perimeter you like that uses the vertices. Trying to take the algebra further than that while holding the known dimensions of the rectangle as the variables w and h gets really fucking ugly. (I tried. I said fuck it. :P)

Now, if you expand your original rectangle proportionally (and here it gets hard to describe in words, so you really just want to go look at page 3 of that .pdf I linked), you have two useful measures by which you can describe the distance the rectangle's perimeter has been expanded: β which is 1/2 the distance added to each side, and α which is the hypotenuse of the right triangle that has both sides equal to β. And I swear to god, that all makes twenty times more sense in the picture than it does written in English.

So! For this new rectangle, to circumscribe it with the smallest possible ellipse, you get a

_{2}, b_{2}in terms of the original rectangles vertices a, b where:a

_{2}= a + α OR a_{2}= a + β*√(2)b

_{2}= b + α OR b_{2}= b + β*√(2)You can use either measure of the distance that the rectangle was expanded by to calculate the new vertices, whichever's what you know. And of course n that you have the vertices of the new ellipse you can use that to, again, approximate the ellipse's perimeter.

If you survived that mess, here's a

a visual demonstration of two different ellipses circumscribing proportional rectangles. This demonstration has the first rectangle at dimensions 2640x450; the second rectangle with dimensions 2670x480 -- it's been expanded by 30 on each side, ie a β value of 15. The zoom doesn't show the entire ellipses, but is pulled in one where the rectangles touch the ellipses that circumscribe them.I hope that is, actually, what you were looking for! If not, lemme know? I don't think I can get a simple multiplier that relates the perimeters of the ellipses out of the mess of algebra that gets you into, though.

edited at (OKAY THE ARITHMETIC IS ALL FIXED. oiiiiiii.) 2015-05-26 01:01 am (UTC)(- reply to this
- link
)

## no subject

marycontraryhttp://marthawells.tumblr.com/post/

(- reply to this
- link
)