I have an array that consists of [A, C+] and I invoke it inside a method called getPoints(). The method's job is to check every element in the array and based on the conditions it should assign a number into another array, but it did not. I've been studying Java for 3 weeks now, so all I know is the basics. public static double[] getPoints(String[] grade) {     double[] points = new double[grade.length];          for (int i =0, j = 0; j &lt; grade.length; i++,j++) {         if (grade[i] == &quot;A+&quot;) {             points[j] = 4.0;}         else if (grade[i] == &quot;A&quot;) {             points[j] = 3.75;}         else if (grade[i] == &quot;B+&quot;) {             points[j] = 3.5;}         else if (grade[i] == &quot;B&quot;) {             points[j] = 3.0;}         else if (grade[i] == &quot;C+&quot;) {             points[j] = 2.5;}         else if (grade[i] == &quot;C&quot;) {             points[j] = 2.0;}         else if (grade[i] == &quot;D+&quot;) {             points[j] = 1.5;}         else             points[j] = 0.0;     }          return points; }
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Inverse of a Positive Definite The cardinality of $\{f\subseteq\mathbb R^2\mid f\colon\mathbb{R\to R}\text{ is a function}\}$ is strictly greater than the cardinality of $\mathbb R$ I have a little question here.  If I have two files, say filea and fileb, mv filea fileb would   delete fileb rename filea to fileb   Then if I have two directories, say dira and dirb, mv dira dirb would   move dira into dirb (it will become dirb/dira)   Noting that in both cases there are no notice or message, then this is pretty inconsistent to me. I think mv dira dirb should just overwrite dirb with the contents of dira (or merge the two directories under a directory named dirb).  I remember reading somewhere that a directory name with a slash (like dira/) is treated like a directory, and name with no slash (like dira) is treated like a file (to certain extents, of course). Anyway now I want to make the shell (zsh and possibly bash) respect my notation of a directory by using a slash. Is there a terminal option which enable me to enforce that?  To clarify, here is my desired behaviour:   mv dira dirb results in dirb being overwritten with the contents of dira mv dira dirb/ results in dira being moved into dirb (in dirb/dira)   Has anyone thought the same way as me? Or am I just weird? What happens when I run the command cat /proc/cpuinfo? What happens when I write cat /proc/cpuinfo. Is that a named pipe (or something else) to the OS which reads the CPU info on the fly and generate that text each time I call it? I have recently noticed a rather large amount of small worms in the fresh cod I am buying. I have tried to take them out as much as I can and of course have spoken to my fish supplier about them, but he assures me they are harmless. However, I don't believe my customers would be as assured. Is it okay to serve this fish, taking into account I might miss a worm or two? Why is $M\frac{dv}{dt} = v_{rel} .\frac{dm}{dt}$ correct and $(M - dm)\frac{dv}{dt} = v_{rel} .\frac{dm}{dt}$ wrong? Newton's 2nd law of motion can't be applied for mass-varying systems. Another force, known as Thrust must come to play. It can be measured using law of conservation of linear momentum. $$\text{Thrust} M.\dfrac{dv}{dt} = v_{rel} .\dfrac{dm}{dt}.$$   where $M$ is the mass of the system;   $\frac{dm}{dt}$ is the rate at which the mass changes;    &amp;    $v_{rel}$ is the relative velocity of the exhausted mass w.r.t to the main system.    This is what my book writes. Now, the left hand side of the eqn. represents force on mass $M$ whereas the right hand side represents the force due to variable mass. How can they be equal? During the application of thrust, $M$ does change and the equation had to be $$ (M - dm). \dfrac{dv}{dt} = v_{rel} .\dfrac{dm}{dt}$$ But that is not the book's equation. Why is mine wrong? What is the intuition? I'm using biblatex for my references.  Normally, if I use \cite{source1, source2, source3}, I get a citation like  [3, 45, 98]   If I now want to give a page number for one of them, it looks confusing imho, as I should get (did not try it out up to now, honestly)   [3, 45, 78, p. 23f, 98]   So imho it would make sense to change one of the separator from a comma to e. g. a semicolon like:  [3; 45; 78, p. 23f; 98]   Question 1: Does that make sense, or are there other conventions for citing sources with and without page numbers together?  (Up to now I collected the citations without page number in one cite command and added singular \cite[][p. xy]{} commands for those with page numbers., so I'd get:   [3, 45, 98][78, p. 23f]   )  the \cites[]{}[]{}[]{} could also do that, but it also uses the same separators for entries and postnotes.  Question 2: How could I change the separator globally for those number-citations from comma to semicolon in biblatex? How can I manage the "Open with Explorer" button based on user permissions? MCMC in a frequentist setting I have been trying to get a sense of the different problems in frequentist settings where MCMC is used. I am familiar that MCMC (or Monte Carlo) is used in fitting GLMMs and in maybe Monte Carlo EM algorithms. Are there more frequentist problems where MCMC is used? In iOS 6 and below I could double tap the home button, tap and hold an app, and  click the red - to close an application(s).  In iOS 7 this does not work. How can I restart an app that's exploding without resetting the entire OS? Which browsers are officially supported by Stack Exchange?  Also, what else is needed in order to use every feature of the site? I want to implement the EM algorithm manually and then compare it to the results of the normalmixEM of mixtools package. Of course, I would be happy if they both lead to the same results. The main reference is Geoffrey McLachlan (2000), .  I have a mixture density of two Gaussians, in general form, the log-likelihood is given by (McLachlan page 48):      $$ \log L_c(\Psi) = \sum_{i=1}^g \sum_{j=1}^n z_{ij}\{\log \pi_i + \log f_i(y_i;\theta_i)\}. $$ The $z_{ij}$ are $1$, if the observation was from the $i$th component density, otherwise $0$. The $f_i$ is the density of the normal distribution. The $\pi$ is the mixture proportion, so $\pi_1$ is the probability, that an observation is from the first Gaussian distribution and $\pi_2$ is the probability, that an observation is from the second Gaussian distribution.   The E step is now, calculation of the conditional expectation:      $$ Q(\Psi;\Psi^{(0)}) = E_{\Psi(0)}\{\log L_c(|\Psi)|y\}. $$ which leads, after a few derivations to the result (page 49):      \begin{align} \tau_i(y_j;\Psi^{(k)}) &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{f(y_j;\Psi^{(k)}}  \\[8pt]                        &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{\sum_{h=1}^g \pi_h^{(k)}f_h(y_j;\theta_h^{(k)})} \end{align} in the case of two Gaussians (page 82):      $$ \tau_i(y_j;\Psi) = \frac{\pi_i \phi(y_j;\mu_i,\Sigma_i)}{\sum_{h=1}^g \pi_h\phi(y_j; \mu_h,\Sigma_h)} $$ The M step is now the maximization of Q (page 49):      $$ Q(\Psi;\Psi^{(k)}) = \sum_{i=1}^g\sum_{j=1}^n\tau_i(y_j;\Psi^{(k)})\{\log \pi_i + \log f_i(y_j;\theta_i)\}. $$ This leads to (in the case of two Gaussians) (page 82):      \begin{align} \mu_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}y_j}{\sum_{j=1}^n \tau_{ij}^{(k)}}  \\[8pt] \Sigma_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}(y_j - \mu_i^{(k+1)})(y_j - \mu_i^{(k+1)})^T}{\sum_{j=1}^n \tau_{ij}^{(k)}} \end{align} and we know that (p. 50)      $$ \pi_i^{(k+1)} = \frac{\sum_{j=1}^n \tau_i(y_j;\Psi^{(k)})}{n}\qquad (i = 1, \ldots, g). $$ We repeat the E, M steps until $L(\Psi^{(k+1)})-L(\Psi^{(k)})$ is small.        I tried to write a R code (data can be found ).    # EM algorithm manually # dat is the data  # initial values pi1       &lt;-  0.5 pi2       &lt;-  0.5 mu1       &lt;- -0.01 mu2       &lt;-  0.01 sigma1    &lt;-  0.01 sigma2    &lt;-  0.02 loglik[1] &lt;-  0 loglik[2] &lt;- sum(pi1*(log(pi1) + log(dnorm(dat,mu1,sigma1)))) +               sum(pi2*(log(pi2) + log(dnorm(dat,mu2,sigma2))))  tau1 &lt;- 0 tau2 &lt;- 0 k    &lt;- 1  # loop while(abs(loglik[k+1]-loglik[k]) &gt;= 0.00001) {    # E step   tau1 &lt;- pi1*dnorm(dat,mean=mu1,sd=sigma1)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))   tau2 &lt;- pi2*dnorm(dat,mean=mu2,sd=sigma2)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))    # M step   pi1 &lt;- sum(tau1)/length(dat)   pi2 &lt;- sum(tau2)/length(dat)    mu1 &lt;- sum(tau1*x)/sum(tau1)   mu2 &lt;- sum(tau2*x)/sum(tau2)    sigma1 &lt;- sum(tau1*(x-mu1)^2)/sum(tau1)   sigma2 &lt;- sum(tau2*(x-mu2)^2)/sum(tau2)    loglik[k] &lt;- sum(tau1*(log(pi1) + log(dnorm(x,mu1,sigma1)))) +                 sum(tau2*(log(pi2) + log(dnorm(x,mu2,sigma2))))   k         &lt;- k+1 }   # compare library(mixtools) gm &lt;- normalmixEM(x, k=2, lambda=c(0.5,0.5), mu=c(-0.01,0.01), sigma=c(0.01,0.02)) gm$lambda gm$mu gm$sigma  gm$loglik   The algorithm is not working, since some observations have the likelihood of zero and the log of this is -Inf. Where is my mistake? Given a set $\{1,2,3,4\}$, how is the following relation $R$ antisymmetric?  $$R = \{(1, 2), (2, 3), (3, 4)\}$$  Note: Antisymmetric is the idea that if $(a,b)$ is in $R$ and $(b,a)$ is in $R$, then $a = b$. In my textbook  it says the above is antisymmetric which isn't the case as whenever $(a,b)$ is in $R$, $(b,a)$ is not. I am buing assamble self PC for playing games.  I am wondering, all the drivers, which are most likely for Windows, can i just use them on Ubuntu?  So if i understand you right, it will automaticaly detect the drivers, no need for installs ? or it find custom drivers for ubuntu.  This is the setup, will there be any problem with it? Difference between standard beta and unstandard beta distributions? What is the difference between standard beta and unstandard beta distributions? How to understand in an article if it is not described if it is standard or not? I have build a website for a finance company.  The Cognito Form is on the website as an application form.  I would like the information sent automatically to the finance company's email address (as soon as the form is submitted) without having to log into Cognito Forms. The finance company needs to know the exact moment the application for finance comes in. The finance company can not possibly log in to Cognito Forms 24/7 to check if there are any finance applications. Style every four posts differently Possible Duplicate:          Is it possible to style every four posts differently? I mean something like this:  &lt;div class="row"&gt; &lt;div&gt;1st post&lt;/div&gt; &lt;div&gt;2nd post&lt;/div&gt; &lt;div&gt;3rd post&lt;/div&gt; &lt;/div&gt; &lt;div class="row&gt; &lt;div&gt;4th post&lt;/div&gt; &lt;/div&gt; ...Repeat   I'm using , so it would be great if I could experiment more with that.. :) I know that there's a difference between relativistic and rest mass. Relativistic mass is "acquired" when an object is moving at speeds comparable to the speed of light. Rest mass is the inherent mass that something has regardless of the speed its moving at.  When fusion happens, a certain percentage of the rest mass of two hydrogen atoms is converted into energy. I understand that $E = m_{rest}c^2$.   How does the rest mass of an object turn into energy? Does this involve particle physics? Doesn't this suggest that rest mass can be viewed as some sort of potential energy? It seems to me that it's a sort of locked energy that has to undergo a certain process to expel its energy to surrounding particles.  Also, Why does only a small percentage of rest mass turn into energy? Why not all of it. What dictates how much rest mass gets converted into energy? What makes the number of neutrons the number of proton similar? Recommended books for advanced undergraduate electrodynamics What books are recommended for an advanced undergraduate course in electrodynamics?