I have a parent list of length n % 5 = 0 and want to create a list of lists for each 5 elements in the parent list. Ex: parent_list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] new_list = [[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15]]  I know this shouldn't be that hard but searching through past posts I can only find how to create a list of combinations for the parent directory, not a list of n-length lists from the parent list.
I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:
Determinant of a block lower triangular matrix I'm trying to prove the following: Let $A$ be a  $k\times k$ matrix, let $D$ have size $n\times n$, and $C$ have size $n\times k$. Then,  $$\det\left(\begin{array}{cc} A&amp;0\\ C&amp;D \end{array}\right) = \det(A)\det(D).$$  Can I just say that $AD - 0C = AD$, and I'm done? Is it true that the light from some galaxies will never reach us?   The explanation for that is that the Universe expanding faster than the speed of light. But, if the speed of light is constant in all reference frames, then in the reference frame of a galaxy, light must move at the speed of light and thus it must reach us (?).   Could you also explain  how is it possible that the Universe is expanding faster than the speed of light if an object can never be observed to move faster than light? (without Doppler effects). Unable to post - login problems with Area 51 ... again I recently signed up for Area 51 with my stackexchange network account/ID, verified the account and logged in.  I see the main page  where I confirm that I am logged in.  I click on the discuss link on the black menubar at the top, which takes me to the discussion zone. From here I click on ask question, which asks me to add  a login even though I have already logged in with my stackexchange ID.  Here if I choose the stackexchange login option then it takes me back to the main page, from where the cycle begins again. Is there a way to use the covariance matrix to find coefficients for multiple regression? For simple linear regression, the regression coefficient is calculable directly from the variance-covariance matrix $C$, by  $$ C_{d, e}\over C_{e,e} $$ where $d$ is the dependent variable's index, and $e$ is the explanatory variable's index.  If one only has the covariance matrix, is it possible to calculate the coefficients for a model with multiple explanatory variables?   ETA: For two explanatory variables, it appears that $$\beta_1 = \frac{Cov(y,x_1)var(x_2) - Cov(y,x_2)Cov(x_1,x_2)}{var(x_1)var(x_2) - Cov(x_1,x_2)^2} $$ and analogously for $\beta_2$. I'm not immediately seeing how to extend this to three or more variables. Novel about interstellar war: Both sides win, both sides think they lost What is the value of $\sum\limits_{i=1}^\infty\frac{1}{p_{p_i}}$ where $p_{i}$ is the $i$th prime? What is the value of $\sum\limits_{i=1}^\infty\dfrac{1}{p_{p_i}}$ where $p_n$ is the nth prime (and so $p_{p_n}$ is the $k$th prime, where $k$ is the $n$th prime) ?  Thus $\frac{1}{3}+\frac{1}{5}+\frac{1}{11}+...=$ ??  How do I efficiently decide if $\sum_{i=1}^\infty\dfrac{1}{p_{p_i}}\gt1$ is true without using a computer ?  I assume this infinite sum is an irrational number. Has this already been proven ? How to find correctly the .bib file? I am using ArcMap 10.2 and want to represent a layer in a rotated dataframe with chart (graph) symbology. The problem is that the charts do not rotate with the dataframe:     I thought I could convert to graphics and rotate each chart individually, but   that is very tedious I don't find an option to convert a layer to graphics, works for the legend but not for the actual layer symbology fastest way to detect if a value is in a group of values in Javascript I have a group of strings in Javascript and I need to write a function that detects if another specific string belongs to this group or not.  What is the fastest way to achieve this? Is it alright to put the group of values into an array, and then write a function that searches through the array?  I think if I keep the values sorted and do a binary search, it should work fast enough. Or is there some other smart way of doing this, which can work faster? Diagonal straight lines in residuals vs fitted values plot for multiple regression I am observing strange patterns in residuals for my data:   [EDIT] Here are the partial regression plots for the two variables:      [EDIT2] Added the PP Plot   The distribution  seems to be doing fine (see below) but I have no clue where this straight line might be coming from. Any ideas?   [UPDATE 31.07]  It turns out you were absolutely right, I had cases where the retweet count was indeed 0 and these ~ 15 cases resulted in those strange residual patterns.   The residuals look much better now:   I've also included the partial regressions with a loess line. How to install Ubuntu on a Mac and keep OSX? Could anyone provide a concise step by step instruction on how to install Ubuntu 12.04 on a Mac OS X Lion?  I have read that Ubuntu corrupts the EFI file so I would like to hear from those who have successfully done it. Fibonacci combinatorial identity: $F_{2n} = {n \choose 0} F_0 + {n\choose 1} F_1 + ... {n\choose n} F_n$ Can someone explain how to prove the following identity involving Fibonacci sequence  $F_n$  $F_{2n} = {n \choose 0} F_0 + {n\choose 1} F_1 + ... {n\choose n} F_n$ ? Evaluating $\lim\limits_{n\to\infty}(a_1^n+\dots+a_k^n)^{1\over n}$ where $a_1 \ge \cdots\ge a_k \ge 0$ Need to find $\lim\limits_{n\to\infty}(a_1^n+\dots+a_k^n)^{1\over n}$ Where $a_1\ge\dots\ge a_k\ge 0$  I thought about Cauchy Theorem on limit $\lim\limits_{n\to\infty}\dfrac{a_1+\dots+a_n}{n}=\lim a_n$ and something like what happen if all $a_i=0$ or $a_1=\dots=a_k$, but may be something I am thinking wrong?  Maybe it is too simple but I am not getting it; please help. Identify a book with a social engineering theme I originally read this book in the mid- to late '70s.   The premise was a bureaucracy whose job it was to manipulate events in human history by making the smallest possible change that would effect the desired outcome. Not time cops in the sense of going after law breakers.  The intent was to maintain a policy of non-interference as much as possible but when interference was warranted then to make the least possible change and to do so invisibly.  For example, they might take someone's keys off the dresser and put them just out of sight underneath the dresser where they plausibly might have fallen.  The subject would never know of the manipulation but would then be delayed getting out of the house and the ripples grew from there to avert a war or otherwise affect events on a large scale.  After reading that, whenever I would lose something - especially in an improbable way such as dropping a screw at my feet and then finding it on the other side of the room half an hour later - I would take some consolation in the thought that I had just averted some global catastrophe.  I was pretty scatterbrained as a kid (we call that ADHD nowadays) so I experienced this a lot.  Given that I've spent so much time pondering the ideas from the book, I'd love to re-read it. How should I refer to a friend who is a girl but not a girlfriend? When I'm talking about my friend, who is a girl, but not a girlfriend, what word or phrase should I use? If the gender was unimportant, it would not be a problem. But if I want to note that the friend is female, not male, how should I say that, to avoid ambiguity? Is there any preference given based on how far in advance of the deadline a graduate application is submitted? How would I setup  to recognize import arcpy?   I'd like to use PyCharm to develop and debug geoprocessing tool. True Ubuntu on Chromebook ARM I have installed Ubuntu 13.04 on my desktop (runs like a charm). Then I used Crouton to install Ubuntu 12. 04 on my chromebook samsung (ARM). It also works quite well.  Here comes my question. Can we have a true Ubuntu (preferably 13.04) on my ARM chromebook?  It seems that the Crouton/Ubuntu is not 100% the real thing.  The best option would be to have the full Ubuntu 13.04 and remove the Chrome OS. List of ways to tell if degree sequence is impossible for a simple graph I'm trying to make a list of ways to tell if a given degree sequence is impossible. For example $3,1,1$  is not possible because there are only 3 vertices in total so one can't have degree 3.  The list so far   vertices has degree equal to or larger than number of vertices sum of degrees is odd for n vertices if one has degree n-1 and another has degree 0 for n vertices the sum of the degrees cannot be greater than $n(n-1)$ because this would be have more edges than a complete graph Short story from many years ago: the ancient, brilliant, cruel race was Earthlings