Bridge Between Series and Set Theory
Is the sum of all natural numbers countable?
The Most Efficient Way To Find Top K Frequent Words In A Big Word Sequence Input: A positive integer K and a big text. The text can actually be viewed as word sequence. So we don't have to worry about how to break down it into word sequence. Output: The most frequent K words in the text.  My thinking is like this.    use a Hash table to record all words' frequency while traverse the whole word sequence. In this phase, the key is "word" and the value is "word-frequency". This takes O(n) time.  sort the (word, word-frequency) pair; and the key is "word-frequency". This takes O(n*lg(n)) time with normal sorting algorithm.  After sorting, we just take the first K words. This takes O(K) time.    To summarize, the total time is O(n+nlg(n)+K)， Since K is surely smaller than N, so it is actually O(nlg(n)).  We can improve this. Actually, we just want top K words. Other words' frequency is not concern for us. So, we can use "partial Heap sorting". For step 2) and 3), we don't just do sorting. Instead, we change it to be  2') build a heap of (word, word-frequency) pair with "word-frequency" as key. It takes O(n) time to build a heap;  3') extract top K words from the heap. Each extraction is O(lg(n)). So, total time is O(k*lg(n)).  To summarize, this solution cost time O(n+k*lg(n)).  This is just my thought. I haven't find out way to improve step 1). I Hope some Information Retrieval experts can shed more light on this question. What is the reason that the value "47" is so popular in electrical engineering? We often see component values of 4.7K Ohm, 470uF, or 0.47uH.  For example, digikey has millions of 4.7uF ceramic capacitors, and not a single 4.8uF or 4.6uF and only 1 listed for 4.5uF (specialty product).  What's so special about the value 4.7 that sets so far apart from say 4.6 or 4.8 or even 4.4 since in the 3.. series we usually 3.3,33, etc.  How did these numbers come to be so entrenched?  Perhaps a historical reason? coloring the page numbers in the table of contents Can you decide to counterspell after another counterspell has failed? Why do objects appear smaller when farther away? I'm currently working on a web application which has a page which displays a single chart (a .png image).  On another part of this page there are a set of links which, when clicked, the entire page reloads and looks exactly the same as before except for the chart in the middle of the page.  What I want to do is when a link is clicked on a page just the chart on the page is changed.  This will speed things up tremendously as the page is roughly 100kb large, and don't really want to reload the entire page just to display this.    I've been doing this via JavaScript, which works so far, using the following code  document.getElementById('chart').src = '/charts/10.png';   The problem is that when the user clicks on the link, it may take a couple of seconds before the chart changes.  This makes the user think that their click hasn't done anything, or that the system is slow to respond.  What I want to happen is display a spinner / throbber / status indicator, in place of where the image is while it is loading, so when the user clicks the link they know at least the system has taken their input and is doing something about it.    I've tried a few suggestions, even using a psudo time out to show a spinner, and then flick back to the image.    A good suggestion I've had is to use the following  &lt;img src="/charts/10.png" lowsrc="/spinner.gif"/&gt;   Which would be ideal, except the spinner is significantly smaller than the chart which is being displayed.  Any other ideas? To find:  $$\int \sqrt{1+\sin(x)} dx$$  What I  tried:  I put $\tan(\frac{x}{2}) = t$, using which I got it to:  $$I = 2\int \dfrac{1+t}{(1+t^2)^{\frac{3}{2}}}dt$$  Now I am badly stuck. There seems no way to approach this one. Please give a hint. Also, can we initially to some manipulations on the original integral to make it easy? Thank you. Problem with packages subfiles and import.sty after using TexLive Utility for updating Everything worked fine before using TexLive for updating my packages three days ago. Now it is not possible anymore to use the package subfiles   Here are the MWE  The minimum Preamble.tex file  \documentclass{amsart} \usepackage{subfiles}   The MWE.tex file  \documentclass[MWE.tex]{subfiles} \begin{document} MWE \end{document}   When I compile the MWE file I get on the console  This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded &gt;format=pdflatex)  restricted \write18 enabled. entering extended mode  (./MWE.tex  LaTeX2e &lt;2020-02-02&gt; patch level 5  L3 programming layer &lt;2020-02-25&gt; (/usr/local/texlive/2019/texmf-dist/tex/latex/subfiles/subfiles.cls  Document Class: subfiles 2020/02/14 v16 Multi-file projects (class)  Preamble taken from file `MWE.tex'  (/usr/local/texlive/2019/texmf-dist/tex/latex/tools/verbatim.sty)  (/usr/local/texlive/2019/texmf-dist/tex/latex/import/import.sty)  ! LaTeX Error: File `import.sty' not found.  Type X to quit or &lt;RETURN&gt; to proceed, or enter new name. (Default extension: sty)  Enter file name:   I checked and the import.sty file is in the right directory, and everything worked fine before. Do you have any idea about what happened (apart from the fact that I should not upgrade stuff before the official releases of TexLive I suppose  ...)? Simulate repeated rolls of a 7-sided die with a 6-sided die What is the most efficient way to simulate a 7-sided die with a 6-sided die? I've put some thought into it but I'm not sure I get somewhere specifically.  To create a 7-sided die we can use a rejection technique. 3-bits give uniform 1-8 and we need uniform 1-7 which means that we have to reject 1/8 i.e. 12.5% rejection probability.  To create $n * 7$-sided die rolls we need $\lceil log_2(  7^n ) \rceil$ bits. This means that our rejection probability is $p_r(n)=1-\frac{7^n}{2^{\lceil log_2(  7^n ) \rceil}}$.  It turns out that the rejection probability varies wildly but for $n=26$ we get $p_r(26) = 1 - \frac{7^{26}}{2^{\lceil log_2(7^{26}) \rceil}} = 1-\frac{7^{26}}{2^{73}} \approx 0.6\%$ rejection probability which is quite good. This means that we can generate with good odds 26 7-die rolls out of 73 bits.  Similarly, if we throw a fair die $n$ times we get number from $0...(6^n-1)$ which gives us $\lfloor log_2(6^{n}) \rfloor$ bits by rejecting everything which is above $2^{\lfloor log_2(6^{n}) \rfloor}$. Consequently the rejection probability is $p_r(n)=1-\frac{2^{\lfloor log_2(  6^{n} ) \rfloor}}{6^n}$.  Again this varies wildly but for $n = 53$, we get $p_r(53) = 1-\frac{2^{137}}{6^{53}} \approx 0.2\%$ which is excellent. As a result, we can roll the 6-face die 53 times and get ~137 bits.  This means that we get about $\frac{137}{53} * \frac{26}{73} = 0.9207$ 7-face die rolls out of 6-face die rolls which is close to the optimum $\frac{log 7}{log6} = 0.9208$.  Is there a way to get the optimum? Is there an way to find those $n$ numbers as above that minimize errors? Is there relevant theory I could have a look at?  P.S. Relevant python expressions:  min([ (i, round(1000*(1-(  7**i )  /  (2**ceil(log(7**i,2)))) )/10)  for i in xrange(1,100)], key=lambda x: x[1]) min([ (i, round(1000*(1- ((2**floor(log(6**i,2))) / (  6**i ))   )    )/10)  for i in xrange(1,100)], key=lambda x: x[1])   P.S.2 Thanks to @Erick Wong for helping me get the question right with his great comments.  Related question: Which is the correct tense to use with 'by'? I gave him the money by 6 PM.   I had given him the money by 6 PM.   I can't spot the difference between them and both seem right, but I was told the first one is wrong. Can anyone say, why?  Here is a another set of sentences with the same issue:     By 5 PM I gave him the book.   By 5 PM I had given him the book.   In both the sentences the book was given before 5 PM and no later than 5 PM. But I can't understand then what the difference between them is.   Is it right to use simple past with 'by' at all? If yes, then why and if not, then why is it incorrect to use simple past with 'by'? I have encountered this question while tring to figure out why every sequential space $X$, is a quotient spaces of a metric space. If I understand correctly, given a sequential space, every sequence (including it's limit) can be identified with the space $Y=\{0\} \cup \{\frac1{n+1}|n \in N\}$. So The space $X$ can viewed as a quotient space of $\bigoplus_{(x_n) \in C} \{(x_n) \} \times Y$ where $C$ is the set of all converges sequences in $X$. My question is, How can I show that this space is metrizable?  Thank you! Shir Why do I have to press Ctrl+D twice to close stdin? How to create individual chapter PDFs from included TeXs? My document structure has   one file with preamble (i.e. MainTex) and around 75 individual .tex files (i.e. Chapter_01, Chapter_02, ..., Chapter_75) representing each chapter.   I am using \include command to create a one big PDF file, the output is MainTex.pdf. Life is all good up to this point.   If I have to create individual PDF for each chapter then do I need to run 75 times with each chapter name and rename the PDF manually to match to chapter name. Because if I include only Chapter_01 and run it creates PDF named as MainTex.pdf.  Is there a way I can automate this workflow? I'm fairly excited for Unity, as it looks like a promising new direction for Ubuntu.  However, I do have a concern - will it be possible to use Unity without the global menu?  I have my window manager set to focus-follows-mouse/sloppy focus, and find the productivity gains to be immense. Sloppy focus is incompatible, however, with global menus, as it is possible for the focus to change while you move from window to menu.  Will Unity support an option to use window menus while still using Unity? Is there a way to delete all stack exchange accounts at the same time?  I also want to remove all traces of my posts on the site. Is that possible?   Will I have to delete all of my posts manually?  Can I use the stack exchange API for this? I always thought with "any" I should use the plural, but on the internet I can find both:   It can be found in any book. It can be found in any books Do you have any books? It can be said in any language.  This can be understood by anyone.  It has been used in any form.   So, what's correct?  Is there any rule? I tried installing Office 2007 in Ubuntu with Wine but it was throwing an error after installing and also when I tried to open a PowerPoint document and save it. Has anybody gotten Office 2007 installed without any issues? Please help me. In Euclidean geometry texts, it is always mentioned that point is undefined, it can only be described. Consider the following definition: "A point is a mathematical object with no shape and size." I do not understand what is the problem with this definition. Please give the detailed reasons. Thanks in advance! This is a batch file in Windows.  Here is my .bat file          @echo off copy "C:\Remoting.config-Training" "C:\Remoting.config"  "C:\ThirdParty.exe"   This works fine except the .bat file leaves the command window open the whole time the "ThirdParty" application is running. I need the command window to close.   I would use the short-cut for the application but I must be able to run this copy command first (it actually changes which data base and server to use for the application).    The ThirdParty application does not allow the user to change the source of the db or the application server.    We're doing this to allow users to change from a test environment to the production environment. Intuitive explanation of why $\dim\operatorname{Im} T + \dim\operatorname{Ker} T = \dim V$ I'm having a hard time truly understanding the meaning of $\dim\operatorname{Im} T + \dim\operatorname{Ker} T = \dim V$ where $V$ is the domain of a linear transformation $T:V\to W$. I've used this equation several times in many problems, and I've gone over the proof and I believe that I fully understand it, but I don't understand the intuitive reasoning behind it. I'd appreciate an intuitive explanation of it.  Just to be clear, I do understand the equation itself, I am able to use it, and I know how to prove it; my question is what is the meaning of this equation from a linear algebra perspective.