Thread: Math Quiz 9
View Single Post
  #94   Spotlight this post!  
Unread 13-08-2016, 00:27
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,574
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Math Quiz 9

Thanks, Ether! I really did put more work into making it readable than doing the math (though not nearly as much work as for a textbook, which I can vouch is a truly painstaking task if you've never done it). I don't think there's anything in there beyond second semester calculus; I know I was routinely doing more complex multidimensional integrals in second semester college physics.

Anyway, as I promised a while back, I came back to solving the square problem in radial coordinates. Once I didn't try too hard for symmetry and integrated over r first, it was pretty straightforward:

As already established, the mean segment length in Cartesian coordinates is:
Ḹ = 40101 (1-x)(1-y)√(x2+y2) dx dy
Converting to polar coordinates, placing the lower left corner of the square at the origin and aligning so that the x axis is along θ=0, the y axis along θ=π/2, we replace √(x2+y2) = r, x=rcosθ, y=rsinθ, and dxdy = rdrdθ. For bounds of integration, note that the lower and left sides of the square are θ=0 and θ=π/2 for 0<=r<=1. The right side is defined by rcosθ=1, or r=secθ for 1<=r <= √2. Similarly the top side is r=cscθ for 1<=r <= √2. This yields:
Ḹ = 40π/40secθ(1- rcosθ)(1- rsinθ)r rdrdθ + 4π/4π/20cscθ(1- rcosθ)(1- rsinθ)r rdrdθ
In the first integral, we substitute α=θ, and in the second we substitute α=π/2-θ, which means cscθ = secα, cosθ = sinα, and sinθ = cosα. After these substitutions and a reversal of the limits of integration on the second term, the first and second term are identical, so combine them:
Ḹ = 80π/40secα(1- rcosα)(1- rsinα)r rdrdα
Ḹ = 80π/40secα r2 – (cosα+sinα)r3 + cosαsinαr4 drdα
The integrals over r are polynomials:
Ḹ = 80π/4[⅓r3 – ¼(cosα+sinα)r4 + ⅕cosαsinαr5 ]0secα
Ḹ = 80π/4[⅓sec3α – ¼(cosα+sinα)sec4α + ⅕cosαsinαsec5α]
Ḹ = 2/150π/420sec3α – 15 sec3α -15tanαsec3α + 12tanαsec3α dα
Ḹ = 2/150π/45sec3α -3tanαsec3α dα
To solve the integral of sec3α, try tanαsecα. By the product rule,
dtanαsecα/dα = sec3α + tan2αsecα = sec3α + (sec2α-1)secα = 2sec3α - secα
We can fill in with the well-known integral of secα to offset. The integral of 3tanαsec3α is seen to be sec3α:
Ḹ = 2/15[5(secαtanα + ln|secα+tanα|)/2 – sec3α]0π/4
Ḹ = 2/15[5(√2-0 + ln(√2+1)-ln(1))/2 - 2√2 + 1]
Ḹ = 2/15[5ln(√2+1)/2 + 5/2√2 - 2√2 + 1]
Ḹ = 2/15[5ln(√2+1)/2 + √2/2 + 1]
Ḹ = ln(√2+1)/3 + √2/15 + 2/15
Which is the same result achieved by Aren Siekmeier through a much longer process.
--------------------------------------------------------
The above process did not result in a population density of segment lengths (many of Ether's histograms), which was my primary motivation to do the polar integral. To get this population, leave out the "r" factor representing segment length and integrate over angle only:
Ƥ(r) = 4(1- rcosθ)(1- rsinθ)rdθ
Ƥ(r) = 4r - r2(cosθ+sinθ)+ r3cosθsinθ dθ
Ƥ(r) = 4[rθ - r2(sinθ-cosθ)+ r3sin2θ/2 ]
For 0<=r <=1, the limits of integration are 0 to π/2. This is the integral over the intersection of the unit circle and this unit square:
Ƥ(r)|r<=1 = 4[rθ - r2(sinθ-cosθ) + r3sin2θ/2]0π/2
Ƥ(r)|r<=1 = 4[πr/2 - 0 - r2(1 - 0 - 0 + 1)+ r3(1-0)/2]
Ƥ(r) = 2πr - 8r + 2r3
For 1<=r <= √2, the limits are cos-1(1/r) and sin-1(1/r) (or equivalently sec-1r and csc-1r); this is the integral over the part of the unit square which is outside of the unit circle. To evaluate sin(cos-1(1/r)) and cos(sin-1(1/r)), recall that sin2x = 1-cos2x:
Ƥ(r)|r>=1 = 4[rθ - r2(sinθ-cosθ)+ r3sin2θ/2]cos-1(1/r)sin-1(1/r)
Ƥ(r)|r>=1 = 4[r(sin-1(1/r)-cos-1(1/r)) - r2(1/r-√(1-1/r2)-√(1-1/r2)+1/r)+ r3(1/r2-(1-1/r2))/2]

Ƥ(r)|r>=1 = 4r(sin-1(1/r)-cos-1(1/r)) - 8r + 8r√(r2-1) + 4r - 2r3

Ƥ(r)|r>=1 = 4r(csc-1r - sec-1r) - 4r + 8r√(r2-1) - 2r3
As a sanity check, I calculated the population, population * length, and the integrals of each using excel with a step size of 0.001, and plotted all four (image and excel file attached). The sum of the population was 0.99999947, good to six decimal places, and the average length came out to 0.521405427, which is good to eight decimal places.
Attached Images
File Type: bmp Segments-in-square.bmp (713.9 KB, 3 views)
Attached Files
File Type: xlsx Segments-in-square.xlsx (334.8 KB, 2 views)
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 13-08-2016 at 17:13. Reason: Added "To evaluate sin(cos-1(1/r...", left out two 5s, another typo.
Reply With Quote