Consider the following simulation experiment:  In order to estimate the area ($\theta$) of a circle drawn somewhere on a square of known side=10, a collection of random vectors $(X_i,Y_i), i=1,...,10$ are generated. Each $X_i$ and $Y_i$ are iid $\text{Uniform}[0,10]$.   From this, iid random variables $Z_i$ are obtained. Each $Z_i$ is $1$ if $(X_i,Y_i)$ is within the circle and $0$ otherwise.    I asked a version of this questions earlier and the comments below have been very helpful in getting me to an answer. However, while reviewing it again today, I encountered an issue that I would like to ask about.  From comments below, I got that the $Z_i \sim \text{Bern}(\theta/100)$ where $\theta$ is the area of the circle. Using this, I was able to get the estimator $100\frac{\sum_{i=1}^{10} z_i}{10}$ and prove that this is unbiased for $\theta$.   I was also able to show that $\sum_{i=1}^{10} Z_i$ is a sufficient complete statistic for $\theta$ and so $100\frac{\sum_{i=1}^{10} z_i}{10}$ is UMVUE for $\theta$.  However, if I use this estimator I can end up with an estimate of the area that is not possible (one larger than the largest possible circle). That is if all or almost all my points happen to fall in the circle (8, 9 or 10), I can get an estimate that's $(&gt;25\pi)$.  My question is this: why isn't $25\pi\frac{\sum_{i=1}^{10} z_i}{10}$ a better estimator of $\theta$? This never gives an impossible value.  If I let my $Z_i's$ be $Bern(\frac{\theta}{25\pi})$ I think the rest of the solution for all of the requirements of the problem will follow, but I can't seem to justify that when the instruction of the problem is to have $Z_i$ be the indicator function that the point $(X_i,Y_i)$ is in the circle.
I am fairly sure that I understand the how Monte Carlo integration works but I am not understanding the formulation of how it is used to estimate Pi.  I am going by the procedure outlined in the 5th slide of this presentation   I understand the preliminary steps.  Pi is equal to 4 times the area of a quarter of the unit circle.  And the area of the top-right quarter of the unit circle centered at (0,0) is equivalent to the integral of the curve that is the top-right quarter of the unit circle in $0&lt;x&lt;1$ and $0&lt;y&lt;1$.    What I don't understand is how this integral is  $\iint I((x^2+y^2)&lt;1)P(x,y)dxdy$  where $P(x,y)$ is uniformly distributed in the unit square around the quarter circle (i.e. it is always equal to 1 if $0&lt;x&lt;1$ and $0&lt;y&lt;1$ and 0 otherwise).  So this would mean that  $I((x^2+y^2)&lt;1)P(x,y)$ is the function that is the top-right quadrant of the unit circle at $0&lt;x&lt;1$ and $0&lt;y&lt;1$ but I do not understand how this is true since the indicator function can only be 1 or 0.  I understand that it is probably written in this way to make Monte Carlo sampling easy (i.e. it is an expectation so just sample from $P(x,y)$ and get the average of the samples applied to $I((x^2+y^2)&lt;1)$) but it just does not make intuitive sense to me why that integral represents the area under that curve.  Could someone provide an intuitive explanation of this.  Maybe show how that integral was derived in a step-by-step way?  EDIT:  I was able to gain a better understanding by relating the expectation to an area.  I will explain it here in case it helps anyone.  First start with relating Pi to the area of the top-right quadrant of the unit circle  $\pi=4\times A_{tr}$  Then we place the top-right quadrant into the unit square.  And under a uniform distribution over the unit square, the area of the circle quadrant is proportional to the probability of obtaining a sample from it.  It follows that the following equality holds  $P(x^2+y^2&lt;1)=\frac{A_{tr}}{A_{square}}$  and $A_{square}=1$ so  $P(x^2+y^2&lt;1)=A_{tr}$  And substituting into the original equation  $\pi=4\times P(x^2+y^2&lt;1)$  and it is also true that $P(x^2+y^2&lt;1)=E[I(x^2+y^2&lt;1)]$ which is equal to the original double integral.  So I understood it by relating the area to a probability then relating that probability to an expectation that is equivalent to the integral.  Let me know if I have made any mistakes.
Find the infinite sum of the series $\sum_{n=1}^\infty \frac{1}{n^2 +1}$ This is a homework question whereby I am supposed to evaluate:  $$\sum_{n=1}^\infty \frac{1}{n^2 +1}$$  Wolfram Alpha outputs the answer as   $$\frac{1}{2}(\pi \coth(\pi) - 1)$$  But I have no idea how to get there. Tried partial fractions (by splitting into imaginary components), tried comparing with the Basel problem (turns out there's little similarities), nothing worked. Possible Duplicate:          My reputation score has gone down, but the reputation tab in my profile does not indicate why. Is this a bug? What else could have caused it? I would like to filter the markers on my (geojson) layer according to two features: year and type of event, ideally using both filters (year and eventType) as check-boxes without using layerGroup at all. I would like to be able to click on a checkbox and update dynamically the markers by filtering them according to feature.properties.eventType too, in addition to the year displayed, something like    &lt;input type="checkbox" id="all" name="all" value="all"&gt;   &lt;label for="all"&gt;All&lt;/label&gt;   &lt;input type="checkbox" id="funfair" name="funfair" value="newsletter"&gt;   &lt;label for="funfair"&gt;Funfair&lt;/label&gt;   &lt;input type="checkbox" id="trade" name="trade" value="trade"&gt;   &lt;label for="trade"&gt;Trade&lt;/label&gt;   &lt;input type="checkbox" id="exhibition" name="exhibition" value="exhibition"&gt;   &lt;label for="exhibition"&gt;Paid exhibition&lt;/label&gt;   etc... which would trigger a  filter: function(feature, layer) {   return feature.properties.eventType == value-of-checkbox; }   I have five types of eventType. So, for instance, if 1890 is checked, the map is showing all 1890 events, no matter what kind of event it is (because by default it would show all events). If the user checks the 'funfair' and the 'trade' checkbox, though, I want the map to show only the 1890 events of the funfair and trade kind, and not other kind of events.  This is my complete script, which so far is working fine with filtering by year.  var oldmap = L.tileLayer('address', {   maxZoom: 12 }),  var modernmap = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {   maxZoom: 12,   id: 'mapbox.streets',   accessToken: 'mytoken' });  var map = L.map('map', {   center: [40.1857864,-4.5536861],   zoom: 7,   layers: [oldmap, modernmap] });  var baseMaps = {   "Old map": oldmap,   "Modern map": modernmap };  var jsontest = {"type": "FeatureCollection",   "features": [     {       "type": "Feature",       "geometry": {         "type": "Point",         "coordinates":  [ -16.5471268,28.4136726 ]       },       "properties": {         "Name":"Point1",         "year":'1892',         "eventType":"funfair",         "notes":""       }     },     {       "type": "Feature",       "geometry": {         "type": "Point",         "coordinates":  [ 2.1753895,41.3767925 ]       },       "properties": {         "Name":"Point2",         "year":'1890',         "eventType":"trade demonstration",         "notes":""       }     }   ]};  var mapLayerGroupsYear = [];  function onEachFeature(feature, layer) {   var year = mapLayerGroupsYear[feature.properties.year];   if (year === undefined) {     year = new L.layerGroup();      //add the layer to the map     year.addTo(map);      //store layer     mapLayerGroupsYear[feature.properties.year] = year;   }    //add the feature to the layer   year.addLayer(layer);    }   var myLayer = L.geoJSON(jsontest, {   onEachFeature: onEachFeature })  L.control.layers(baseMaps, mapLayerGroupsYear).addTo(map);   I am a beginner with leaflet so please forgive the dumb question, in case it is. Can we really not tell if we are moving? It has been a while since I've thought about physics, however, I remember something about how if you are on a train with no windows that is going perfectly straight and is perfectly smooth, there is no experiment that you could perform to prove that you are in motion or at rest. So I have a couple of questions related to this.   Is this still held to be true? I was just wondering if anything in physics has come to light since I learned about this (about 10 years ago) that would allow an observer on the train to tell if they are moving. If this is true, why couldn't you accelerate a particle in different directions to a certain mass and measure how much energy it took to get it up to that mass. If you were moving in any direction, wouldn't you measure less energy in your direction of travel? Would having an outside observer affect the aforementioned experiment in any way? Creating polygon from hole in QGIS? Is there a constraint that restricts my generic method to numeric types? Check a string to see if all characters are hexadecimal values How do I insert the total continuation count in the allowframbreaks frame title? I would like to change the numbering of allowframbreaks frame, for instance, from I II III to (1/3) (2/3) (3/3)， but fail to find out a command to get the total continuation count. Here is the MWE.  \documentclass[compress]{beamer} \usetheme{Warsaw}   %allowframebreaks numbering in the title \setbeamertemplate{frametitle continuation}{(\insertcontinuationcount/)} %\setbeamertemplate{frametitle continuation}{(\insertcontinuationcount/\inserttotalcontinuationcount)}  \title{title} \author{author}  %%%%% \begin{document}  \begin{frame}[allowframebreaks]{allowframebreaks title} frame 1 \framebreak  frame 2 \framebreak  frame 3 \framebreak \end{frame}  \end{document} How do I color table columns? I've found question , but the link to the documentation isn't helping me at all.  I'd like to know how to color a table column given my column code, but the documentation only gives the syntax of the command. It doesn't give any code example of where to use it.  \usepackage{colortbl}  \begin{table}[h]     \centering     \begin{tabular}{|c|c|c|c|c|c|c|c|}         \hline         \cellcolor[gray]{0.8}128&amp;64&amp;32&amp;16&amp;8&amp;4&amp;2&amp;1\\\hline         1&amp;0&amp;1&amp;1&amp;0&amp;1&amp;0&amp;1\\\hline     \end{tabular} \end{table}   As you can see, I got \cellcolor to work, but I don't want to color individual cells. I want to color a whole column of the table. Does anybody know how I can go about to do this? Comparing $2^n$ to $n!$ I'm running CentOS 7.0 build 1503. I'm trying to search for commands I don't know the name of by searching the man descriptions for multiple keywords using AND (e.g. search for a command containing the both words "create" and "group" in the description).  So I came across the command apropos (which is an alias for man -k). The default behaviour when given multiple keywords is to return any command matching any of the keywords, which isn't what I want. According to the man page the option -a specifies using AND, to return matches only when all words match.  But this isn't what I'm seeing in practice, so I need some help here - e.g. using Centos 7, if I do:  apropos create user   I see a huge list of commands, seemingly matching any command with create or user in the description, as expected. Noting the list includes an entry for the command 'useradd (8) - create a new user...'.  If I do:  apropos -a create user   I only get 2 commands (environ and open). This is what I'm confused by - I would expect it to return the command 'useradd (8) - create a new user', because i can see from the previous search that command does contain those words in the description. Also the 2 returned commands don't obviously seem to be anything about creating users. What am I doing wrong? I'm sure it's something embarrassingly obvious, for that I apologise in advance.  Thanks Reentering serial number in Windows 7 Does anyone know how to install a new serial on a working copy of Windows 7 - I get notified that my software is not genuine but cannot reenter the serial Does name of sitemap file that Wordpress generates matter? I need to enter the command line alone with no GUI to install the official NVIDIA drivers. I'm trying to get my computer to work over HDMI and someone on Youtube shows how but you have to be in the Nvidia settings program. How do I calculate if a spell hits and how much damage it does? I'm not entirely sure I understand what the PHB is telling me about spell attacks.  Say I'm a wizard who's casting Fire Bolt (I could also be a Cleric casting Inflict Wounds or what-have-you), the spell itself doesn't say anything about making an attack roll or the enemy making a saving throw.    So do I make an attack roll and then add in my INT mod + proficiency bonus?  Or does the target have to make a saving throw against a DC of 8+ my INT mod + proficiency bonus?  And, assuming I hit, do I add my INT mod + proficiency bonus to the damage? Error: The processing instruction target matching "[xX][mM][lL]" is not allowed Is it possible to disable X at boot time? I'm setting up a server so it would be nice if it wouldn't load the graphical interface every time I boot. Started new job. Rollover previous employer 401k to new 401k, IRA or Roth IRA? I often find myself in a situation where I am facing multiple compilation/linker errors in a C++ project due to some bad design decisions (made by someone else :) ) which lead to circular dependencies between C++ classes in different header files (can happen also in the same file). But fortunately(?) this doesn't happen often enough for me to remember the solution to this problem for the next time it happens again.  So for the purposes of easy recall in the future I am going to post a representative problem and a solution along with it. Better solutions are of-course welcome.     A.h  class B; class A {     int _val;     B *_b; public:      A(int val)         :_val(val)     {     }      void SetB(B *b)     {         _b = b;         _b-&gt;Print(); // COMPILER ERROR: C2027: use of undefined type 'B'     }      void Print()     {         cout&lt;&lt;"Type:A val="&lt;&lt;_val&lt;&lt;endl;     } };       B.h  #include "A.h" class B {     double _val;     A* _a; public:      B(double val)         :_val(val)     {     }      void SetA(A *a)     {         _a = a;         _a-&gt;Print();     }      void Print()     {         cout&lt;&lt;"Type:B val="&lt;&lt;_val&lt;&lt;endl;     } };       main.cpp  #include "B.h" #include &lt;iostream&gt;  int main(int argc, char* argv[]) {     A a(10);     B b(3.14);     a.Print();     a.SetB(&amp;b);     b.Print();     b.SetA(&amp;a);     return 0; } When to use IComparable Vs. IComparer I'm trying to figure out which of these interfaces I need to implement. They both essentially do the same thing. When would I use one over the other?