Integrate area between two normal distributions
Calculate probability (area) under the overlapping area of two normal distributions
New questions, Show Recommended, Sort Newest not working Select New questions, show Recommended and sort by Newest and the  in my list is from 2012:  EDIT The very old questions now appear to be gone (yay) but the ordering seems inconsistent (boo): Let $a,b,c\in\mathbb{R}$ such that $\sqrt{a^2+b^2}=1&lt;c$.  Find $I:=\int_{0}^{2\pi} \frac{1}{a\cos(t)+b\sin(t)+c}dt$.  So, I set $z=e^{it}$ and then $dz=ie^{it}dt$ and so $\frac{dz}{iz}=dt$. Therefore,  $\begin{align*} I &amp; =\frac{1}{i}\int_{|z|=1} \frac{dz/z}{a\cdot\frac{z+z^{-1}}{2}+b\cdot\frac{z-z^{-1}}{2i}+c} \newline &amp;=\frac{2}{i}\int_{|z|=1} \frac{dz}{a\cdot(z^2+1)-ib\cdot(z^2-1)+2cz} \newline &amp;=\frac{2}{i}\int_{|z|=1} \frac{dz}{(a-ib)z^2+2cz+a+ib}\newline &amp;= \frac{2}{i}\int_{|z|=1} \frac{dz}{(z-z_+)(z-z_-)}\end{align*}$  Where $z_{\pm}=\frac{-2c\ \pm\ \sqrt{4c^2-4(a+ib)(a-ib)}}{2(a-ib)}=\frac{-c\ \pm\ \sqrt{c^2-(a^2+b^2)}}{(a-ib)}=\frac{-c\ \pm\ \sqrt{c^2-1}}{(a-ib)}$.  Therefore, if we define $f(z)=\frac{1}{z-z_-}$, we get that $f$ is analytic in $\{z:|z|\leq 1\}$ since  $$|z_-|=\Bigg|\frac{-c-\sqrt{c^2-1}}{a-ib}\Bigg|=\bigg|c+\sqrt{c^2-1}\bigg|&gt;|c|&gt;1$$  Finally from Cauchy's Integral Formula:  $$I=\frac{2}{i}\cdot 2\pi i\cdot f(z_+)=4\pi \frac{1}{z_+-z_-}=\frac{2\pi(a-ib)}{\sqrt{c^2-1}}$$ Which is not always real... So my question is what is the problem.  Moreover, sometimes it is correct, e.g. $a=1,b=0,c=2$ gives the correct answer $\frac{2\pi}{\sqrt{3}}$. It would seem that LIGO measures wibbles in the metric (not manifold) of spacetime:    It would seem that the expansion of the universe is an expansion of the metric of spacetime:    Imagine for a moment that LIGO is not an interferometer. (So, it just plain times speed changes, rather than using phase shift of orthogonal directions.)  If the ends of one of the arms was indeed receding away from each other, at a speed consistent with the expansion of the universe, is the sensitivity of real-world LIGO of the needed sensitivity of a machine which could measure that shift?  On other words: ideally I'd like to know these two meters:  (A) The left arm of LIGO is about 4km. It was stretched/shrunk (a few times) for roughly .01 seconds by the gravitational wave.  How many meters was it stretched/shrunk in .01 seconds?  (B) Assuming the same abstract LIGO arm was affectable and affected by the expansion of the Universe. How many meters is it stretch/shrunk every .01 seconds?    Note - of course, an interferometer is an ingenious device to measure extremely small changes in speed - assuming the changes are orthogonal. Of course, an interferometer, per se, can't at all measure the expansion of the universe since that is uniform in both directions. The sense of my question is, can something that measures distance changes > as accurately as &lt; the LIGO does, measure the expansion of the universe?  How big or small is the ongoing expansion of the universe compared to the wibble from the black hole system in question? How to loop the particle simulation indefinitely? I've made a simple snowfall particle simulation (using gandalf3's solution: ). Is there a way to loop the animation, so the transition between last frame and first frame is not visible? Is there a setting to do it? The spell was cast without words, simply a flick of the Death Eater's wand, and a 'streak of purple flame' that lanced across her chest. It was later mentioned that the spell was weakened because of the lack of a verbal component, but still 'did enough damage as it was'. She was in the infirmary healing from the damage for some time. What spell was this? How do I efficiently get "the most recent corresponding row"? I have a query pattern that must be very common, but I don't know how to write an efficient query for it.  I want to look up the rows of a table that correspond to "the most recent date not after" the rows of another table.  I have a table, inventory say, which represents the inventory I hold on a certain day.  date       | good | quantity ------------------------------ 2013-08-09 | egg  | 5 2013-08-09 | pear | 7 2013-08-02 | egg  | 1 2013-08-02 | pear | 2   and a table, "price" say, which holds the price of a good on a given day  date       | good | price -------------------------- 2013-08-07 | egg  | 120 2013-08-06 | pear | 200 2013-08-01 | egg  | 110 2013-07-30 | pear | 220   How can I efficiently get the "most recent" price for each row of the inventory table, i.e.  date       | pricing date | good | quantity | price ---------------------------------------------------- 2013-08-09 | 2013-08-07   | egg  | 5        | 120 2013-08-09 | 2013-08-06   | pear | 7        | 200 2013-08-02 | 2013-08-01   | egg  | 1        | 110 2013-08-02 | 2013-07-30   | pear | 2        | 220   I know one way of doing this:  select inventory.date, max(price.date) as pricing_date, good from inventory, price where inventory.date &gt;= price.date and inventory.good = price.good group by inventory.date, good   and then join this query again to inventory. For large tables even doing the first query (without joining again to inventory) is very slow.  However, the same problem is quickly solved if I simply use my programming language to issue one max(price.date) ... where price.date &lt;= date_of_interest ... order by price.date desc limit 1 query for each date_of_interest from the inventory table, so I know there is no computational impediment.  I would, however, prefer to solve the whole problem with a single SQL query, because it would allow me to do further SQL processing on the result of the query.  Is there a standard way to do this efficiently? It feels like it must come up often and that there should be a way to write a fast query for it.  I'm using Postgres, but an SQL-generic answer would be appreciated. About the number format in ticks Every planar graph has a vertex of degree at most 5. I am trying to prove the following statement, any help!?     Prove that every planar graph has a vertex of degree at most 5. Why should users have to press Return twice to insert new lines? When I post a question and want to add a new line, I have to press Return two times, or else the next text will appear on the same line.  Is this really supposed to behave this way? If so, why? Show that $\gcd(a^2, b^2) = \gcd(a,b)^2$ Are there any tools for Windows 7 that will allow me to enable/disable monitors from the command-line?  For example, my GTX 480 has three outputs (2x DVI and 1x HDMI) but only two displays can be active at any given time.  I'd like for a command-line to allow me to disable one of the DVI monitors and enable the HDMI monitor, etc.  (I've found NirCmd which is an amazing utility but it doesn't seem to support this...)  EDIT: UltraMon seems capable of doing this but I really hoping for a more light-weight command-line solution... We can apply l’Hôpital’s Rule to the indeterminate quotients $ \dfrac{0}{0} $ and $ \dfrac{\infty}{\infty} $, but why can’t we directly apply it to the indeterminate difference $ \infty - \infty $ or to the indeterminate product $ 0 \cdot \infty $?  Furthermore, why can’t we call $ \infty + \infty $ and $ \infty \cdot \infty $ indeterminate forms?  I’m new to calculus, so please clear up my concepts if you can. Thanks! Should I use center or centering for figures and tables? What is the correct way to center figures and tables (figure, table)?  \begin{center} ... \end{center}   or   \begin{centering} ... \end{centering} I'm getting "jumpy" loadings in rollapply PCA in R. Can I fix it? I have 10 years of daily returns data for 28 different currencies. I wish to extract the first principal component, but rather than operate PCA on the whole 10 years, I want to rollapply a 2 year window, because the currencies' behaviours evolve and so I wish to reflect this. However I have a major problem, that is that both the princomp() and prcomp() functions will often jump from positive to negative loadings in adjacent PCA analyses (ie 1 day apart). Have a look at the loading chart for the EUR currency:    Clearly I can't use this because adjacent loadings will jump from positive to negative, so my series which uses them will be erroneous. Now take a look at the absolute value of the EUR currency loading:    The problem is of course that I still cannot use this because you can see from the top chart that the loading does go from negative to positive and back at times, a characteristic which I need to preserve.   Is there any way I can get around this problem? Can I force the eigenvector orientation to always be the same in adjacent PCAs?   By the way this problem also occurs with the FactoMineR PCA() function. The code for the rollapply is here:  rollapply(retmat, windowl, function(x) summary(princomp(x))$loadings[, 1], by.column = FALSE, align = "right") -&gt; princomproll Selecting a security team that includes at most one of the oldest man or oldest woman A security company consists of $7$ men and $6$ women. Determine the number of ways to form the night shift team of $3$ men and $3$ women if it can include at most one of the oldest man or oldest woman.  I know the first step is to pick $3$ from each group which is   $_6C_3 \cdot _7C_3 $  but I am not sure how to account for the "include at most one of the oldest man or oldest woman"   The answer is $_6C_3 \cdot _7C_3 + _6C_3 \cdot _5C_3 + _6C_2 \cdot _5C_3 $  Also, how do I account for it in my calculations if I want to include the oldest man and oldest woman from the group? Is it because Rey just saved BB-8 from a net, and then the droid just decides to follow her about - or is it for some other reason?  Does BB-8 have any idea who Rey is prior to being rescued by her?  Just wondering as she literally tells the droid to go elsewhere. Copy-paste functionality stops working after about an hour after each reboot on a Windows 7 64-bit system. Running Google Chrome (with gmail and few other tabs open like Calendar, Reader), MS Outlook (which I don't think has anything to do with the problem — I saw it when outlook was off as well), iTunes (9.1.1.12 if it matters).  Would appreciate hints where and what for to look in a registry, and ideas for possible fix.  That is not an Internet Explorer problem (I don't even run it) — it happens in all applications.  Neither Ctrl-C/Ctrl-V nor context menu right-click Copy-Paste (actually, nothing happens on Copy, so there is nothing in a clipboard to Paste) are working. Drag-and-Drop (where supported) continues working though. How to remove a filter that is an anonymous object? Vehicles required/allowed in weigh stations on US interstates This is in Windows, but answers for other operating systems can be handy to others.  Most guides say something to the effect of "hold down the Alt key and type in the code on the keypad".  This works fine for decimal codes (like 65 for 'A'), but not for  codes (like  for 'A').  Some applicatons provide other facilities that will allow hexadecimal Unicode character codes to be typed and then transformed.  Word allows you to type the code (such as 200f) and then convert it to Unicode by typing Alt-X.  I'm looking for a general method of doing this that will work with the standard input.