I was wondering if there is some mathematical approximation for calculating the ratios of factorials. I don't mean a shortcut to deriving the factorial results through a means like Stirling's Formula, but of bypassing the factorial calculations altogether when the final ratio would actually turn out to be a small number. The reason I'm asking is that I occasionally run into manifestations of this problem when teaching myself to convert statistical and data mining equations into T-SQL code, where the highest precision float data types can only go up to about a 135! or so before triggering arithmetic overflows. The final product of these ratios, however, is often much smaller even when very high values are plugged in, and would fit comfortably within the range of the data types I'm using.  For example, 200! is beyond the range of our data types. But if you plug it into the equation N! / (N -1)! it would return 0.0049751243781094527363184079602, which fits easily. What I need is some general-purpose method for reaching the same answer (or something close to it) without using factorials as either the divisor or dividend. Approximations would be acceptable.   I'm also running into a similar issue when nearly infinitesimal decimal points are tacked onto the end of divisors. For example, I found it difficult to code the Hosmer-Lemeshow Test because the final test statistic often involves computations like this: 1 / (1 + some number like 0.1-E50). When the two parts of the divisor are added together, the infinitesimal part is rounded off in almost all computer languages I've heard of. Like the factorial ratios, the final product would fit easily within most high-precision data types, but cannot be reached through the standard equation. Is there a means of approximating these type of equations as well (or even of factoring them by splitting the divisor somehow?).   Thanks for any help in advance. In order to avoid duplicating any existing questions I tried to do some searches across the Internet and in CrossValidated on this issue over the last month or so on both, but may be using the wrong search terms, because I'm coming up empty. I figured CrossValidated would be the right forum, since I'm encountering these issues from time to time with various statistical and data mining algorithms, most recently the Hosmer-Lemeshow Test.
I have a Dirichlet distribution from which I'm maximizing $\alpha$ by calculating the log likelihood with the following equation  $p\left(s|\alpha\right) = \sum\limits_{i=1}^O\log\left(\frac{n_i!}{\prod\limits_{j=1}^kn_{ij}!}\frac{\Gamma\left(\alpha_0\right)}{\Gamma\left(\sum\limits_{j=1}^k\left(n_{ij}+a_j\right)\right)} \prod\limits_{j=1}^k \frac{\Gamma\left(n_{ij}+\alpha_j\right)}{\Gamma\left(\alpha_j\right)}\right)$  I have a python script to calculate the log likelihood. It works for small values, but when $n_{ij}$ gets high $\Gamma\left(\sum\limits_{j=1}^k\left(n_{ij}+a_j\right)\right)$ and $\Gamma\left(n_{ij}+\alpha_j\right)$ python runs into overflow error (the max for math.gamma is between 171 and 172).   Is there a way to change the likelihood function so that $\Gamma\left(\sum\limits_{j=1}^k\left(n_{ij}+a_j\right)\right)$ and $\Gamma\left(n_{ij}+\alpha_j\right)$ don't run into overflow errors. Can I just divide the values in $\Gamma$ by for example 100, if I then compare the likelihood between $p(s|\alpha)$ with different $\alpha$ values do the best $\alpha$ values still have the highest likelihood?
Read Value from URL in PHP How to choose a circle for default stream in Google Plus? How can I choose a specific circle for the default stream in Google+ ? Many extensions don't work, and are not comfortable if using another PC. When I try to print a Unicode string in a Windows console, I get an error . UnicodeEncodeError: 'charmap' codec can't encode character .... I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Python automatically print a ? instead of failing in this situation? Edit:  I'm using Python 2.5.  Note: @LasseV.Karlsen answer with the checkmark is sort of outdated (from 2008). Please use the solutions/answers/suggestions below with care!!  is more relevant as of today (6 Jan 2016). How to look up a symbol or identify a letter from a math alphabet or other character? Is there a way to input particular sections of source code using \lstinputlisting (from the listings package) in a flexible way?  It's possible to use the firstline and lastline options to input particular line ranges, but this isn't robust to changes to the source file.  For example, suppose that the input source file is:  int square(int x) {   return x * x; }  int cube(int x) {   return x * x * x; }   In my LaTeX document, I can include the cube procedure using the command \lstinputlisting[firstline=5,lastline=7]{source.c}.  But suppose I later decide to rewrite the cube procedure.  The input source file becomes:  int square(int x) {   return x * x; }  int cube(int x) {   int x2;   x2 = square(x);   return x * x2; }   Now my LaTeX document will not show the final two lines of cube because the listing uses only lines 5-7.  I could manually update the line range, but this is tedious and error-prone.  Is there a way to mark sections of source code with some kind of label so that the listing will be robust to these sorts of changes?  For instance, perhaps the input source file would be something like  int square(int x) {   return x * x; }  /**\beginlabel{lst:cube} **/ int cube(int x) {   int x2;   x2 = square(x);   return x * x2; } /**\endlabel{lst:cube} **/   so that I could use something like \lstinputlisting[lines=lst:cube]{source.c} to include the section that I want and remain robust to changes.  I am open to using other packages for source code listings (e.g., minted) if helpful. High CPU usage by "System" and "System interrupts" (caused by ACPI.sys) I have a laptop, which was running Windows 8.1 x64 without any problems. Now with Windows 10 x64 installed, Task Manager constantly shows unusual CPU usage by "System" and "System interrupts". To solve this, I already tried the following, without success:   Disabling and uninstalling all non-essential drivers. Installing newer drivers than the ones that were automagically installed (if available). Disabling/enabling fast boot option. Disabling all of the non-essential services. Sysprep. Resetting BIOS to defaults and various combinations of settings. Flashing BIOS to the latest available version. Clean install from the same media that I use for other PCs. Installing all of the updates offered in Windows Update to this day. Windows Performance Recorder / Analyzer.   I'm not very familiar with Windows Performance Analyzer, so I'm hoping someone here can point me in the right direction - what exactly should I look for, to figure out which device/driver is the culprit. Or, if there's any other approach to figuring out this problem?  For the brave souls, here's my  and a screenshot of the problem: Distance between two hyperplanes I have two parallel hyper planes $$a^Tx=b_1,a^Tx=b_2$$ where $a \in \mathbb{R}^n, x \in \mathbb{R}^n ,b \in \mathbb{R}$ and I want to find the distance between the two. I have read that the distance between the two hyperplanes is also the distance between the two points $x_1$ and $x_2$ where the hyperplane intersects the line through the origin and parallel to the normal vector $\vec a$. These points are given by $$x_1=\frac{b_1}{\|a\|^2_2}a$$ and $$x_2=\frac{b_2}{\|a\|^2_2}a$$ Then the distance is $|x_1-x_2|$ but I don't really understand how we got $x_1$ and $x_2$. Installing a strong-tie post anchor on unlevel concrete How to draw arrows between parts of an equation to show the Math Distributive Property (Multiplication)? There is a part of my paper where I use the distributive property and it might not be clear to the reader to see the operation result (I'm using in proposional logic for a proof). The logic equation (part of) is: $$ (l_{1}) \vee \big( (p \vee q) \wedge (\neg p \vee q) \wedge (p \vee \neg q) \wedge (\neg p \vee \neg q)\big) $$ $$ (l_{1} \vee p \vee q) \wedge (l_{1} \vee \neg p \vee q) \wedge (l_{1} \vee p \vee \neg q) \wedge (l_{1} \vee \neg p \vee \neg q) $$  So I was wondering if there is a way to represent this operation like a 'shower' (see another example in pic ). Maybe there is some hidden magic mathmode command or pkg for this. At last we can also rely on tikz. Kernel of a substitution map Can more than one antibody bind the same antigen I'd like to clear something up about antibodies that I'm not sure I've understood in the articles I've read. Looking at concepts such as "affinity maturation", "monovalent antigens" and "polyvalent antigens" it seems as if there are multiple antibodies which can bind to the same antigen. (Although I think I'm right in saying that individual antibodies can only bind to one antigen?) However, when I read sentences like "It has been estimated that humans generate about 10 billion different antibodies, each capable of binding a distinct epitope of an antigen" on the Wikipedia page (for antibody) it does make it sound like it's one antibody per antigen? Is this the case? Or is it one antibody per epitope. Either way, to put this question in a nutshell:  Is it true to say that the same substance could bind with (and, therefore, be recognised by) more than one antibody, or not?  Also, if the answer is no, does that mean that antibodies with different binding affinities are classed as the same antibody or not? Expected number of games played in a game with 'win by two' rule. Calvin and Hobbes play a match consisting of a series of games, where Calvin has probability p of winning each game (independently). They play with a “win by two”” rule: the first player to win two games more than his opponent wins the match. What is the expected number of games played? My attempt: I use Markov chains. Let $S$ denote that starting state, $W$ and $L$ denote the states where Calvin and Hobbes win respectively. Then, I have $$\mu_S = 1+ p\mu_W+q\mu_L $$ $$\mu_W = 1+ q\mu_S $$ $$\mu_L = 1+ p\mu_S $$ where $\mu_j$ denote the expected number of games from state $j$. Solving the system, I get the solution $\mu_S = \frac{2}{1-2pq}$ which I think is correct. I however would like to know how to approach it with geometric distribution instead of Markov chains. I read one solution where the number of games is given as $1+\text{Geom}(p^2+q^2)$ but I do not understand it. My understanding is that for the game to stop, the required probability is $p^2 + q^2$ since this is the probability that either Calvin or Hobbes win two games in a row. How to use this information in a Geometric random variable? Thanks. Where can I get a Thunderbolt hub or splitter? Apple has just announced the new MacBook Airs, Mac mini, and Thunderbolt display. One of the features of the Thunderbolt display that caught my eye was its ability to daisy-chain two displays together from one Thunderbolt port (on a MacBook Pro).  I already have two 24" monitors and I don't feel like paying for two £900 displays. I worked out that all I need is a Thunderbolt hub/splitter so that I can plug the two cables that emerge into mini DisplayPort-to-DVI adapters.  Does anyone know of any Thunderbolt hubs or splitters? Or does anyone know of an alternative method? How to avoid overflow using \IEEEpubid on the first column? I am trying to write a journal paper using the IEEEtran.cls template.  My problem is that the Publication ID Mark overflows into my thanks section.  This is the bottom of the title page:    From the documentation of IEEEtran.cls we see that:    I included the command \IEEEpubidadjcol into the second column. This prevents the overflow in the second column as you can see in my previous image, but lets the first column run freely.  I tried including \IEEEpubidadjcol into the first column aswell, but that causes compilation errors.  Please, could you give me some hint on how to solve this problem without doing something illegal with respect to the IEEE modus operandi?  EDIT:  As the answer suggests, the problem can be solved using the \IEEEpubidadjcol command twice. When I tried this, I got an error:  Infinite glue shrinkage found in box being split   In spite of this error a correct pdf is produced. The error goes away when I do not include packages fixltx2e and dblfloatfix. Can't use String#trim as a callback for Array#map Test if a string contains any of the strings from an array Proving that an additive function $f$ is continuous if it is continuous at a single point Suppose that $f$ is continuous at $x_0$ and $f$ satisfies $f(x)+f(y)=f(x+y)$. Then how can we prove that $f$ is continuous at $x$ for all $x$? I seems to have problem doing anything with it. Thanks in advance. How to show that $\mathbb{Q}$ is not $G_\delta$ I read a section of a book and it made mention of the set of rationals not being a $G_\delta$. However, it gave no proof. I read on  about using contradiction, but it made use of the Baire category theorem, which is unfamiliar to me. I was wondering if anyone could offer me a different proof; perhaps using the fact that the complement of $G_\delta$ is $F_\sigma$.  Thanks. This morning I upgraded my system to Windows 10 2004, the upgrade went smooth and was through Windows Update. I am using Hyper-V as my virtualization program for virtual machines and to provide extra layer of protection to the system through core isolation. After the upgrade, I noticed that a new Virtual Switch was created with the name &quot;vEthernet (Ethernet)&quot; where &quot;Ethernet&quot; within the parentheses is the name of my primary network adapter. Also noticed this behavior has a specific pattern of creating new vSwitches correspond to the adapters you have, e.g. if you created a new Virtual Switch and restarted the system, a new additional switch will appear with the name &quot;vEthernet (your-new-switch-name)&quot;. Tried to remove Hyper-V and reinstall it but no luck. I am aware of a similar  on SuperUser but has no answers on it. Any clues for the root of the problem? Allow rejected editors to be @replied to