Let's say I have a bunch of points:    What is the best way to get a certain amount of closest neighbors. For example I wan't the 8 closest points for point no 57.  This without using brute force.  O yeah, if possible, it would be great if it's efficient for moving points as well.
I am trying to make a top down shooter that could potentially have hundreds of objects at once at one point. I need to check collision with projectiles, walls, and enemies. I am currently using ArrayLists which probably won't suffice later on and was wondering if someone had a good method or knows a good method for checking all of those objects at once. This is going to be a game for smartphones and is built in java. Any ideas would be great or if you could point me in some direction that would be fantastic.  Thanks in advance!
What is the relationship between symmetry and degeneracy in quantum mechanics? Let me remind you about the following classical  examples in quantum mechanics.     Example 1. Bound states in 1-dim potential V(x).   Let $V(x)$ be a symmetric potential i.e.   $$V(x) = V(-x)$$   Let us introduce the parity operator $\hat\Pi$ in the following way:   $$\hat\Pi f(x) = f(-x).$$   It is obvious that    $$[\hat H,\hat\Pi] = 0.$$   Therefore, for any eigenfunction of $\hat H$ we have:   $$\hat H|\psi_E(x)\rangle = E|\psi_E(x)\rangle = E\hat\Pi|\psi_E(x)\rangle,$$   i.e. state $\hat\Pi|\psi_E(x)\rangle$ is eigenfunction with the same eigenvalue. Is $E$ a degenerate level? No, because of linear dependence of $|\psi\rangle$ and $\hat\Pi|\psi\rangle.$   Consider the second example.     Example 2. Bound states in 3-dim a potential $V(r)$. Where $V(r)$ possesses central symmetry, i.e. depends only on distance to center.   In that potential we can choose eigenfunction of     angular momentum $\hat L^2$ for basis    $$|l,m\rangle,$$   where $l$ is total angular momentum and $m$ - its projection on chosen axis (usually $z$). Because of isotropy eigenfunction with different $m$ but the same $l$ correspond to one energy level and linearly independent. Therefore, $E_l$ is a degenerate level.      My question is if there is some connection between symmetries and degeneracy of energy levels. Two cases are possible at the first sight:   Existence of symmetry $\Rightarrow$ Existence of degeneracy Existence of degeneracy $\Rightarrow$ Existence of symmetry     It seems like the first case is not always fulfilled as shown in the first example. I think case 1 may be fulfilled if there is continuous symmetry. I think the second case is always true. Setting up PyCharm to reference ArcPy? How would I setup  to recognize import arcpy?   I'd like to use PyCharm to develop and debug geoprocessing tool. Parenthesis vs brackets for matrices When I first learned linear algebra, both the professor and the book used brackets like [ and ] to enclose matrices. However, in my current differential equations textbook, matrices are enclosed by parenthesis, and I suddenly realize everybody else are using them too.  So are brackets/parenthesis for enclosing matrices always totally interchangeable? Is there a way I can see all the versions that are in the archives that I have configured in sources.list. I can see the last version of each archive withapt-get policy, but how can I see them all?  Is there any way that this can also include PPA and anything in sources.list.d? Is there a way to calculate the improper integral $\int_0^\infty \big(\frac{\ln x}{x - 1}\big)^2 dx$?  What have I tried:  $$\int_0^\infty \Big(\frac{\ln x}{x - 1}\Big)^2 dx = \int_0^1 \Big(\frac{\ln x}{x - 1}\Big)^2 dx + \int_1^\infty \Big(\frac{\ln x}{x - 1}\Big)^2 dx = \int_1^\infty \Big(\frac{\ln x}{x - 1}\Big)^2dx + \int_1^\infty\Big(\frac{\ln t}{\big(\frac{1}{t} - 1\big)t}\Big)^2dt = 2\int_1^\infty \Big(\frac{\ln x}{x - 1}\Big)^2dx$$  From the above statement we can conclude, that the integral does indeed converge, as $0 \leq (\frac{\ln x}{x - 1})^2 \leq \frac{C}{(x - 1)^{\frac{3}{2}}}$, for some constant $C$. However, this new form of the integral is not much helpful in finding its exact value.  I also tried substituting $z = \ln x$ , then $dz = \frac{dx}{x}$. Then the integral becomes reduced to $2\int_{0}^{\infty} \frac{z^2}{e^z(e^z - 1)^2}dz$, which, unfortunately, also does not seem to be any easier. Last semester I picked up an algebra course at my university, which unfortunately was scheduled during my exams of my major (I'm a computer science major). So I had to self study the material, however, the self written syllabus was not self study friendly (good syllabus overall though).  The course was split up into 3 parts, group theory, ring theory and field theory. As a computer science major we only had to study the first 2.  Now that I passed the exam for this course I want to study the field theory part ( which covers Galois theory, etc).  So, now I want to ask whether any of you know any good books on abstract algebra, which lift off at basic ring theory and continue to more advanced ring theory and to finite fields, Galois theory, ...  Please keep in mind that I am not a math major, and that I would like books which are suited for self study (thus a lot of examples and intuition).  Thanks in advance! Use variable with TOP in select statement in SQL Server without making it dynamic How do you reset the sa password? Are PDO prepared statements sufficient to prevent SQL injection? Let's say I have code like this:  $dbh = new PDO("blahblah");  $stmt = $dbh-&gt;prepare('SELECT * FROM users where username = :username'); $stmt-&gt;execute( array(':username' =&gt; $_REQUEST['username']) );   The PDO documentation says:     The parameters to prepared statements don't need to be quoted; the driver handles it for you.   Is that truly all I need to do to avoid SQL injections?  Is it really that easy?  You can assume MySQL if it makes a difference.  Also, I'm really only curious about the use of prepared statements against SQL injection.  In this context, I don't care about XSS or other possible vulnerabilities. natbib: combining chicago style and sorting by appearance What's the fastest way to make money online? Everything in the online world is expensive, well the best things are. We all want the luxurious apartment with 10 cars garage and the best weapons but to achieve that, we need money. Which missions or activities give the most cash ? Minecraft Forge 1.7.10 will not start My minecraft will not start on only that version, I have a Windows 7 computer with Java 8u20 installed, because the latest java 7 update will not work at all(plus imma dev for other stuff).   [22:26:39] [main/INFO] [LaunchWrapper]: Loading tweak class name   cpw.mods.fml.common.launcher.FMLTweaker  [22:26:39] [main/INFO] [LaunchWrapper]: Using primary tweak class name   cpw.mods.fml.common.launcher.FMLTweaker  [22:26:39] [main/INFO] [LaunchWrapper]: Calling tweak class   cpw.mods.fml.common.launcher.FMLTweaker  [22:26:40] [main/INFO] [FML]: Forge Mod Loader version 7.10.25.1208 for Minecraft   1.7.10 loading  [22:26:40] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version   1.8.0_20, running on Windows 7:amd64:6.1, installed at C:\Program   Files\Java\jre1.8.0_20  [22:26:40] [main/INFO] [LaunchWrapper]: Loading tweak class name   cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker  [22:26:40] [main/INFO] [LaunchWrapper]: Loading tweak class name   cpw.mods.fml.common.launcher.FMLDeobfTweaker  [22:26:40] [main/INFO] [LaunchWrapper]: Calling tweak class   cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker  [22:26:40] [main/ERROR] [LaunchWrapper]: Unable to launch  java.util.ConcurrentModificationException     at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:1.8.0_20]     at java.util.ArrayList$Itr.remove(Unknown Source) ~[?:1.8.0_20]     at net.minecraft.launchwrapper.Launch.launch(Launch.java:117) [launchwrapper-  1.9.jar:?]     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]  Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and   will likely be removed in a future release How to disable grub menu at boot time in Ubuntu 20.04? Uninstalling Ubuntu from Windows Dual Boot if I don't have Windows recovery CD I installed Ubuntu (I had already had Windows 8.1) from USB (I still have live Ubuntu on it). Is there a way I can uninstall Ubuntu in a way that my Windows will remain bootable? All the tutorials I have seen say that uninstalling ubuntu will delete GRUB also so I will need a Windows recovery CD to boot into it, but I don't have one. Is there a solution? How to install packages to external drive (and run them)? I am running Xenial 16.04 and looking to install packages to an external drive - my computer has a 32gb SSD so it would be very useful to me to be able to use an external drive.  In a quick search I found a framework called  which seems to be designed to package all dependencies for a program (chromium, GIMP, some python packages, etc), but haven't had time to look into it.   seems to be looking for the same solution I am.   Thanks, Chris My machine is currently running Windows 7. I have 2 partitions: OS (C:) and DATA (D:). I intend to do a native Ubuntu 14.04 install. Assuming I format my Windows OS partition, will I have full access to my D partition in Ubuntu ? How to factor polynomials in $\mathbb{Z}_n$? How to factor a certain polynomial over $Zn$.  for example factor the following polynomial into irreducible polynomials in $Z5$:  $X^3+X^2+X-1$  or factor the following polynomial into irreducible polynomials in $Z2$:  $X^4+X+1$   is there a certain method (algorithm) I can follow?  Please help I'm stuck and i really need the help!  thank you in advance!! How to Install Virtualbox on Windows 10 host? Maximizing expected value of coin reveal game I was asked this question today in an interview and am still not sure of the answer. The question is as follows.   Part one:  Say I have flipped 100 coins already and they are hidden to you. Now I reveal these coins one by one and you are to guess if it is heads or tails before I reveal the coin. If you get it correct, you get $\$1$. If you get it incorrect, you get $\$0$. I will allow you to ask me one yes or no question about the sequence for free. What will it be to maximize your profit?  My approach for this part of the problem was to ask if there were more heads than tails. If they say yes, I will just guess all heads otherwise I just guess all tails. I know the expected value for this should be greater than 50 but is it possible to calculate the exact value for this? If so, how would you do it?   Part two: Same scenario as before but now I will charge for a question. I will allow you to ask me any amount of yes or no questions as I go through this process for $\$1$. What is your strategy to maximize your profit?  I was not sure about the answer to this part of the question. Would the best option be to guess randomly? I think the expected value of this should be 50. I am not sure about the expected value of part one but if it is greater than 51, I think I could also use that approach. Anyone have a good idea for this part? Calling Table with custom iterator