What type of ANOVA? Three types of measurement in 2 groups

Question: I am working on an assignment where I am expected to use an ANOVA test to analyse a set of data.
The data set consists of two groups, the first group is a healthy group of participants, group 2 have had an operation involving a brain lesion.
Both groups have then been tested with three tests: maths, language, logical reasoning.
I am expected to test whether the brain lesions have led to any significant decrease in cognitive functions. I am not sure what type of ANOVA to use? Maybe a 2x3 mixed ANOVA? would this be the correct choice of statistical analysis?
Thank you
Comment: Welcome to the site, @Alex. We have a tag for homework, called 'homework', which you should add to your question. Our policy is to give hints for homework completion, not answers :)
Comment: @Placidia The tag is actually called `self-study`
Answer: You need to ask yourself two questions: What is being measured, and why do measurements vary?

You are measuring responses to test scores.
Tests vary for 4 reasons: the person is healthy or brain damaged; Bob is different from Paul; a math test is different from a language test; and finally, if Bob does the same test on two separate occasions, he will get a different score.

two of these reasons are fixed effects and two are random. Can you take it from here?
Comment: I am guessing the that you are hinting at a fixed vs random effect anova. I have done some research on it, and while it seems that it may in fact be a viable option, my past lectures and covered course material has lead me to believe that my choice is rather one of a mixed ANOVA vs a MANOVA? What I have been taught in stats as a psychology undergraduate is quite limited, perhaps this is why.  Maybe I should have specified that this was more so the dilemma I was experiencing. Am I on the right track guessing that a MANOVA could be appropriate?
Comment: a MANOVA would work, especially if you have a large sample. a mixed effects (repeated measures) could also work. if you wanted to compare the tests that would be the method. but if you just care about the brain damage, then manova is good also.
Comment: I think i will end up using a MANOVA as the brain damage is the main variable of interest for the study and report. thank you very much for the clarification, it's been very helpful.
Answer: You have two independent groups that you are comparing.  If your aim is really testing: You can either (1) do a separate test of shifts in mean (or median) score for each response (math, language, reasoning) using either a t-test or else an equivalent distribution-free test (Wilcoxon-Rank Sum test). (2) If you want to be fancy and bundle all three tests into a single overall test of differences (that will also yield a cognitive 'score' from the three responses), use MANOVA, also called (since there are two groups) Hotelling's T-test.
However, it is just as likely that you really want to know how much the scores differ between groups and not just that they differ.  I'd recommend a confidence interval for the difference in scores, one interval for each response (these can be obtained from t-test software).  There are also nonparametric versions of these intervals (Hodges-Lehmann) that are fairly robust, but that's probably overkill.  Along with these, a pair of box plots for each response (math, language, reasoning) is a good idea, too.


The definition of lim sup at infinity

Question: When studying analysis, I met with the problem of lim sup at the infinity. The limit superior of $f$ at $y$ is defined as:
$$\begin{aligned}
\underset{x\to y}{\overline\lim} f(x)
&= \inf_{\delta > 0}\ \sup f \restriction (X\cap B(\delta,y)-\{y\}) \\
&=\lim_{\delta \to 0^+}\; \sup f \restriction (X\cap B(\delta,y)-\{y\}).
\end{aligned}$$
Then, I wonder whether $\displaystyle \underset{x\to \infty}{\overline\lim} f(x)$ should be defined as:
$$\begin{aligned}
\underset{x\to \infty}{\overline\lim} f(x)
&= \underset{k\to \infty}{\overline\lim}\; \sup_{j\ge k} f \restriction (X\cap \{x\ge j\}) \\
&= \inf_{k\to \infty}\; \sup_{j\ge k} f \restriction (X\cap \{x\ge j\}).
\end{aligned}$$
I just wonder whether I made up right mathematical expression for limit superior of $f$ at infinity.
Comment: What is $X$?  Is it an arbitrary metric space?  In that case, what does $\{x \ge j\}$ mean?
Comment: @NateEldredge We have not talked about the concept of metric space. In our context, $X$ is an unbounded subset of $\Bbb R ^m$. In word, I think the lim sup f at infinity(=L, say) should be: $\forall \varepsilon \gt 0, \exists j \gt 0,$ s.t. $\forall x\gt j,\ |\sup f(x) -L|\lt \varepsilon$. I have trouble in converting this into expression.
Comment: If $X \subset \mathbb R^m$ for $m > 1$, how do you define $x \ge y$ for $x,y \in X$?
Answer: You're thinking along the right lines, but unfortunately it appears you haven't covered the theory that lets you talk meaningfully about lim sup in the more general setting of topological spaces.
There are two things that go wrong in trying to apply the metric space definition to the problem:

$\infty$ is not a real number, and
even if it were, the $\delta$-ball around $\infty$ wouldn't make much sense.

The second problem is most easily fixed by moving the discussion to the realm of topological spaces, so since we have to do that, let's use this opportunity to introduce the extended reals, $\overline{\mathbb R} = [-\infty,\infty]$, i.e. the real line with a point added "infinitely far to the left" and another "infinitely far to the right". What are the open sets of this concoction? Well if $U \subseteq \mathbb R$ is open, then it's also open in the extended reals. And if $U \subseteq \overline{\mathbb R}$ contains $\infty$, then it's open when it's bounded below and when $U \cap \mathbb R_+$ is open in $\mathbb R$.
Next we need the topological definition of limit superior that only makes reference to the open sets. Following Wikipedia's article on limit superior and inferior in slightly less generality, we consider a function $f: E \to \mathbb R$, where $E \subseteq \overline{\mathbb R}$, and a limit point $a$ of $E$.
$\displaystyle\limsup_{x\to a} f(x) = \inf \{ \sup \{ f(x) : x \in E \cap U - \{a\} \} : U\ \text{open}, a \in U, E \cap U - \{a\} \neq \emptyset \}.$
And indeed one finds that everything works and when one unwinds the definition to the concrete situation you're in, one finds (for the case $E = (b,\infty)$) that one gets what you've written below (here I'm making some assumptions about what you mean with your notation, but it seems reasonable enough).

The definition of lim sup at infinity


can't group the ckk fields

Question: I am using drupal 6. I can create a group inside of a content type, but I can't see any way of attaching a field to the group. In a different installation of drupal on my computer, I see a box right under the new field name where you can enter a group, but this doesn't show up in this installation. Why would that be?
Answer: You can achieve this functionality by using the Fieldgroup cck module.
Answer: You can drag a field under the group.
Fieldgroup is already included in CCK module.
Comment: Fieldgroup is installed and enabled. I think I must have somehow messed up this instalation of drupal because dragging the field under the group doesn't do anything. I was hoping that someone might know what happened.
Comment: You mean you can drag the field under the group but still that field is not under that group after saving? Did you try to run the `update.php`? Do you have `Content Permission` module installed?
Comment: There must have been something messed up with my theme files. I made a copy of clean one and renamed it, and now everything works fine! I'm not sure how I messed things up, I have done this before...

can't group the ckk fields


Lagrange's Theorem (Number Theory): Proof Using $ \textbf{Z}_p $

Question: ...where $ \textbf{Z}_p $ is the ring of residue classes $ (\text{mod } p) $ and $ p\in\textbf{P} $.
As an exercise, we're supposed to prove in detail the following lemma used in the proof of the theorem:

Suppose $ f $ is a polynomial of degree $ n\geq2 $ with coefficients
  in $ \textbf{Z}_p $ and $ [a]\in\textbf{Z}_p $. Now if $ f([a])=[0] $,
  there exists a polynomial $ g $ of degree $ n-1 $ (with coefficients
  in $ \textbf{Z}_p $) such that $$ f([x])=([x]-[a])g([x]). $$

I'm certain the identity $$ [x]^n-[a]^n=([x]-[a])\left([x]^{n-1}+[x]^{n-2} [a]+\ldots+[a]^{n-1}\right) $$ will be of great use here, but I've hard time getting started.
Any help would be appreciated.
Comment: Do you have the division algorithm for polynomials with coefficients in a field?  If not, you can prove that by induction and then show that for, for any $a\in\mathbb{Z}/p$, you have $f=(x-a)q(x)+f(a)$.
Comment: I don't understand why trying to prove this for $\mathbf{Z}_p$ when it is true for *any* commutative ring.
Comment: @JoeJohnson126 No, on this course we don't have the division algorithm for polynomials (as of yet).
Comment: @user236182 It's far more simple than I thought! Thanks for the fast reply.
Comment: @egreg What I (of the teacher) mean with "using $\textbf{Z}_p$" is "prove the theorem through $\textbf{Z}_p$", not "for $\textbf{Z}_p$". -- We already proved the theorem (generally) using induction on the degree of the polynomial. This is just some kind of practice, I quess...
Answer: Theorem. Let $R$ be a commutative ring and let $f(x)$ be a polynomial with coefficients in $R$, of degree $n\ge 0$. If $h(x)$ is a monic polynomial with coefficients in $R$, then there exist polynomials $g(x)$ and $r(x)$, with the degree of $r$ less than the degree of $f$, such that $f(x)=g(x)h(x)+r(x)$.
Proof. If the degree of $f(x)$ is $0$ there is nothing to prove: either $h(x)$ has degree $0$, so $h(x)=1$, or it has higher degree and we can take $g(x)=0$ and $r(x)=f(x)$.
So assume the thesis holds for all polynomials having degree less than $n$, where $n>0$. Again, if the degree $m$ of $h(x)$ is larger than $n$, we can take $g(x)=0$ and $r(x)=f(x)$, so let's assume $n\ge m$. If $f(x)=a_0+a_1x+\dots+a_nx^n$, then
$$
f_1(x)=f(x)-a_nx^{n-m}h(x)
$$
has degree less than $n$ and so, by the induction hypothesis, $f_1(x)=g_1(x)h(x)+r(x)$, so that
$$
f(x)=f_1(x)+a_nx^{n-m}h(x)=(g_1(x)+a_nx^{n-m})h(x)+r(x)
$$
and we're done. QED
Your result is the special case when $h(x)=x-a$ (on an arbitrary ring). Then the remainder $r(x)$ is constant and it's obvious that $r(x)=f(a)$. So, if $f(a)=0$, we also have
$$
f(x)=(x-a)g(x)
$$
Take the ring $R=\mathbb{Z}_p$ and you're finished.
I don't think that proving the particular result using the factorization of $x^k-a^k$ (maybe using special notation for the $p$ element field) is particularly illuminating.
But here it is: if $f(x)=c_0+c_1x+\dots+c_nx^n$, then
$$
f(x)=f(x)-f(a)=c_1(x-a)+c_2(x^2-a^2)+\dots+c_n(x^n-a^n)
$$
and you can collect $x-a$ from all terms.
Answer: If $f(x)\bmod p$ is a polynomial of degree $n\ge 2$ and $f(a)\equiv 0\pmod{p}$, then ($b_i\not\equiv 0$ are reduced mod $p$):
$$f(x)\equiv f(x)-f(a)$$
$$\equiv b_nx^n+b_{n-1}x^{n-1}+\cdots + b_1x+b_0-b_na^n-b_{n-1}a^{n-1}-\cdots -b_1a-b_0$$
$$\equiv b_n\left(x^n-a^n\right)+b_{n-1}\left(x^{n-1}-a^{n-1}\right)+\cdots +b_1(x-a)$$
$$\equiv (x-a)\left(b_n\left(x^{n-1}+x^{n-2}a+\cdots + a^{n-1}\right)+b_{n-1}\left(x^{n-2}+\cdots +a^{n-2}\right)+\cdots+b_1\right)\pmod{p}$$


Scala access fields

Question: I started learning scala recently and stumbled upon a problem trying to "print" cells:
class Cell(
            val x: Int,
            val y: Int,
            val left: Option[Cell],
            val right: Option[Cell],
            val top: Option[Cell],
            val bottom: Option[Cell],
            var isPainted: Boolean) {

  def paint(radius: Int) = {
    println("Printing")

    if (radius == 0)
      isPainted = true
    else {
      isPainted = true
      top.isPainted = true
      bottom.isPainted = true
      left.isPainted = true
      right.isPainted = true

Why are these neighbouring cells
      top.left.paint(r - 1)
      top.right.paint(r - 1)
      bottom.left.paint(r - 1)
      bottom.right.paint(r - 1)

not accessible?
    }
  }

How can I  access the top, bottom, left, right cells?
edit:
thank you for the great answer.
one addon- question:
how could I check that all the cells around cell x are set to true?
My try unfortunately does not work.
def isMiddleCell()={
    if(List(top, bottom, left, right).forall(_.Some))
      true
    else
      false
  }

Comment: Because they are not `Cell`s, they are `Option[Cell]`. Read about `Option`s.
Comment: So if I understand correctly a `.get()` needs to be called similar to: ```val ttop = top.getOrElse("No top neighbour")
      ttop.isPainted = true

      top.getOrElse("No top neighbour").isPainted = true```  However both of these do not work. Even wrapping the `true`in `Some(true)` does not work.
Answer: to do this
  bottom.isPainted = true

you actually need to modify value inside Option
  bottom.foreach(_.isPainted = true)

to access nested Option you should use flatMap, so
top.left.paint(r - 1)

should be
top.flatMap(_.left).foreach(_.paint(r - 1))

You basically want to make a side effect, execute some code if value is present. For this, the idomatic solution is foreach which does exactly this.
To navigate through your cells that have their neighbours as Option as well, flatMap is the simplest solution. top is of type Option[Cell]. If you wanted to get the value inside it and extract left from it, you could think about map.
top.map(_.left)

this expression has type Option[Option[Cell]], this is why flatMap is helpful here, it will flatten nested Options and give you [Option[Cell]] that will contain inside tle left neighbour of top neighbour of your cell if it exists. Now, having this you can simply do foreach as in previous example.
To explain on your comment where you posted this code:
top.getOrElse("No top neighbour").isPainted = true

this couldn't work, because it will get you the Cell if it is present, else it will give you a String which gives you expression of type (I think) Serializable (so the most common supertype) that has no field called isPainted. When you use getOrElse you usually want to put the expression of the same type that the object inside the Option. But anyway getOrElse doesn't seem like most useful thing in your example.
Edit
To answer the follow up question, method that checks for value presence is isDefined
def isMiddleCell = List(top, bottom, left, right).forall(_.isDefined)

Some is a type. The _ syntax is just shorthand for function, expanded it looks like this:
x.forall(a => a.isDefined)

Comment: Do I understand correctly that I sould change the method signature to return Unit? http://stackoverflow.com/questions/3739133/why-does-scala-require-a-return-type-for-recursive-functions this seems somewhat strange ...
Comment: yes, it seems like your method does not return anything, so it should have return type of `Unit` which is equivalent of `void` from java. You are calling it recursively, so scala compiler can't or won't infer the return type, you need to specify it yourself.
Comment: Thank you very much for the explanation.
Comment: May I ask a small add-on question - please see the edit

Scala access fields


Existe justificativa para essa alteração? Mudança no padrão de variáveis

Question: Um colega de trabalho leu em um fórum que usar short, int e long era o jeito correto e melhor para o desempenho do sistema, então este começou a alterar em todas as telas e classes em que trabalhava.
Eu pesquisei e não vi ganho nenhum, exceto o fato de existir alguma perda de bytes quando se trabalha com conversões de double, mas a questão não é essa, a questão é que está mudando o padrão do sistema que foi feito todo usando tipos Int16,Int32 e Int64, e daí temos agora algumas poucas classes e telas com outro padrão.
A pergunta é: Existe justificativa seja por padrão de desenvolvimento, ganho de sistema, ou ser mais bonito usar assim? Algum motivo que justifique essa despadronização de desenvolvimento que essa "melhoria" está gerando?
Comment: De que linguagem está falando ?
Comment: Sim, é de `C#` (`.NET`)?
Comment: @NelsonTeixeira C# .Net
Answer: Geralmente, não existe justificativa para contrariar o padrão estabelecido. Se o projeto está usando 100% int, long,  e short, continua utilizando, mesmo com Int16, Int32, e Int64.
Agora, creio que a pior coisa que poderia fazer é deixar o projeto com essa mistura -- fica difícil acompanhar qual padrão deveria estar seguindo.
Se seu colega começou mudar tudo para int, acredito eu que teria mudar tudo, não deixar nada no outro jeito.
Comment: Sim, cada programador tem um jeito - mas na área de desenvolvimento, é melhor o *time* estabelecer uma padrão, pois o *time* terá que manter o código-fonte. Tem um ditado aqui nos states que descreve um programador que quer fazer tudo diferente simplesmente porque pode: *Cowboy Coder*
Comment: Concordo, foi o que eu argumentei.
Mas este colega disse:
"Cara cada um de nós tem um jeito de programar, a gente nunca vai programar do mesmo jeito."
Comment: Diante desse comentário: "Cara cada um de nós tem um jeito de programar, a gente nunca vai programar do mesmo jeito." me faz pensar que ele quer mudar pois ele QUER, sem nenhuma outra justificativa aparente e muito menos técnica.
Answer:
Não existe absolutamente nenhuma diferença entre um e outro, exceto a leitura do código por um humano.

O alias figura como uma palavra-chave (keyword) da linguagem, mas o uso, função e funcionamento é idêntico a utilizar o seu tipo ou classe equivalente.
short, int, long, string... são apelidos (alias) C# para os seus tipos no .Net Framework (System.Int16, System.Int32, System.Int64 e System.String, respectivamente) e durante a execução não fará nenhuma diferença se você usou um ou outro para declarar a variável.
Quanto ao seu colega fazer diferente do que vinha sendo feito e alegar que cada um codificará de um jeito, contradiz o senso comum de que o time deve escolher padrões, informal ou formalmente se necessário, e todos devem adotar os padrões.
Quando todo o código segue o mesmo padrão, depois de nos acostumarmos com este padrão ninguém se sente desconfortável ao ler o código alheio e ficamos dispensados de ter que fazer o fatídico "chaveamento" de modo de leitura a cada vez que vamos ler outro código.

Além dos padrões de estilo que evitam as constantes adaptações por parte do leitor, existem também os padrões pela segurança, robustez, qualidade do código. Se um time não segue nem os padrões de estilo, seguirá outros padrões ainda mais importantes?

Uma evidência da importância de o time seguir um padrão de codificação é a existência de ferramentas especializadas nisso (por exemplo: StyleCop, FxCop e Resharper).
Afinal, existe justificativa para essa alteração?
A única justificativa plausível é a preferência do seu colega por este estilo que ele está adotando.
Qualquer outra justificativa é falta de informação ou só uma mentirinha mesmo.
Comment: Hoje esse colega não está mais na empresa, com a saída dele hoje após conversar com o resto da equipe fiz um levantamento das classes que ele modificou para que possamos abrir tarefas de adequação aos padrões do projeto.
No total temos que alterar **1229 linhas de código**. :)
Algo que será posto na fila pois não é prioridade, e provavelmente o sistema nunca ficará inteiramente no padrão original.

Obrigado a todos que se deram ao trabalho de responder a esta pergunta.
Answer: Acredito que se ele esteja programando SOZINHO em um projeto poderia fazer da forma que achar melhor, porém como existe uma equipe, deve haver regras e padrões estabelecidas e concordadas com a mesma no inicio do projeto.
Qualquer coisa que esteja fora dos padrões deve ser justificado o motivo de não seguir aquilo que foi combinado, mesmo que seja através de um simples comentário de uma linha.
Concordo que cada um tem uma forma diferente de programar e nem por isso um ou outro estará errado, mas para que em um projeto a melhor forma seja definida (para não acabar virando "miscelânea), deve ser estabelecidos padrões.
Para mudar algum padrão deve ser dada a justificativa do mesmo e logo ser debatido e aceito por todos. Mesmo que isso seja simples e leve em torno de 10 minutos para acontecer, mas é a equipe, e não um ou outro que decide. Ao menos que este tem autoridade para passar por cima dos outros mas mesmo assim penso que não seria a melhor alternativa.
Comment: Concordo, eu até concordei que fosse assim nos sistemas novos, porém como já dito antes em toda tela que ele toca, seja sistema novo ou velho ele faz isso.


How do I decide if my piece should be expressed as 3/4, 6/4 or 3/2?

Question: I'm still an amateur composer, but I've been wanting to explore time signatures outside of 4/4. The trouble is, I'm having issues figuring the actual time signature of what I've written. I was arranging the track with my DAW set to 3 beats per bar at 135bpm. However, when I went to transcribe it onto a sheet, I started questioning exactly what the best time signature is to express the song.
The song follows this drum pattern. A snippet of the actual arranged song is this. Finally, a basic computer-played piano arrangement sounds like this, but it is quite flat in terms of dynamics so I'm not sure it's very helpful.
I'm heavily leaning towards 3/2 at 67.5bpm per half note, especially because I think the piece is a lot slower than I would expect 135bpm to sound. Any help identifying what would fit best would be really helpful!
Below, I've transcribed the sheet music in the various signatures. I'm still new to making sure rhythms are properly grouped, so if you notice an error, please feel free to point that out as well.
Here, I've expressed it in 3/2:

And 3/4:

And 6/4:
Comment: @PiedPiper *Which* to choose is a matter of opinion, but the question is *how* to choose, which is not. However, short of reading the other posts you linked to, it is very likely a duplicate, as we do have a lot of similar kinds of questions.
Comment: It´s all a matter of opinion. I would go with 6/4. Other contributors will almost certainly disagree. This is also a duplicate https://music.stackexchange.com/questions/32462/how-does-one-choose-the-correct-time-signature-to-match-the-tempo-and-vice-versa https://music.stackexchange.com/questions/105536/how-do-you-decide-what-kind-of-rhythm-time-signature-to-use https://music.stackexchange.com/questions/45364/what-makes-a-composer-decide-between-time-signatures-3-4-3-8-or-3-2
Comment: I just want to throw 12/8 in as another candidate.
Answer: This type of question in general can be considered opinion based but there are underlying factors here that make some choices better than others.
Looking at the rhythms in both hands but especially the left, I would say 3/2 is out because there is a strong sense of a division of the 3/2 bar in the center. 6/4 works because it divides the bar into two halves but there is a distinctly different feel in both halves of the bar so I would prefer to separate those with bar lines.
Your choice of 3/4 is good. 6/8 is also potentially a good choice. The thing is your basic pulse for this in eighth notes is 123 123 12 12 12. The first half is a perfect 6/8, the second a perfect 3/4.
Aside from some Flamenco music I've heard, a few specific songs some to mind. The first is "America" from West Side Story that has this 3,3,2,2,2 feel pretty much throughout. The others are several from "Man of La Mancha", the title song, "It's All The Same", "Dulcinea"  and "Aldonza".
I have seen arrangements of "America" notated both in 6/8 and 3/4. I think the original time signature is actually 6/8(3/4), indicating alternating bars of 6/8 and 3/4. "Man of La Mancha" is written in 3/4 but has that underlying feel in the melody. In the other two, they actually alternate bars of 6/8 and 3/4 throughout in the score and parts. Changing time signatures every bar is unusual but they did it and it has been read, played and performed that way for decades. The same thing can be accomplished by using a time signature with a sum: 6/8+3/4. If you use the "America" or the "sum" solution it wouldn't hurt to add a small note at the beginning indicating your intentions. Here are samples of two of them songs:
Comment: +1, another good point. Time signature doesn't need to stay the same, and two time signatures can even coexist at the same time.
Comment: As soon as you counted it out as 123-123-12-12-12, my mind jumped to "America" before reading anything further. Would definitely agree with your points here
Comment: I'm used to see the pattern of alternating bars of 6/8 and 3/4 written as "6/8 + 3/4", and I think it would make a good fit here, indeed.
Comment: I like the 3/4+6/8 idea. You could emulate Brahms and write 3/4+6/8 as a time signature then use beaming to help with reading.
Answer: There are two primary considerations:

Where (e.g., on which notes) do the pulses fall, and
Which pulses are relatively stronger and weaker.

3/2
In 3/2 time, there are three pulses, presumed to be Strong - Weak - Weak unless otherwise indicated, corresponding to the half note. So the pulse pattern would be as shown here.

3/4
3/4 time is similar insofar as the notation is identical except for the bar line placement. The beats in 3/4 come at double the notational "speed" as in 3/2, since they correspond to the quarter note rather than the half note. This means that the strong beats occur twice as often.

6/4
6/4 is nearly identical to 3/4, with every other bar line removed, but now there is a Strong - weak pulse pattern that corresponds to the dotted half note.
Answer: Aaron gives some helpful pointers, but I'd like to point there is one more topic you need to understand to make your decision, and that's syncopation.
Syncopation occurs when the accent is shifted from a strong beat to a weak one, and results in strong emphasis. Your music quite certainly includes lots of syncopation. You need to figure out which notes are syncopated.
For example, in the second measure, the right hand plays two dotted half notes. In both 3/4 and 6/4 these notes would fall on the metric accents thus sound agreeable, stable, calm, while in 3/2, the second note would be syncopated, that is startling, unexpected, emphasized.

The drum pattern provides more hints. I wrote it down below, marking strong accents with color. In 3/4 the accent would come on the first kick drum (down beat), then the following snare hit would be syncopated, and thus accented, and then the next snare would come on another downbeat. Note how it differs from 3/2, where the last kick drum would be accented instead. In 6/4 the syncopation would occur on the first snare hit, but since a weak beat would be syncopated, perhaps the resulting accent would be less strong as well.


Proof that $\left | \left \langle g^{m} \right \rangle \right | = n$, where $\left | G \right |=mn$ confusion

Question: I'm trying to prove that if $\left | G \right |>1$ is not prime, there exists a subgroup of $G$ which is non-trivial, where $G$ is finite.
I know that the question has been answered multiple times, for example.
But for many of the answers given, they say that "$|G|=mn$ with $m,n>1$, then  $\langle g^m\rangle$ and $\langle g^n\rangle$ are proper subgroups", in order to complete the proof.
However, I've come accross a theorem on Proof Wiki stating that Group does not Necessarily have Subgroup of Order of Divisor of its Order, so how are we certain that in the case above, that $\langle g^m\rangle$ even exists, and is it always true that $\left | \left \langle g^{m} \right \rangle \right | = n$ ?
edit: For the Proof Wiki theorem, does it not apply to cyclic groups, as this University of Washington PDF states that "3. Suppose $G$ is a finite cyclic group. Let $m = |G|$. For every positive divisor $d$ of $m$, there exists a unique subgroup $H$ of $G$ of order $d$."
Comment: Presumably $g$ is an element of $G$.  Then obviously $g^m$ exists, so $\langle g^m\rangle$ exists.  But it is not true that $\big|\langle g^m\rangle \big|=n$.  There is a group $G$ of order $mn$ where $m=n=2$ such that $g^m$ is the identity for any $g\in G$.  It would be true if $G$ is cyclic and generated by $g$.
Comment: @QiZhu how do you get that $\left | \left \langle g^{m} \right \rangle \right | \: | \: n$ , and how does it suffice for what I want to prove. Don't I need to show that $\left | \left \langle g^{m} \right \rangle \right | \neq |G| \neq 1$?
Comment: No. But $|\langle g^m \rangle | \mid n$. (This suffices for what you wanted to prove.) Quick counterexample: Set $g = 1$.
Comment: $|\langle g^m \rangle|\; |\; n$ follows from Lagrange's theorem.
Comment: If you want to show that $\langle g^m \rangle$ is a non-trivial proper subgroup, then, as you say, you have to show two things: $\langle g^m \rangle \neq 1$ and $\langle g^m \rangle \neq mn$. However, for the step you are asking about (show that $\langle g^m \rangle \rangle$ is a proper subgroup) you only need to show the second of these two. When its order divides $n$ then it is less than or equal to $n$ and hence less than $mn$. Of course the question why its order would divide $n$ still remains.
Comment: @DatCorno: how? The naive application of Lagrange's theorem only gives $|\langle g^m \rangle| | mn$. What is the more subtle application of Lagrange's theorem that we need here?
Comment: @Vincent so how would I go about showing that $| \langle g^m\rangle | \neq mn$
Comment: @Vincent I seem to have misread our assumptions about $|G|$, my bad.
Comment: Hm, we get $\operatorname{ord}(g) \mid mn$ by Lagrange, so $\operatorname{ord}(g^m) \mid n$. If we're in the case $\operatorname{ord}(g) = m$ where $g \neq 1$, then we have already found a non-trivial subgroup, namely $\langle g \rangle$.
Comment: The idea is quite simple (as all answers demonstrate): Every element has order dividing $mn$. If one element has order $mn$, then this is a cyclic group. For a generator $g$ we can simply choose $g^m$. If no element has order $mn$, then we are done anyway.
Answer: I think you are missing several clauses in the argument.
Take  a finite group $G$ of order $mn$, with $1\lt m,n\lt |G|$. We want to show that it has a proper nontrivial subgroup.
Let $g\in G$ be any nontrivial element. Now, if $\langle g\rangle\neq G$, then we are done: the subgroup $\langle g\rangle$ works, because it is a proper subgroup (since $\langle g\rangle\neq G$), and it is nontrivial (since $e\neq g\in\langle g\rangle$).
So now assume that this is not the case; that is, that $\langle g\rangle$ is, unfortunately for us, actually equal to $G$. That means that $G$ is cyclic, and the order of $g$ is $mn$. In that case, $\langle g^m\rangle$ is nontrivial, since $m\lt mn$, so $g^m\neq e$ and $e\neq g^m\in\langle g^m\rangle$. Moreover, since $(g^m)^n = g^{mn}= e$, the order of $\langle g^m\rangle$ is a divisor of $n\lt mn$, so $\langle g^m\rangle\neq G$ (it has order $|g^m|$, which is at most $n$, which is less than $mn$). Thus, you have a proper nontrivial subgroup. Similarly if you take $\langle g^n\rangle$ instead of $\langle g^m\rangle$.
But this is all predicated on $\langle g\rangle = G$. Without that assumption, you do not know that $\langle g^m\rangle$ and $\langle g^n\rangle$ are nontrivial. For example, if you take the Klein $4$-group of order $4 = 2\times 2$, with $m=n=2$, and you take $g$ a nontrivial element, then $\langle g^m\rangle = \langle g^n\rangle = \langle g^2\rangle = \langle e\rangle = \{e\}$ is a trivial subgroup. But again, in this case, you get that $\langle g\rangle$ is a subgroup of order $2$ and hence a proper nontrivial subgroup.
So what you are missing is the assumption that $\langle g\rangle = G$, which is the "bad" case (for what you are trying to show). But just one of the two possibilities you are exploring.
Comment: @Vincent: The last part should be "with $\mathbf{k}$ the order of $h$", not $r$.
Comment: O I didn't see your answer because I was busy typing, but it is the same argument
Comment: how do you know that the order of $\langle g^m\rangle$ is a divisor of $n$?
Comment: I'm not sure if it is true in general, but in the case that $g^{mn} = e$ (which is where Arturo makes this claim) then I can answer you. Write $h = g^m$ for simplicity. First note that the order of the group $\langle h \rangle$ equals the order of the element $h$. Let's call this order $k$.
Comment: Second we know, as Arturo writes, that $h^n = e$. Let's do long division and find numbers $q, r$ with $r < k$ such that $n = qk + r$.
Comment: We have $e = h^n = h^{qk +r} = (h^k)^qh^r = e^qh^r = h^r$
Comment: So $h^r = e$, but $r < k$ with $r$ the order of $h$. This can only hold when $r = 0$. But then $n = qk$. This last equation implies that $k|n$.
Comment: @panzershreks: In general, in any group, if $g$ is an element and $g^k=e$, then the order of $g$ divides $k$. Here, $(g^m)^n=e$, so the order of $g^m$ divides $n$.
Comment: @Vincent: In this case we can actually prove that the order is **exactly** $n$, but this is unnecessary to show that the subgroup in question is proper.
Answer: Here is a bit unsatisfactory answer. I'd be curious to hear a more beautiful answer using e.g. Lagrange. Nevertheless, here goes:
Pick a random element $g$, not equal to the identity and look at the group $\langle g \rangle$ generated by $g$.
We know it is not the one-element group because it contains at least two elements: $e$ and $g$ itself.
We are now left with two possibilities. The first one is that $\langle g \rangle$ is not equal to all of $G$. In that case we are done and have a group of the type we were looking for without putting in any effort. This is the unsatisfactory case.
In the second case we have that $\langle g \rangle$ is all of $G$. But we also know that $\langle g \rangle$ is cyclic. It follows that $G$ is cyclic of order $mn$. Now, using cyclicity it is easy to show that the subgroup $\langle g^m \rangle$ has order at most $n$ and hence is a proper subgroup: just write down all its elements!
We have $g^m, g^{2m}, \ldots, g^{nm}$ and we know that $g^{mn} =e$ because $G$ was cyclic of order $mn$ by assumption, so this means that these elements are all the elements of $\langle g^m \rangle$. It looks like that there are $n$ of them, but as you point out in the comments we might have written down the same $k < n$ elements a number of times (actually $n/k$ times, showing that this is a whole number, showing in turn that $k|n$ but we do not really need this). What is not possible is that there are more elements than the $n$ written down here. So the number of elements of $\langle g^m \rangle$ is at most $n$, as claimed.
Finally you might worry that $\langle g^m \rangle$ could still be the one element group in this case, so that $g^m = e$ but then, since $g$ generates all of $G$ by assumption this would mean that $G$ had exactly $m$ elements and hence that $n =1$.
It feels like cheating because the assumption that $g$ generates $G$ does all the heavy lifting, but remember: we could make that assumption because in the alternative, when $g$ does not generate all of $G$, it would be even easier to find a proper subgroup.
Comment: You have that all the elements of $\langle g^m \rangle$ are $g^m, g^{2m}, \ldots, g^{nm}$, but do we know for sure that there does not exist some $k$ such that $1<k<n$ where $g^{km}=e$
Comment: Yes, sorry I should have mentioned that. Suppose that such a $k$ exists, then $g, g^2, g^3, \ldots, g^{km}$ are all the elements in $\langle g \rangle$ so that this group has apparently $km < nm$ elements. So we are back in the first case where $\langle g \rangle$ is a proper subgroup and we are done and don't need to look at $\langle g^m \rangle$ at all. (But of course we are free to look at it as it will provide us with another example of a proper subgroup of $G$. The more the merrier, right?)
Comment: I'll edit to encompass this
Answer: Let $g$ be any non-identity element of $G$. Then the order of $g$ is not $1$ and so is $pk$ where $p$ is a prime and $k$ is a positive integer.
Then $g^k$ has order $p$ and so generates a cyclic subgroup of $G$ of prime order. This is therefore the required non-trivial subgroup.


Getting over lapping guitar sound

Question: I am recording semi-acoustic guitar and vocals at same time in reaper through scarlett 2i2(2nd gen)

Input 1 --guitar
Input 2 --mic

but my mic catches guitar sound too and when I listen to my recording the guitar and vocals overlap. Is there any solution so that I record only vocals through mic without having guitar sound.
Answer: There's no real easy way to achieve this. The two are so close together that total separation is just not possible.
Historically it comes down to two choices...

Record each separately
Live with it.

You can get a slight improvement by using more directional microphones, or by trying to place an absorber between your face & body [uncomfortable & you can't see what you're playing].
After comments, there's a 3rd option.
 3. Use a quieter guitar with pickups. I actually used to do this sometimes with a Line6 Variax set to an acoustic guitar sound - reasonably successfully.
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/50436/discussion-between-dr-mayhem-and-tetsujin).
Comment: Does sound hole cover help to decrease the guitar sound
Comment: Yes, but it will make it sound terrible.
Comment: Is there any other way :(

Getting over lapping guitar sound


Semipermeable swimming nose clips

Question: Is there a solution against nose aches after a lot of swimming?
maybe nose clips, that only let you breathe out and close when you breathe in?
Comment: too much chlorine
Comment: What's the source of the nose aches?
Answer: You can buy nose clips on Amazon, a lot of swimmers use them. I don't know what they are like but from what I read some people use them if they have allergies to chemicals in a pool. That could be the problem you are having?
Here is an excerpt from a good article on the pros and cons of using a nose clip.
Advantages:

If your nose is allergic to pool chemicals (e.g. chlorine), a clip
  might be the solution to keep those chemicals out.

Drawbacks:

Breathing is less efficient because the nose is shut down and the
  overall physical efficiency in the water decreases. You have a greater
  tendency to hold your breath if you wear a nose plug. Holding your
  breath should be avoided as it is better to exhale continuously in the
  water because it keeps the body more relaxed and the stroke more
  fluid. Water might become trapped in the nose and generate snot that
  can't evacuate. That was the case for me and my nose was regularly
  obstructed after a swim practice where I had used a clip.

This is an excerpt from an article talks about the reasons why you could have an aching nose after swimming.

Breathing:
Proper breathing during swimming is essential to help reduce nasal
  congestion and discomfort. If you get water in your nose while
  swimming, try to continually exhale slowly through your nose. When you
  raise your head to breathe, do it quickly between strokes. This may
  feel odd in the beginning, but with practice you will become
  accustomed to this type of breathing. The pressure of the air that you
  exhale prevents water from entering your nose.
Allergies:
Both chlorine and bromine are gases in the halogen family of
  chemicals. Both chemicals are used to sanitize water. Chlorine is less
  expensive and is often used in public pools. Unlike bromine, chlorine
  can tolerate sunlight and is most often used in outdoor facilities.
  Bromine is used for hot tubs and spas because it is easily destroyed
  by sunlight. Bromine does not have the chemical smell of chlorine,
  which acts as irritant that can result in nasal congestion. Both
  chemicals can cause respiratory and skin reactions. They are absorbed
  through your skin, so showering off as soon as you can after leaving
  the pool is important.
Infections:
Inhaled water that lodges in your sinus cavities can cause irritation
  and infection. This condition is known as sinusitis and nasal
  congestion is one of the first symptoms. You are more likely to get an
  infection from ocean or lake water because it is not sanitized and is
  filled with living organisms. If your nasal congestion is accompanied
  by headache, body aches and fever, see your health care provider for
  proper treatment.
Comment: @Ronan are you quoting all that? if so please make it clear, and that's kind of a lot text to copy/paste into an answer.
Comment: In case these links die, what are the pros and cons and what are the reasons for an aching nose after swimming?
Comment: Ok I'll add them to the answer
Comment: Use quotation marks? Yea I Was thinking that I could get rid of some of the less important stuff

Semipermeable swimming nose clips


Position of 20096 in triangular array of all natural numbers

Question: Write the set of all natural numbers in a triangular array as

Find the row number and column number where $20096$ occurs. For example, $8$ occurs on row: $3$, column: $2$
Now, the upper row is obviously of the form $\large f(n) = \frac{n(n+1)}{2}$. Running a computer program I get that at $n=200$, $f(n)$ has the value $20100$.
I used the program to determine the value closest to $20096$. So now I know $20100$ occurs at row:$1$, column: $200$, thus $20096$ can be reached by going bottom-left for five steps? Am I counting right? Should it be row:$5$ , column:$195$?
Also can anyone figure out a less "hacky" way to solve this? Because this solution was completely dependent on finding $f(200) = 20100$ which was completely trial and error, albeit made easier by the fact that I didn't have to do it by hand. Also why exactly are the numbers in the top row of the form of the sum of the first $n$ natural numbers, I can't see a clear connection?
Comment: Your counting is off; you increased row number by $4$, but decreased column number by $5$. It ought to be row $5$, column $196$. Also, why the first row looks like it does is explained by looking at the length of each diagonal on which you place numbers (thinking along the lines of an induction proof won't hurt). Hve you ever heard the term "triangular number"?
Comment: Ah, yes I see. Right. Thanks.
Answer: Let x be the number of the column and y be the number of the row where your number exists. Let z be your number.
As you noticed, you have to find the number n where $f(n-1)\lt z\le f(n)$. Then, n+1 will be the number of the diagonal: $x+y=n+1$.
Then you will have to find out your row: $x=f(n)-z+1$
So for your example: $19900=f(199)\lt 20096\le f(200)=20100$
and $x=f(200)-20096+1=5$.
So $y=n-x+1$. $y=200-5+1=196$
The position is $(x,y)=(5,196)$
Comment: To find the diagonal, you can note that $f(n)=\frac 12n(n+1)$, so $n^2+n-2f(n)=0, n=-\frac 12+\sqrt{1+8f(n)}$, rounding up to the next whole number.  That way you don't have to count through the $n$'s
Comment: that was great thanks.
Comment: Ah, yes that's good @RossMillikan


Is it Good Practice to Sing Saptak while Practicing Bansuri

Question: So far I hadn't seen anyone practice singing Saptak (Sa Re Ga Ma Pa Dha Ni Sa) while practicing Saptak on Bansuri.
Would it be good practice or even a good idea to practice singing alongside playing into Bansuri?
Seems like it would enhance ones lung capacity. Or would singing dilute the Bansuri practice?
I myself am double minded on whether to practice singing the Saptak while practicing Bansuri, or if at all.
On the other hand I notice instructor at Easy Flute School on YouTube (I can post link on request) has solid singing voice, at least when singing Saptak for demonstration purposes.
Answer: Ultimately much base of all instrumental music is also came from "gayaki ang", so its a good practice, also you can practice words when practicing with bansuri, it will help you to make "bansuri sing" rather then to make "bansuri play".
Answer: It is definitely a good idea to practice singing even while learning to play the Bansuri.
One advantage is that it gives you another way to internalise the positions of the notes (swaras), the form of the oscillations (gamakas), etc. It helps build a solid grounding when you have more than one method or tool to master the basics. The different forms of feedback help one to gain a better mental picture or model of the saptak.
In fact, the converse is also true: if one is learning vocal music, then it is often encouraged to learn an instrument side by side, for the same reasons.
Another advantage in your case is, as you mentioned, that it is another way to increase your lung capacity.
So, go right ahead and practice singing the saptak alongside your Bansuri practice! There won't be any dilution in your learning, only an enhancement.

One caveat: each person has a natural range for their singing voice, and it is possible that the pitch of the instrument is very far from the natural pitch of the singing voice. For instance, males typically have deeper voices and females more high pitched. So, it might damage the voice if a male sings at a high pitch for very long periods of time, or if a female sings at a very low pitch for long periods of time. Please take care of this aspect as well. In particular, if you feel a lot of strain in your voice by singing at an unnatural pitch, then please discontinue so that you don't damage your singing voice.


PDF of a distribution with a tuning parameter

Question: I have been thinking about how to approach this problem for a while, and it still seems a little obscure to me. I will really appreciate a detailed answer with relevant Proof. I try to clearly describe it below:

Part A:
In Figure (a) (See below), $X$ is uniformly distributed in the smaller circle. I understand that the pdf is $f(x)= \dfrac{2 x}{r^2}$. Let's call this Case 1.
Now, let's say we modify this distribution, which we call "new distribution" with a "tuning factor," i.e for $0 \leq f < 2$, the pdf becomes
$$\frac{(2- f) r^{1-f}}{R^{2-f}}.$$
Note that with $f=0$ we have the same pdf as in Case 1.

Part B
In Figure (b), $X$ obeys a uniform distribution in the shaded region and $S$ is the area of the shaded region. $\ell(r)$ is the length of any arc $BPQ$. Points $A$ and $B$ are the centers of the intersecting circles with the same radii, respectively.
Distance between point $A$ to $X$ obeys $0 < r \leq R$.
I know the pdf of $r$, i.e. $f(r)$, is given by $\dfrac{\ell(r)}{S}$, which I clearly understand from this question.

My Question:
How does the pdf $f(r)$ change with the new distribution in Part A? In other words, what is the new pdf given the shaded area in Figure (b) and its expectation?
Comment: Hint: if $X$ has the Case 1 pdf, $X^{1/(1-f/2)}$ has the more general pdf in Part A.
Comment: Please, although I voted this up it seems quite unclear to me
Comment: Please make only substantial edits. Bumping the question with pointless edits is noise.
Comment: Thanks @Alex Francisco.  $R$ is the mutual distance between A and B. The new distribution of $X$ in part 2 follows the modified distribution in part 1. So a general pdf which depend on $f$ based on this distribution is what I want to get.
Comment: @Abdulhameed I mean the new distribution of the point $X$, not the distance $r=|AX|$. The new distribution of $r$ is based on that of $X$, which is also omitted in part 1. If you just want the distribution of $r$ obeys some specific new distribution, then the configuration of circle $A$ and circle $B$ has nothing to do with ensuing calculation.
Comment: Yes @AlexFrancisco! The reason for including that detail is that the pdf of $r$ given by $\ell(r)/S$ depends on the area of the shaded region, $S$ i.e in the case for the uniform distribution.
Comment: @AlexFrancisco, that is for the one in Fig(a), the area of intersection of the circle will definitely reflect in the pdf as in [this question](https://math.stackexchange.com/questions/2517888/probability-density-function-for-the-radius-half-the-length-of-two-equal-interse). The main objective for the pdf  is to derive the expectation within the shaded area. Thanks for those clarifications. I have tried to redraw the diagrams also.
Answer: $\def\d{\mathrm{d}}\def\peq{\mathrel{\phantom{=}}{}}$Here is an answer based on one possible interpretation of the question. Denote the tuning factor by $c$ instead.
First, reverse-engineering from the modified density of $r$ in Case 1, the density of the point $X$ can be assumed as$$
f_1(x_1, x_2) = \begin{cases}
\dfrac{2 - c}{2π R^{2 - c}} \dfrac{1}{(x_1^2 + x_2^2)^{\frac{c}{2}}}; & x_1^2 + x_2^2 < R^2\\
0; & \text{otherwise}
\end{cases}
$$
Now for Case 2, suppose the origin is $A$. Assume that $X$ has the above density conditioned to the shaded area $S$. Because in Case 1,$$
p := P(X \in S) = \iint\limits_{(x_1 - R)^2 + x_2^2 < R^2} f_1(x_1, x_2) \,\d x_1\d x_2,
$$
then the density of $X$ in Case 2 is$$
f_2(x_1, x_2) = \begin{cases}
\dfrac{1}{p} f_1(x_1, x_2); & (x_1 - R)^2 + x_2^2 < R^2\\
0; & \text{otherwise}
\end{cases}
$$
Thus the distribution of $r$ in Case 2 is\begin{align*}
&\peq F_r(r_0) = P(\|X\| \leqslant r_0)\\
&= \iint\limits_{x_1^2 + x_2^2 \leqslant r_0^2} f_2(x_1, x_2) \,\d x_1\d x_2 = \iint\limits_{\substack{r \leqslant r_0\\-π < θ \leqslant π}} f_2(r \cos θ, r \sin θ) r\,\d r\d θ\\
&= \int_0^{r_0} r\,\d r \int_{-π}^π f_2(r \cos θ, r \sin θ) \,\d θ = \int_0^{r_0} r\,\d r \int\limits_{r < 2R \cos θ} f_1(r \cos θ, r \sin θ) \,\d θ\\
&= \frac{1}{p} \int_0^{r_0} r\,\d r \int_{-\arccos \frac{r}{2R}}^{\arccos \frac{r}{2R}} f_1(r \cos θ, r \sin θ) \,\d θ = \frac{1}{p} \int_0^{r_0} r\,\d r \int_{-\arccos \frac{r}{2R}}^{\arccos \frac{r}{2R}} \frac{2 - c}{2π R^{2 - c}} \frac{1}{r^c} \,\d θ\\
&= \frac{1}{p} \int_0^{r_0} r · 2\arccos \frac{r}{2R} · \frac{2 - c}{2π R^{2 - c}} \frac{1}{r^c} \,\d r = \frac{2}{p} · \frac{2 - c}{2π R^{2 - c}} \int_0^{r_0} r^{1 - c} \arccos \frac{r}{2R} \,\d r,
\end{align*}
which implies the density is$$
f_r(r_0) = \frac{1}{p} · \frac{2 - c}{π R^{2 - c}} · r_0^{1 - c} \arccos \frac{r_0}{2R}. \quad \forall 0 < r_0 < R
$$

For the degenerate case $c = 0$, since by definition,$$
p = P(X \in S) = \iint\limits_{(x_1 - R)^2 + x_2^2 < R^2} f_1(x_1, x_2) \,\d x_1\d x_2 = \iint\limits_{(x_1 - R)^2 + x_2^2 < R^2} \frac{1}{πR^2} \,\d x_1\d x_2 = \frac{|S|}{πR^2},
$$
then$$
f_r(r_0) = \frac{1}{p} · \frac{2}{π R^2} · r_0 \arccos \frac{r_0}{2R} = \frac{2r_0}{|S|} \arccos \frac{r_0}{2R}.
$$

For $c = 0.5$,$$
f_r(r) = \frac{1}{p} · \frac{1.5}{π R^{1.5}} · \sqrt{r_0} \arccos \frac{r_0}{2R}. \quad \forall 0 < r_0 < R
$$
Here is a figure for $f_r$ and $F_r$:
Comment: @Abdulhameed The "reverse-engineering" part is done like this: since$$\int_0^Rf(r)\,\mathrm dr=\int_0^R\int_{-π}^πf_X(r\cos θ,r\sin θ)r\,\mathrm dr\mathrm dθ,\tag{1}$$ in order to make $f_X$ not depend on $θ$, (1) becomes$$\int_0^Rf(r)\,\mathrm dr=2π\int_0^Rrf_X(r)\,\mathrm dr$$ and it suffices to take$$f_X(r\cos θ,r\sin θ)=f_X(r)=\frac{f(r)}{2πr}.$$
Comment: This looks great! As a proof of correctness, please could you show that when $c=0$, $f(r) = \frac{2r_{0}\arccos(\frac{r_{0}}{2R})}{S}$ where $S= (\frac{2\pi}{3}-\frac{\sqrt(3)}{2})R^2$? I have not been able to do this as I don't properly get the context of $p$
Comment: Also, @Alex, I wouldn't mind if you like to share the "reverse-engineering" process. Much thanks!
Comment: Yes! @Alex Francisco, you integrated over both $(x_1 - R)^{2} + x_2^2 < R^2$? That seems a little unclear to me. Then, if I have other values of $c$ where does it change (where do I manipulate) in the integral. Very much Thanks
Comment: @Abdulhameed This means the area of the double integration is that determined by this condition, i.e. the area is $\{(x_1,x_2)\in\mathbb R^2\mid(x_1-R)^2+x_2^2<R^2\}$. For different $c$, the integrand is different because $f_2$ has $c$ in its expression.
Comment: Thank you so much for the answer. Please, at your convenience, for my benefit and others please show us an example with an arbitrary value of $c$ say $2$ or $3$ etc. Its a pleasure seeking clarifications from you. I am eligible to award the bounty in 6 hours time.
Comment: You answer is quite intuitive and well organized! Although, for $f_r$ you have shown. But peculiarly, steps on how we can get specific expressions given some $c$ (like you said). $E(r)$ would also be applauded! Many thanks
Comment: The application of this is that, $c$ determines how close the distribution of points would be within that area! That is why it would be very nice to see how to apply this using the expressions you have derived. Many thanks!
Comment: @Abdulhameed Well, the expression of $f_r$ is already given in the answer. Also, it seems that $E(r)$ has no closed form.
Comment: Thanks for the response. You haven't mentioned anything about the case where $c$ is other than $0$. Just to see how $(x_1^2 + x_2^2)^\frac{c}{2}$ fits into the picture. And that's all!
Comment: Please, what value did you use for $p$ ?
Comment: @Abdulhameed I didn't calculate $p$. The normalization is done by the graphing program.
Comment: Please I haven't been able to understand and follow your answer to this question line by line . If you don't mind could I request for the following: (1) The use of (${x_1}^2 + {x_2}^2) ^ {\frac{c}{2}}$ is not very clear to me, (2) The inclusion of $f_x(r \cos \theta, r \sin \theta)$ and the first two lines of the reverse engineering process.  Also, could you refer me to a reference material to understand this concept better. I will be so glad.
Comment: Thanks, you haven't mentioned anything about a suitable reference. Please if you don't mind could I request for the code for the graphs? Thanks


Find the number of composition series of D24 (with 24 elements)

Question: I got this question and trying to find a way that is not fully brute force.
I found a composition series which is of length 4, so i know they are all of length 4. looking at the divisors of 24 we have $1,2,3,4,6,8,12,24$. so the corresponding sizes, by Lagrange's theorem can be:
Case 1: $1,3,6,12,24$
Case 2: $1,2,4,12,24$
Case 3: $1,2,4,8,24$
From here on I'm stuck. I can't see anything by brute force finding almost every subgroup of $D24$. Is there a better way? or maybe finding subgroups isn't too hard?
Thanks!
Comment: Use that $G/N$ is abelian if and only if $G' \subseteq N$. So the possible penultimate terms of a composition series of $G$ correspond to the maximal subgroups of the abelian group $G/G'$. If you have found such a penultimate term $N$, go on by considering $N/N'$ and so on...
Comment: Btw: A composition series consisting of five subgroups has length four. You have to count the number of inclusions, not the number of subgroups.
Comment: Thanks for the comment and correction. i actually didn't study the derivative group yet, so should do it somehow without using it.
Answer: $\newcommand{\normal}{\trianglelefteq}$
I think there's a nice recursive way of decomposing $D_n$ (I'm going to use this notation to mark the group with $2n$ elements) when $n=2^k \cdot p$ for some prime $p$ (which is your case for $n=12$). Let $D_n = \left<\rho, \varepsilon \right>$ where $\rho^n=1$ and $\varepsilon^2=1$. If $n$ is even then $N=\left<\rho^2,\varepsilon\right>$ is a normal subgroup as it has index $2$. For the same reason, this shows that the quotient group is simple.
Next, you can show that $N_1 \cong D_{n/2}$. Now you continue in the same manner until you get $N_k \cong D_{n/2^k}=D_p$. At this point we know that $p$ is prime, and you can check that the normal subgroups are $\left<\rho^d \right>\cong \mathbb{Z}_{n/(2^k\cdot d)}$ for any $d \ | \ n/2^k=p$, thus the only proper normal subgroup is $\left<\rho\right> \cong \mathbb{Z}_p$, which finishes the composition series, since the next subgroup must be $\{1\}$.
This gives you one possible composition series, in your case it is:
$$\{e\}\underset{\mathbb{Z}_3}{ \normal} \mathbb{Z}_3  \underset{\mathbb{Z}_2}{ \normal} D_3 \underset{\mathbb{Z}_2}{ \normal} D_{6} \underset{\mathbb{Z}_2}{ \normal} D_{12}$$
and you can simply check the permutations of the quotient orders to see if you have other possibilities
Comment: Much thanks! regarding the last part, the permutations of the quotients is reflected in the 3 cases.. the problem is how do i know how much series exist for each case.. you showed an example for case 1, i found another one with the cycle of rotations subgroup of order 12. how do i know if there are more? i know whenever i have a cyclic group it's quite easy. but for example i have the problem: how many subgroups of order 8 are there, and for each one how many subgroups of order 4, and etc.. seems impossible
Comment: Write down all the normal subgroups of $D_n$, there aren't a lot (note that they differ if $n$ is odd or even). Then you cam simply check all cases at each step in the series.
Comment: I see. but for example i want to find all normal subgroups of order 12, which means all subgroups of order 12, i found two and it seems like there are no more, how do i prove it? i thought that maybe i can go over all pairs of elements and singletones and look at the groups they generate, but also seems like too much work. is this they only way?
Comment: Use the fact that normal subgroups are unions of conjugation classes. Think about the form of conjugacy classes in $D_n$, they are pretty "well" ordered. Once you have those written down (again, they differ for odd/even $n$) think about the size of the subgroup induced by taking various unions, you'll see that there aren't a lot of options.


windows forms MSN Messenger Login

Question: Ive got a basic questions about windows forms, im designing a app in visual c# express, It needs a login, heres where im stuck,
Take msn messenger loads up and you get the use/pass prompt, put the details in and then you get your contacts,
How would you replicate something like that
in the simpilist form is this 2 seperate forms? ie a login form and a contact form? or is this one form with dynamic controls? etc
Comment: In its simplest form, it would be 2 yes. You'd load the application showing the login screen, they'd enter their details and then you'd authenticate them. Once that's successful, you load the main form of the application. EDIT: Putting this as a comment as I'm sure someone can give you a more elegant solution overall.
Comment: Thanks, im coming from a php/html background so im not clued on winforms atall, in your opinion, Im going to go back to msn messenger here but whe you sign in msn keeps the same height width and screen position as the login, is this possible using two forms?
Comment: You should be able to set the height, width, and screen position of the form to match the login form when it loads. I'm work primarily in web apps, so I'd be a little rusty in trying to provide code simples for win forms. But it's definitely possible.
Answer: Since no one else has posted an answer yet, I'll go ahead and move my comments to here. Hopefully someone can provide more insight still.
In its simplest form, it would be 2 yes. You'd load the application showing the login screen, they'd enter their details and then you'd authenticate them. Once that's successful, you load the main form of the application.
You should then be able to set any options on the second (main) form when you show it, such as its height, width, or screen position as desired.
As a reference and possible starting point on opening one form from another, check out this question: Open Form2 from Form1, close Form1 from Form2
Hopefully that'll help get you started.
Answer: This is what I'd suggest:

Have a central form in your application, you could call it "frmMain" for-the-purpose-of-discussion, and ensure that this form is the first thing that loads up on application start-up -
Program { Main() { Application.Run(frmMain()); } }
Next, define a central app-level properties management class, FTPOD - "AppProperties"
Define, configure and manage the logged in users' entity in this class
This is so that, if the user is logged in then the details like login-name, id, email address, etcetera can be easily accessed at any time in the application life-span i.e., from any form
Have a method in this class to check whether a user is logged in or not, FTPOD - "IsUserAuthenticated"
Now when the Form_Load event of the "frmMain" is invoked, check if the user is logged-in
If not then open a new form for requesting the user for login credentials, FTPOD - "frmLogin"

``
<code>frmLogin login = new frmLogin()
login.ShowDialog(this);
login = null;
</code>

Manage your authentication/login logic in this form ("frmLogin"), or as relevant in its business logic
Upon successful authentication, set the users' entity in the "AppProperties" class and then close the from
Then from the "frmMain" class (once authenticated) open your main functioning form

windows forms MSN Messenger Login


Why Dimension applied to one table influences both JTables?

Question: I have 2 JTables, both placed in their own FastScrollPanes, and them scroll pane placed into JPanel and then they both are placed into JPanel. I put different objects as the parameters in .setPreferredScrollableViewportSize(dimensionPrameters), however, both tables tend to have the same size.
How I can make them fully independent on each other?
The code:
Dimension dimensionPayments = new Dimension(600, 60);

table1.setPreferredScrollableViewportSize(table1.getPreferredSize());
table2.setPreferredScrollableViewportSize(dimensionPayments);

FastScrollPane fastScrollPane1 = new FastScrollPane(table1);
fastScrollPane1.setAlignmentX(JComponent.LEFT_ALIGNMENT);

FastScrollPane fastScrollPane2 = new FastScrollPane(table2);
fastScrollPane2.setAlignmentX(JComponent.LEFT_ALIGNMENT);

firstPanel.add(fastScrollPane1);
firstPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS));

secondPanel.add(fastScrollPane2);
secondPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS));

allPanel.add(firstPanel);
allPanel.add(secondPanel);

In the image the effect I'm trying to avoid is encircled.
In order to get minmal reproducible example, please check the below code:
import javax.swing.*;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.MaskFormatter;
import java.awt.*;
import java.awt.event.*;
import java.text.ParseException;

public class CfgTrafficProvidersBoxTest extends JPanel {

  private static final long serialVersionUID = 1500904348023955658L;

  private JTable changeTrafficProviderTable;
  private JTable changeTrafficProviderPaymentsTable;

  private final String PRICE_FORMAT = "#.####";

  public JButton addBtn;
  public JButton addPaymentBtn;
  public JButton saveBtn;
  public JLabel addTrafficProviderServiceLabel;
  public JLabel addTrafficProviderPaymentLabel;
  private long editId = -1;

  CfgTrafficProvidersBoxTest() {
    createGUIElements();
  }

  public void createGUIElements() {

    JPanel allAndSavePanel = new JPanel();
    allAndSavePanel.setLayout(new BoxLayout(allAndSavePanel, BoxLayout.Y_AXIS));

    JPanel allPanel = new JPanel();
    allPanel.setLayout(new GridLayout(0,1));

    JPanel firstPanel = new JPanel();
    firstPanel.setLayout(new GridLayout(0,1));
    firstPanel.setAlignmentX(JComponent.LEFT_ALIGNMENT);

    addTrafficProviderServiceLabel = new JLabel("Add Service");
    addTrafficProviderPaymentLabel = new JLabel("Add Payment");

    firstPanel.add(addTrafficProviderServiceLabel);
    allPanel.add(firstPanel);

    JPanel secondPanel = new JPanel();
    secondPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS));
    changeTrafficProviderTable = new JTable();
    changeTrafficProviderTable.setModel(new TableModel()  {
      @Override
      public int getRowCount() {
        return 0;
      }

      @Override
      public int getColumnCount() {
        return 6;
      }

      @Override
      public String getColumnName(int columnIndex) {
        return "name"+columnIndex;
      }

      @Override
      public Class<?> getColumnClass(int columnIndex) {
        return String.class;
      }

      @Override
      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return true;
      }

      @Override
      public Object getValueAt(int rowIndex, int columnIndex) {
        return "aa";
      }

      @Override
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {

      }

      @Override
      public void addTableModelListener(TableModelListener l) {

      }

      @Override
      public void removeTableModelListener(TableModelListener l) {

      }
    });

    JScrollPane fastScrollPane = new JScrollPane(changeTrafficProviderTable);
    fastScrollPane.setAlignmentX(JComponent.LEFT_ALIGNMENT);

    secondPanel.add(fastScrollPane);
    secondPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS));

    Dimension dimension = new Dimension(600, 20);
    Dimension dimensionPayments = new Dimension(600, 60);

    changeTrafficProviderTable.setPreferredScrollableViewportSize(dimension);

    addBtn = new JButton("X");
    addBtn.setAlignmentX(JComponent.RIGHT_ALIGNMENT);
    secondPanel.add(addBtn);

    allPanel.add(secondPanel);

    saveBtn = new JButton("SAVE");
    changeTrafficProviderTable.setCellSelectionEnabled(false);
    changeTrafficProviderTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

    JPanel thirdPanel = new JPanel();
    thirdPanel.setLayout(new GridLayout(0,1));
    thirdPanel.setAlignmentX(JComponent.LEFT_ALIGNMENT);

    thirdPanel.add(addTrafficProviderPaymentLabel);
    allPanel.add(thirdPanel);

    JPanel forthPanel = new JPanel();
    forthPanel.setLayout(new BoxLayout(forthPanel, BoxLayout.X_AXIS));

    changeTrafficProviderPaymentsTable = new JTable();
    changeTrafficProviderPaymentsTable.setPreferredScrollableViewportSize(dimensionPayments);
    changeTrafficProviderPaymentsTable.setModel(new TableModel()  {
      @Override
      public int getRowCount() {
        return 1;
      }

      @Override
      public int getColumnCount() {
        return 6;
      }

      @Override
      public String getColumnName(int columnIndex) {
        return "name"+columnIndex;
      }

      @Override
      public Class<?> getColumnClass(int columnIndex) {
        return String.class;
      }

      @Override
      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return true;
      }

      @Override
      public Object getValueAt(int rowIndex, int columnIndex) {
        return "aa";
      }

      @Override
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {

      }

      @Override
      public void addTableModelListener(TableModelListener l) {

      }

      @Override
      public void removeTableModelListener(TableModelListener l) {

      }
    });

    JScrollPane fastScrollPanePayments = new JScrollPane(changeTrafficProviderPaymentsTable);
    fastScrollPanePayments.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    fastScrollPanePayments.setVerticalScrollBar(fastScrollPane.getVerticalScrollBar());
    forthPanel.add(fastScrollPanePayments);

    addPaymentBtn = new JButton("XX");
    addPaymentBtn.setAlignmentX(JComponent.RIGHT_ALIGNMENT);

    forthPanel.add(addPaymentBtn);
    allPanel.add(forthPanel);

    allAndSavePanel.add(allPanel);
    saveBtn.setAlignmentX(Component.LEFT_ALIGNMENT);

    Box b = Box.createHorizontalBox();
    b.add(saveBtn);
    b.add(Box.createHorizontalGlue());
    allAndSavePanel.add(b);
    this.add(allAndSavePanel);
  }

  public static void main(final String[] args) {
    final JFrame frame = new JFrame();
    frame.getContentPane().add(new CfgTrafficProvidersBoxTest());
    frame.pack();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    SwingUtilities.invokeLater(new Runnable() {

      @Override
      public void run() {
        frame.setVisible(true);
      }
    });
  }

}

and the image:

note
Dimension dimension = new Dimension(600, 20);
Dimension dimensionPayments = new Dimension(600, 60);

applied to both different tables
  [1]: https://i.stack.imgur.com/X3BFk.png

Comment: Personally, I wouldn't be messing with the `preferredSize` of the `JScrollPane`, but would, instead, consider overriding the `getPreferredScrollableViewportSize` of the `JTable`.  It's also likely an issue with the layout manager of `allPanel`, but we're missing a lot of context, it's also possible that `FastScrollPane` could be doing something, but since it's a non-standard component, that's just guess work
Comment: *How I can make them fully independent on each other?* - they should be unless the layout manager makes them the same size. We don't know what the layout manager of the "allPanel" is. Some comments: 1) Typically you set the layout manager BEFORE you add components to the panel.  2) Why are you creating a separate panel just to add the scroll pane to the panel? 3)  Why are you specifying the "secondPanel" as a parameter when creating the BoxLayout for the "firstPanel"? I've never seen a panel shared by multiple layout managers like this before. Post an [mre] demonstrating the problem.
Comment: Still waiting for the [mre]. Your question is about the size of two tables. So create a simple example with two table where each has its own size. Once that works then you add the other components. Simplify the logic so you understand how the layout managers work. Having a table and a horizontal button doesn't affect the vertical height.
Comment: @camickr 2) is done for add + button, but this button is ommited from the sample code
Comment: @camickr let me prepare
Comment: @camickr I have prepared the example not depending on internal classes, just pure swing
Answer: No idea why the code implements TableModel. For a simple example it is one statement to create a TableModel. Just use
table.setModel( new DefaultTabelModel(1, 5) );

Also, no idea why you create a panel to hold each label. You stated in your comment you need a panel because the table has a button on the right. Well, the label doesn't have a button so there is no need for the panel. Keep the code simple. It is too hard to keep track of all then unnecessary panels that you have created.

however, both tables tend to have the same size.

This is your basic code:
JPanel allPanel = new JPanel();
allPanel.setLayout(new GridLayout(0,1));

....
allPanel.add(firstPanel);

...
allPanel.add(secondPanel);

...
allPanel.add(thirdPanel);

...
allPanel.add(forthPanel);

The allPanel uses a GridLayout. The GridLayout will make all components the same size. So the size of each component will be the size of the largest table.
This is also why you have space between the labels and the tables.
Don't use a GridLayout. Instead use a vertical BoxLayout or a GridBagLayout.


Omega 4: Export settings to .info

Question: I'm sure its a simple question but i cannot find any resource to the solution.
In Omega 4, i keep getting this message "The settings for this theme are currently served from a variable. You might want to export them to your .info file".
So how do i do that?
Answer: drush omega-export
drush omega-revert
or
omega-export --revert
See: http://friendlymachine.net/posts/getting-started-omega-4
Answer: I don't have drush on my machine (issues with installation), so i copied theme-settings from Omega and placed it in to the sub-theme and then opened it in Notepad++ and copied and replaced with my new theme name. That message has now gone.
Answer: you have to run  'drush omega-guard' and the error will desapear
Comment: omega-guard is for watching SCSS files

Omega 4: Export settings to .info


Assigning a value of a promise to an object method

Question: Consider this object i'm creating.
$scope.formules = {};
$scope.formules = {

    label: 'some label',
    getYear: function() {

        // getData() is a promise
        $scope.getData().then(function(){

            // Some code to get the right data

            return someData;

        }.catch(function () {
         $scope.error = 'bad error';

    }

}();
}

At this point, getYear is undefined, obvious because i have to do a second return.
$scope.formules = {};
$scope.formules = {

    label: 'some label',
    getYear: function() {

        // getData() is a promise
        $scope.getData().then(function(){

            // Some code to get the right data

            return someData;

        }.catch(function () {
         $scope.error = 'bad error';

    }

    return $scope.getData();  //Putting the second return here

}();

or a shorter way could be this:
$scope.formules = {

    label: 'some label',
    getYear: function() {

        // getData() is a promise
        return $scope.getData().then(function(){ // Or putting the second return here.

            // Some code to get the right data

            return someData;

        }.catch(function () {
         $scope.error = 'bad error';

    }

}();

again this is not the right way because the second return just returns the promise so my method getYear contains a promise now, not the right way to do this.
last try:
$scope.formules = {

    label: 'some label',
    getYear: function() {

        // getData() is a promise
        return $scope.getData().then(function(){ // return the $scope.getData()

            // Some code to get the right data

            return someData;

        }.catch(function () {
         $scope.error = 'bad error';

    }

}().then(function(data){ return data; });

Now i run out of luck and ideas, console.log($scope.formules) shows me again that getYear is a promise, and won't give me the value.
Note: If i do console.log(data) instead of return data; i do get the value that i would like to bind to the method.
What am i doing wrong here, what is the right way to bind the value? Stack & Google did not gave me any answer...
EDIT
Here is the actual code that i use inside the method:
getYear: function ()  {

    $scope.measure = value.formules_total_year;

    $scope.getCube().then(function(test){

        var totalRatioData = [];

        for (var i = 0; i < $scope.tempData.length; i++){

        totalRatioData.push($scope.tempData[i][1].qNum);

    }

    return totalRatioData;

})

}(),

$scope.tempData is an array of 5 arrays. [Array[2], Array[2], Array[2], Array[2], Array[2]] and in those 5 arrays you have 2 objects
0: Object
    qElemNumber: 0
    qNum: 2009
    qState: "O"
    qText: "2009"
    __proto__: Object
1: Object
    qElemNumber: 0
    qNum: 225632.21000000002
    qState: "L"
    qText: "225632,21"

What i want as you see in this edit is a new array of all the qNum's of the last object of the 5 arrays and assign this array to getYear.
Comment: Where do you want to bind the values to? You can just do the assigning in the callback: `$scope.formules.years = someData;`
Comment: Stackoverflow give answer of every question. if you find proper string
Comment: What you're trying to do is not possible. You should show us what problem you're trying to solve with thaht `getYear` method.
Comment: Why are you trying to call an object? `$scope.formules = {
...
}();`
Comment: @hansmaad - See my edit above.
Comment: @nils i do not try to call an object. there was a brace missing, fixed it now. What i do now is call a method so it is invoked immediately
Comment: This does not help. Explain what you want to do with the result of `getYears` and how and where you want to call it.
Comment: Well basically what i want is an object where there are other objects inside i.e. `$scope.formules { label1: {label: "label1", getYear: [1, 3, 5, 2]}, label2: {label: "label2", getYear: [2.8, 2, -7, 9]}, ... }` so in my view i can do `ng-repeat="(forms in formules)"` and get this data publishes with `{{ forms.label }}` and `{{ forms.getYear }}`
Comment: `$scope.getCube().then(function(test){...}` but the data `test` is not used, Why?
Answer: it's a bit hard to understand what you finally want to achieve and why you're "bundle" all the $scope assignments in your getYear() function. It looks to me, like you're trying to return a async value (totalRatioData) synchronous. the point here is, that this is not possible with es5. es7 will provide a new method called "await" which would enable that.
if you want to use the value of getYear on your view, just pass the value of the promise to your view model ($scope variable).

// init ctrl
$scope.year = null;
_initYears();

function _initYears() {

  $scope
    .getData()
    .then(
      function() {

        var totalRatioData = [];

        for (var i = 0; i < $scope.tempData.length; i++){

          totalRatioData.push($scope.tempData[i][1].qNum);

        }

        // assign data to year
        $scope.year = totalRatioData;

      }
    )
  ;
}

if you're using ui-router, I would suggest, to place your promise in the desired section of your state config to ensure it's resolved, before the state is activated.
hope that helps
Comment: Well for me it is not that simple to explain what is happening but basically i have a database where there are 54 formules inside. These formules are calculations that i can send to another program through web sockets. That program answers with an array of values. See the EDIT in my question. You could say i just want to group all the response in one object, whyle the program sends back multiple arrays.
Comment: do you use multiple service calls to get all the data required for your response object? if so, you can also group the promises of all calls and resolve them tougether with $q.all([promise1, promise2, promise3, etc.]).then(.... and then create your response object inside of your success callback
Answer: You should not call for data inside your scope properties but in the controller.
function myController($scope, someService) {
    $scope.formules = { label : 'label' };
    someService.getData().then(function(data) {
      $scope.formules.year = getYear(data);
    });
}

Then bind to scope properties


Derivation of the Mann Whitney U normal approximation

Question: The normal approximations for the Mann Whitney U statistic are given by wikipedia but there are no refrences mentioned. What are the actual derivation steps of the untied and tied case approximations? I´m interested in this mainly for learning purposes.
Answer: Mann and Whitney (1947) (the reference in the first note in the Wikipedia article) derive the mean and the variance of the U statistic and prove that the limiting distribution is normal (see section 4) by showing that all the even moments of the standardized statistic converge to those of the normal distribution. (The odd central moments are all zero.)
[Showing convergence to the normal moment sequence would not be sufficient if the mgf didn't converge in a neighborhood around zero, but for the normal it does.]


Float equivalence of 1.0E7

Question: From an api I getting a float value 1.0E7, but what exactly api trying to send is 9999999.99. As it is using float data-type to send the this value, rounding will happen automatically in api's host side only, and finally what I am receiving here is 1.0E7.
Is there any way for me to change 1.0E7 to 9999999.99
Comment: No. The data is lost in the conversion to float.
Comment: This is the API problem, not yours ... You can't fix this safely.
Answer: if the rounding happens in the other side the answer is NO.
if you have access to the code you could try the strictfp to ensure floating point portability.

Float equivalence of 1.0E7


Are large displays bad in a recording studio?

Question: The other day I visited a friend's home studio, and I noticed the computer was hooked up at a quite small display. Probably 19 inches, maybe even 17.
I asked why, and my friend said that a larger display would create unwanted echoes and reflections, and that you would never find a serious studio with large things, including large displays.
Is this true? I can't seem to find any information on this. I also find it hard to believe that if this were true, display manufacturers haven't come up with materials to make large displays without these unwanted effects.
Is there any hard data on this?
Comment: @ToddWilcox: I happen to work for a company which makes large-format mixing consoles (although they're typically found more in TV facilities, OB trucks, stadiums, and theaters, not in studios), and now I have this image in my head of our next product being an anechoic desk coated with wool.
Comment: As your friend if you will ever find a serious studio with a large mixing console.
Comment: I'm voting to close this question because it would be suitable on Sound SE site.
Comment: @user1079505 There's enough crossover that it's highly likely you'll get good answers (and answers have proved this).
Comment: To clarify: this site gathers primarily musicians, and not necessarily sound engineers, therefore answers to this question are likely to be opinion based or not properly justified, and the community would not be able to verify the correctness of the answer.
Comment: This forum is full of questions about acoustical science and sound engineering. The former is lumped under music theory and the later in music "practice."
Comment: Couldn't you just tape a few egg cartons on the back of the big monitor and then problem solved?
Comment: @michael curtis: this is not me, but my friend. I think he meant the front of the computer screen, not the back...
Answer: And 87% of statistics are made up on the spot too ;) I've never heard such tosh. In a home studio the least of your worries is going to be reflections from a couple of screens. What about the windows, or the hard parallel walls & ceiling?
Even a properly-designed control room has a myriad hard surfaces - the desk, for instance… & the window through to the studio…
or what about a vision mixing facility?
Examples pretty much at random…

I have a pair of 27" screens in my own studio. I'd have more but I don't have the space. Trying to do a full mix in a single tiny screen is like trying to decorate your hallway through the letterbox.
Comment: Mix automation was previously done by sacrificing one of your precious few 24 tape tracks & you had to drop it in & out of record like audio to update the mix. The early SSL 'total recall' [which meant the tape op had to come in an hour early to move all the knobs to match the pictures on the TV screens] was the new height of sophistication. Life's changed a bit in the subsequent decades ;)
Comment: Three chairs for Herman Miller - hip, hip… It's part of the client schmooze, posh chairs in the advertising - bet they rented them for the shoot ;)) Those three chairs cost more than my dynaudios.
Comment: Oh I get it. You meant big for the 80s and bigger than small for the 80s. And also editing things other than digital audio (MIDI, patches, sequences, etc). You could have included a Slate in the photos, that would drive the point home about large screens in the control room pretty well.
Comment: Yeah I put a lot of sequences into a Korg M1 and also one of the first versions of Cakewalk when it was MIDI only. These days things have come around again and I have a Model D reissue, a DFAM, and a Prophet 6 so patch sheets (in an iPad at least) and tedious hardware sequences are sometimes part of my workflow.
Comment: In the 80s? For film editing, I'm assuming? Pro Tools wasn't released until 89, although there were other digital NLEs available in the 80s, I had thought most rock, pop, and related genres were done analog in the 80s. Also, large screens didn't even exist in the 80s, unless it was projected.
Comment: @ToddWilcox - the letterbox comparison first came came from editing early 80's synths with teeny onboard screens, the DX7 was the first I can recall to have that type of hopelessly small screen, my earlier Chroma [80?] you had to have a map pinned on the wall. I first used the DX7 in 83 [yes, the year before release, ours didn't have midi]. We were using Atari sequencers by the mid 80s, then those same computers had editors for things like the DX7. A 12" screen was big for its time, in comparison. By the late 80's we were using SSL & Harrison desks which had a pair of possibly 21" screens...
Comment: After a brief excursion with an SE30 & its small screen, early 90's, I've had dual displays ever since, various 21/22" CRTs for the first 15 years, flat 27s ever since.
Comment: Three Herman Miller chairs in that first photo!
Comment: @ToddWilcox - yeah, when I started with synths we wrote patches down on bits of hand drawn then photocopied paper of the settings dials & sliders;) Synths with memories were yet to come, let alone ones with display screens. Actually usable sequencers with monitors came a little after that. I once spent an entire night - whilst the rest of the band, engineer, producer & tape-op all buggered off for a meal & watch a gig - pushing buttons… note..note.. … rest… note… rest...note…  in a sequencer, some early 80s hardware monstrosity I never cared to see ever again in my life ;)
Comment: @ToddWilcox - that's quite funny, because I always think of the M1 as being about the last synth I ever bought;) Used it a lot but never sequenced in it because we had Pro24 by then [if not Cubase, not sure of my years on that one]. After that I kind of took a decade off working for Yamaha so basically used most of what they were making & by the time I came back we were starting to see soft synths.
Comment: Did you just make up that "87%" on the spot? Just joking :-)
Answer: I feel like most non-home studios—and I suppose any home studios that can manage it—put everything "engineer-facing" in a separate room from the actual mics. Computers, mixing board, screens, etc. I imagine the biggest reason for this is to get the noise they might generate out of the recording space. Computer fans hum; some screens even have fans or generate high-pitched frequencies or electrical interference. You also give the engineer and other "onlookers" a place to exist without holding their breath or sitting absolutely motionless.
Ironically, these rooms are typically on the other side of a giant plate-glass window, providing a much larger hard flat place than any screen. I suppose some could provide some kind of treatment, like a curtain that pulls back and forth over the window, but I've never witnessed such a thing. I've also seen studios that, while they treat many hard surfaces (rugs on the floor, curtains on the wall), leave areas larger than a screen untreated. And my anecdotal experience, as an amateur, is that 100% perfect mic placement in a 90% perfect room is 1000% better than the opposite.
Comment: Concerning studio window, they are typically mounted at an angle, to avoid parallel surfaces. So yes, people do care about it.
Comment: @ToddWilcox Wow, I just assumed the OP's friend's concern was about the effect on the recording, not the playback! Maybe it's just because I ain't one, but I have a hard time imagining an engineer being like "Yeah, I use this 10-inch screen to preserve the delicate acoustics of *this booth*!"
Comment: @AndyBonner To be sure, the acoustics of the control room are super important. You have to know what you're hearing. Early reflections from mixing consoles have been a concern for decades, but there's not a lot to be done about it. Most people focus on eliminating other early reflections. One thing about large displays is that they are usually not located in a place where they would create bad ERs. Between the monitors is relatively "safe". You may notice mastering suites with much more attention paid to hard surfaces and of course no console.
Comment: I assume the unwanted reflections are for the engineers ears, not the mics. And the largest surface that creates low-quality early reflections between the speakers and the engineer has always been the mixing console. But the engineers and producers just deal with it, because getting rid of the console would not be worth the tiny sound quality benefit.
Comment: Mixing consoles tend to not be made of large panes of glass....
Comment: @user1079505 And often, it's 2 windows mounted at different angles to each other, leaving a trapezoidal space between them, wider at the top and narrow at the bottom - and the windows themselves are usually double paned, and may have thick dampening rubber around the edges, more than you'd see on just a regular exterior window for insulation.
Answer: There are plenty of counter-examples in pictures on other answers. But I think it's important to go back to refute the OP's friend's misconception directly.
He says that large flat surfaces cause reflections. As far as that goes, it's kind of true. What he's missing though is that reflections have to come from somewhere. His monitors are firing forwards, so the sound as it leaves the speaker isn't going to reflect off the screen, and everything is good.
In order to reflect off the screen, the sound would first have to bounce off the rear wall, then off the screen and back. If there are substantial reflections off the rear wall though, the small extra reflection off the screen is insignificant compared to the much larger reflection off the rear wall. In that case, what needs fixing (and urgently if he's doing mixes) is the rear wall with some appropriate panels in appropriate places. At which point there's no longer anything reflecting back towards the screen, and everything is good again.
In short, the OP's friend has (mis)heard something semi-relevant but hasn't actually understood it even slightly. He's simply doing a Cargo Cult thing without knowing what's happening or why, and it'll be just as effective as a Cargo Cult's bamboo model of a radio.
Comment: The truth is, acoustics is one of the [many] places where we're susceptible to pseudoscience, placebo perception, and "but-somebody-told-that" wives' tales. And especially when we're talking about armchair acousticians! "I always throw a pinch of salt over my left shoulder because it disperses the fundamental bass frequency..."
Answer: Search for "Hans Zimmer studio" and look at the pictures. As a film composer, he is pretty much surrounded by large monitors. If it doesn't bother him, I wouldn't worry about it myself.
Comment: Except that every Hans Zimmer song has a persistent background hum. It's his trademark sound, I just never realised it was caused by all those monitors behind him
Comment: ... although do note that composers will probably have setups optimized differently than those of recording studio engineers.
Answer:
larger display would create unwanted echoes and reflections ?

True !
Of course, as Tetsujin writes, like any other surface in the field of the sound source(s) would.

you would never find a serious studio with large things, including
large displays.

Because reflections also depends on the volume of the room, I presume this will be true for small sized serious studios only.
Then as with any other parasitic source of whatever, the question being : How much do you care ?
I can understand that if you spent a lot, sacrificed the esthetics of your home, in order to build a truly anechoic chamber, you'll be reluctant to spoil your work with whatever object.
Because the unwanted effects of most reflections can be significantly diminished changing the position and orientation of objects, the larger the screen is, the more difficult changing position and orientation is. This is the reason why I personally prefer several "small" screens to a big one.
After all, and as usual in so many disciplines impacted by parasitic effects, everything depends on the way you work :
Either you invest a lot in upstream work (building the theoretical idealistic studio) which needs a good knowledge in physics, and you even don't need any screen at all or…
You invest a lot in post-processing since everything including fine denoising can finally be achieved that way.
You'll then need a good knowledge of the available plugins, a fair knowledge in computer programming, strong processing power... and… big screens.


Countably dimensional Hilbert Spaces?

Question: I have seen a simple proof that no Banach space over $\mathbb{R}$ can be of countably infinite dimension.  However since the space of all square integrable functions on the unit interval forms a Hilbert space, and all Hilbert Spaces are Banach, this space must not be of countable dimension.  However we know that each point has a unique decomposition as a sum complex exponentials $e^{2n\pi}$ were $n\in\mathbb{Z}$.  Thus these complex exponentials form a basis.  But since there is a countable number of such exponentials there must be a contradiction.  Where is that contradiction?
Comment: Basis $\ne$ Schauder basis. You're talking about a countable Schauder basis for the space; it's not a basis, since you allow infinite sums.
Comment: Better to say "Hamel basis $\ne$ Schauder basis".  A mathematician will use "basis" by itself for his favorite one.
Answer: The unique decomposition is as an infinite combination (series) of the complex characters, while a linear basis is a set of vectors such that any element of the space can be expressed as a finite combination.
The set $B$ such that any element of the space $V\supseteq B$ can be uniquely expressed as an infinite combination of elements of $B$ is called Schauder basis, as indicated by Brian M. Scott in the comment, as opposed to linear basis, usually called Hamel basis in functional analytic contexts.
For any cardinal number $\kappa$, there is a Banach space with a Schauder basis of cardinality $\kappa$ -- the Hilbert space of Hilbert dimension $\kappa$, for instance, but none of them have linear dimension $\aleph_0$.

Countably dimensional Hilbert Spaces?


android - Why is ImageView canvas black?

Question: I'm new to android graphic so hold on to your hats!
The screen is black whatever i do.
I draw a circle and i draw bitmap and noting shows.
Here is xml,code and a picture showing my screen.
Im thinking i have to set the size of the ImageView maybe that's why it's black??!
R.layout.main1
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<com.hasse.move.DrawView
    android:id="@+id/mainView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:background="#00FF00"
    android:adjustViewBounds="true"

  />
   <RelativeLayout
    android:id="@+id/InnerRelativeLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" >
   <EditText
    android:id="@+id/edittextaddtext"
    android:layout_width="fill_parent"
    android:layout_toLeftOf="@+id/btnsave"
    android:layout_height="wrap_content"
    android:text="wrap"
   />
   <Button
    android:id="@+id/btnsave"
    android:layout_alignParentRight="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="save"
   />
   </RelativeLayout>
 </RelativeLayout>

DrawView class
public class DrawView extends ImageView {
private Context ctx;
public DrawView(Context context, AttributeSet atts) {
    super(context, atts);
    this.ctx = context;
}
@Override
protected void onDraw(Canvas canvas) {
    String filePath = Environment.getExternalStorageDirectory().toString() + "/PTPPservice/163693fe-7c48-4568-a082-00047123b9f1.2.IMAG2200.jpg";
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 2;

    Bitmap bitmap = BitmapFactory.decodeFile(filePath,options);

    canvas.drawBitmap(bitmap, 10,10, null);
    canvas.drawCircle(10,10,10,null);
}

}
main Activity
public class Main extends Activity {

DrawView theImage;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // draw the view
    setContentView(R.layout.main1);

    theImage = (DrawView) findViewById(R.id.mainView);
    //do stuff
}
@Override
public void onConfigurationChanged(Configuration newConfig)
{
//  Toast.makeText(this, "onConfigurationChanged",Toast.LENGTH_LONG).show();
    super.onConfigurationChanged(newConfig);
}

}
Image
Comment: Two comments: 1) your background color is 0x00FF00, which means that *alpha*, the opaqueness, is zero.  If you want the background to be green, set the background color to 0xFF00FF00.
Comment: I kind of got it working like this. In constructor im running ...setImageBitmap(btm). And in the onDraw im running ...canvas.drawBitmap(bitmap, 0,0, null);. This is strange but it seems i must run that line in constructor kind of like initiating the imageView(dunno). but i have two images, one is centered middle and one is positioned 0,0 Andy ide?
Comment: 2) It's an ImageView, not a Canvas.  I just bring it up because I thought you literally meant canvas and started to answer with that in mind, until I saw that it wasn't.
Comment: yea ok sorry , but i draw on the canvas of the imageView. I update the question head!
Comment: Thanks all! Got it working will post answer tomorrow.
Got a new follow up question here [stackoverflow](http://stackoverflow.com/questions/5971268/android-how-to-set-image-in-imageview-to-right-proportions)
Answer: Looking at your code, your unlikely to see the circle as your trying to draw it with a null paint object. To test your code make sure you use a Paint object with a colour that contrasts the background colour. Secondly, I would call the super object method e.g.
super.onDraw(canvas);

I'm not 100% sure about drawing the bitmap with a null Paint object.
Also, check the package name of your DrawView class (com.hasse.move.DrawView) in your layout file matches that of the actual DrawView class.
Comment: Thanks Im adding super.onDraw(canvas);


Proving limit using epislon definition

Question: How can I use $\epsilon-\delta  $ to prove the following?
If $mh \le k \le Mh$  $ (m,M > 0)$  ,
$\lim_{h\to 0}\frac{G(h)}{h}=0\iff lim_{h\to 0}\frac{G(h)}{k}=0$.
Answer: The "If" Part:
If $\lim_{h\to 0}\frac{G(h)}{h}=0$, the for all $\epsilon>0$, there exists a $\delta>0$, such that
$$\left|\frac{G(h)}{h}\right|<\epsilon$$
whenever $0<|h|<\delta$.
But then we have
$$\left|\frac{G(h)}{k}\right|\le \left|\frac{G(h)}{mh}\right|=\frac1m\left|\frac{G(h)}{h}\right|<\epsilon/m$$
whenever $0<|h|<\delta$, which implies $\lim_{h\to 0}\frac{G(h)}{k}=0$.

The "Only If" Part:
If $\lim_{k\to 0}\frac{G(h)}{k}=0$, the for all $\epsilon>0$, there exists a $\delta>0$, such that
$$\left|\frac{G(h)}{k}\right|<\epsilon$$
whenever $0<|h|<\delta$.
But then we have
$$\left|\frac{G(h)}{k}\right|\le \left|\frac{G(h)}{Mh}\right|=\frac1M\left|\frac{G(h)}{h}\right|<\epsilon/M$$
whenever $0<|h|<\delta$, which implies $\lim_{h\to 0}\frac{G(h)}{h}=0$.
And we are done!

Proving limit using epislon definition