Representing an algebraic cycle by differential forms

Question: Let $E_1$ and $E_2$ be isomorphic elliptic curves.
Then the Neron-Sever group of $S:=E_1 \times E_2$ is generated by 3 elements: $E_1$, $E_2$ and the diagonal.
I want to see this in de Rham cohomology (after tensoring by $\mathbb{C}$).
Let $dz_1$ and $dz_2$ be the generator of $H^{1,0}$ of $E_1$ and $E_2$ respectively.
Then forms like
$$
dz_1 \wedge d\bar{z_1}, \ dz_2 \wedge d\bar{z_2}, \ dz_1\wedge dz_2…
$$
span a basis of $H^2(S,\mathbb{C}) \cong \mathbb{C}^6$.
We see that $dz_1 \wedge d\bar{z_1}$ and $dz_2 \wedge d\bar{z_2}$ represents (certain multiple of) the classes $E_1$ and $E_2$ respectively.
What about the diagonal?
By considering intersection, we know that them which corresponds to the diagonal contains
$$
dz_1 \wedge d\bar{z_1}+dz_2 \wedge d\bar{z_2},
$$
but I don't know the coefficients of the other terms like $dz_1\wedge dz_2$ and $dz_1\wedge d\bar{z_2}$.
Comment: If E has complex multiplication, there is a 4th class- the graph of the complex multiplication.
Answer: Actually, the sign stuff is much more confusing than I thought, and my scalars were off too, so I've completely rewritten my answer to explain this a little better.
The natural Poincaré pairing is defined by
\begin{align*}
(-,-) : H^*(E,\mathbb R) \otimes H^*(E,\mathbb R) &\to \mathbb R\\
\alpha \otimes \beta &\mapsto \int_E \alpha \wedge \beta.
\end{align*}
The pairing is understood to be $0$ if $\alpha \wedge \beta$ is a $k$-form for $k \neq \dim_\mathbb R E = 2$. It can be extended to either a bilinear form or a sesquilinear form
$$H^*(E,\mathbb C) \otimes H^*(E,\mathbb C) \to \mathbb C.$$
This is where the confusion starts. Note for example that the sesquilinear form is not Hermitian, because the bilinear form we started with is not symmetric (rather, it's graded symmetric). Thus, it seems more natural to me to pick the bilinear extension:
\begin{align*}
(-,-) : H^*(E,\mathbb C) \otimes H^*(E,\mathbb C) &\to \mathbb C\\
\alpha \otimes \beta &\mapsto \int_E \alpha \wedge \beta.
\end{align*}
Given a basis $x_i$ of $H^*(E)$, we will call a right dual basis $x_i^*$ a basis such that
$$(x_i,x_j^*) = \delta_{ij}.$$
We could also work with left dual bases, which differs only up to a suitable sign from this notion. Recall also that the Künneth isomorphism is given by
\begin{align*}
H^*(E) \otimes H^*(E) &\stackrel\sim\longrightarrow H^*(E \times E)\\
\alpha \otimes \beta &\longmapsto \alpha \times \beta := \pi_1^* \alpha \wedge \pi_2^* \beta.
\end{align*}
Now if $z$ denotes the coordinate on the universal cover $\mathbb C \twoheadrightarrow E$, then $dz$ is a basis for $H^{1,0}(E)$. Moreover, after possibly rescaling, we get
$$\int_E dz \wedge d\bar z = -2i \int_E dx \wedge dy = -2i.$$
In particular, the right dual basis of $(1, dz, d\bar z, dz \wedge d\bar z)$ is $-\tfrac{1}{2i}(dz \wedge d\bar z, d\bar z, -dz, 1)$. Now, it follows from Poincaré duality and the graded-commutativity of the cohomology ring that
$$[\Delta] = \sum_i (-1)^{\deg{x_i}} x_i \times x_i^*,$$
where the $x_i$ are a homogeneous basis for $H^*(E)$, with right dual basis $x_i^*$. See for example Bott–Tu, Lemma 11.22, or Milnor–Stasheff, Theorem 11.11. Thus, in our case, we find
\begin{align*}
[\Delta] &= -\tfrac{1}{2i} \left( 1 \times (dz \wedge d\bar z) - dz \times d\bar z + d\bar z \times dz + (dz \wedge d\bar z) \times 1\right)\\
&= -\tfrac{1}{2i} \left( dz_2 \wedge d\bar z_2 - dz_1 \wedge d\bar z_2 + d\bar z_1 \wedge dz_2 + dz_1 \wedge d\bar z_1 \right).
\end{align*}
Note the factor $-\frac{1}{2i}$ on the front; this is even necessary to make sure we get a real class! (Compare the class we wrote down with its complex conjugate.)
Remark. More generally, it should be possible to describe the class of a middle-dimensional subvariety in $E \times E$ in terms of its action on $H^i(E) \to H^i(E)$ defined by Künneth and Poincaré duality. You can start by reading the proof for $\Delta$, and then see how it generalises.


Why is the time complexity of merge sort with a $\Theta(n^2)$ merge function $\Theta(n^2)$?

Question: The original problem I was solving was what would the time complexity of a merge sort algorithm be, if it used a merge algorithm with complexity $\Theta(n^2)$ instead of $\Theta(n)$. The solution says the time complexity will be $\Theta(n^2)$, but I don't understand why it's not $\Theta(n^2\log n)$? I tried using a recurrence tree, and since it looks similar to the one for a linear merge method, just with $T(n)=2T(n/2)+\Theta(n^2)$ instead of $T(n)=2T(n/2)+n$. So why does it not give a similar solution? I understand that the master theorem can be used to prove this, but I don't understand why the approach used when finding a runtime for merge sort with linear merge doesn't work here.
Answer: Because the work done is
$$ T(n) = 2T(n/2) + n^2 \leq
\sum_{i=0}^{\log_2 n} 2^i \left(\frac{n}{2^i}\right)^2 =
n^2 \sum_{i=0}^{\log_2 n} \frac{2^i}{2^{2i}} = O(n^2).
$$
Try for yourself to see what happens when you remove the factor squared in the summation.
Answer: In the recursion tree, the cost of the top level (i.e. level 0) is $n^2$. There are two nodes in level $1$, each having a cost of $(n/2)^2$; hence, the total cost of level $1$ is $n^2/2$.  In level $2$, there are $4$ nodes, each with a cost of $(n/4)^2$; hence, the total cost of level $2$ is $n^2/4$.  Thus, each level has a cost $n^2$ times a coefficient, but these coefficients decrease geometrically, i.e. the coefficients are $1, 1/2, 1/4, 1/8$, etc.  Hence, the total cost of all levels is $n^2 (1+1/2 + 1/4 + \cdots) \le 2n^2$, and hence the total cost is $\Theta(n^2)$.
Thus, even though the formula for the total cost has on the order of $\log n$ terms and each term is of the form $n^2$ times a coefficient, the sum of these coefficients is bounded from above by a constant. Recall that constants are subsumed in asymptotic notation.
More generally, when the common ratio $r$ is less than $1$, we have that $1+r+r^2 + \cdots + r^{\log_2 n} = \Theta(1)$, i.e. the first term $1$ dominates the sum.  This is why, in this case of the Master theorem, the total cost $n^2 (1+r+r^2+\cdots+r^{\log_2 n})$ is dominated by the first term; equivalently, the total cost of all levels of the recursion tree is dominated by the top level.
Answer: Assume $n=16$.
Standard MergeSort involves the cost $16+2\cdot8+4\cdot4+8\cdot2$. If we divide by $n$, $1+1+1+1$.
"Quadratic" MergeSort involves $256+2\cdot64+4\cdot16+8\cdot4$. If we divide by $n^2$, $1+\dfrac12+\dfrac14+\dfrac18$.
Do you see the patterns ?


How to create instances of all subclasses

Question: I have over 250 subclasses that need instances made of them, and I can't sit there and coy and paste new Class(); 250 times. Is there anyway using Reflection to make an instnace of the classes? No constructor is needed when making the instance.
Thanks.
Comment: We need more info than this. Where should these instances be created for example? Some code would be helpful.
Comment: @Keppil There are no instances, I need to create them. I would need to create them at startup of my program.
Comment: I assume you know names of those classes and have a full list of them and number of instances of each you want create?
Comment: I need this to be dynamic, make a file extend a Superclass and when the program starts, make an instance of the class, no code added.
Comment: If you have a package-qualified class name, you can get an instance using Class.forName(qualifiedName).newInstance(). If you're able to parse/obtain a list of the class names then you're most of the way there. Hard to say without knowing how the instances will be used. Edit: didn't realize they're all subclasses.  Brain's answer looks like it should work.
Comment: There is no way using reflection to get all instances of a class or interface.
Answer: I really don't undesrtand you, but I try to guess (not tested):
public class Test {
    public static void main(String[] args) {
        Class[] classes = new Class[]{Class1.class, Class2.class, Class3.class};
        for (Class cls : classes) {
            Object myObject = cls.newInstance();
            -------^^^^^^^^-------
        }
    }
}

Look at Creating New Class Instances
EDIT:
May be
http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#forName(java.lang.String)
Class.forName("mypackage.MyClassname");

Comment: I know that much, but I need to do all that, without having the class name. I need to loop for all of the clases, and check if its superclass is another class (Class.getSuperclass()), and instance it.
Answer: First, you'll need to get all the subclasses. That particular answer seems legitimate, though I haven't tested it myself.
Then iterate through the classes and create the instances using either Class.newInstance (no-args constructors) or Class.getConstructor and Constructor.newInstance when there are parameters for the constructor that you have to pass. The final code will look something like this:
Reflections reflections = new Reflections("my.project.prefix");
Set<Class<? extends SomeType>> subTypes =
        reflections.getSubTypesOf(SomeType.class);
Set<SomeType> someTypes = new HashSet<SomeType>(subTypes.size());
for (Class<? extends SubType> subType : subTypes) {
    someTypes.add(subType.newInstance());
}
// Do something with someTypes here

This will get the subclasses, iterate over them, and create an instance of each one. There are some exceptions here that I'm not doing anything with. You may also have to do some casting (though I don't think you have to).
Edit: My answer above will apparently cause some spurious class loading. Create your set of subclasses like this instead:
Reflections reflections = new Reflections(...); //see in other use cases
Set<String> subTypeFqns = reflections.getStore().getSubTypesOf(SomeClass.class.getName());
Set<Class<?>> subTypes = new HashSet<Class<?>>();
for (String fqn : subTypeFqns) {
    subTypes.add(Class.forName(fqn));
}

Then these lines:
for (Class<? extends SubType> subType : subTypes) {
    someTypes.add(subType.newInstance());
}

Become this:
for (Class<?> subType : subTypes) {
    someTypes.add((SomeType) subType.newInstance());
}

Comment: Note that this will get sub-subclasses as well, so you can filter them as you iterate by using `subType.getSuperclass().equals(SomeType.class)`, in case you didn't want them.
Answer: You can do as follows:
Class instantiableClass = Class.forName("package.subpackage.ClassName");
Object instance = instantableClass.newInstance();

Only works if your classes have only a default constructor, or public zero args constructor. The code may be looped, generalized or reproduced if you need.
For more general solution this may help you understand why it is not possible. You can do whatever you want with any classes you know, or know their name, or can access their name from any source, or be provided with such minimum information in any way.
But without any knowledge of that classes, it is hardly possible. You would have to seek for all classes in current classpath and then chceck their inheritance tree for compliance with your particular class.
Answer: That's a chunk of code to load all the classes of a package, to create new instances for it and to put them in an hashmap (all my classes inherits from Commande):
    this.actions = new HashMap<String, Commande>();

    ServletContext sc = this.getServletContext();

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    URL res = classLoader.getResource(COMMAND_DIRECTORY);
    File[] list = new File(res.getFile()).listFiles();
    String className = "";
    for (File f : list) {
        className = f.getName().replaceAll(".class$", "");
        try {
            Class<?> classe = Class.forName("org.commandes." + className);
            if (classe.getSuperclass() == Commande.class) {
                Commande c = (Commande) classe.newInstance();
                this.actions.put(c.getName(), c);
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

Here, COMMAND_DIRECTORY is org/commandes for me.
I don't know if this is the right way to do it, but it's the only way i found to implement the Command design pattern (plugin-like implemented) in a servlet.


All Reviewers Assigned : Nature Communications revised manuscript: What does it means?

Question: I have a revised manuscript which I submitted to Nature Communications. The status of the manuscript says 'Reviewers Assigned' for about 24 days. What does it mean? Is it under review by the reviewers? Or reviewers are not responding to the editor after the request to review the revised manuscript by the editor? Just want to clarify, that this question is specific to the editorial process of 'Nature Communications' which is not usual and not related to generalized peer review process. I think I am asking this question especially because Nature Journals have their own editorial workflow which is not as same a typical workflow of many journals.
Comment: Another update: I got an update from the editor finally after email her asking what it really means. The manuscript was under review when it was showing 'all reviewers assigned' and when the status changed to 'under consideration' it means that reviews are back with her and she is discussing it with her collegues.
Comment: Update on the question. After being under the status 'All reviewers assigned', the manuscript status changed back to 'Manuscript Under consideration'.
This is more confusing as generally, 'Manuscript Under consideration' means that the editor is considering the manuscript for peer review. Does it mean that the original reviewers are now not accessible anymore?
Answer: It means reviewers have been invited, but you can't read anything more than that. Whether or not reviewers have accepted the invitation is usually confidential information available only to journal staff. Depending on the range of statuses the journal uses, this status might even mean that some reviews have been received.
In any case, there's nothing to do except wait and see.
Answer: It can mean many things, if the status has been same since you resubmitted your manuscript then editor might still be waiting for all the reviewers to send the editors their review reports, in some cases when one reviewer is too much busy and needs more time to finalize his review report, editors waits for him to send his comments then they contact the author and make a decision on the basis of these reports and send you acceptance, rejection or revision based on their reports.
Also if one reviewers has recommended for rejection and one or two reviewers has endorsed the publication then editor weighs the comments of all the reviewers and then make the final decision.


Calculate NDVI with converted canon sx260 hs

Question: I have converted my canon sx260 hs so it can capture NIR part of specter. Can anyone tell me how can i calculate NDVI now? My guess is that on the blue channel is now NIR value and Green channel=(TRUE_GREEN + NIR) And Red channel =(TRUE_RED + NIR) So NDVI would be: NDVI= (NIR-TRUE_RED)/(NIR+TRUE_RED)
 Am i on the right tracks?
 Any hints?
Comment: Can you describe which method you used to convert your camera? This is rather important when answering your question.
Comment: Yes. The filter you are using maps NIR to red, green to green and blue to blue. Thus, NDVI is not possible, but BNDVI is pretty straight forward.
Comment: You can calculate how it should look in theory by taking values from the ASTER spectral library - http://speclib.jpl.nasa.gov/ - for example http://speclib.jpl.nasa.gov/speclibdata/jhu.becknic.soil.inceptisol.xerumbrept.coarse.87P325.spectrum.txt is a decent soil while http://speclib.jpl.nasa.gov/speclibdata/jhu.becknic.vegetation.trees.deciduous.solid.decidou.spectrum.txt represents a good decidous forest sample. As per the formula, your values with range from -1 to 1, with vegetation having a high value and soils near 0. The exact values will obviously depend on the camera settings.
Comment: I used this NGB filter:
http://www.dronecenter.com.br/produto.php?cod_produto=8284990
 It seems that formula is BNDVI=(NIR-BLUE) / (NIR+BLUE)
Comment: Can you tell me what are range values for BNDVI(e.g. vegetation, soil...)
Is there some resource that you know for this index?
Answer: If you converted a Canon camera to pseudo-NIR by removing the NIR filter in front of the sensor, then you will end up with a blue/green/nir sensor (vegetation appears white). Indeed, all channels will be affected with extra intensity from the NIR depending on their sensitivity to this wavelength, with effect on RED >> BLUE > GREEN.  Red sensors are the most affected and the amount of NIR light is larger than visible light, so you don't have true red anymore. In this case you cannot compute NDVI because you are missing te Red and blue or green are not correlated with red to provide a substitute.
It is technically possible to create a Green/Red/NIR camera (vegetation appears red), but far more difficult (and I don't know how to do it). With such a camera, NDVI can be computed with your equation. Alternatively, you could try using two cameras (one with and one without IR cut filter) that you could register then compute your NDVI.


Do Engle-Granger residuals need to be normally distributed?

Question: Do EngleGranger residuals need to be normally distributed?
Comment: Does the Engle-Granger paper say anything about this? Have you checked it? (It will probably stay a rhetorical question before the OP gets enough points to comment.)
Answer: The Engle and Granger test for cointegration is basically an ADF test in the estimated error of the long run equation, say $\hat{u}$. The ADF test is looking for stationarity of this process (or trend-stationary). It does not require normality, as there are many non-normal processes which are stationary (see here or here).
For instance, this paper compares the power of different unit root tests (including ADF) for a whole range of distribution of the variable in question. Distributions include normal and non-normal like Chi-squared, Beta, and Laplace (double exponential in their terminology). Their interest is to propose more powerful unit root tests, but an aside conclusion is that, even under non-normality, the ADF test performs "well" (their proposed tests perform better though).
Having this in mind, the next question is: does the error in a cointegrated, long run equation has to be normal? This is akin to the question of whether errors in a regression have to be normal. There are tons of related posts in CV about this. The short answer seems to be: hopefully yes, but might not be. Examples here, here, here, and more generally, here.
(Richard Hardy's summary of this normality issue in the comments is certainly more precise on this than my summary. Basically, if you have a small sample, you want normality, so that standard tests have the theoretical distribution the should have (so, tests are valid). If you have a large sample, the Central Limit theorem will do that job for you.)
Comment: The problem is that ADF is not a *general* test for *any type* of stationarity, and therefore it may or may not have specific assumptions beyond what is required for stationarity in general -- just to stress the logic of the argument. Now we know that ADF test does not require normality -- but it is *not because* stationarity does not require normality, but rather because such is the construction/design of the ADF test.
Comment: Three points: (1) minor quibble: *predicted error*? I would say *residual (=estimated error)*; (2) the existence of nonnormal yet stationary processes cannot by itself imply anything about the assumptions of the ADF test, so the first paragraph suggests a misleading connection; (3) the short answer is, normality of errors is required only for the validity of small sample $t$ and $F$ tests (while consistency, asymptotic normality, Gauss-Markov theorem does not rely on normality).
Comment: Thanks. Added the comments you mention. Let me know if I was right in (3). Feel free to edit if not.
Comment: That's better, although the first paragraph is unchanged and still suggests a relation between the assumptions of ADF test and general requirements for stationary processes.
Comment: Mmm, what I am saying is that ADF tests for stationarity and that normality is not necessary, as there are many stationary but non-normal processes. The point of the new second paragraph was to show an example that indeed the ADF test remains valid even with non-normal but stationary processes, confirming the first paragraph claim.
Comment: I see. There can be tests for stationarity which require normality, and others that do not. I was assuming that all of them do not, even if we know that the ADF does not.
Comment: Came here accidentally and noticed again that the argument *It does not require normality, as there are many non-normal processes which are stationary* is not logically sound as pointed out above...


tomcat - WEB-INF/classes vs WEB-INF/lib

Question: I'm porting an application over to tomcat, and I suspect the following classloading may be an issue...
If I have a class in WEB-INF/classes that requires a class that is in WEB-INF/lib, they can not find it.
If I have a class in WEB-INF/classes and copy that class over to WEB-INF/classes directly, no issues, works fine.
If I take an example class and move it to WEB-INF/lib, where it depends on another WEB-INF/lib, no issues, works fine.
Is there a classloader trick/visibility thing around getting certain WEB-INF/lib's 'loaded' appropriately to be visible to WEB-INF/classes?
tomcat6 (possibly tomcat7 if someone has answer there), oracle jdk6.
Additional information:  The is moving from an EAR (jboss) to a WAR (tomcat).  The particular libraries that are the symptom of the issues used to be in the EAR as a jarModule, not part of WEB-INF/lib.  Moving them to WEB-INF/lib does not seem to be working.
The original .class file(s) that can not see (classnotfoundexception) items in the /lib/*.jar's are also configured with load-on-startup of 1
Comment: RESOLVED: stupid packaging problem, was excluding certain classes & jars included in WAR (related to prior EAR assembly in the maven war plugin configuration).  No user could have found this, question was unanswerable otherwise.
Answer: in lib folder you have to place your jars files, not compiled class, all your compiled code is placed in classes folder
Comment: the code was that was tested was archived into a .jar before being put into the WEB-INF/lib location, thanks though.

tomcat - WEB-INF/classes vs WEB-INF/lib


Exponential of unbounded self adjoint operator

Question: If $A$ is an unbounded, self-adjoint operator on a separable Hilbert space with spectral family $E_t$, then $\exp(iA)$, defined by functional calculus with function $f(t)=exp(it)$, is an unitary operator. My question is, what about the spectral family of $exp(iA)$? Is again the unbounded $E_t$? Must not be a bounded one? How to calculate it?
Comment: I guess $E_t = 1_{(-\infty,t]}(A)$? Are you familiar with the spectral measure induced by a spectral family, $E(B)=1_B(A)$ for any Borel set $B\subseteq \mathbb{C}$?
Comment: Yes $E_t=E (]-\infty,t])$. I familiar with spectral measure
Answer: For a closed, densely defined, normal operator $T$ in a Hilbert space $\mathcal{H}$, denote by $E^T(B)=1_B(T)$ the spectral measure induced by $T$, and if $B\subseteq \mathbb{C}$ is a Borel set and $x\in\mathcal{H}$, let $E^T_x(B):=\langle x, E^T(B) x\rangle$. Recall that $E^T$ is uniquely determined by the family of complex measures $(E^T_x)_{x\in\mathcal{H}}$. Now, if $f:\mathbb{C}\rightarrow \mathbb{C}$ is any measurable function, then
$$
E_x^{f(T)}(B) = \langle x,1_B(f(T))x\rangle = \langle x,1_{f^{-1}(B)}(T)x\rangle =  E_x^T(f^{-1}(B)).
$$
It follows that $E^{f(T)}(B)=E^T(f^{-1}(B))$.
If $A$ is self-adjoint and $U=e^{iA}$, then the spectral measure of $U$ is supported in the unit circle $S\subseteq \mathbb{C}$, and is explicitly given by the formula $E^U(B)=E^A(f^{-1}(B))$, with $f(t)=e^{it}$.
Comment: So if $T=A=\int_RtdE_t$ is self adjoint and $U=e^{iA}=\int_Re^{it}dE_t$, then if B is a Borel subset of the circle T, $E^U(B)=E^A(-i\ln(B))$ and $U=\int_T\lambda dE_{-i\ln\lambda}$ ?
Comment: With a appropriate definition of the logarithm, $E^U(B)=E^A(-i\ln(B)))$, and $U=\int_S \lambda \, dE^U(\lambda) = \int_{\mathbb{R}} e^{i\lambda} \, dE^A_\lambda$
Comment: Ok, many thanks


Gaussian noise model derivation

Question: I have the following linear regression model, $y = f(x;w) + n$, where $y$ is the vector of true labels, $x$ is the observed data, $f(x;w) = w^Tx$, and $n$ ~ $N(0, \sigma^2)$ is the noise.  Why then does $p(y|x;w) = N(w^Tx;\sigma^2)$ (taken from page 12 of these notes: http://cs229.stanford.edu/notes/cs229-notes1.pdf)?  Could someone please derive this for me?
Comment: Are you aware that adding a constant $\mu$ to a Normal$(0,\sigma^2)$ variable gives a Normal$(\mu,\sigma^2)$ variable?
Comment: Why is this true?
Comment: For many people, it's the *definition.* One first defines a Normal$(0,1)$ variable (its probability density at any number $x$ is proportional to $\exp(-x^2/2)$) [and then defines](http://en.wikipedia.org/wiki/Normal_distribution#General_normal_distribution) a Normal$(\mu,\sigma^2)$ variable to be a Normal$(0,1)$ variable that has been multiplied by $\sigma$ and had $\mu$ added to it. Evidently that is not your definition, so what is your definition?
Answer: I think whuber boils the questions down to its essentials with

adding a constant $μ$ to a Normal$(0,σ^2)$ variable gives a Normal$(μ,σ^2)$ variable

So how do we know this is true? How we show that depends on what you're prepared to start with. To talk about the normal at all we must begin with some kind of definition, so it depends on what you define the general normal to be. (As whuber points out, Wikipedia defines $N(\mu,\sigma^2)$ as a scaled, shifted standard normal, from which the pdf can be derived).
We can go the other way; we could begin with say a $N(0,\sigma^2)$ (your $n$ variable) and investigate the effect of adding $\mu$ to it. Here's the density of $n$:
$$\frac{1}{\sigma\sqrt{2\pi}}\, e^{-\frac{n^2}{2 \sigma^2}}$$
Let $Y=n+\mu$.
Now, how do we work out the density of the transformed (shifted) random variable? Again, it depends on what you're prepared to assume. It can be done from first principles ($F_Y(y)=P(Y\leq y)=P(n+\mu\leq y)=P(n\leq y-\mu)=F_n(y-\mu)$ and then differentiate $F_Y(y)$ to obtain the density $f_Y(y)$).
Or we could use the transformation result $f_Y(y) = f_X(g^{-1}(y))|\frac{d}{dy}g^{-1}(y)|$
So $n=Y-\mu$, hence $g=y-\mu$ and $dy = dn$
Hence $f_Y(y)=f_n(y-\mu).|1|$
$$=\frac{1}{\sigma\sqrt{2\pi}}\, e^{-\frac{(y-\mu)^2}{2 \sigma^2}}$$
which is a $N(\mu,\sigma^2)$
Comment: +1 I would like to suggest that a simpler and fully general way to show the effect of an affine transformation would be to contemplate the CDF rather than the PDF: when $Y=\sigma X+\mu$ (with $\sigma\gt 0$), then $F_Y(x)={\Pr}(Y\le x)={\Pr}(X\le (x-\mu)/\sigma)$, whence each "$x$" in the PDF (if it exists) must be replaced by "$(x-\mu)/\sigma$" and the $dx$ (which is implicitly in the PDF) must be replaced by $d((x-\mu)/\sigma)=dx/\sigma$. This doesn't really even require any knowledge of Calculus, but only of how to obtain slopes of lines.
Comment: Why is $N(w^Tx, \sigma^2)$ then set equal to $p(y|x;w)$?  It seems just as reasonable to let $p(y,x;w) = N(w^Tx, \sigma^2)$.
Comment: @whuber indeed so; via CDFs in essentially the way you did it is the way I prefer to look at it. I guessed that since the fact wasn't immediately obvious to the OP, that such an explanation might carry less impact than the pdf version that essentially derives from it.
Comment: @eric throughout the calculation, we're conditioning on $x$. The idea is to model the conditional expectation (we don't necessarily know the *distribution* of $x$, only the values we have -- it may not even be a random variable; it might be experimentally controlled, for example).
Answer: To complement what whuber said in  the comments. You can do some simple manipulations to derive the distribution of $y^{(i)}$. In the regression equation:
$$y^{(i)} = \theta^T x^{(i)} + \epsilon^{(i)}$$
We isolate $\epsilon^{(i)} $ and than replace it in the density formula:
$$p(\epsilon^{(i)}) = \frac{1}{\sqrt{2\pi\sigma}}exp{\left(-\frac{(\epsilon^{(i)})^2}{2\sigma^2} \right)} $$
$$p(y^{(i)} - \theta^T x^{(i)}) = \frac{1}{\sqrt{2\pi\sigma}}exp{\left(-\frac{(y^{(i)} - \theta^T x^{(i)})^2}{2\sigma^2} \right)} $$
Then we rewrite the probability term in a more convenient way, considering $\theta$ as a fixed parameter and $x^{(i)}$ as a given variable. So
$$p(y^{(i)}| x^{(i)}; \theta) = \frac{1}{\sqrt{2\pi\sigma}}exp{\left(-\frac{(y^{(i)} - \theta^T x^{(i)})^2}{2\sigma^2} \right)} $$
Comment: +1 yours posted when I was almost finished composing mine. I guess mine shows some details the OP might seek, so I'll leave it there for now.
Comment: Furthermore, you're not picking randomly a $(x, y)$ pair and measuring its probability. You're choosing instead a $x$ and then measuring the probability of the response variable $y$ taking a particular value.
Comment: In your final equation, why is it correct to assume that $x^{(i)}$ is fixed?  It seems more appropriate to define $p(y^{(i)}, x^{(i)};\theta) = N(\theta^Tx, \sigma^2)$.
Comment: In order to write $y^{(i)} = \theta^T x^{(i)} + \epsilon^{(i)}$ you assumed that $x$ was your predictor variable (called the "input" variable in the notes), thus by definition it is a given variable, you know its value.

Gaussian noise model derivation


Wick rotation and the arrow of time

Question: It is well known that we can switch from a statistical system to a quantum mechanical system by a Wick rotation. Has this rotation some implication on the way the time flow? namely, this is an accident or has a deep meaning?
Comment: You don't always get a statistical system, it is not an accident, but it doesn't have anything to do with the "arrow of time", that's just thermodynamics.
Answer: In perturbation theory, the Wick rotated Euclidian Green functions are exactly the time ordered vacuum expectations. The reason behind that is that the Wick rotation in the complex plane is only possible given the analyticity properties of the causal Green functions. The situation in nonperturbative situations is more subtle, because not always the action functional becomes negative after the Wick rotation, please see the following article by t'Hooft.
Comment: Bar Mosche  What does it means from the physical point of view?

Wick rotation and the arrow of time


Can an electron have a spin opposite to the hole?

Question: Consider the simplest case - a gapped system where the electron in the valence band is excited to the conduction band. In this process, is the spin conserved? Or to word it differently, can the excited electron have a different orientation of spin compared to the hole?
Answer: Spin-orbit coupling
Solids are composed of atoms, where orbital and spin momentum are coupled via spin-orbit coupling. While in some cases this interaction can be neglected or considered as a higher-order correction, strictly speaking it should be taken into account when calculating band structure, and  may have significant impact. Thus, the electrons in conduction band are not in pure spin states.
Still, as an approximation one often uses the band structure without spin-orbit interaction, including the latter via empirical terms, whose coupling constants either follow from more precise band calculations or estimated experimentally. These coupling constants typically turn out to be much bigger than what one could expect by simply including the spin_orbit term isnpired by Dirac equation into the effective mass Hamiltonian. Specifically, one often speaks of Elliot-Yafet interaction (bulk SO coupling), Dresselhaus or Dyakonov-Perel interaction (in lattice-asymmetric materials), and Rashba interaction (in non-symmetric semiconductor nanostructures).
Spin of holes
If we think of a hole as a vacancy left by an electron, excited to the conduction band, this description has to compensate both for electron spin and the orbital momentum that the electron ahd before being excited. The orbital momentum traces back to the atomic orbitals forming the corresponding valence band. In typical semiconductors one has three valence bands, and the corresponding holes are assigned different total spin and its projection on the quantization axis; $(1/2, \pm 1/2)$, $(3/2, \pm 1/2)$, $(3/2,\pm 3/2)$ (see Kittel's book, but also the comments to this answer). This nomenclature is extremely important when discussing the selection rules for optical absorption.
Many-particle effects
It also has to be kept in mind that neither electrons in the conduction band, nor the holes in the valence band are single-particle excitations, but excitations of a many-body system with strong Coulomb coupling. While the Coulomb coupling commutes with spin operator and conserves the oevrall spin, one has to add spin-spin interaction, particularly between electrons and holes (simplest inclusion of it is done via Bir-Aronov-Pikus Hamiltonian). The situation becomes even more complicated when considering composite particles, such as excitons, whose spin is badly defined (although this fact is often missed when one adopts approximate Hydrogen-like description, see Knox's Theory of excitons for a deep discussion.).
Comment: Vadim, thanks for the great answer. So if I understand correctly, in theory, the spin can be different between these quasiparticle excitations (one being the hole and the other being the electron that was excited)?
Comment: Firstly, it depends on how they are generated - if it is via excitation by electric field across the band, or via photon absorption, or via some kind of other process. Secondly, after excitation their spins may change independently via spin-orbit coupling or scattering by other electrons/holes.
Comment: That makes sense. Thank you.
Answer: Yes, the Spin of the electron will be the same (as it is essentially the same electron of the same shell).
[
Moreover, the spin of the electron will not matter at all, as the other electron of different atom 'lives' in splited subshell (different).
So, Auf Bau'S principle will not be violated
]


How do I get my child to stop picking his nose?

Question: My son picks his nose and, yes, eats it. How can I get this to stop?
Answer: You have 3 options.

Explain to him, why he shouldn't do it. Try to keep it at a low level, but make him understand that it's like everybody is picking his nose.
You could simply say he's not allowed, with a consequence if he's caught doing it.
You could try to encourage him to stop, and let him get a price, if he doesn't pick his nose for several weeks. That should be enough to has his habit broken.

It's hard to say which of the 3 is most effective, it depends a lot on you and your son. At his age, I would myself go for the last one. Encouraging a behavior can be quite effective, and it wont be something you'll have to fight over if he's caught doing it.
Comment: could you please explain why he shouldn't do it?
Comment: How about all three ..
Answer: Work slowly towards getting him to not pick his nose or eat his pickings.
Try telling him that he may pick his nose as much as he wants, but it must be ONLY at home. Then ONLY at home and and he must throw his pickings in the garbage. Then, ONLY at home when there are no guests. Then, work towards restricting the rooms - e.g. ONLY bathroom and his bedroom.
If he picks his nose a lot and only at home is too strict to begin with, try something only at home and in the car. Add things like he must dispose his pickings in the tissue.
Just work slowly towards getting rid of the habit.
Answer: If the picking is specifically related to the nostrils feeling dry + itchy, I would recommend trying to apply Aquaphor or other moisturizer.
It will both help the condition and make the idea of picking less appealing (getting sticky ointment on the picker's finger).
This simple emphasis has helped break cycles of picking -> nosebleed -> scabbing -> re-picking with my son.
Answer: It is indeed socially unacceptable to do that in public. I would just tell him that it feels really good to pick your nose and that he should enjoy it, but that it should be done out of sight
Comment: Yes and thus enhances his and his peers immune system. The germs are also spread by sneezing
Comment: Since you editing the question makes my response nonsensical I will delete. My point was that the health issue is not a good argument. I believe that you should always try to be as honest as possible
Comment: Germs are spread by dirty hands touching the face. If he has a cold, picks his nose, and then opens the fridge door, his cold germs are being spread.
Comment: @nGinius as with sneezing (and using the toilet) the key to reducing the spread of germs is washing hands
Comment: The medical debate is for another forum. Thanks for your feedback!
Answer: Easy technical solution:

Make "the picker" wear these: https://www.rhinix.com/

Ask me later about effects on the long run, when he stops wearing them ;)
Answer: What worked with my daughter...
1) In no uncertain terms, I was very disgusted by the eating. Repeatedly and consistently. Nothing about the person, but the act itself.
2) Every chance I get, I offer her a nose picking to eat. Ask her why she won't eat everyone's nose pickings. If that seems gross then keep offering until that decision sticks and gets applied to her own pickings.
I'm not sure what I would have done if she accepted other's pickings.


randomize NSArray

Question: I need to randomize an NSArray that I have loaded with quiz questions, but I need to keep the elements in a specific order.
Answer: NSArray is an immutable object, meaning you can't change the order of elements. I think i get what you are getting at though.  Just write some functionality overtop of your datastructure to choose elements of this array at random.  You will need to keep track of what elements have been accessed already so you don't re-select them.
You could also make a copy of your array using the subtype NSMutableArray.  Once a question has been selected, remove it from this array (you can do this because the array is now mutable)
You use a C function for random numbers.  See rand() and srand()
Comment: I suggest arc4random() instead of rand() and srand() for Objective-C
Answer: If I understand the question correctly: you have an array of questions, you want to show a subset (of a presumably fixed size?) of them, but the subset needs to preserve the order as in the original array?
Let's say you have N questions and want to randomly pick M of them.  You could create an array of elements [0 .. (N - 1)] that stores indices to the original array.  You then could shuffle this array using the Knuth/Fisher-Yate's algorithm, sort the first M elements, and use those first M indices to do lookups into the original array.

randomize NSArray


Present continuous

Question: Why is it incorrect to say 'we are have a meeting today?' It follows the rules of the present continuous subject + aux verb to be + verb + ing. So why is it incorrect?
Comment: In this sentence, "a meeting" is a noun, not a verb. The verb that needs the "ing" is "have."
Answer: It actually doesn't quite follow the rules of the present continuous.  The -ing should follow the verb, which is "to have" not "meeting".  In this case, "meeting" is a noun and a direct object.
It should be "we are having a meeting today".

Present continuous


Automatic parsing of citation text in academic references

Question: Is there any software (or pseudo-code) which can automatically scan a piece of text (either pasted into the tool, or read from a .doc/.pdf) and identify citation data using standard formats?  The data would then be split up into its constituent fields and exported in XML, CSV, or some other structured data format.  I have looked at cb2Bib but it was only able to extract the year from Harvard-style references, which is insufficient.
Comment: Do you want to scan the text itself or just the references section?
Comment: Just the references - it'd likely be a document containing personal publications.
Comment: I'm not sure if this what you might need but you can try this https://www.refhive.com
Answer: Take a look at this list of Citation Parsers that can generate XML from input text:
http://paracite.eprints.org
http://aye.comp.nus.edu.sg/parsCit (in maintenance mode as of Aug 1, 2012)
http://opcit.eprints.org
http://search.cpan.org/~mjewell/Biblio-Citation-Parser-1.10
Comment: Another option is https://github.com/inspirehep/refextract. It's not based on ML but it worked very well on my tests.
Answer: At the moment (2017) the most active Open-Source project implementing this seem to be Anystyle Parser (last version 07-2016). It can be used through a web-interface, API, or downloaded as a RubyGem.
They explicitly mention on their website that the implementation is inspired by ParsCit (last version 2013?) and FreeCite (last commit 2009).
Also form their website:

AnyStyle Parser uses powerful machine learning heuristics based on
  Conditional Random Fields that can be trained by everyone using our
  built-in editor.

That is a realy cool feature, that makes this the most interesting implementation (imho). Training seems to be pretty straightforward, as explained in the API documentation. You just provide some manually corrected results, and and run the Anystyle.parser.train command. I am not sure if ParsCit and FreeCite also support this, but if they don't, this seems like a huge feature-difference to me.
Comment: @Brandon: I have posted a HOWTO here: https://github.com/inukshuk/wapiti-ruby/issues/3
Comment: That looks great, thanks! As someone who has never touched ruby, it will be very helpful indeed.
Comment: With the exception of Anystyle Parser they're all mentioned in the currently highest voted answer. What actually makes them stand out? What would be advantages or disadvantages given the original question?
Comment: Ah, indeed. I'll edit and improve my answer. Thx for pointing that out.
Comment: Looks like it's dead now.
Comment: @expert : It's resting :) I've been mailing with the developer, while trying to get the source to compile on Windows (works now). He's planning to give it a remake in 2018 to add new functionality, like full-text parsing of papers.
Comment: @Wouter did he ever make clear how to get it compiled on windows? Very interested in this as well.
Answer: Try a tool such as Regex Buddy or Expresso.
If you're not a programmer Regular Expressions may be a bit intimidating, but they're really not that hard, especially with a decent tool like one of the above.
Here's an example of someone using Regular Expressions for extracting citations:
Citation parsing regular expression
Answer: Mendeley should be able to do this. It can import PDFs and then export the metadata to BibTeX, RIS and EndNote XML. It is free to download and is cross-platform.
Edit: I tested this on a few documents. The PDF import does seem to work well for references that are formatted correctly. For a document I created using LaTeX, all of the references with the author in the form "Smith, J." or "J. Smith", etc., were imported fine. If the author is a company (a single word), or the reference is incomplete, it does not work as well. The extracted references can easily be edited and exported to BibTeX, etc.
Comment: "This feature was removed in Mendeley 0.9.7 because it was consuming a fair amount of resources (client and server side) without providing enough value. We plan to re-introduce it in an improved form in future." ......  http://feedback.mendeley.com/forums/4941-mendeley-feedback/suggestions/834313-version-0-9-7-does-not-extract-references-from-the
Answer: I've seen a Westlaw program do that for legal citations, but that's probably not what you're looking for.  Reference Manager might do something like that for academic formats, but I've never used it.
Answer: Try
http://www.crossref.org/guestquery/#stqsearch
This one is capable of automatic parsing your reference text and offers a link to an on-line article.
Answer: Zotero is a plugin for firefox which does this for web content. Not sure if there is a similar tool for documents/pdfs
Comment: I know that this isn't exactly what Zotero is designed to do, but if you pointed Firefox to a text file or html file with the relevant data, Zotero might recognize the references and then you could add it to the Zotero library and export the whole library into whatever format you like (I know Zotero supports a bunch of formats). This would be painful for a large number of files though.
Comment: I don't see how Zotero does what the OP asks. I've installed it, but there seems to be no option to parse a reference.
Comment: Zotero parses citations from specially-coded websites, not from regular text.
Answer: This probably belongs more as a comment to @Abhinav, but zotero definitely only handles structured data, as you would find described here:
http://www.zotero.org/support/getting_stuff_into_your_library#importing_records_from_other_reference_tools
An interesting hack might be to try to write a program that uses each citation as a search query in your favorite database, then uses something like zotero to generate the ref information. You could also download structured information from services like citeUlike. Let me know if you end up doings something like that! (put it up on github if you do ;).


Is a planter light a bad idea?

Question: My wife and I were looking for a light for the kitchen and came across this:

Seems like a bad idea to me:

Seems like watering the plant would be hazard
The heat from the light would kill the plant

Am I right, or is there a way to make this work?
Comment: Are you sure that's not an artificial plant up there? Although fake plants tend not to like being cooked any more than real ones do...
Comment: Heat from a lamp is not really an issue these days, as high heat light sources are slowly becoming obsolete. Your first point is still highly valid, though.
Comment: It could be a low voltage bulb or LED.
Comment: If it's UL listed, the hazard can be assumed to be minimal (if it's not artificial.) If not, then that's one good reason to avoid it... This sort of thing can be engineered around, but I'd first guess it's an unlisted import and may lack any such engineering/design effort.
Comment: You have lights in swimming pools come on don't get hung up on the easy stuff. Find out what the light source voltage & wattage are before even getting concerned.
Answer: Well I took some time to try and find this fixture to see if it was listed and the voltage used and light source.
"Beautiful halo" appears to be at best a horrible company at worst a total scam company. So I would not do any mail order from them 620 reviews 565, 1 Star reviews and only 24, 5 star reviews.
Could this be done with a live growing plant? Yes this could be easily done with low voltage that is finger safe.  Voltages (you can touch the exposed conductors and not get shocked)  or line voltage with GFCI protection built in.
Today LED lamps could be in both options low voltage or GFCI protected. with only 6-9 watts of power consumed a fixture of that size may not feel much more than warm if that.
Wavelength of light 4500-7000K light spectrum would be good for vines or leaf growth. mix in some 2000-3000k LED's and that would help with flowering so it is feasible it could be done safely and even get a listing.
As I mentioned swimming pools have wet niche light fixtures  and they are safe when properly installed plant light Fixture should be easy.
I would make sure it has a UL listing if being used in the US.
Not all stuff is safe or listed on the internet some just junk but if you purchase it at a brick and mortar store in the US you are usually safe as they can get in trouble for selling non listed equipment.
Comment: I was just as surprised as you when searching for them seeing so many negative reviews.
Comment: Note that while it's possible to do this safely via low voltage wiring or GFCI protection, that doesn't mean that the fixture actually used either of those methods.
Comment: Seriously? How'd they manage to screw up *reviews*?  Most cheap Cheese junk has a horde of 5-star reviews since [they go to extreme extremes](https://imm.com/blog/what-you-need-to-know-about-brushing-and-fake-reviews) to fake them, and a few 1-star reviews from real people who actually bought the product.
Answer: It's conceivable to have such a thing, but I would rely on two design keystones to do it:

Low voltage, isolated power supply, so there's only 12V in the light. That's harmless.
LED emitters to eliminate the heat problem you are concerned with.

Regardless, Ed Beal has identified that light as complete junk. You must be very, very careful when shopping for electrical things online.  In fact, here's a word for that: Don't.  The problem is that certain Asian countries are flooding our markets with absolute junk, and not even bothering to lowball the price anymore - if a real Leviton gadget costs $23, they will brazenly ask $21 when they used to ask $3.  People believe that $3 connotes "fake" and $21 connotes quality. It's the same exact piece o'junk.   Because of this flooding, any source - particularly Amazon - is completely unreliable.  Consider only bricks-and-mortar firms such as Home Depot, or their in-house websites/curbside/home delivery, or better yet, proper family-owned lighting suppliers in your own town.
Everything you buy should have an NRTL mark such as UL, CSA, or ETL.
In particular the CE mark is the mark of fake trash; it's the "one they go for" when faking a safety mark, since enforcement is completely toothless. It only has meaning for a manufacturer and retailer inside the EU. CCC is also rubbish.  FCC and RoHS have nothing to do with safety.

Is a planter light a bad idea?


How to enable the vertical lines in atom?

Question: The screenshot on the Atom.io site shows, that the editor has vertical lines which show how much a line is "tabbed" in. I wonder if this is an additional package or if it can be enabled in atom by default.
Comment: what color theme is that? looks nice
Answer: Open up your settings panel, usually by selecting the Preferences option in the Edit menu. Inside there, select the Editor submenu. In the Invisibles section, select the option titled Show Indent Guide. The vertical line indentation markers will then appear for you like in the image.
Comment: On the Mac, it's not the `Edit` menu, but the `Atom` menu where you find the preferences.
Comment: Atom 1.60.0 on MacOS: Shift + Cmd + P for the command palette -> Editor: Toggle Indent Guide
Answer: On atom version 1.40.1 (Windows), Goto File -> Settings -> <>Editor -> []Show Indent Guide
Answer: It's a little different in Windows version v1.40.1
Settings > Editor > Show Indent Guide
Answer: First, type ctrl-shift-p, open the Command Palette.
Then enter 'indent guide'. Select Editor:Toggle Indent Guide.
Answer: If you additionally want to customize the soft wrap vertical line…
Settings and Preferences → Editor → Preferred Line Length (or via customization file).
Answer:

Result
Please note the guideline now displayed.


Is it possible for a GPT model to run in a distributed way?

Question: Say that we're on GPT20 - maybe the model that's resulted from training is 10PB large (maybe unlikely but this is an example). Is it possible for a GPT model to be distributed across machines? How does this work if distributed inference is needed?
Answer: ChatGPT is already a model of Large neural networks based on a distributed computing platform. ChatGPT was built in collaboration with Microsoft. The model is trained using Azure supercomputing infrastructure with Nvidia GPUs. ChatGPT's hardware comprises over 285,000 CPU cores, 10,000 GPUs, and network connectivity of 400 GBs per second per GPU server. Information taken from here and here


Why are all the Watchers in Buffy English?

Question: In Buffy the Vampire Slayer, was there ever any reason given for all of the Watchers being English?  Or does the show just make them such because the accent is cool?
Comment: Two words: Hugh Grant. It was the nineties man. Mistakes were made.
Comment: Because none of the viewers would understand another language
Answer: The Watchers' Council of Britain originally began as the Shadow Men (creators of the Slayer) in ancient Africa.  As far as I know, no canon stories have detailed the history of how they came to settle in Britain.
Being based in Britain, it makes sense that the majority of Watchers would also be British.  This is especially true in modern times, as we see that there is even a nepotism aspect with Watcher families like the Giles and Wyndam-Pryces.
Not all Watchers are British (although most that we see are).  For example, Merrick, Buffy's first Watcher was American (both in the non-canon film and the TV series).  Robson is played by an American actor (I can't recall if he used a British accent in the show or not).  Kendra's Watcher, Sam Zabuto, may not have been British (his name hints at his being Jamaican like Kendra), but we don't see him on screen or in the comics.
Andrew Wells, an American, appears in two episodes of Angel season five and is being trained as a Watcher.  In Season Eight of Buffy:

 Andrew is seen leading a group of Slayers in Italy, and later doing more Watcher work in Scotland.  Xander is also working with the Watchers, although he doesn't want to be called one, and Robin Wood, also American, is a Watcher as well.
Comment: I can't remember the source for this, but I seem to recall reading somewhere that the British Council was established during the colonization of Africa, when the descendants of the Shadow Men came to the attention of (or maybe were killed by?) the occupying forces, and so the British created a group to continue their work in their own "civilized," stuffy way.  If I find the source for that, I'll add it.
Comment: @Nerrolken: chances are we ruined it through colonisation. It's kind of our thing.
Answer: It's possible that as history's largest and most populous empire, Britain was the logical location for the Council to base itself - secure and stable, global in reach and tended by a culture that also developed institutions like the British Museum, Oxford University and the Royal Society. My theory is, the Shadow Men 'evolved' from their African origins and entered ancient civilization via Egypt, transferring to Greek control after the conquest of Macedon, then to Rome after Julius Caesar conquers Egypt. After the fall of Rome, the Council tracked the movement of power and wealth to Western Europe, perhaps via Germanic/Saxon or Norman migration, and eventually settled in England. In the season seven episode Never Leave Me, a Watcher named Phillip mentions - among other locations - Council bases in Munich and Rome. It's possible these may be former headquarters from earlier stages in the Council's history.
Comment: Seems reasonable, but do you have any canon support for your theory? It is always important to add supporting evidence to your answer, quotations, stills, interviews that sort of thing. 'Reckons' are perfectly fine, it's just unfortunately this isn't really the place for them
Comment: This sounds like pure guesswork and supposition.#


Face authentication system using Convolution Neural Network (CNN)

Question: I'm working on developing an face authentication system using Convolution Neural Network (CNN). I know that the CNN can be used to classify two classes. However, my problem is how can I train the CNN as the training set in the face authentication system should be only for the clients users?. In other words, how can I train my CNN using only one type of data?
My dataset consists of 106 persons, each one has 50 images.
Is there any idea on how can I divided my dataset to be suitable for the face authentication system?
your help in this regard is highly appreciated.
Comment: To clarify: is your goal simply to distinguish clients from one another? Or is it to also make sure that it rejects non-clients? In either case, it sounds like you'd be better off with getting a pre-trained face recognition system, e.g: https://github.com/serengil/deepface

primarily because you have very little data, and will not be able to easily generalize if new clients are added, let alone reject non-clients, because you don't have any negatives outside your client images.
Comment: A very similar problem is discussed in https://youtu.be/AwQHqWyHRpU?t=1673. They mention https://www.tensorflow.org/addons/tutorials/losses_triplet.
Answer: One possible and simple approach in your case is the one-shot recognition. The idea is to use the pre-trained library that extracts the feature vector from the face images. So, you compile a DB with the unique vectors for each of your client faces. These vectors are in Euclidian space, meaning that you can simply calculate the distance between the images, and determine whether they are close enough to call it a match.
I used an old library called FaceNet, look it up in Interweb. The steps were in my case:

find the face on image, and cut it out
remove the background and possibly hair
create 3d model of the face and turn it en face
use FaceNet to extract Euclidian vector representing a face

Once you have the vectors, you put them in DB of recognized faces. The above procedure would be executed every time a picture is received. There is dedicated software for each of the steps above, or you can compile your own using the open source libraries
I wouldn't do this kind of DIY approach if there's any kind of liability involved. For instance, if you're building a security authorization to a prison. Reliable face recognition is a serious project. I'd buy commercial hardware/software systems for it.
Answer: Assuming your face authentication system is supposed to only detect users from the client database and reject those who aren't, the best way to train the model would be to use few images of all clients in the database and then test the model on the remaining images of those clients. For example,
Number of users = 106
Number of images per user = 50
Total amount of available data = 106 x 50 = 5300 images
Training Data: 35 images of all users => 35 x 106 = 3710 images
Testing Data: 15 images of all users => 15 x 106 = 1590 images
You could go ahead and also use a validation set and cross validation to better train your model.
Answer: You could try a siamese network approach.
The way to do that is to build a network that receives two faces and processes them in parallel, then concatenating/summing activations to obtain a single probability.
Instead of classifying faces as belonging to each person (106 classes), you reduce your problem to solely two classes: matching persons or mismatched persons.
Then, with new faces you can test them against the training data (ideally, you could store activations from training data, greatly accelerating the processing of new data).


Two masses in deep space - collide or orbit?

Question: If two identical masses are somehow "released" into deep space (that is, they're subject to no other gravitation forces but their own, and are initially at rest to each other). What decides whether they collide or orbit each other? I'm imagining for example two 1 kg masses initially at rest, say 10 m apart. What happens next?
Comment: "they are initially at rest wrt one another". They collide; I'm surprised all the answers are making such a big deal of this.
Comment: @all: Is it possible to study motion without a reference frame? The above up voted comment is wrong: If they gravitate the common barycenter they stay *always* "at rest wrt one another", as I try to show in my own answer. IMO the selected and most upvoted answer is not correct.
Comment: What John said. If there's no other acting forces, and no initial motion, they collide. You can simulate this on any number of orbit simulators. Try making the prograde motion as small as possible.

https://academo.org/demos/orbit-simulator/
Answer: Due to the law of conservation of angular momentum they will only orbit if there is angular momentum in the initial conditions.  If they start at rest, there is none and so they will collide.
Since we're supposed to provide links and whatnot, here's the wikipedia entry.
http://en.wikipedia.org/wiki/Orbit
Part of the difficulty in answering this question, however, is that there are many different kinds of orbits and the details of the trajectories depends on the relevant masses and linear and angular momentums.
Comment: Also note that orbital period depends on eccentricity...0.54 years is for a circular orbit with a constant separation of 10 m.
Comment: Thanks. There's an orbital period calculator at the end of the Wikipedia article. When I inputted the figures for my example (two 1kg masses, 10m apart, assuming of course they are in orbit) it gave a period of 0.54 years! For some reason I thought they'd be buzzing round each other.
Comment: @Peter: Gravity is the weakest of the forces by a long, long way. We only notice it at all because it's always attractive and there is so *much* mass in the universe.
Comment: "Part of the difficulty in answering this question, however, is that there are many different kinds of orbits" - different kinds of orbits or just different eccentricities?  The only relevant kind of orbit should be elliptical, although the 2 objects hit, not orbit.  If they don't hit or subsequently orbit after the hit then an elliptic orbit is the only possibility.
Answer: with no forces perpendicular to the vector connecting them, they will just collide on this line, at a distance proportional to the ratio of their masses.
The only way to avoid this situation is start with a different tangential velocity.
Comment: a different way to see this is that the angular momentum in the initial state vanishes, so they cannot orbit
Comment: That's not the only way to avoid collision.  They could have zero tangential velocity, but sufficient radial velocity to escape to infinite distance.
Answer: the collision of objects depends on the mass of each and its velocity vector relative to each other.
Answer: Assume: no visible stars, CMB, you on Earth and the Sun. You have a watch that is calibrated by the solar day. To simplify lets assume that the N-S direction of the rotation is normal to the plane of a circular orbit, if it is the case.
With a Foucault pendulum and assuming that exist invisible distant stars to avoid a Machian problem interpretation, you can say:
The Earth is rotating (irt the universe, and obtain the sidereal day (first you will have to find a correct latitude- North or South pole that minimize it).  If this one is equal to the solar day then the Earth is not orbiting the Sun and a collision will happen.
If you have a a microwave antenna you can detect the CMB photons and if you are rotating then you will detect the sidereal day and if you are orbiting the Sun you will detect the direction into which the Earth is moving (the CMB dipole direction makes a 360º full sky turn in each sidereal day modulated by one turn in each solar year).
In the above experiments the referential in use is the absolute space.
At each noon you can measure the angular diameter of the Sun. If it stays constant then you are orbiting, else you have to wait to decide.
If you dont have instruments the option is 'wait and see'. If the two bodies have angular momentum > 0 then you are orbiting. If a collision happened then it is = 0. How do you define an adequate referential in this situation? It has to be a referential centered in the Earth but you have no way to 'anchor' one axis except in the line Sun-Earth. With this referential you can not discriminate the motion except using the apparent diameter.

EDIT add
The negative reactions to my answer motivated this explanation  to the sentence "at rest one in relation to the other"
We have a solid bar ended with two masses as in this picture:
The masses are at rest (one wrt the other) ?  Yes.
Next: make the object rotate wrt the barycenter.   The masses are at rest (one wrt the other) ?  Yes.
Next: remove the bar and put gravity in, and the masses are gravitating.
The masses are at rest (one wrt the other) ? Yes, and yet they move and will not collide.
It is the case that imo the most upvoted and accepted answer is not correct.
Aother problem that I address in my answer is the definition of a practical reference frame.
You can draw 3 axis not anchored in any objects and say it forms a reference? No, except if you consider the existence of an 'absolute observer' outside the problem. This is the case with you, and me, because we are exterior to the problem configuration and we can easily 'frame' the problem.
In any problem we have to define the reference with help of the objects of the problem.
With only two objects left alone in space we do not have many choices.
If we see the Sun motion around the sky we can pinpoint the N and S poles and the equator  (the observer reference frame), etc, but we are not enabled to state that the Earth is not the center of the universe.
At last: an observer synchronously gravitating the rotating and featureless Earth above the day/night separation line will not sense any motion or force. To him the universe is static.
Thats why I used the Foucault pendulum and the CMB reference frame.
Summary:
If the masses are at initially at rest wrt to the CMB frame (and one wrt to the other), then they will collide.
If they are at rest one wrt to the other they may collide or not.
Note: I do not understand how the others answers are trying to analyse motion and forces without defining a reference frame.

EDIT add end
Comment: I don't understand the negative reaction either.
Comment: "Next: make the object rotate wrt the barycenter. The masses are at rest (one wrt the other) ? Yes." No. Both masses are now in motion with respect to the barycenter and each other...not the initial conditions the question describes.


How do we define an object as existing in nature?

Question: How and in what manner is an object defined as "existing"? What principles are followed to deem some object as tangible or real, and not imaginative? Please answer.
Comment: Hi, welcome to Philosophy SE. Please visit our [Help Center](https://philosophy.stackexchange.com/help) to see what questions we answer and how to ask. Broad questions such as yours are not suitable for our format. The response is an entire philosophical subject, and learning about it is best started by reading articles in online encyclopedias rather than asking here, e.g. [SEP's Existence](https://plato.stanford.edu/entries/existence/).  We take more pointed questions that usually come up after reading such sources.
Comment: The etymology of 'exist' is 'stand out'. Thus what stands out from a background we deem to exist. The background is another matter and in metaphysics this definition of 'exist' leads to intractable problems. Still it is what most people use.   . .
Comment: See [Nonexistent Objects](https://plato.stanford.edu/entries/nonexistent-objects/) and see [Alexius Meinong](https://plato.stanford.edu/entries/meinong/#ObjTheOntBeyBeiNonBei).
Answer: Technically speaking, all objects are imaginative, because our mind constructs objects from a complex reality in order to aid cognition.
Think about a fist. Is it an object? Many people would say so, because it can punch and break things. But what happens to a fist when you open it?  The object you thought was so real suddenly isn't there - it morphed into something else.
This is the nature of all reality - everything is in constant flux, and things we perceive as physical objects are temporary arrangements of matter, arbitrarily named and categorized by our mind so we don't get lost in complexity.
So to answer your question - all objects are indeed imaginative and as long as you can think of them, they exist. Whether they also exist on the physical observable reality is a question of scientific measurements of weight, volume, mass and / or other properties, but we're entering the realm of physics here.
Comment: I like your answer. You could strengthen this answer by providing a reference or two to someone who holds the same view and perhaps quote that reference to confirm that it is a reference worth looking at. That would give the reader also a place to go for more information.
Comment: I dislike this answer because it doesn't address what "real" means. You call eveything imaginative but people use the word real so what is the difference. Also I don't understand your fist example because I don't see any inconsistency with something "existing" and being able to transmute to something else.


Radio vs checkboxes

Question: Can I get thoughts on which pattern is better (internal debate at work as to which we should be using)...
Developers favor radio buttons as there's no need for any error handling.
Thanks
Comment: Do you as a business *want* Email to be set as a default (not just to avoid error handling)? Is that a good idea? Or do you truly need the user to make a selection?
Answer: When designing a user interface for a list of selections, whether to use radio buttons or checkboxes depends on the context and the user's interaction needs.
Use Radio buttons when you want the user to make a single, exclusive choice from a list of options.
Use checkboxes when users can select multiple items from the list. If it's possible for the user to choose multiple options simultaneously, checkboxes are the way to go.
But here we have an extra option called "both" as one of the selections in the radio button. It's better to reduce the no of selections for less cognitive load for the user.
Conclusion:
Considering the Cognitive load it is best to use checkboxes cause the user can select either one or both also what if in the near future, there comes a third option eg:(Whatsapp OTP) then Both option needs to be changed but for the checkbox, you can just add it to the selection.
Answer: What I understand is that if they are checkboxes it is implicit that you can select one or more than one, on the other hand, if they are radio buttons, only one
In other words
Example #1 : email, post, or email and post
Example #2 : email or post or both
Comment: Exactly, they both perform the same function I'm just trying to establish which is the preferred pattern and is more understood.
Answer: There's a lot that you can read over on NNG about this exact topic.
But in general and as has been mentioned, checkboxes are for multiple select and radio buttons are for single selection. Even though your team has a clever way for allowing users to select both "Post" and "Email", that isn't a match for the use case of radio buttons.
This trick also won't scale well, say for example you had 3 or even more options, not only do you now need to add several more combination radio button options, but the user will be left confused about their settings and what actual outputs will result.
There are some considerations you'll need to keep in mind, for example if it's required that at least one option be selected. But you can find ways around this, even if it takes a bit more error handling on the back end.
Of course your developers are going to favor the option that is easier for them, but that doesn't mean it will also be the option that makes a better product. If you take the easy route and make the developers happy, but leave your users unhappy, you'll quickly be headed in the wrong direction.
Answer: Your developers are right. Frontend validation is needed when it is possible for users to fill in incorrect data. In your case this can be avoided using the radio buttons with one option selected by default. This has nothing to do with lazy developers as it's usually better to protect users from a poor experience due to errors they didn't know they could cause. Don't confuse frontend with backend validation though. Backend validation is always needed to avoid misuse and malicious data.
I can understand that when more than three options become available, the radio buttons become inefficient. When you decide to use checkboxes, more effort is needed for an adequate UX:

You need to give users instructions in advance about how many options they have to select
You will have to validate if the selection is compliant and give feedback to the user

In your case, I recommend using the radio buttons since there are only three options. This means less instructions (less cognitive load) and less mistakes to make (and thus less frustrating error messages when instructions are not followed). For accessibility purposes I would also advice to rename the "both" option to "E-mail and post" or "Both: e-mail and post".

Radio vs checkboxes


Task Manager in Mac OS X?

Question: I'm new to Mac OS X. Sometimes my system hangs, and I cannot do anything with it. In Windows, I would use Task Manager to stop the unwanted application, but in Mac OS X, what option is available? When my Mac has hung, I have used "Activity Monitor" only. Are there any other options available in Mac OS X?
Answer: If you just want to kill hanging apps try pressing cmd+alt+esc. This opens a mini version of activity monitor, which allows you to select and kill any hanging applications.
Comment: That allows you to force quit running Applications, but it is nowhere near a fully fledged task manager as there is a LOT more going on in the background.
Comment: Activity Monitor is the "fully fledged task manager" as you called it. But Pugal Devan already found it.
I think he wanted to now what's the fastest way to force applications to quit. That's the "cmd-alt-esc"-way.
Comment: another task manager alternative is atMonitor, it has no Sample option, but offers some other interesting features such as querying iUseThis for the latest version info, so you easy can tell what a program does. http://www.atpurpose.com/atMonitor/
Answer: You want to use Activity Monitor in your /Applications/Utilities folder.  This is the equivalent of Windows Task Manager.  It will give you a full list of all processes running on your computer at that time, importantly the ones running in the background.  However, be careful what you decide to kill because it can make your system temporarily unstable (requiring a reboot) if you don't know what you're doing.
Comment: He already found Activity Monitor...
Answer: You can right-click on the icon of a running/hanging application in the Dock. If it is not responding, the usual Quit is turned into Force Quit.
If  the program is running fine, but you want to force quit anyway, hold alt.
Answer: I used the Terminal with the command top -o vsize to see wich program is consuming more memory, then i killed with kill PID or killall PROGRAM. I like these because is lighter than Monitor Activity.
Answer: in Terminal application you can type
ps -e

to list all the processes. each one has a pid which you can stop by typing
kill pid

replacing pid with the actual process number
Answer: I like to add a link to iStatMenus. It shows cpu, ram consumption, disk usage and a lot more in the menubar.
(It's a shame that isn't integrated in Mac OS X)
Comment: Try MenuMeters. It's almost the same but not as polished as iStatMenus. But it's free. =)
Comment: If you open the Activity Monitor, included with OS X, there is an option under the Window menu for a CPU usage meter, CPU history meter and a floating CPU meter. Sure, it's not in the menubar, but it **is integrated into Mac OS X** and performs the same purpose as the Windows Taskmanager.
Comment: But this doesn't help at all with killing hanging apps, does it?
Comment: @lajuette: Right, but this was something I missed switching from the Windows TaskManager to Mac OS X. In Windows, you get the CPU usage in the Systemtray when the Taskmanager is open. Just want to mention it...
Comment: @lajuette: I'll give that a try, thanks a lot.
@ghoppe: I did not know that, thnaks!

Task Manager in Mac OS X?


Free merge tools

Question: I need free merge tool, in order to compare differences in 2 directories. I used Beyond Compare and Araxis Merge, but this tools are not free. Maybe you can recommend some other? I tried WinMerge, but it is not comfortable to use.
Answer: KDiff3 is good, open source (GPL), and works across many platforms.
Answer: Winmerge is something that i use and i find it very comfortable. Why not try examdiff?
Answer: I really like the diff/merge tool that comes with perforce. You can select it in the client installer. Perforce is free to use for max two database users, so you should be fine with none. :)
Comment: You can use `p4merge` without needing to use a perforce database so the database user restriction is irrelevant if you just want to use their merge tool for free.
Answer: I use DiffMerge pretty much every day
Answer: Meld is simply the best merge tool I've ever used. Sadly I don't think there is a Windows version. It can compare directories.
If you use SVN, Tortoise SVN comes with a merge tool.
Comment: Tortoise SVN can compare only the same directory. I would use it, but it compares changes made to directory with the state of directory, when it was last updated.
Comment: Meld is available for Windows: http://meldmerge.org/
Answer: For a long time I stubbornly refused to pay for a merge tool and searched high and low for a free merge tool that I liked, but I found that all free merge tools I tried had their quirks.
In the end I got a trial copy of Beyond Compare and found that I liked using it a lot more than the free tools I'd tried so far.  If you're struggling to find a free compare tool that you can work with then don't discount commercial tools - Beyond Compare is very reasonably priced and I use compare tools all the time.  For me the cost was worth it.

Free merge tools


Creating a Vector calculator append function. Attempting to add any value to it

Question: So I'm having some more trouble with my vector calculator here and I'm not entirely sure of how I can get a float value to append to a vector.  The append function is made and works properly, but the only problem I have is a case of "What if the user wants to put a 0 in the vector?"
Right now, I'm using a check to see if the float is 0, but obviously it doesn't work because it will split out an invalid operand.  Is there anyway I can see if a float value is either not entered, or is not a number? So far, here's a fragment of the part I'm having trouble with:
<code>//Vector that is intialized
Vector * myVector = alloc_vec();
//character for the options
char optionSelect[100];
//character that picks out the selection.
char select;
//A float for the operations that require an option.
float myScales = 0;

printf("Please enter a selection: ");
fgets(optionSelect, 100, stdin);
sscanf(optionSelect, "\n%c%f", &select,&myScales);

...

else if(select == 'a')
{
    if(myScales != 0)
        {
            myVector = extend_vec(myVector, myScales);
        }
        else
        {
            printf("No operand specified.\n");
        }
}
</code>
What can I do to make sure any float value from -inf to inf can be added in, but invalid things such as letters or no input right after 'a' is selected?
Answer: Figured it out, if you set myScales to 0.0/0.0 to get a NaN(presumably?) number, and check myScales == myScales followed by the rest, and set myScales back to 0.0/0.0 it should work!


Doubt in using the interface?

Question: Whenever i hear about interfaces i have the following doubt.
i have the following interface
interface Imammals
          {
           walk();
           eat();
           run();
          }

and i have two classes Human and Cat that implements this interface.
Anyway, the functionality of the methods are going to be different in both the Classes.
For Eg: walk(), the functionality differs as cat uses four legs and human uses two legs
Then, Why do i need to have a common interface which ONLY declares these methods? Is my design here faulty?
If the functionality of the methods are going to be same in both the classes, i could go for a class based inheritance where the parent implements the complete functionality and the child inherits and uses the parent class methods.
But here the interfaces help us just to consolidate the methods declarations or is there anything more inside?
EDIT: walking(), eating(), running() was changed to walk(), eat(), run() and mammals was changes to Imammals.
Answer: In your scenario, either type-inheritance or interface-implementation would work - but interface based abstraction allows types outside of your existing type model to provide the functionality. It could be a mock object, or it could be some kind of super killer robot, that can walk run and eat but isn't really a mammal (so having it inherit from a Mammal class could be confusing or just impossible).
In particular, interfaces allow us to express this relationship neatly, while avoiding the subtle points from C# having single (type-)inheritance.
Answer: Using the interface you can have the following:
   public void walkMyAnimal(Animal animal) {
       animal.walk();
   }

without the need to know what animal exactly is passed.
Comment: This is possible for DOG and CAT but how about HUMAN and CAT? Could you please explain more?
Comment: @Sri Kumar, What is unclear?  You don't think a human can be told to walk?
Comment: Oops! i am sorry. I was thinking about the implementation part of walk().
Answer: Interface allows you to define behavior for inheriting classes so if you have Donkey in future then you simply implement this interface and be sure that you donkey will walk,run and eat.
Also you can use composition instead of concrete implementation if some of your objects have common behaviour.
Read a bit about Strategy pattern I think that will help.
Answer: One big advantage of interfaces is that even in languages like Java and C# where multiple inheritance is not allowed, a class can take on more than one interface. Something can be both Closable, for instance, and a List, but could not inherit from both (hypothetical) abstract base classes AbstractClosable and AbstractList.
It is also suitable for cases where you are writing a library or a plugin interface and want to provide a way for your code to use objects provided by library users or plugin writers, but you don't want (nor should you) any say in the implementation. Think of the Listener interfaces in Java, for instance. Without those, there would be no possibility of an event model, since Java doens't support callbacks.
In general, interfaces are good for cases where you want objects that have particular functionality, but the way that functionality is implemented can vary widely, and might not be the only thing a class does.
Answer: The reason you want an interface is to be able to treat them all alike when commanding them.
Whoever calls walking() (which is a rather odd name btw, it should probably be walk()) is just interested in telling your animal to do just that. The actual implementation will vary but that is not something the caller would care about.
Comment: Thanks for indicating the Naming Convention :)
Comment: (for anyone seeing this and wondering, Sri Kumar edited the post accordingly)
Answer: Well, sometimes you'd want to be able to do something to "anything capable of running" without necessarily knowing at design time whether you're talking about a human or a cat or whatever.  For instance, imagine a function mammal raceWinner(mammal m1, mammal m2){...}
to calculate which mammal would win in a race.  To determine who wins, perhaps the function needs to call m1.running() and m2.running().  Of course, the mammals we pass in will really be cats or humans or whatever, and this class supplies the actual implementation of running().  But all raceWinner needs to know is that they have a running() method with the expected signature.
If we only defined running() on cat and human, we couldn't call m1.running() (because the compiler is not guaranteed that m1 has a running() method, as it only knows it's a m1 implements mammal).  So instead we'd have to implement a raceWinner(human m1, cat m2) and likewise for two humans, two cats, or any other pair of mammals we had in mind, leading to a lot more work on our part.
Answer: An interface provides a contract. It doesn't provide an implementation. It's good practice to interface out your classes.
Answer: Of course, walking(), eating() will have different implementation in different animals. But they all walk, run, etc. That is all the interface is saying.
Answer: You could model this using inheritance, which would allow you to give default implementations for some or all of the methods. However, interfaces are really useful for declaring a set of features that apply to many unrelated types.
To continue your example, you could imagine a type Alien, which would probably have the same methods, but would not fit in your inheritance hierarchy.
Answer: The purpose of interfaces is to tell you what a class does, not how it does it.
This is especially important for accepting things that work differently -- each printer we attach to the PC works differently, so does each scanner, so does each external drive. If all programs needed to care about how each of them worked, you would need to recompile, say, Microsoft Office, for every model of printer that comes out.
Answer: One way to develop interfaces is to define an interface and a relative class which implements te interface a common reasonable way. Having both interface and class, you could use the interface in the case the class alreay derives from another class, otherwise a class could derived derivctly to the interface implementation.
It's not always possible, but it solves many problem.
Having a common interface is used to use different object using only the interface (collecting them to a generic list, for example).
Answer: There isn't much difference between an entirely abstract class and an interface if you only have one base type.  Interfaces can't have any implementation code, but abstract classes can.  In this case, abstract classes can be more flexible.
Where interfaces are really useful is that you can assign multiple interfaces to a single implementation, but you can only assign one base class.
for instance, you could have:
class Cat : IMammal, IFourLeggedAnimal
{
}

class Human: IMammal, ITwoLeggedAnimal
{
}

Now you can treat both of them as Mammals, with a "walk()" method, or you can treat them as Four or two legged animals (not necessarily mammals).
Answer: What is really useful with an interface like mammal is that you can treat an array of objects (Humans and Cats) as of being of the same type when you want them to walk, eat or run.
For instance if you ware creating a game where you have a number (objects would be created dynamically, but just for example lets say 10 cats and 1 human) of mammals on the screen (saved in a collection), and just wanted them to walk on every turn, you could simply do:
foreach(mammals m in MamalsArrayList){
{
    m.walking();
}

note: I suggest you follow naming conventions and name your interfaces with "I" in front of them, so your example should be named IMammals.
without having to know weather any particular m is either a cat or a human.
Interfaces are hard to show on any particular snippet - but when you really need one you can see how useful they can be.
Of course they have other uses to (that are mentioned in other answers), I just focused on your example.
Answer: There are two issues here that are often confused. Inherited behaviour allows different 'commands' to be responded to in the same way e.g Man.walk() === Woman.walk(). Polymorphic behaviour allows the same 'command' to be responded to in different ways e.g. Animal.move() for one object may be different for Animal.move() for another, the bird will choose to fly while the slug will slide.
Now, I would argue the second of these is good while the first is not. Why? Because in OOP we should be encapsulating functionality into objects, which in turn promotes code reuse and all the other nicenesses of OOP. So rather than inheriting behaviour we should delegate it out to a shared object. If you know patterns then this is what State and Strategy are doing.
The problem lies in the fact that normally when you inherit , you get both of these behaviours mixed together. I suggest that this is more trouble than its worth and we should only be using interfaces, though sometimes we do have to make do with whatever the framework provides.
In your specific example Mammal is probably a bad interface name because it doesn't really tell me what it does and it has the potential to blowout to thousands of methods. It's better to divide interfaces into very specific cases. If you were modelling animals you might have a Moveable interface with one method, move(), to which each animal could respond by walking, running, flying, or crawling as appropriate.

Doubt in using the interface?


IC 555 as monostable multivibrator

Question: How is the output of a monostable multivibrator affected if the trigger pin is kept at a negative voltage (0V)?
The upper voltage reference comparator will change its output to logic 1, while the lower reference comparator is already at logic 1. As a result the input to the RS flip flop goes into forbidden state (R=1,S=1).
What happens at the output?
Comment: 0V is not a negative voltage.
Comment: What happens is that one input dominates.
Comment: it is impossible to guess about the behavior of an unknown circuit
Comment: This sounds a little like homework.
Answer: The 555 device if connected in a standard monostable mode will generate an output pulse at the falling edge of the trigger pin signal. If the trigger pulse signal goes back high before the normal ending of the output pulse then there is no effect on the output pulse. If the trigger pulse stays low longer than the normal timing of the output pulse then the output pulse will stay high until such time that the trigger input goes back low. These comments apply to a circuit wired up as follows:

If you want to have the trigger pulse level not interfere with the output pulse then you have to make sure that the trigger pulse is always shorter than the nominal output pulse width. One way to do this is to use an R/C coupling of the trigger input so that it is just a short spike just enough to trigger the 555. Here is a circuit configuration that is setup that way.

IC 555 as monostable multivibrator