How to prove that a power series in a unital Banach algebra converges normally in an open ball around 0

Question: Let $A$ be an unital Banach algebra over a vector space $X$. Let us consider the power series:
\begin{equation*}
\sum_{k=0}^{+\infty} c_k x^k
\end{equation*}
with coefficients in $\mathbb{K}$ and the $x$ in $X$.
Suppose the series converges for some $\bar{x}\neq 0$. then the sequence $c_k \bar{x}^k$ converges to zero, which means that it is also bounded, so that there exists an $L \in \mathbb{R}_+$ such that $|c_k \bar{x}^k |\leq L ,  \forall  k \in \mathbb{N}$. Now, let $x$ be such that $|x|<|\bar{x}|$. We have the following:
$$|c_k x^k| \leq |c_k| |x|^k = |c_k| |x|^k \left(\frac{|\bar{x}|}{|\bar{x}|}\right)^k = |c_k||\bar{x}|^k q^k$$
Having defined $q = \frac{|x|}{|\bar{x}|} $. I then want to say that the last term of the inequalities is less or equal to $L q^k$, with $|q| < 1$, so that the series has normal convergence by comparison with the geometric series. But that inequality doesn't follow from any property of the norm!! Am i missing some other way one could go about it?
Comment: i know that $|c_k \bar{x}^k| \leq L$, but not that $|c_k||\bar{x}|^k \leq L$! And in fact $|c_k \bar{x}^k| \leq |c_k||\bar{x}|^k $ because the norm is submultiplicative.
Answer: The problem you found is essential. What you are trying to do works with numbers, but it doesn't necessarily work in a Banach algebra.
For example let $X=M_2(\mathbb C)$ with the operator norm, and consider the series
$$
\sum_{k=0}^\infty  x^k.
$$
Let
$$
\bar x=\begin{bmatrix} 0&3\\0&0\end{bmatrix}.
$$
Since $\bar x^2=0$, the series converges at $\bar x$ (and is equal to $1+\bar x$). If now you take
$$
x=\begin{bmatrix} 1&1\\0&1\end{bmatrix},
$$
then
$$
\|x\|=\sqrt{\frac{3+\sqrt5}2}\leq 3=\|\bar x\|.
$$
But
$$
\sum_{k=0}^\infty   x^k=\sum_{k=0}^\infty \begin{bmatrix} 1&k\\0&1\end{bmatrix}
$$
does not converge.
Comment: So basically what fails in the Banach algebra is that the series will not necessarily diverge outside of the radius of convergence.
Comment: Series do converge in balls. You can still find the radius of convergence $R$ of the numerical series, and then the series in the Banach algebra will converge for any $x$ with $\|x\|<R$. What you cannot do, as the example shows, is to say that if the series converges for a certain element, it converges for all those with less radius. In the example, the radius of convergence of the series is $1$. Because the algebra has divisors of zero, there are elements with norm greater than 1 where the series still converges.
Comment: Thank you for your answer, i see the problem now. So this means that it's not true, in general, that power series converge in balls, not even when the vector space is finite dimensional. I stumbled upon this proof because i wanted to find the most general setting possible to deal with power series, and to prove just once in that set the well-definedness of things like the exponential function, sine/cosine... and then prove things like $e^{x+y} = e^x e^y $ if $xy-yx=0$, or the trigonometry identities, without having to redo all the proofs for square matrices, complex numbers, etc.
Comment: Any tips on how to generalize, if not by proving this statement about the convergent sets? Also, shouldn't $||x||  $ be the square root of the one you wrote?
Comment: Got it. If we call $R$ the radius of convergence of the numerical series, and let $x \in X$ such that $|x|<R$ then, from the fact that the norm is submultiplicative follows that:
\begin{equation*}
\sum_{k=0}^{+\infty} |c_k x^k| \leq \sum_{k=0}^{+\infty} |c_k| |x|^k  ,
\end{equation*}
 which means that convergence of the series on the right implies convergence of the series on the left (so, normal convergence). Now, because $X$ is a Banach space, normal convergence implies convergence.
Comment: Indeed. $\ \ \ \ $
Comment: (+1) I think $x = I_2$, the identity matrix would also work since $\|x\| = 1$ and $x^n = x$ for all $n \geqslant 0$. (The only reason for suggesting this is that it's easier to compute the norm for this $x$.)
Comment: Yes, you are right.


Make call with alternate provider if NOANSWER

Question: I have two voip providers, one free an the other paid. The free provider only allows local calls to certain area codes, so I need to fall back to the the paid provider if a call fails.
At the moment, I have the following context in my extensions.conf file:
[globals]
; freephoneline.ca
PRIMARY_PROVIDER=fpl
; voip.ms
SECONDARY_PROVIDER=voipms

[local]
exten => _NXXNXXXXXX,1,Set(CALLERID(name)=${OUTGOING_NAME})
exten => _NXXNXXXXXX,n,Dial(SIP/${EXTEN}@${PRIMARY_PROVIDER})
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=${OUTGOING_NUMBER})
exten => _NXXNXXXXXX,n,Dial(SIP/1${EXTEN}@${SECONDARY_PROVIDER})
exten => _NXXNXXXXXX,n,Hangup()

I checked the logs and noticed that the free provider responds with NOANSWER if a call is not allowed (Even though it plays a message). What I want is to:

Try calling the ${PRIMARY_PROVIDER} first.
If NOANSWER is returned by provider (not that the callee did not answer), then call with ${SECONDARY_PROVIDER}

How can I modify my dial plan to get the desired results?
EDIT : The primary provider is freephoneline.ca, and I'm using asterisk v188.8.131.52-2
Comment: Including the VOIP server you are using and the version number in the body of your question would be helpful in answering.
Answer: [local]
exten => _NXXNXXXXXX,1,Set(CALLERID(name)=${OUTGOING_NAME})
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=${OUTGOING_NUMBER})
exten => _NXXNXXXXXX,n,Set(dest=${EXTEN})
exten => _NXXNXXXXXX,n,Dial(SIP/${EXTEN}@${PRIMARY_PROVIDER},20,); 20 is how much to call,in seconds
exten => _NXXNXXXXXX,n,Goto(s-${DIALSTATUS},1)

exten => s-ANSWER,1,Hangup
exten => s-ANSWERED,1,Hangup
exten => s-NOANSWER,1,Goto(dialnext,1)
exten => s-CHANUNAVAIL,1,Goto(dialnext,1)
exten => s-BUSY,1,Busy
exten => s-FAIL,1,Goto(dialnext,1)
exten => s-CONGESTION,1,Goto(dialnext,1)

exten =>dialnext,1,Dial(SIP/1${dest}@${SECONDARY_PROVIDER})
exten =>dialnext,n,Hangup()

Comment: This answer is technically correct but you need to detect CHANUNAVAIL.  http://www.voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS
Comment: 2jfalcon user say he need NOANSWER. 2adaptive: please show output of asterisk verbose log.
Comment: @arheops doesn't matter what he needs... it's what he gets back from the VSP.
Comment: I haven't tested `CHANUNAVAIL` yet, but your answer was helpful.
Comment: Yes, @jfalcon was rignt! `CHANUNAVAIL` is what I needed.
Comment: Thanks for the helpful info, but that did not solve the problem.
Answer: Here is an example of how I do this with google voice and trunks. With my setup I had to make a way to limit gv to 1 channel, also setup a rotation so the first gv trunk is not always hammered since it is first. There is a lot more to this but for just displaying failover I thought this was more than enough:
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = ""]?15:)

exten => _1NXXNXXXXXX,15,Set(goto=$[${PRIORITY} + 15])
exten => _1NXXNXXXXXX,n,Set(thetrunk=feliciesmaty)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(email@example.comfirstname.lastname@example.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)

exten => _1NXXNXXXXXX,30,Set(goto=$[${PRIORITY} + 20])
exten => _1NXXNXXXXXX,n,Set(thetrunk=bettyrobertson169gmailcom)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(email@example.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)

exten => _1NXXNXXXXXX,50,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=swigartjosephgmailcom)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(firstname.lastname@example.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)

exten => _1NXXNXXXXXX,75,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=bettyrobertson169gmailcom)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(firstname.lastname@example.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)

exten => _1NXXNXXXXXX,100,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=sandralanago)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(firstname.lastname@example.comfirstname.lastname@example.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)

exten => _1NXXNXXXXXX,125,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=sofiadugal)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(email@example.comemail@example.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)


Condition for $k$ so that $\lim_{n\rightarrow \infty} 1 - k(1-2^{-k})^{(n/k)} = 1$

Question: I'm going over a proof, whose last step is the following statement:
If $ k = (1-\epsilon )\cdot \log_{2}(n)$
$$ \lim_{n\rightarrow \infty} 1-k(1-2^{-k})^{(n/k)} = 1$$
I'm trying to understand why this k ensures that the limit converges to 1.
Comment: Your title asks to find conditions for $k$ for that limit to be $0$. But in the body, you ask about the last step. So, I conclude you did some work on finding conditions for $k$ and asking to verify the answer. In my previous comment, I intended to say that adding your work will save others' time from re-doing the same work you have done. Sorry if I'm misunderstanding you.
Comment: I see only one statement, but not so-called *"last step"*. Please, add your work so that somebody can help you check that.
Comment: The rest is irrelevant to this statement in the proof. The prior steps don't change the fact regarding the condition for k that satifies that this limit converges to 0. I can change the description in the question to "why this statement is true" if that helps...
Comment: I was unclear then. I meant that I'm going over a proof. The last statement in the proof is the limit and they give a potential k that ensures the limit converges to 0. I will edit my post to clarify this.
Answer: As far as I can tell, the limit is $1$, for $0<\epsilon<1$, take a look at:
https://www.wolframalpha.com/input/?i=limit+when+n+goes+to+infinity+1-0.5*log2%28n%29%281-1%2F%282%5E%280.5*log2%28n%29%29%29%29%5E%28n%2F%280.5*log2%28n%29%29%29
Lets work over the limit:
\begin{align}
lim_{n\rightarrow \infty}[1-(1-\epsilon)log_2(n)[1-\frac{1}{2^{(1-\epsilon)log_2(n)}}]^{\frac{n}{(1-\epsilon)log_2(n)}}]&=\\
lim_{n\rightarrow \infty}[1-(1-\epsilon)log_2(n)[1-\frac{1}{n^{(1-\epsilon)}})]^{n^{1-\epsilon}\frac{n^{\epsilon}}{(1-\epsilon)log_2(n)}}]&=\\
lim_{n\rightarrow \infty}[1-(1-\epsilon)log_2(n)e^{-\frac{n^{\epsilon}}{(1-\epsilon)log_2(n)}}]&=1-0
\end{align}
Note that $lim_{n\rightarrow\infty}(1-\frac{1}{n})^{n}=e^{-1}$ (this is a famous result see https://en.wikipedia.org/wiki/List_of_limits)
Since $lim_{n\rightarrow\infty}log_2(n)e^{ -\frac{n^\epsilon}{(1-\epsilon)log_2(n)} }=0$. To show that this last limit is $0$, we can use the fact that $e^x>e^y$ if $x>y$. For $n$ large enought, we have that $-log(n)>-\frac{n^\epsilon}{(1-\epsilon)log_2(n)}$, sice logarithms grow solower than linear functions. Hence:
$$0\leq log_2(n)e^{ -\frac{n^\epsilon}{(1-\epsilon)log_2(n)} }\leq log_2(n)e^{ -log(n)}$$
Computing this limit:
$$lim_{n\rightarrow \infty}\frac{ log_2(n)}{e^{ log(n) }}= lim_{n\rightarrow \infty}\frac{log_2(n)}{n}=0$$
Comment: You're right I wrote 0 but in my mind I was referring to the second part.
Comment: @ec2604 Okay, hope it made thinks more clear. Let me know if you want more details.
Comment: Two questions:
1. Can you transition to $lim_{n\rightarrow\infty}f(n)*(1-\frac{1}{n})^{n\cdot g(n)} = lim_{n\rightarrow\infty}f(n)\cdot e^{-g(n)}$?
2. Assuming 1 works, why does the last part converge to 0?
Comment: @ec2604 I will edit the answer for those questions.
Comment: Just to note I understand that $lim_{n\rightarrow\infty} (1-\frac{x}{n})^{n} = e^{-x}$, In question 1 I'm asking whether this still applies when x is also a function of n.
Comment: @ec2604 yes, in general $lim_{n\rightarrow\infty}(1-\frac{1}{g(n)})^{g(n)}=e^{-1}$, if ($lim_{n\rightarrow\infty}g(n)=\infty$)
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/116036/discussion-between-ec2604-and-jorge).
Answer: We have that by $k = (1-\epsilon )\log_{2}(n)$
$$1-k(1-2^{-k})^{\frac n k}=1-(1-\epsilon )\cdot \log_{2}(n)\left(1-\frac1{n^{1-\epsilon}}\right)^{\frac n {(1-\epsilon ) \log_{2}(n)}} \to 1$$
indeed since as $x \to 0^+$ we have $\log (1-x) \le -x$
$$\left(1-\frac1{n^{1-\epsilon}}\right)^{\frac n {(1-\epsilon )\cdot \log_{2}(n)}} =e^{\frac n {(1-\epsilon )\cdot \log_{2}(n)}\log\left(1-\frac1{n^{1-\epsilon}}\right)}\le e^{-\frac {n^{\epsilon}} {(1-\epsilon ) \log_{2}(n)}}$$
and then
$$(1-\epsilon )\cdot \log_{2}(n)\left(1-\frac1{n^{1-\epsilon}}\right)^{\frac n {(1-\epsilon ) \log_{2}(n)}} \le (1-\epsilon )\log_{2}(n)e^{-\frac {n^{\epsilon}} {(1-\epsilon ) \log_{2}(n)}}=$$
$$=\frac{\frac {n^{\epsilon}} {(1-\epsilon ) \log_{2}(n)}}{e^{\frac {n^{\epsilon}} {(1-\epsilon ) \log_{2}(n)}}} \cdot \frac{\left[(1-\epsilon )\log_{2}(n)\right]^2}{n^{\epsilon}} \to 0\cdot 0=0$$


Alternatives to Nagios

Question: Can you recommend any alternatives to Nagios, capable of monitoring both Linux and Windows computers and having an extensible architecture? I would like free products, but commercial ones could also be acceptable.
I am interested in monitoring CPU load, memory load, swapping, running processes, running services as I intend to use the software for performance monitoring. I would also like the monitoring plugins to be able to generate events when a certain threshold is exceed for a period of time and to pass data to external application (custom event handler functionality).
I do not know yet the deployment scenario, therefore having a relatively small footprint and being able to run on a regular computer with little performance impact is a plus (monitor just the host).
Comment: Any particular reason you don't want to go with Nagios?
Comment: There are plenty of alternatives to nagios, but it depends what exactly you're looking for. If you said why nagios wasn't suitable, it would give people more of a hint.
Answer: Zabbix works great and his extremely flexible and scalable, you may distribute nodes or proxies among your sites
Comment: +1 Yes, Zabbix is really nice. IMO, the best idea of Zabbix is that it gets data (one value) instead of status (OK, WARNING, CRITICAL). So you can graph any check without configuring graph before... You can also easily create alerts or reports from multiple checks.
Comment: Yep, any program outputing a resulet can feed Zabbix, Zabbix and Splunk are a great tandem.
Comment: Since last year we're using Zabbix in our company network and it works just great. The distributed monitoring feature and the possibility to deploy proxies over your networks is amazing. It has not the prettiest user interface but you can get used to it. ;-)
Answer: Maybe also the Nagios Fork Icinga is worth a look.
Answer: My sys admins have settled on Groundwork, which incorporates Nagios and other opensource products while improving the management interface, deployment, and configuration.  The pay version is pretty cheap for 100 or fewer devices ($49/year).
We tried Hyperic and Zenoss.  Hyperic was pretty good, but once you download it, they will hound you forever trying to sell the paid version - outside of Oracle, no one has ever called me so often about a product.  Maybe that has changed now that Spring Source owns them.  Zenoss looks good, but can be complicated to get setup to do useful stuff since it required a lot of snmp configuration and we started to run up against the limits of the open source version fairly early in our testing and decided that we couldn't afford the the paid version.
You might also find some other useful alternatives at http://monitoringforge.org
Comment: Hyperic seems to be better for what I need. It also looks like a mature, professional product.
Answer: I run zenoss at work, but I run munin at home. They are both excellent products.
Zenoss is a full featured NMS and has many useful tools.
Munin is straight graphing and alerting. But very flexible.
If you want log file integration use zenoss. If not, use munin.
Comment: Isn't Munin is very different from Nagios:  its a server-side configured type of monitoring rather than client-side configured?
Answer: Have you looked at OpenNMS?
Answer: I have switched from Nagios to Zabbix some time ago and though there are some problems with it - still they are easier to overcome and manage than Nagios, especially for people that are not technical nor do they have access to the server. Zabbix has nice web ui to manage hosts, services, alerts, triggers and so on and pretty flexible rule mechanism, autodiscovery, maps and other goodies - give it a try!
Answer: Two that come to mind are

Zenoss - http://www.zenoss.com/
Pandora - http://pandorafms.org/
Answer: I used bigbrother a very long time ago, which is proprietary and shell script driven (really helps with unix-like compatibility). An open-source compatible port named hobbit was developed, which was subsequently renamed to xymon, which I then adopted. It is extremely fast, ridiculously easy to setup since it automatically graphs (using rrd), and meets AFAIK all enterprise criteria (reporting, groups, downtime, etc).
The thing that made me stick with it almost all of this time are the little things, like out of the box support for SSL cert expiration, the fact that you can configure it to alert you when something is running (cough like telnet on a solaris 9 install), and what I consider to be most important: context sensitive monitoring like doing more than just checking that port 80 is open, but making sure it's a HTTP 200, etc.
Answer: A Nagios-like alternative that is more modern and scalable would be Shinken.

It is Windows and Unix native. So no problem running windows based
WMI/powershell/etc.
Assigns business priority to events in
addition to the state to permit filtering/alerting on business impacting
services.
It can use all existing Nagios plugins and frontends.
100% python including a Livestatus API. So modern and maintainable.
Based on Pyro distributed programming, so no issue running it on one
or ten boxes.
Has one of the best correlation and dependancies models without resorting to huge $$$ for Monolith/Smarts/etc.
Web configuration interface using nconf. Has a configuration API.

Of the open sourced solutions Shinken and Zabbix are the two outstanding ones that are taking off.
Answer: I currently use and love ZenOSS. It's way easier to configure than Nagios and a pleasure to use. It works as expected out of the box, but it requires a solid configuration.
Other interesting options :

Cacti with the "Monitor" plugin. Adding a host is a little more complicated than with ZenOSS, but still a good and light solution (and nothing alike the complexity of Nagios).
Nagios Centreon (formerly Nagios Oreon) : a PHP frontend to Nagios. I've not tested it personally, but it supposedly hides a bit of the complexity.
Answer: http://www.intellipool.se/
Intellipool is quite good (it's closed and paid) but it's not as pricey as the big boys.
Answer: Well, if you have money, I would go with SCOM2007
From R2 it has integrated cross-platform monitoring. As for Windows it is really end-to-end complex monitoring. Moreoverm it's highly extensible with 3rd-party features and Management Packs. For example, Jalasoft has Xian for network devices monitoring. You can even extend OpsMgr to check for the coffee level if you want :)
Disadvantages are really price, complexity and the need to have some training (or much testing and reading). But if your infrastructure is big enough, high-precise monitoring, extensibility and tiering overcome those disadvantages.
Answer: You don't mention the target OS, but if you want to run the monitoring station on a Windows box, have a look at PRTG (freeware or commercial). It will allow you to create custom sensors and custom actions (we call them "notifications").
You mention you need something with a small footprint: Paessler monitors their complete office network (75 devices with more than 1400 sensors) on a DELL Inspiron Mini netbook (details...)
Answer: I've used a number of monitoring systems but keep coming back to mon. It's incredibly easy to configure, easy to maintain and with the sole exception of handling SNMP traps it's monitored and alerted with anything I've thrown at it.
Answer: We have just started using Zenoss and so far i'm very pleased. Easy configuration of what should be monitored and what causes alerts. Only modification I've done is to change the pager altering to send SMS instead.
Answer: We have had customers who have switched from Nagios to SolarWinds Server & Application Monitor because Nagios did not provide support for virtual environments and the customer wanted to monitor both physical and virtual servers & applications with one UI.  One customer had done a lot of custom monitoring of applications with Nagios and had no problem moving those scripts to SolarWinds.
Answer: You can take look at Spiceworks It is free and easy to set up.
Comment: SW does not do much of anything that the OP wants:  Real-time alerting, CPU/Memory Usage, Swapping, etc.
Comment: Maybe that was true when this was posted? It certainly does those things now. (Including SNMP)

http://www.spiceworks.com/free-network-monitoring-management-software/
Comment: I have a big problem with Spiceworks: even thou they say they won't cell my info to anyone and stuff like, it just looks like a big spyware operation: I understand that they are trying to get paid from advertisers rather than selling a paid version, but I'd rather have a paid one then see all of that crap on my monitoring pages.

Alternatives to Nagios


Does the number of IV after stepwise model selection depend on the amount of data?

Question: I have 3 different DV that I try to model with 3 distinct models (linear mixed models) using the same set of IV. I found that the DV that I have the least amount of data for also has the lowest number of IV's in the final model, while the DV that has the largest amount of data has a larger number of remaining IV (including interactions). I tend to believe that this might be an artifact of data-availability. Might that be the case? And if so: Is that a serious problem when reporting these results in peer reviewed journal?
I know that many argue against stepwise reduction procedures, however my feeling is that (at least in my case) the selection mostly comes to the same final models irrespective of minor changes in the inital model. Are the constraints against model selection mostly valid in case of large numbers of IV or is it even in case of a relatively small number of initial IVs that there might be completely different results?
Answer: Yes. This is another argument against stepwise. Since it uses p-values, it will find more complex models when there is more data, even if the data is generated from the same underlying process.
This is true of all automatic methods, though (at least, all I can think of).
It's really another argument for using effect sizes, your substantive knowledge and your brain to figure out models.
Comment: In my case I used AIC, as I don't trust the p-values that much
Comment: OK but AIC is based on likelihood and likelihood also changes with N.
Comment: You can compare AIC among models that are reasonable.
Comment: Using my brain is really the last option I want to go for ;)...No seriously: is there a way that I can make use of a priori knowledge and then test model fit? I tried comparing residual plots but they all look somehow similar almost irrespective of the IVs that are considered
Answer: If you increase the sample size enough, the most complex model in your candidate set will have the lowest AIC (if it contains the others as special cases). The AIC is intended to pick the model with best predictive accuracy from a candidate set of models that are all wrong—i.e. approximations to the infinite-dimensional "model" that is reality. So in this context "too big" a model is one that over-reaches & ends up adding noise, for a given sample size. For a selection rule that converges on the least-complex true model among your candidate set as sample size increases, use the Bayesian information criterion (BIC)—if you think that the truth is simple enough to be among the models you're considering.


How to call event handlers inside render() in React

Question: My aim is to invoke the onClick event handler when the user clicks on the div that's wrapped around the Media component, but I keep hitting walls. Here's my script:
import React, { Component } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import { Media } from 'reactstrap';

var items = require('./feedData.json');

class App extends Component {
  constructor(props) {
    super(props);
  }

  onClick = (event) => {
    alert('x');
  }

  render() {
    return (

        {
            items.map(function(item) {
                return (

                    <Media>
                      <Media body>
                        <Media heading>
                          {item.title}
                        </Media>
                        {item.body}
                      </Media>
                    </Media>

                )
            })
        }

    );
  }
}

export default App;

This particular arrangement produces the following error:

TypeError: Cannot read property 'onClick' of undefined
Answer: Use an arrow function.
    items.map((item) => {
        return (

                <Media>
                    <Media body>
                        <Media heading>
                            {item.title}
                        </Media>
                        {item.body}
                    </Media>
                </Media>

        )
    })

We need to ensure the scope of this points to our class.


Interesting Property of Tri-Rectangular Tetrahedron

Question: For starters, we know that a trirectangular tetrahedron is a tetrahedron where all three face angles at one vertex are right angles.
Here's an interesting property I stumbled upon, of which I look for an elegant proof:
(For the sake of explanation, I shall model this tetrahedron in the Cartesian plane, with origin as a vertex and the three normal vectors of the three faces intersecting at the origin, along the coordinate axes)
And here it goes
Consider the plane,
$$
\frac{x}{a}+\frac{y}{b}+\frac{z}{c}=1
$$
forming a tetrahedron OABC, with the XY, YZ, and ZX planes. O is the origin, and A,B,C are the other three vertices. The property is, that, the foot of perpendicular from O, on plane ABC, is the orthocentre of triangle ABC.
I have already proved it, with an analytic approach (extending the Cartesian model I describe above), however, I'm looking for a rather elegant, and possible geometric proof for this property.
Please share your ideas and proofs, thanks a lot!
P.S.
Feel free to ask for the analytic proof (It's probably too obvious, and also undesirably lengthy) which I've completed. (I shall attach a picture of the handwritten work to this post)
Answer: Let $OABC$ be your tetrahedron. $OA$ is perpendiclular to $OB$ and $OC$, so $OA$ is perpendicular to the plane $OBC$ and, in particular, $OA \perp BC$. Now, the theorem of three perpendiculars states that if some line is perpendicular to $l$, then its projection onto any plane containing $l$ is also perpendicular to $l$. So, if $H$ is the foot of perpendicular from $O$ onto $ABC$, then $AH\perp BC$.
By the way, tetrahedrons such that each pair of opposite edges are perpendicular are called orthocentric tetrahedrons. Your fact is true for any orthocentric tetrahedron.


Voice changes after illness

Question: I recovered from the flu a few weeks ago, but my voice hasn't returned to its normal range. I'm a fairly high soprano usually, and have a comfortable range from about a Middle C to a high Eb.
For the past few weeks my top range has remained much the same, but I have a low B and A (and occasionally a G!) that certainly weren't there before. I also appear to have a lot more body in my lower range than I did before being sick - more of a "belt" - which I've never had before.
I've never heard of changes sticking around after an illness like this. Has anyone else had experience with this? Do you know how long it will last? (Can I keep it?)
Comment: I have the impression many women's voices get lower with age -- so maybe yes you can keep it.  // Here's something you might find interesting: https://longestshortesttime.com/podcast-56-the-new-you-itll-do/
Answer: This is probably just a normal effect of the flu. Losing part of one's range after the flu is probably normal. I lost about an octave of high range for a few weeks after I had the flu, and it came back naturally. Trying not to sing too much might help.
Answer: This is normal after such an illness, and full voice recovery should be expected within 45 days or less.
It's important to note that many orally-delivered steroids will cause a thin, trebly quality to the speaking (and singing) voice, but that situation normally fades within a week after the steroid cycle is complete.
Answer: Yes, sickness certainly does affect the singing (and spoken) voice - for a period after a serious bout of flu. I would recommend giving yourself several weeks to recover, building up what you expect of your voice slowly again. Much the same way a sportsperson would return to full "match fitness" after an injury, the same is true of the voice which needs to be slowly brought back to its pre-illness state.
Answer: This question is now over a year old.  So DID you keep it?
(Yes, technically a comment.  But, in the interests of getting it noticed and hopefully responded to, don't jump on it for a bit? Then it may be able to be turned into a pretty definitive answer!)
Comment: not looking good.... @lily Kendrick : "Last seen Nov 6 '17 at 1:01"

Voice changes after illness


Restlet: GET requests using queries that access more than one resource

Question: In a database, lets say I have the name and date of birth of many persons and I want to GET the name of persons that are older than 20 years. I might use something like this :
http://www.example.com/people?age=over20
In this case the router will attach this uri to the people resource class.
Are there any functions that could parse the uri and get the needed request (in this example, age>20) ? or should I write my own functions ?
Another issue, in this example, the query ( age>20 ) is simple, so it could be included in the uri, what if I have complex queries (union between two tables ..etc ) ? should I put the query in xml file and send it to the server?
Comment: If you put the query in the GET entity body, the same URI pattern now maps to a huge number of distinct resources.  This means that caching responses to the queries becomes impossible, you can't email links to queries, bookmarking queries doesn't work, and so on.  The REST principle of exposing every distinct application resource via its own resource name (URI in HTTP) avoids all these problems.
Answer:
Are there any functions that could parse the uri and get the needed request (in this example, age>20) ?

Yes there are functions to parse the query string. In this particular case, using Restlet, you could get the value in your resource through: getRequest().getResourceRef().getQueryAsForm().getFirst("age").getValue() == "over20"
There could be other ways as well (and maybe it's improved in Restlet 2.0), but it's been my experience that Restlet, at least was, very structured and verbose. I've since moved to JAX-RS and Jersey to make my resources since it lets me accomplish a lot of the same with only a few annotations. (in this case @QueryParam("age").) You may consider making the over/under part of the key instead of the value, so that you can more easily parse the string and build your query. The idea being it'd be the difference between trying to handle:
http://www.example.com/people?age=over20&age=under30
versus handling: http://www.example.com/people?ageAtLeast=20&ageAtMost=30

Another issue, in this example, the query ( age>20 ) is simple, so it could be included in the uri, what if I have complex queries (union between two tables ..etc ) ?

Here I would recommend looking for discussions on Restful URI design. Ideally different entities would be different uri paths, and their relations would be apparent through your URL. For example there was a highly voted question: RESTful URL design for search

should I put the query in xml file and send it to the server?

Technically this is a potential option, but I would avoid it if at all possible. It's very obtuse, especially for simple GETs. (Also note, that while technically not forbidden, an entity body on a GET is not standard, and there are many products that do not handle it properly, so you'd wind up abusing POST or another method to accomplish this).


How can I make check_nrpe wait for my remote script to finish executing?

Question: I have a python script that's being used as a plugin for NRPE.  This script checks to see if a process if running on a virtual machine by doing an SSH one-liner with a "ps ax | grep process" attached.  When executing the script manually, it works as expected and returns a single line of output for NRPE as well as a status based on whether or not the process is running.
When I attempt to run the command setup to execute this script (from my Nagios server), I instantly get the output "NRPE: Unable to read output", however when I run the script manually it takes about a second before it returns output.  Other commands run just fine, so it would seem like NRPE needs to wait a second or two for output rather than instantly failing, but I've been unable to find any way of accomplishing this; any tips?
PS:  The virtual machines are not accessible from anywhere other than the host machine, hence the need for the nrpe plugin to ssh from the host into the VM to check the process.
Comment: Did you switch to `nagios` user before calling this plugin from Nagios server?
Comment: @SamLambert I no longer recall exactly how I fixed this, but here are some things that helped me get on the right track:  test everything as the 'nagios' user, adjust timeouts if needed, make sure there aren't two installs of NRPE on the system (on the system I was working on NRPE had been installed manually from a tarball, and via apt so the configuration file I was initially working on wasn't actually doing anything since the OTHER install's config is what was actually being used. This meant everything I tried at first was in vain until I realized I was using the ignored config file)
Comment: How did you fix this? I have the same problem.
Comment: @SamLambert - you can see the answer with the checkmark below. THats the answer that the user said helped them fix it.
Comment: Would it not be possible to check the status of your process using SNMP instead?
Comment: No, nor can I use passive checks
Answer: You can change the timeout by following the instructions here or searching timeout in the nrpe documentation, although I don't think this is your issue, or you'd see an error like this:
CHECK_NRPE: Socket timeout after 270 seconds.
There is also probably a nagios plugin that will return the data you want that has been written already.
Comment: I've pretty much memorized the nrpe documentation by now, but it doesn't mention anything along the lines of wait times.  Unfortunately the last update was about 4.5 years ago, so it may be outdated (I've had a few problems with it already). The issue isn't check_nrpe timing out because it's failing to connect to the host, but rather it appears to be executing the plugin, not immediately seeing output, then returning the given error.
Answer: Why not use check_proc plugin?
On the virtual machine, define a command for your service in /etc/nagios/nrpe.cfg:
command[check_<service_name>]=/usr/lib64/nagios/plugins/check_procs -c 1:1 -C <service_name>
and from the Nagios server:
define service{
    use                     critical-service
    host_name               xx
    service_description     <service_name>
    check_command           check_nrpe!check_<service_name>
    event_handler           autostart_<service_name>!xx
    process_perf_data       0
    contact_groups          admin
}

a sample result:
# su - nagios -s /bin/bash
-bash-3.2$ /usr/local/nagios/libexec/check_nrpe -H xx -c check_<service_name>
PROCS OK: 1 process with command name '<service_name>'

Comment: The service isn't being run on the machine running NRPE, but on a virtual machine on that host.
Answer: I think the default timeout is around 10 seconds, so that's probably not it.
If you're using ssh to execute a check, remember that nrpe is probably running as user "nagios" (depending on install options).  Does that user have the right keys and ssh options?


My problem with the velocity of the object with position $z=t^2-t^3$.

Question:
(a)
(b)Using first derivative test, $$\frac{dz}{dt}=0.$$ We get $t=2/3$. When $t=2/3$ object move $z=4/27$ units far from $z=0$.
(c) Velocity at which object departed from $z=0,$ $$\frac{dz}{dt}|_{t=0}=0.$$ Am I correct? What about the velocity at which it return? Is it $$\frac{dz}{dt}|_{t=1}?$$
(d)Is $z=f(t)$ unique?
May I know where is my mistake? Please help me to complete the answer.
Comment: The title may be edited. It does not provide much information about your question ;-)
Comment: Why do you think that you made a mistake?
Comment: velocity at which object return. Am I using the correct formula?
Comment: Yes, you are. As for part (d), the solution is not unique, as you say. The question only asks you to find one example. Can you find it on your own?
Comment: okay. Then I got the complete solution. Thank you very much sobi :)
Answer: You are OK so far and your graph works for the first 3 parts of the problem.
For part $(d)$ they want to find a different function with both velocities being zero at $t=0$ and $t=1$
You consider a polynomial in form of $bt^2+ct^3$ and find the coefficients.
It should work out.


Apache server on Fedora

Question: So I followed this guide to a T when setting up apache on my Fedora machine: http://www.techotopia.com/index.php/Configuring_a_Fedora_Linux_Based_Web_Server#Requirements_for_Configuring_a_Web_Server
I was unable to get a static IP so I used the dnsExit route and got that configured fine. I entered
/sbin/service httpd status

and it said that apache was running. I setup the config file as specified within that article. I reset the apache server to ensure the settings saved... I am not able to access my site externally OR internally. It's clear that there is an issue, however I am fairly new to this... so I honestly do not know where to even begin troubleshooting for this sort of thing. Can anyone point me in the right direction? I cannot find much documentation for people who can't access the site internally or externally.
Answer: The page you give is old ? because at this time, on Fedora, we are using "systemctl" to enable and start services.
This is a better way:
sudo yum install httpd
sudo systemctl start httpd

Check with
sudo systemctl status httpd

Then, you can configure your settings and use
sudo systemctl restart httpd

Then check if http port is open, at first try to shutdown firewall with
sudo systemctl firewalld stop

If it's ok, relaunch firewall (systemctl firewalld start) and use "firewall-config" tool to open http port in external and internal zones
Comment: I appreciate your help. It's still not working, so I believe that this is an issue with dnsExit.

thank you!

Apache server on Fedora


Juntar 3 graficos usando plot

Question: Quero juntar os três gráficos abaixo usando a função plot. Eu faço o básico iniciando com o comando par(mfrow=c(1,3)) mas nao consigo junta-los.
O problema acredito que seja o fato de estar usando um objeto summary direto da regressão quantilica.
Vocês poderiam me ajudar nessa?
library(quantreg)
data(engel)

x1 <- engel$income
x2 <- 0.5*engel$income*2^(0.3)
x3 <- engel$income*3^(2)

fit1 <- rq(foodexp ~ x1, tau=seq(0.05, 0.95, by = 0.05), method="br", data=engel)
fit2 <- rq(foodexp ~ x2, tau=seq(0.05, 0.95, by = 0.05), method="br", data=engel)
fit3 <- rq(foodexp ~ x3, tau=seq(0.05, 0.95, by = 0.05), method="br", data=engel)

fit1_betas <- summary(fit1, se="iid")
fit2_betas <- summary(fit2, se="iid")
fit3_betas <- summary(fit3, se="iid")

par(mfrow=c(1,3))

plot(fit1_betas, parm=2, main=expression("Regression": beta[0]), ylab="beta", xlab = "tau", cex=1, pch=20)

plot(fit2_betas, parm=2, main=expression("Regression": beta[0]), ylab="beta", xlab = "tau", cex=1, pch=20)

plot(fit3_betas, parm=2, main=expression("Regression": beta[0]), ylab="beta", xlab = "tau", cex=1, pch=20)

Answer: Consegui fazer no ggplot2, baseando no código que fiz para a sua outra pergunta: Alterar gráficos dos betas de uma regressão
O código não ficou bonito, mas funcionou. A parte que ficou mais feia é onde coloco aquelas linhas vermelhas, que na verdade são as estimativas de uma regressão linear normal.
Segue:
library(broom)
library(dplyr)
library(ggplot2)
library(quantreg)

data(engel)

x1 <- engel$income
x2 <- 0.5*engel$income*2^(0.3)
x3 <- engel$income*3^(2)

fit1 <- rq(foodexp ~ x1, tau=seq(0.05, 0.95, by = 0.05), method="br", data=engel)
fit2 <- rq(foodexp ~ x2, tau=seq(0.05, 0.95, by = 0.05), method="br", data=engel)
fit3 <- rq(foodexp ~ x3, tau=seq(0.05, 0.95, by = 0.05), method="br", data=engel)

lm_fit1 <- lm(foodexp ~ x1, data = engel)
lm_fit2 <- lm(foodexp ~ x2, data = engel)
lm_fit3 <- lm(foodexp ~ x3, data = engel)

lm_data <- bind_rows(
  lm_fit1 %>% tidy() %>% mutate(id = "fit1"),
  lm_fit2 %>% tidy() %>% mutate(id = "fit2"),
  lm_fit3 %>% tidy() %>% mutate(id = "fit3")
  ) %>%
  bind_cols(bind_rows(
    lm_fit1 %>% confint() %>% as.data.frame(),
    lm_fit2 %>% confint() %>% as.data.frame(),
    lm_fit3 %>% confint()%>% as.data.frame()
  )) %>%
  rename(low = `2.5 %`, high = `97.5 %`) %>%
  filter(term != "(Intercept)")

bind_rows(
  tidy(fit1) %>% mutate(id = "fit1"),
  tidy(fit2) %>% mutate(id = "fit2"),
  tidy(fit3) %>% mutate(id = "fit3")
) %>%
  filter(term != "(Intercept)") %>%
  ggplot(aes(x = tau, y = estimate)) +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = 0.2) +
  geom_point() +
  geom_hline(data = lm_data, aes(yintercept = estimate), colour = "red") +
  geom_hline(data = lm_data, aes(yintercept = low), colour = "red", linetype = "dashed") +
  geom_hline(data = lm_data, aes(yintercept = high), colour = "red", linetype = "dashed") +
  facet_wrap(~id, scales = "free")

Tente entender o passo a passo do que foi feito.
Segue também o gráfico obtido.
Comment: Que bom que ajudou! Acho que funciona com os dois, mas realamente com `term` fica melhor.
Comment: Daniel, novamente muito obrigado! Uma correção (?) na ultima linha seria `term´ ao invés de `id´. Certo??

Juntar 3 graficos usando plot


proving an inequality involving three terms

Question: The inequality is as follows:
$a^2+b^2+c^2+3\ge2(a+b+c)$
I was thinking about using the factorization $a^3+b^3+c^3-3abc=(a+b+c)(a^2+b^2+c^2-ab-bc-ac)$
But I can't get anywhere. I don't have any idea at the moment.
Comment: You are writing $a^2+b^2+ c^2-3abc$ is it actual question or typing mistake?
Answer: In the last form you may rewrite it as:
$$(a-1)^2+(b-1)^2+(c-1)^2\ge 0$$
which is obviously true.
Answer: From given equation we have,
$a^2 + b^2 + c^2 − 2a − 2b − 2c + 3 \ge 0$
$(a^2 - 2a +1) + (b^2 - 2b + 1) + (c^2 − 2c + 1) \ge 0$
$(a−1)^2 + (b−1)^2 + (c−1)^2 \ge 0$


Getting SessionNotCreatedError when trying to run scripts from Jenkins pipeline

Question: I am trying to run my protractor scripts on jenkins pipeline and getting the SessionNotCreatedError when it tries to access the Selenium address. When I run the same on local its working fine. Not sure what's going on.
Conf.js script
<code>let domainName = util.domainName;
exports.config = {
  seleniumAddress: 'http://selenium-hub:4444/wd/hub', //for testing in the pipeline
  directConnect: false, // Set to true for local testing, or provide a link to a running selenium grid.
  // specs: ['e2e/**/mailbox-test.js', 'e2e/**/email-dumps-test.js'],
  specs: ['e2e/**/*-test.js'],
  capabilities: {
    browserName: 'chrome',
    acceptInsecureCerts: true,
    'goog:chromeOptions': {
      w3c: false,
      args: [
        '--no-sandbox',
        '--headless',
        '--disable-gpu',
        '--window-size=1200,1200',
        '--disable-dev-shm-usage',
        '--allow-insecure-localhost',
        '--allow-running-insecure-content',
        '--ignore_ssl',
        '--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
      ],
    },
  },

  allScriptsTimeout: 600000,
  baseUrl: eaUrl,
  framework: 'jasmine',

  jasmineNodeOpts: {
    isVerbose: true,
    showColors: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 600000,
    stackTrace: false
  },
</code>
Jenkins output error

[15:32:21] D/launcher - Protractor version: 5.4.2 10:31:59  [15:32:21]
D/launcher - Your base url for tests is
https://ea-webapp-int-raven.ocp-nonprod.ice.dhs.gov/ 10:31:59
[15:32:21] I/launcher - Running 1 instances of WebDriver 10:31:59
[15:32:21] I/hosted - Using the selenium server at
http://selenium-hub:4444/wd/hub 10:37:05  [15:37:21] E/launcher -
Could not start a new session. New session request timed out 10:37:05
Build info: version: '4.1.2', revision: '9a5a329c5a' 10:37:05  System
info: host: 'eb3088c85a9d', ip: '172.17.0.2', os.name: 'Linux',
os.arch: 'amd64', os.version: '3.10.0-1160.53.1.el7.x86_64',
java.version: '11.0.13' 10:37:05  Driver info: driver.version: unknown
10:37:05  [15:37:21] E/launcher - SessionNotCreatedError: Could not
start a new session. New session request timed out 10:37:05  Build
info: version: '4.1.2', revision: '9a5a329c5a' 10:37:05  System info:
host: 'eb3088c85a9d', ip: '172.17.0.2', os.name: 'Linux', os.arch:
'amd64', os.version: '3.10.0-1160.53.1.el7.x86_64', java.version:
'11.0.13' 10:37:05  Driver info: driver.version: unknown 10:37:05
at Object.throwDecodedError
(/app/test/node_modules/selenium-webdriver/lib/error.js:514:15)
10:37:05      at parseHttpResponse
(/app/test/node_modules/selenium-webdriver/lib/http.js:519:13)
10:37:05      at doSend.then.response
(/app/test/node_modules/selenium-webdriver/lib/http.js:441:30)
10:37:05      at process._tickCallback
(internal/process/next_tick.js:68:7) 10:37:05  From: Task:
WebDriver.createSession() 10:37:05      at Function.createSession
(/app/test/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
10:37:05      at Function.createSession
(/app/test/node_modules/selenium-webdriver/chrome.js:761:15) 10:37:05
at createDriver
(/app/test/node_modules/selenium-webdriver/index.js:170:33) 10:37:05
at Builder.build
(/app/test/node_modules/selenium-webdriver/index.js:626:16) 10:37:05
at Hosted.getNewDriver
(/app/test/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
10:37:05      at Runner.createBrowser
(/app/test/node_modules/protractor/built/runner.js:195:43) 10:37:05
at q.then.then
(/app/test/node_modules/protractor/built/runner.js:339:29) 10:37:05
at _fulfilled (/app/test/node_modules/q/q.js:834:54) 10:37:05      at
/app/test/node_modules/q/q.js:863:30 10:37:05      at
Promise.promise.promiseDispatch (/app/test/node_modules/q/q.js:796:13)
10:37:05  [15:37:21] E/launcher - Process exited with error code 199
10:37:05   10:37:05  exitStatus=$? 10:37:05   10:37:05  # Allow the
Jenkin pipeline to access and archive any test output. 10:37:05  chmod
-R 777 ./test_output/
Comment: Hello, Can anyone please help me how to fix this. I am completely stuck with this issue. Thanks
Answer: I am adding my observations as others might need if they get similar issues and this might help them too. After a long long investigation of the console output in Jenkins with my docker installation scripts, I noticed that we are trying to install the latest version of the selenium hub and chrome node but the docker command doesn't include the SE_EVENT_BUS_HOST information. After changing my code from
docker run -d --name selenium-node-chrome -e HUB_HOST=selenium-hub --shm-size="2g" nexus2.xxx.com:18443/selenium/node-chrome
to
docker run -d --name selenium-node-chrome -e SE_EVENT_BUS_HOST=selenium-hub --shm-size="2g" -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 nexus2.xxx.com:18443/selenium/node-chrome
Then it started working for me.


unexpected result of Excel formula

Question: i have the following formula; =BYROW(SEQUENCE(30;;0,01;0,01);LAMBDA(n;MOD(n;0,03)))=0.
Excel returns
{FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
While I would expect
{FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE}
Am i making a mistake somewhere? Please help (i have more array formulas returning unexpected results, i might use lambda wrong)
Best,
Answer: I assume you are in a locale where comma is the decimal point.
You cannot do exact comparisons with floating point numbers.  The numbers 0.01 and 0.03 cannot be represented exactly in binary, so what you get are very close approximations. The more arithmetic you do, the more you accumulate very small errors.
You should be doing your arithmetic as integers, and then divide the result by 100.
Comment: thx, that is it, the solution.

unexpected result of Excel formula


how I grant s3 bucket access with this particular role?

Question: I've looked at some other solutions for similar questions, but here's the twist: I was given this and asked to grant s3 bucket for another account to put/get objects:
arn:aws:iam::[account number]:role/CustomerManaged/XMO-Custom-SPEG-DPM-Share-Role

I know the basics of how to change bucket policies in the JSON format. Do I need to create the JSON from this in the s3 bucket policy, or do I add this in IAM? I have seven tabs open for AWS doc pages but am getting lost in the weeds of what to do here.
Comment: You need to assign role to the resource you will be accessing s3 bucket from.
Role is designed to assign to AWS resources, can perform some interactions with the resources. You can assign role to EC2 instance via role profile or ECS task etc...
Comment: @DanielHornik the role exists in a different account.
Comment: Ahh OK, so you can delegate permisisons like here: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html
Answer: It appears that your requirement is:

An IAM Role (Role-A) in Account-A wants to access...
An Amazon S3 Bucket (Bucket-B) in Account-B
You are an Administrator in Account-B

The simplest way to permit such access is to add a Bucket Policy to Bucket-B:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::ACCOUNT-A:role/CustomerManaged/XMO-Custom-SPEG-DPM-Share-Role"
            },
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::bucket-name/*"
            ]
        }
    ]
}

This policy says:

Allow the given IAM Role
Permission to put/get objects
In this bucket

There is no need to assume roles. Simply adding this bucket policy on Bucket-B allows Role-A to access the bucket.
Oh, and Role-A also needs to be granted sufficient S3 permissions to access the bucket, which might be via generic permissions (eg s3:GetObject on a Principal of *), or it could be specific to this bucket. Basically, Account-A has to grant it permission (via IAM), AND Account-B has to grant it permission (via the bucket policy).
Comment: Oops! Just noticed that my answer was similar to @jarmod. Hopefully between the two you'll get the right idea.
Answer: In account B, which needs to access account A's bucket, set up an IAM role that includes the relevant permissions (e.g. s3:GetObject on s3://bucketa/prefix/*). For example:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": "arn:aws:s3:::bucketa/prefix/*"

        }
    ]
}

In account A, which owns the bucket, add an S3 bucket policy to bucketa that gives the relevant permissions to the account B role. For example:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::accountb:role/rolename"
            },
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::bucketa/prefix/*"
            ]
        }
    ]
}

Finally, in account B, given the relevant IAM users or roles permission to assume the account B role so that they can get cross-account access to the bucket.
Alternatively, rather then delegate permissions directly to an IAM role in account B, account A can set a principal of "AWS": "arn:aws:iam::accountb:root" in the bucket policy and this will allow account B administrators to delegate permission as they choose (see example).
For more, see How can I provide cross-account access to objects that are in Amazon S3 buckets?


Formula for standardized Regression Coefficients(derivation and intuition)

Question:
Here is the formula of standardized regression coefficients. I have two questions:
1)How do we derive this formula?
2)How can we understand intuitively this formula(I cannot understand why do we multiply old coefficient by ratio 'standard deviation of predictor/standard deviation of dependent vatiable'.
Comment: It's merely a change of units of measurement.  See, for instance, the analysis at http://stats.stackexchange.com/a/197788/919, formula $(2)$.
Comment: Are you comfortable with linear algebra, matrix algebra?
Comment: @MatthewGunn Yes I am.
Answer: Basic intuition: change of units
Let's consider two models. Let's say $y$ is in units degrees.
Model 1: $x_i$ is denoted in units feet.
$$y_i = a + b x_i + \epsilon_i$$
$b$ is in units degrees per feet.
Model 2: $\tilde{x}_i = 12 x_i$, hence $\tilde{x}_i$ is denoted in units inches.
$$y_i = a + \tilde{b} \tilde{x}_i + \epsilon_i$$
$\tilde{b}$ is in units degrees per inch.
You will find that $\tilde{b} \cdot \frac{12\text{ inches}}{1\text{ foot}} = b$.
You're essentially doing the same thing with your scaling by the standard deviation. It's a change of units and linear models handle changes of units in an intuitively sensible way.
Linear transformation of data leads to linear transformation of coefficient estimates
Linear regression is an linear model. Any linear transformation of the input leads to a clearly defined linear transformation of the estimate.
Let $X$ be the $n$ by $k$ data matrix where we have $n$ observations of $k$ regressors.
Let $\tilde{X} = X A'$ so that $\tilde{\mathbf{x}}_i = A\mathbf{x}$.
Then we have:
\begin{align*}
\tilde{\mathbf{b}} &= (\tilde{X}'\tilde{X})^{-1} \tilde{X}'\mathbf{y} \\
&= \left( A X'X A'\right)^{-1} AX'\mathbf{y}\\
&= A'^{-1} (X'X)^{-1} A^{-1} A X'\mathbf{y}\\
&= A'^{-1} \mathbf{b}
\end{align*}
So if your data is transformed by the linear transformation $A$ so that $\tilde{\mathbf{x}}_i = A \mathbf{x}$ then your estimate $\mathbf{b}$ is transformed so that:
$$\tilde{\mathbf{b}} = A'^{-1} \mathbf{b}$$
Is standardizing (i.e. subtracting mean and scaling by standard deviation) a linear transformation? No if your data does not include a constant, but yes if it does! (i.e. the first column of $X$ is a column of $1$s.)
Example: standardizing with 2 variables and a constant
Let
$$ A = \begin{bmatrix} 1 & 0 & 0 \\ -\frac{\mu_1}{\sigma_1} & \frac{1}{\sigma_1} & 0 \\
-\frac{\mu_2}{\sigma_2} & 0 & \frac{1}{\sigma_2} \end{bmatrix} \quad \quad \mathbf{x} = \begin{bmatrix} 1 \\ x_1 \\ x_2 \end{bmatrix}$$
Then:
$$ \tilde{\mathbf{x}} = A\mathbf{x} = \begin{bmatrix} 1 & 0 & 0 \\ -\frac{\mu_1}{\sigma_1} & \frac{1}{\sigma_1} & 0 \\
-\frac{\mu_2}{\sigma_2} & 0 & \frac{1}{\sigma_2} \end{bmatrix} \begin{bmatrix} 1 \\ x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 1 \\ \frac{x_1 - \mu_1}{\sigma_1} \\ \frac{x_2 - \mu_2}{\sigma_2} \end{bmatrix}$$
That is linear transformation $A$ will standardize your right hand side variables (i.e. subtract mean and divide by standard deviation).
You can show:
$$ A'^{-1} = \begin{bmatrix} 1 & \mu_1 & \mu_2 \\ 0 & \sigma_1 & 0 \\ 0 & 0 &\sigma_2 \end{bmatrix}$$
Hence:
$$\tilde{\mathbf{b}} = A'^{-1} \mathbf{b} = \begin{bmatrix} b_0 + \mu_1 b_1 + \mu_2 b_2 \\ \sigma_1 b_1 \\ \sigma_2 b_2 \end{bmatrix}$$
You get a conceptually similar logic/result if you apply a linear transformation to $y$ (see @whuber's comment for roadmap).
Comment: +1 I thought you had in mind a more fundamental linear algebra explanation: since (when the model includes an intercept) standardization changes the design matrix $X$ into $X_0=XQ^{-1}$ for an appropriate matrix $Q$ and the augmented response matrix $Y$ into $Y_0=YR^{-1}$, then any solution $Y_0 = X\beta$ can be rewritten $Y_0R=X_0Q\beta$. Right-multiplication by $R^{-1}$ gives $Y_0 = X_0(Q\beta R^{-1})$, whence $\beta^{*}=Q\beta R^{-1}$, giving the quoted formula. (The augmented response includes a column of constants needed to subtract the mean from $Y$.)
Comment: Another answer of mine on this topic: https://stats.stackexchange.com/questions/237039/is-there-ever-an-advantage-to-using-raw-data-in-supervised-learning-over-normali/237051#237051


Differences between cross validation and bootstrapping to estimate the standard error of the AUC of a given ROC curve

Question: I know there's been some discussion on differences between CV and bootstrapping for estimating out-of-sample prediction error of a classifier.
For example, in here (Differences between cross validation and bootstrapping to estimate the prediction error), here (Bootstrapping estimates of out-of-sample error) and here (What is the .632+ rule in bootstrapping?).
I'm interested in, however, maximizing AUC directly, and not the prediction error (1 - accuracy) itself as the cutoff points are not specified a priori.
Would the reasoning of the posts above apply? I find it difficult, for example, to calculate the AUC with only 10 observations (assuming a CV10 applied to a sample of 100 observations).
Currently I'm using the "optimism" bootstrap estimator, though it is pretty expensive (at least for the PC I access to).
Any thoughts?
Comment: AUC seems to be the more "neutral" evaluation metric as I don't have to specify a threshold (which is, in itself, a different problem altogether), required to calculate accuracy, for example.
Comment: See [this page](http://stats.stackexchange.com/questions/71184/cross-validation-or-bootstrapping-to-evaluate-classification-performance?rq=1) for further information, including some thoughts on why AUC might not be the best evaluation of your model.
Answer: The AUC is equivalent to the c-index or concordance, the fraction of pairs of cases in which the ordering of the predictor value (based on the combination of predictor variables) is consistent with differences in outcome. So in principle if you wanted to do cross-validation you could use the paired comparisons of the held-out cases to calculate a concordance index (and thus an AUC) for each fold of CV.
But to get enough comparisons to be useful you would probably have to do not just one CV but multiple repeated cross validations with different subsetting of the cases. The many iterations of CV may offset your initial idea that fewer computing resources are required for CV than for bootstrapping. I find the bootstrap more straightforward and have used it for estimating standard errors of AUC values. If you only have on the order of 100 observations there shouldn't be that large a computational cost, so check the bootstrap algorithm you are using.
My hesitation is that although AUC might be considered a "neutral" evaluation metric, classifiers are typically used in a situation where there are different costs to false-positive and false-negative determinations. It's not clear that you would necessarily get the same result by "maximizing AUC directly" as you would by evaluating the cost-benefit tradeoffs in the context of how you plan to use your results. And your use of the word "maximizing" suggests that you might be trying to use AUC to compare among models, which might be better done with a different measure like the Akaike Information Criterion; see the accepted answer on this page and its comments.
Comment: For model selection I've run 100CV2, 50CV4, 40CV5, and 10CV10 (CV) to get 200 pairs for comparison each time. It is somewhat costly but nothing that a top Intel/AMD processor can't handle in a few minutes. I had to write critical parts of the code in C to make things run (way) faster, though.
Comment: Which flavor of bootstrap estimator do you use? Elsewhere Frank Harrell advocated the "optimism" boostrap but I can't seem to find a proper reference. Thoughts?

I'm aware of what you mean about the AUC. I can't estimate error costs for this particular problem so I'm good with the whole AUC.

AIC and BIC don't apply to my problem, I reckon. The number of parameters is fixed and there`s no likelihood function.
Comment: Try looking at the functions provided in Harrell's `rms` package in R, and at the notes on his academic website.
Comment: [This page](http://thestatsgeek.com/2014/10/04/adjusting-for-optimismoverfitting-in-measures-of-predictive-ability-using-bootstrapping/) is exactly on point.


Highcharts formats differently in Safari vs Chrome

Question: I am using the following code which produces the desired Highchart formatting that I want in Safari. However when I tried it in Google Chrome I get the error "Uncaught TypeError: this.value.slice is not a function" even when I don't change anything.
In the xAxis section I change the string read in from the csv file from something like this '02/15/2016 10:31:46' to '10:31:46'.
However when I remove the entire xAxis section in the below code and run it in Chrome, it automatically formats the xAxis to be something like '10:31'. Personally I would prefer the format that is produced when the below code is used in Safari. I was just wondering does anyone know why this happens or what is it in Chrome that changes the way the below code works.
$.get(data, function(csv) {
  $('#container').highcharts({
    chart: {
      zoomType: 'x',
      type: 'column',
    },
    data: {
      csv: csv,
      lineDelimiter: "\n",
    },
    title: {
          text: 'CSV file data'
      },
    yAxis: {
        title: {
            text: 'Bytes'
        }
    },
    xAxis: {
      labels: {
        //Only show the time (not date and time)
        formatter: function() {
              return this.value.slice(10,-4);
        }
      }
    },
    plotOptions: {
        series: {
            marker: {
                enabled: false
            }
        }
    }
  });
});

Answer: If the value is not a String, then Chrome will not find .slice() - TypeError is thrown.
This is because Chrome is successful with parsing your date format into JavaScritp timestamp.
One way could be to set type of xAxis to 'category', because I guess this is what you are using.
Example: http://jsfiddle.net/vs6qpobq/
Another way is to make sure that date is parsed correctly in Safari by adding a paring function in parseDate and get an info from a timestamp.
Comment: Adding category to the xAxis section fixed this issue, Thank you!


React native firestore not working properly because of undefined FirebaseStorageTypes.TaskSnapshot ref

Question: I have a react native app and I am trying to save a post using firestore. I am using @react-native-firebase/firestore and am using the following code:
`
import firebase from "@react-native-firebase/app";
import "@react-native-firebase/firestore";
import "@react-native-firebase/storage";

export const saveMediaToStorage = (media, path) =>
  new Promise((resolve, reject) => {
    const fileRef = firebase.storage().ref().child(path);

    fetch(media)
      .then((response) => response.blob())
      .then((blob) => fileRef.put(blob))
      .then((task) => {
        task.ref.getDownloadURL();
      })
      .then((downloadUrl) => {
        // console.log(downloadUrl);
        resolve(downloadUrl);
      })
      .catch((error) => {
        console.log(error);
        reject();
      });
  });

Response, blob and task all look good and task variable looks like this:
Object {
  "bytesTransferred": 2274761,
  "metadata": Object {
    "bucket": "_______.appspot.com",
    "contentDisposition": "inline; filename*=utf-8''image2",
    "contentEncoding": "identity",
    "contentType": "image/jpeg",
    "fullPath": "post/*****/****/image1",
    "generation": "1672255330334821",
    "md5Hash": "vVYL9wVo/***==",
    "metageneration": "1",
    "name": "image2",
    "size": 2274761,
    "timeCreated": "2022-12-28T19:22:10Z",
    "updated": "2022-12-28T19:22:10Z",
  },
  "state": "success",
  "totalBytes": 2274761,
}

I also checked firebase and see that the images are saved in the storage, but it looks like the issue is with the download url.
task.ref.getDownloadUrl() returns undefined because task.ref is undefined. Any idea what might be going wrong?
I have been working in an expo managed workflow and was using firebase/firebase-storage, and it was working fine, but I recently ejected and switched to a bare workflow in android and started using @react-native-firebase/firestore instead, which is when it broke. I added the required permissions for android (READ/WRITE_EXTERNAL_STORAGE), but I'm wondering if I am missing something android-specific, or if the syntax is different for @react-native-firebase.
Answer: I had the same problem when doing :
let uploadTask = ref.put(blob, {customMetadata: newMetadata});
return uploadTask
    .then((taskSnapshot) => {
        if (taskSnapshot.state === firebase.storage.TaskState.SUCCESS) {
            return taskSnapshot.ref.getDownloadURL(); // Error
        } else {
            throw new Error("Upload error")
        }
    })
    .finally(() => {
        blob.close();
    });

I would get ref is undefined. I got it working by using the previously defined ref
let uploadTask = ref.put(blob, {customMetadata: newMetadata});
return uploadTask
    .then((taskSnapshot) => {
        if (taskSnapshot.state === firebase.storage.TaskState.SUCCESS) {
            return ref.getDownloadURL(); // Success
        } else {
            throw new Error("Upload error")
        }
    })
    .finally(() => {
        blob.close();
    });


How to keep track of how much profile a user has completed in spring boot?

Question: I have a Spring Boot project in which a user can create his/her profile, which may not be completed in one sitting.
I want to keep track of how much profile is completed, probably in percentage, and show it to the user.
I was thinking of checking all the fields for null but that seems tedious as there are already about 25 fields, which might increase in future.
While researching about this, I found some answers on SO about using java reflection, but I also came to know that refleciton is slow, and it creates fragile code.
(I am using java 11)
Other than checking nulls in the fields of each user, is there a better way to keep track of profile completeness?
Answer: You have n fields. Assuming that 0 <= k <= n fields were already filled, you have (100 * k / n)% completed. Now, you only need to:

initialize k with 0 upon form completion start
increment k whenever a field is filled
decrement k whenever a filled field gets unfilled
display the new percentages whenever k changes
if a new field is created for the forms, increment n
if a field no longer exists, decrement n
you need to decide whether you count all your fields into the completion percentage or only the required fields
upon page reload, you might want to preserve the form values. You can use localStorage to store the current status whenever a field changes, storing all the filled values
upon page reload the number of filled values stored into localStorage will be the value of k


Calculating Integral via Hermite

Question: Using the "First Hermite Approach" I have to calculate:
$$\int \dfrac{x^3+x^2+x}{x^4+2x^2+1} \mathrm dx $$
I really have no idea how to use this so-called First-Hermite-Approach. I wanted to solve this problem by using partial-fraction.. however, I'm not 'allowed' to?!
Thank you very much :)

EDIT:
In my book it says:
With P(x) and Q(x) being two Polynoms with deg P < deg Q, let
$
Q(x) = (x-a_1)^{k_1} \cdots (x-a_r)^{k_r} \cdot (x^2+2p_{1}x+q_{1})^{m_1} \cdots (x^2+2p_{s}x+q_{s})^{m_s} $
$ z(x) = (x-a_1) \cdots (x-a_r) \cdot (x^2+2p_{1}x+q_{1}) \cdots (x^2+2p_{s}x +q_{s})$
$ V(x) = \frac{Q(x)}{z(x)}.$
Then:
$\int \frac{P(x)}{Q(x)} dx = \frac{U(x)}{V(x)} + \int \frac{w(x)}{z(x)} dx $ is the first-Hermite.
Well, that's it!
Comment: Unlucky, mate..
Comment: @K.L.: What book is this? Regards
Comment: @Amzoti: The lecture notes (for university course) :) So not really "a book".
Comment: What is U(x), w(x)?
Answer: Write the integral like $c\displaystyle\int \frac{f'}{f}$.
Answer: Here is the procedure which can avoid partial fraction:
$\int\dfrac{x^3+x^2+x}{x^4+2x^2+1}dx=\int\dfrac{x^3+x}{(x^2+1)^2}dx+\int\dfrac{x^2}{(x^2+1)^2}dx$
Let $x=\tan\theta$ ,
Then $dx=\sec^2\theta~d\theta$
$\therefore\int\dfrac{x^3+x}{(x^2+1)^2}dx+\int\dfrac{x^2}{(x^2+1)^2}dx$
$=\int\dfrac{x^2+1}{2(x^2+1)^2}d(x^2)+\int\dfrac{\tan^2\theta\sec^2\theta}{(\tan^2\theta+1)^2}d\theta$
$=\int\dfrac{1}{2(x^2+1)}d(x^2+1)+\int\dfrac{\tan^2\theta\sec^2\theta}{\sec^4\theta}d\theta$
$=\int\dfrac{1}{2(x^2+1)}d(x^2+1)+\int\dfrac{\tan^2\theta}{\sec^2\theta}d\theta$
$=\int\dfrac{1}{2(x^2+1)}d(x^2+1)+\int\sin^2\theta~d\theta$
$=\int\dfrac{1}{2(x^2+1)}d(x^2+1)+\int\dfrac{1-\cos2\theta}{2}d\theta$
$=\dfrac{\ln(x^2+1)}{2}+\dfrac{\theta}{2}-\dfrac{\sin2\theta}{4}+C$
$=\dfrac{\ln(x^2+1)}{2}+\dfrac{\theta}{2}-\dfrac{\sin\theta\cos\theta}{2}+C$
$=\dfrac{\ln(x^2+1)}{2}+\dfrac{\tan^{-1}x}{2}-\dfrac{x}{2(x^2+1)}+C$

Calculating Integral via Hermite


Show that there is such a Sylow subgroup

Question: I want to show that if $G$ is finite and $f:G\rightarrow H$ is a group epimorphism and if $Q\in \text{Syl}_p(H)$ then there is a $P\in \text{Syl}_p(G)$ with $Q=f(P)$.
$$$$
I have done the following:
We have that $f:G\rightarrow H$ is a group epimorphism, so $f$ is surjective. That means that for every $y\in H$ there is a $x\in G$ such that $f(x)=y$. So, we have that $H\leq G$.
We have that $Q\in \text{Syl}_p(H)$. Suppose that $|H|=p^ma$, where $p\not\mid a$. That means that $|Q|=p^m$.
$$$$
Could you give me a hint how we could continue?
$$$$
EDIT:
From the first isomorphism theorem we have that $H\cong G/\ker f$.
SInce $Q\in \text{Syl}_p(H)$ we have that $Q\leq H$.
So, there is subgroup of $G$, say $U$, such that $Q=f(U)$.
From the correspondence theorem we have that $\ker f\leq U$.
From the correspondence theorem we have also that $[G:U]=[H:Q]$.
Let $P\in \text{Syl}_p(U)$, then we have that $[G:P]=[G:U][U:P]$.
We have that $[G:U]$ and $[U:P]$ are not divisible by $p$.
Therefore, $[G:P]$ is not divisible by $p$.
That means that $P\in \text{Syl}_p(G)$, right?
Since $P\leq U$ we have that $f(P)\leq f(U)=Q$.
But how could we show that $Q=f(P)$ ?
Comment: Let  $F = \phi^{-1}(Q) = \{ g \in G \mid \phi(g) \in Q \}$. Then $K = \ker \phi \le F$ and $K/F \cong Q$ and $|G:K| = |H:Q| = a$. Let $P \in {\rm Syl}_p(F)$. Then $P \in {\rm Syl}_p(G)$ and $\phi(P)=Q$.
Comment: $\ker \phi \le F$ is true by definition of $F$, and $K/F \cong Q$ is the first isomorphism theorem.
Comment: Yes sorry I meant $f$ not $\phi$. The definition of $f^{-1}(Q)$ is $\{ g \in G : f(g) \in  Q \}$.  This is a subgroup of $G$ with $f^{-1}(Q)/\ker(f) \cong Q$.
Comment: Why does it hold that $\ker\phi\leq F$ and that $K/F\cong Q$ ? @DerekHolt
Comment: With $\phi$ you mean $f$, right? How do we know that the inverse $f^{-1}$ exist? $$$$ Since $f:G\rightarrow H$ is a group epimorphism and $Q$ is a subgroup of $H$, does it always stand that there is a group $F$ such that $Q=f(F)$ or equivalently $F=f^{-1}(Q)$ ? @DerekHolt
Comment: Ah ok... You said at your first post that $|G:K| = |H:Q| $. Shouldn't it be $|G:F| = |H:Q| $ ? $$$$ Also, why does it stand that $f(P)=Q$ ? @DerekHolt
Comment: When $f(P)=Q$, and we have also that $f(F)=Q$, do we conclude that $F=P$ ? @DerekHolt
Comment: I haven't really understood why we suppose that $P \in {\rm Syl}_p(F)$... Could you explain it to me? Can it not be that $F$ is a subgroup of $P$?  @DerekHolt
Answer: Remember the correspondence theorem, and also $\;H\cong G/\ker f\;$ , so if we have
$\;Q\in Syl_p(H)=Syl_p(G/\ker f)\;$ , then there exists $\;K\le G\;$ such that
$$\ker f\le K\;,\;\;K/\ker f=Q\;,\;\;[H:Q]=[G:K]$$$${}$$
If we now take $\;P\in Syl_p(K)\;$ , then we get $\;[G:P]=[G:K][K:P]\;$ , but$${}$$
$$\begin{cases}[G:K]=[H:Q]\,\sim\,\text{coprime with}\;p\;\,\text{since}\,\;Q\in Syl_p(H)\\{}\\{}[K:P]\,\sim\,\text{coprime with $\,p\,$ since}\;P\in Syl_p(K)\end{cases}\;\;\;\implies\;\text{gcd}\,\left([G:P],\,p\right)=1$$$${}$$
and thus we get $\;P\in Syl_p(G)\;$ .
Comment: @MaryStar First Isomorphism theorem, of course.
Comment: This is not right because $\ker f$ is not necessarily a $p$-group so it is not true that $\ker f \le P$. You need to take a Sylow $p$-subgroup of the inverse image of $Q$ under $f$.
Comment: @DerekHolt Thank you. I think I see your point, I shall edit now....but I see this is practically the same as your argument in the comment. Ok, I'll edit and then, if needed, I will erase.
Comment: Why does it hold that $\;H\cong G/\ker f\;$ ?
Comment: Since $H$ is isomorphic to $G/\ker f$, we have that $|\text{Syl}_p(H)|=|\text{Syl}_p(G/\ker f)|$, right? But we do not conclude that $\text{Syl}_p(H)=\text{Syl}_p(G/\ker f)$, do we?
Comment: Also, at $K/\ker f=Q$ do you mean equality or isomorphism?
Comment: I haven't really understood why we take that $\;P\in Syl_p(K)\;$... Could you explain it to me? Can it not be that $K$ is a subgroup of $P$?
Comment: @MaryStar Excuse me but I find this a little exhausting: you seem to be having lots of problems with very, very basic things that should, in my opinion, be well understood before attempting problems of this kind. Of course isomorphic groups have the same number of Sylow subgroups for some given prime, and $\;Q=K/\ker f\;$ is equality or isomorphism: it all depends on the grade of formality, on definitions...and it really isn't that important *in this case*, and we take $\;P\in Syl_p(K)\;$ because is a group we can tell something about **and also** because this precise group is ...
Comment: ...what will be a Sylow subgroup of the whole group, as shown in the answer.
Comment: Since $P$ is a $p$-Sylow subgroup of $U$, we have that $P$ has a prime power order, say $p^i$. Since $[G:P]$ is coprime with $p$, we know that at the prime factorization of $|G|$ the maximal power of $p$ is $i$, or not? That's why $P\in \text{Syl}_p(G)$, right?
Comment: But why does it hold that $Q=f(P)$ ? Do we use the fact that all $p$-Sylow subgroups are conjugated?
Comment: @MaryStar Who says that holds?
Comment: Are we not supposed to show it according to the problem statement?
Comment: We have that $U$ and $P$ are $p$-Sylow subgroups of $G$. That means that these two are conjugate, right? Therefore, $P=gUg^{-1}$, for some $g\in G$, right? Do we have to show that $g=1$ ?


How to use the new Microsoft.IdentityModel.JsonWebTokens to create a JwtSecurityToken?

Question: Since https://www.nuget.org/packages/Microsoft.IdentityModel.JsonWebTokens is a 'newer, faster version of System.IdentityModel.Tokens.Jwt that has additional functionality', but I didn't find some example on how to switch to the new NuGet package, I wanted to ask how to convert the following code (Which uses System.IdentityModel.Tokens.Jwt and Microsoft.IdentityModel.Tokens) to Microsoft.IdentityModel.JsonWebTokens code. The hardcoded values are just for reference, of course.
var data = Encoding.UTF8.GetBytes("SomeStringFromConfig1234");
var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(data);

var claims = new List<System.Security.Claims.Claim>
{
    new System.Security.Claims.Claim(ClaimTypes.Name, "Testuser"),
    new System.Security.Claims.Claim(ClaimTypes.GroupSid, "Tenant1"),
    new System.Security.Claims.Claim(ClaimTypes.Sid, "3c545f1c-cc1b-4cd5-985b-8666886f985b")
});

var algorithms = Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature;
var credentials = new Microsoft.IdentityModel.Tokens.SigningCredentials(securityKey, algorithms));

var token = new System.IdentityModel.Tokens.Jwt.JwtSecurityToken(
    "MyIssuer",
    "MyAudience",
    claims,
    expires: DateTime.UtcNow.AddMinutes(120),
    signingCredentials: credentials;

var tokenHandler = new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler();
var tokenString = tokenHandler.WriteToken(token);

Answer: This should work:
var data = Encoding.UTF8.GetBytes("SomeStringFromConfig1234 SomeStringFromConfig1234");
var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(data);

var claims = new Dictionary<string, object>
{
    [ClaimTypes.Name] = "Testuser",
    [ClaimTypes.GroupSid] = "Tenant1",
    [ClaimTypes.Sid] = "3c545f1c-cc1b-4cd5-985b-8666886f985b"
};
var descriptor = new Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor
{
    Issuer = "MyIssuer",
    Audience = "MyAudience",
    Claims = claims,
    IssuedAt = null,
    NotBefore = DateTime.UtcNow,
    Expires = DateTime.UtcNow.AddMinutes(120),
    SigningCredentials = new Microsoft.IdentityModel.Tokens.SigningCredentials(securityKey, Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature)
};

var handler = new Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler();
handler.SetDefaultTimesOnTokenCreation = false;
var tokenString = handler.CreateToken(descriptor);

Then if compare JWT payload from the output string:
{
  "aud": "MyAudience",
  "iss": "MyIssuer",
  "exp": 1709078400,
  "nbf": 1708992000,
  "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "Testuser",
  "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid": "Tenant1",
  "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/sid": "3c545f1c-cc1b-4cd5-985b-8666886f985b"
}

with the JWT payload from original code:
{
  "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "Testuser",
  "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid": "Tenant1",
  "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/sid": "3c545f1c-cc1b-4cd5-985b-8666886f985b",
  "nbf": 1708992000,
  "exp": 1709078400,
  "iss": "MyIssuer",
  "aud": "MyAudience"
}

both JWT payloads have the same claims
Comment: I have tested your example, this works as expected.
Comment: I was confused about `Microsoft.IdentityModel.Tokens` and thought it should be replaced with something from `Microsoft.IdentityModel.JsonWebTokens`, too... Thank you, I will try this now :)


What are criteria to define a sport as "national sport"?

Question: What are "objective" criteria or rules (if exists) to define a sport as "national sport" for each Country?
e.g. National sport for Italy is (probably) soccer, but I do not know if there are objective criteria to define it. In fact I think there is no official list for National sport for most nation in the world
Comment: The link @DonLarynx provides contains information on how a national sport may be viewed in its respective country...either *de facto* (in practice) or *de jure* (in law). *De facto* is understood within a nation whereas *de jure* is actually documented in a nation's law (see [Canada](http://laws-lois.justice.gc.ca/eng/acts/N-16.7/page-1.html) for example).
Comment: However, to define the intricacies of how each country's national sport originated is [too broad](http://sports.stackexchange.com/help/closed-questions), but asking how a country's national sport may be recognized is a reasonably-scoped question.
Comment: A simple Google search for "national sport" turns up the result: http://en.wikipedia.org/wiki/National_sport
Comment: not only is it too broad but also highly subjective. Football (soccer) is generally considered the largest sport in many Mediterranean countries, however it's likely someone who for instance has played basketball might disagree whether or not football is _the one and only_ national sport in the country.
Comment: @posdef I agree with you, but the way you present your case leans toward being opinionated rather than subjective. Otherwise, the same could be said about the US in regards to American football (because of its popularity), even though it is widely understood that baseball is the *de facto* national sport.
Comment: @edmastermind29 sure but how does one define the _de facto_ national sport, that's what I am questioning here :)
Comment: On a side note, it's good to keep in mind football can not be a national sport (in a sense) anywhere other than the U.K, since that's where modern football originates from. You could argue that Florentine football is a national sport, but then Italians from elsewhere in the country (say for instance Sicily) might disagree with that statement. All in all, I don't think there is a _factual_ answer to this question.
Comment: this is not an objective rule
Answer: The national sport of a country tends to be one that is linked with the culture of that country. Most European countries have the national sport of football (soccer) and America's national sport is baseball. This is not the most played sport in that country, for example the most played sport in England is football, but cricket is actually our national sport.
A Country can have more than one, for example USA have baseball and American football.
Comment: Have you a reference to support the claim that cricket is the national sport of England? Much as I would prefer that to be the case, I was under the impression that it was actually association football.
Comment: Doesn't seem to have any real references there but I'd imagine it is laid in law somewhere. I know in Ireland our national games predate Christianity and at one time players were not allowed to play football or rugby if they played GAA.
Comment: @Spinner - I knew that England's national sport is Cricket. Now found a reference from [Wikipedia](http://en.wikipedia.org/wiki/National_sport)
Answer: Some countries have official, legal national sports. Others simply have unofficial sports that people say are the national sport. For both groups, I would say the criteria are a combination of these factors:

The sport should have been invented in the country. Example: lacrosse
in Canada.
The sport should be extremely popular. Example: kabaddi in
Bangladesh.
If it's not popular, the sport should be "important" in some cultural
way and therefore worthy of conservation, reenactment, and reverence. Example: Charreada in Mexico.
When possible, the sport should convey something meaningful about the country, ideally in a kick-ass way. Example: Varzesh-e Bastani in Iran.

For unofficial sports, current popularity would be a bigger factor than for official sports.
I wrote more about this topic here.


Protocols/Methods available to synchronize msgs and their acks in a broadcast asynchronous network system?

Question: What are the protocols/methods available to synchronize msgs and their acks in a broadcast asynchronous network system? We are using UDP with ACKs and timer to see if there is a need for a resend (max send same msg 3 times).
Comment: Is the question how to implement ordered delivery above an existing ACK-based reliable broadcast middleware?  Or is it an open question about messaging protocols?
Answer: If you're using ACKs and resends, you should think hard about using TCP as building reliability and scalability on top of UDP is fraught with peril (3x resends don't actually give you reliability, either). In a broadcast system that needs to scale you should think about just doing periodic resends and have the receivers unsubscribe once they have the information that they need (which is how lots of auto-discovery systems work).
Comment: But we have to use UDP, cos it is already used in the old software we are building on it. The deadline is tight and we don't have the source code for the old software. So what can we do?
Answer: UDP with ACKs. Try TCP; it does all that and more.
If you really wish to do it by hand, look at sliding window. Long story short, you can send multiple messages at once and expect multiple ACKs (instead of sending and waiting for ACK). How you proceed once an ACK times out (is not received) depends on you. If you are sending video frames, you may choose to ignore it. On the other hand, you may choose to resend only the packets that have not been ACKed, or resend all after last expired ACK.
Wikipedia describes the sliding window protocol here.
A visual demo is at this link: http://www.osischool.com/protocol/Tcp/slidingWindow/index.php


Laravel 4.2 - Trabalhando com tarefas assíncronas para gerar relatórios .xlsx

Question: Olá,
estou trabalhando com uma aplicação em Laravel 4.2 e preciso que, quando o usuário efetue a requisição para gerar um relatório do sistema, uma tarefa seja lançada para gerar o relatório, quando este relatório estiver pronto em uma pasta, preciso enviar um e-mail para o usuário com a URL para efetuar o download do relatório.
Existe uma forma de trabalhar com tarefas assíncronas no Laravel? Algum exemplo?
Obrigado pela atenção.
Answer: Encontrei uma solução para suprir minhas necessidades, um aplicativo gerenciador de filas chamado Beanstalkd, consumir esse serviço é realmente fácil no Laravel 4.2, pois o mesmo possui suporte para utiliza-lo. Mais interessante ainda é saber que existem diversas bibliotecas em diversas linguagens (C/C++, Django, Go, Java, PHP, Lua, Python, entre outras) para utilizar o Beanstalkd.
**
Instalação do Beanstalkd
**
A instalação pode ser feita em diversas versões do Linux, cito o Ubuntu, utilizando o gerenciador de pacotes apt-get, fácil de utilizar, o website possui informação de instalação para vários Sistemas Operacionais, para instalar só utilizar a linha de comando:
sudo apt-get update

Para atualizar a lista do gerenciador de pacotes, e então:
sudo apt-get install beanstalkd

Para instalar o Beanstalkd, para iniciar o serviço utilize o comando:
sudo service beanstalkd start

**
Instalação do Beanstalkd Console
**
Para poder ver o conteúdo das filas no Beanstalkd eu recomendo o Beanstalkd Console, simples de instalar facilita e muito verificar as filas do Beanstalkd e até encerrar processos que estejam travados nas filas, para instalar é fácil, basta baixar  o arquivo do website oficial, descompactar e configurar no seu ambiente como um website. O acesso local se dá por localhost:8080 (porta varia de acordo com a configuração do seu ambiente).
**
Configuração do Laravel 4.2
**
Para consumir o serviço no Laravel 4.2:
Primeiramente adicione a dependência no projeto utilizando o Composer:
composer require pda/pheanstalk ~2.0

Em seguida, já com a base de dados configurada no Laravel, adicione uma tabela na base para receber erros de execução da fila com os comandos:
php artisan queue:failed-table

php artisan migrate

Deve-se então configurar o arquivo em app/config/queue.php, as seguintes linhas tem que ser alteradas:
'default' => 'beanstalkd', // Driver a ser utilizado, linha 18

'host'   => 'minhaFila', // Nome do host da sua fila, linha 39

'queue'  => 'projeto', // Nome da fila do seu projeto, linha 40

Com isso o Laravel 4.2 esta configurado e pronto para utilização. Para que o Laravel possa "escutar" a fila e atender suas requisições, na linha de comando, dentro da pasta da sua aplicação Laravel utilize o comando:
php artisan queue:listen

**
Exemplo
**
Como exemplo de teste, em uma versão "limpa" do Laravel já devidamente configurado para utilizar o Beanstalkd, proceda da seguinte forma:
1. Altere /app/routes.php para:
<?php

Route::get('/', 'HomeController@showWelcome');

2. Altere /app/controllers/HomeController.php para:

class HomeController extends BaseController {

    public function showWelcome()
    {
        $numero = 120;
        // envia tarefa para fila
        Queue::push('Calculos@fatorial', array('numero' => $numero));

        return View::make('hello');
    }

}

3. Crie um arquivo com nome Calculos.php em /app/controllers, com o seguinte código:
<?php

    class Calculos {
        public function fatorial($job, $data)
        {
            Log::info('Iniciando JOB Fatorial');
            $valor = $data['numero'];
            Log::info('Valor obtido para Fatorial, iniciando calculos...');

            $r = 1;
            $fatorial = 0;

            // CALCULANDO
            for($i = $valor; $i > 0; $i--) {
                $r = $r * $i;
            }
            $fatorial = $r;
            Log::info('O fatorial obtido foi: ' . $fatorial);

            // Após execução da Job remove-la da lista
            $job->delete();

            Log::info('JOB Fatorial removida da Lista');
        }
    }

Agora basta rodar o seu ambiente e no navegador digitar a URL de acesso, cada vez que for atualizada a página, uma nova tarefa será lançada na lista do Beanstalkd, você pode visualizar as tarefas e até removê-las da lista utilizando o Beanstalkd Console. Lembre-se de utilizar o comando:
php artisan queue:listen

Dentro do diretório raiz do seu projeto Laravel para que o mesmo possa receber requisições da Lista do Beanstalkd.
Conclusão
No meu caso o Beanstalkd foi uma ótima solução para que a minha aplicação web fosse capaz de executar tarefas que exigem longo tempo de execução sem impactar a navegação dos clientes então, resolvi gastar um tempinho para escrever um pouco do conhecimento que obtive porque não foi fácil, espero que o conteúdo acima seja de grande ajuda.
Abraço.


matrix homomorphism

Question: Prove that $ϕ$ is a homomorphism and describe its kernel.
$$
ϕ:ℝ→GL(2,ℝ),\qquad
ϕ(x)=
\begin{bmatrix}\cos(2x)&\sin(2x)\\-\sin(2x)&\cos(2x)\end{bmatrix}
$$
where $x∈ℝ$
I have begun by saying
$$
y=\begin{bmatrix}\cos(2y)&\sin(2y)\\-\sin(2y)&\cos(2y)\end{bmatrix}
$$
$ℝ$ denote the set of real numbers under addition so I need to show that $ϕ(x+y)=ϕ(x)ϕ(y)$
So I have calculated
$$
ϕ(x+y)\begin{bmatrix}\cos(2y)+\cos(2y)&\sin(2y)+\sin(2y)\\-\sin(2y)-\sin(2y)&\cos(2y)+\cos(2y)\end{bmatrix}
$$
Is this right? And I don't know how to go from there. any help would be appreciated.
Answer: Note that by definition,
$$
\phi(x+y)=
\begin{bmatrix}
\cos(2(x+y)) & \sin(2(x+y)) \\
-\sin(2(x+y)) & \cos(2(x+y))
\end{bmatrix}
$$
Now note that
\begin{align}
\cos(2x+2y)&=\cos(2x)\cos(2y)-\sin(2x)\sin(2y) \\
\sin(2x+2y)&=\sin(2x)\cos(2y)+\cos(2x)\sin(2y)
\end{align}
and compute
$$
\phi(x)\phi(y)=
\begin{bmatrix}
\cos(2x) & \sin(2x) \\
-\sin(2x) & \cos(2x)
\end{bmatrix}
\begin{bmatrix}
\cos(2y) & \sin(2y) \\
-\sin(2y) & \cos(2y)
\end{bmatrix}
$$
as a matrix product.
Comment: @ egreg: do I need to calculate the determinant of each and then multiply together? if so I did it but didn't get the same answer.
Comment: @jessica Why the determinant?
Comment: :Don't worry I've found it. But can you help me with finding the kernel?
Comment: @jessica The condition for $x\in\ker\phi$ is $\cos(2x)=1$ and $\sin(2x)=0$, so $\phi(x)$ is the identity matrix.

matrix homomorphism


Instalação lodown

Question: Estou tentando instalar o pacote lodown, mas o seguinte erro aparece e não consigo solucionar:

 ERROR: loading failed
    * removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/archive'
    Installation failed: Command failed (1)
    '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
      --no-save --no-restore --quiet CMD INSTALL  \
      '/private/var/folders/s0/ydk6pxp96xx9_skq6zsgnz7w0000gn/T/RtmplkTXsa/devtools54239183389/ajdamico-lodown-b902889'  \
      --library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library'  \
      --install-tests

   ERROR: dependency 'archive' is not available for package 'lodown'
    * removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/lodown'
    Installation failed: Command failed (1)

Alguém tem alguma ideia do que devo fazer?
Answer: Se você está usando o macOS, é necessário concordar com os termos da licença (Xcode/iOS license). Você pode ir ao terminal e rodar o código abaixo:
sudo xcodebuild -license

Depois disso, tente rodar o código para instalar o pacote lodown novamente:
devtools::install_github("ajdamico/lodown")

Comment: a língua a ser utilizada é o português. Por favor edite sua resposta
Answer: Eu acabei de fazer o teste e a instalação aconteceu sem erros.
library(devtools)
install_github("ajdamico/lodown" , dependencies = TRUE)

O pacote archive, que deu problema na sua instalação, foi instalado com o auxílio do Rtools. Você pode fazer o download aqui.

Instalação lodown