Archimedean Property and Real Numbers

Question: I have few confusions:
a) What exactly is Archimedean Property. What does infinitesimal and infinite numbers do not exist in Archimedian ordered fields mean? Are not 0 and infinity such numbers?
b) What are the surreal numbers? Do they have anything to do with extended real numbers? I mean real numbers and positive and negative infinity. Rudin introduces extended real numbers with these two additional numbers. Does it mean in the field of reals, infinite means undefined and in extended, infinite means defined?
Does this mean extended real numbers are not Archimedian ?
Thank You.
Comment: If you want to learn about the surreals, the classic intro is Knuth, **Surreal Numbers: How Two Ex-Students Turned on to Pure Mathematics and Found Total Happiness**. If you want to learn about a similar system called the hyperreals, try Keisler, **Elementary Calculus: An Infinitesimal Approach**, http://www.math.wisc.edu/~keisler/calc.html
Comment: I will have a look at the second. It seems to have explained things in very simple and clear way.
Answer: The Archimedean Property of $\mathbb{R}$ comes into two visually different, but mathematically equivalent versions:
Version 1: $\mathbb{N}$ is not bounded above in $\mathbb{R}$.
This essentialy means that there are no infinite elements in the real line.
Version 2: $$\forall \epsilon>0\ \exists n\in \mathbb{N}:\frac1n<\epsilon$$
This essentially means that there are no infinitesimally small elements in the real line, no matter how small $\epsilon$ gets we will always be able to find an even smaller positive real number of the form $\frac1n$.
Note that $0$ is not infinitesimally small as it is not positive (remember that we take $\epsilon>0$) and $\infty$ doesn't belong in the real line. The extended real line $\overline{\mathbb{R}}$ is in fact not Archimedean, not only because it has infinite elements, but because it is not a field! ($+\infty$ has no inverse element for example).
You may want to note that the Archimedean Property of $\mathbb{R}$ is one of the most important consequences of its completeness (Least Upper Bound Property). In particular, it is essential in proving that $a_n=\frac1n$ converges to $0$, an elementary but fundumental fact.
The notion of Archimedean property can easily be generalised to ordered fields, hence the name Archimedean Fields.
Now, surreal numbers are not exactly $\pm \infty$ and I suggest you read this Wikipedia entry. You might also want to read the Wikipedia page for Non-standard Analysis. In non standard analysis, a field extension $\mathbb{R}^*$ is defined with infinitesimal elements! (of course that's a non Archimedean Field but interesting enough to study)
Comment: The way you've expressed the two definitions of the Archimedean property, in terms of $\mathbb{N}$, is not so good. The trouble here is that there are nonstandard models of arithmetic, in which we have infinite integers. By expressing a defining property of the reals in terms of the integers, you've left open what properties the integers are supposed to have, i.e., you've defined "Archimedean" for the reals in terms of "Archimedean" for the integers. It's nicer to say there does not exist any real number $x$ such that $x>1$, $x>1+1$, $x>1+1+1$, ... This looks the same, but it isn't.
Comment: @Ben Crowell Thanks for pointing that important fact. Though, it seems it's "normal in literature" since the books I am using both use integers to define Archimedian property for reals, I will note the point you have clarified. Thanks.
Comment: Thanks for this explanation, the two versions are exactly what I needed to get just the right kind of understanding.
Answer: Similar to the other answers.  The Archimedean property for an ordered field $F$ states: if $x,y>0$, then there is $n \in \mathbb N$ so that
$$
x+x+\dots+x \ge y
$$
where we have added $n$ terms all equal to $x$.
Consequences:  There are no infinite elements $u \in F$, that is, there is no $u$ so that $1+1+\dots+1 \lt u$ (with $n$ terms) for all $n$.
There are no infinitesimal elements $v \in F$, that is, there is no $v$ so that $v>0$ and $v+v+\dots+v < 1$ (with $n$ terms) for all $n$.
There is no real number called $\infty$, so we say the real numbers satisfy the Archimedean property.  The "extended real numbers" do not form a field, but may be useful for certain computations in analysis.  Instead of saying $\infty$ is defined or undefined maybe it is better to say whether $\infty$ is an element of the set you are talking about.
The surreal numbers No does form an ordered Field, but has infinite and infinitesimal elements, so the Archimedian property fails in No.
Comment: At least I tried to make it clear that $\mathbb N$ is not assumed to be a subset of $F$.
Comment: OK, one of the axioms for a field says there is an element called $1$.  This is not required to be the real number or natural number or rational number $1$, just something called $1$.  That is what I meant.  In really beginner books, this thing may have a different name for a few pages to avoid confusion.  Maybe something like $\mathbb 1$.  But even then, we begin using the notation $1$ for it after a while.
Comment: I don't think you need the reference to $n$ or $\mathbb{N}$ in the first paragraph, which has the disadvantage of making it sound as though you're defining the Archimedean property of the reals in terms of some assumed properties of the integers (including their Archimedean property, which would then need to be defined). Syntax is a finite thing, so in $x+x+\ldots+x\ge y$, the number of $x$'s is automatically finite.
Comment: Sorry, but could you please explain to dimwits like me the difference between $1+1+\dots+1$ (with $n$ terms) and $n$ ?
Answer: The Archimedean property states that if $x$ and $y$ are positive numbers, there is some integer $n$ so that $y < nx$.  This is a property of the real number field.  It can be shown that any Archimedean ordered complete fields is isomorphic to the reals.
In an ordered field in which the Archimedean property does not apply, there are numbers $\epsilon > 0$ so that $n\epsilon$ will not eventually exceed every element in the field.  These are the so-called infinitesimals.
The extended real numbers are not a field.  The Archimedean property applies specifically to the reals.
Fields with infinitesimals are studied in non-standard analysis.  See this Wikipedia article.
Comment: Same problem as with Nameless's answer.
Comment: When I say $nx$, I am saying $\sum_{k=1}^n x$.  Whenever you have a ring with identity, it is idiomatic to say $nx$ instead of writing out this sum.  Said ring may not have an isomorphic copy of $\mathbb{N}$ in it.  Example:  Integers mod $r$.
Comment: That isn't the issue. The issue is that when you write $\sum_{k=1}^n x$, you haven't addressed the question of what number system $k$ and $n$ belong to. To define this number system (the integers) sufficiently, you need to define it as being Archimedean...which means that you then need to define what it means for a number system to be Archimedean.
Answer: For (A)
Euclidean geometry is Archimedean because given two segments, say $\overline{AB}$ and $\overline{CD}$, each segment can be extended by its own length until the combined length is greater than that of the other segment.
In terms of numbers, it means that given two numbers greater than zero, say $s$ and $t$, either can be added to itself repeatedly until the resulting sum is greater than the value of other number.
Jerome Keisler in an article "The Hyperreal Line" has:
DEFINITION. An ordered field is said to be non-Archimedean iff it has at least one positive infinite element, and Archimedean otherwise.
If a field has an infinite member, than no finite member of the same field can be added to itself enough times to exceed that infinite number.
I would suppose that in light of nilpotent infinitesimals which aren't invertible to form infinites, his defininition would need to be ammended to say "positive infinite or infinitesimal," but I am not positive on that.
So an Archimedean field is one where there are no values so large that you can't add enough units to reach it (so no infinite elements), and no values so small that enough of them wont eventually add up to be a unit (so no infinitesimals allowed).
As to (2)
It has been answered well and plenty. The Surreal numbers form a non-Archimedean ordered field which contains all the real numbers as well as infinitesimals, infinites, and lots more.
If you remove the requirement from the Surreals that every left element is less than every right element, there is no longer a complete ordering. This gives the numbers called "games".

Archimedean Property and Real Numbers


Google App Engine with custom domain from Google Domains with SSL

Question: I am trying to get a custom domain linked to my Google App Engine project and am completely stuck - it will just not work.
I am trying to do everything through Google - I have no third-party domain registrars or anything.
I have purchased a domain myapp.app through Google Domains, and linked it to my App Engine app through AppEngine settings.
When I go to App Engine -> Settings -> Custom Domains, my custom domain shows as "Google-managed, auto-renewing" in the SSL security tab, and it shows a progress loader which when hovered, says "The certificate is being activated."
It doesn't show anything in certificate ID.

However, on the troubleshooting section at https://cloud.google.com/appengine/docs/flexible/java/securing-custom-domains-with-ssl#troubleshooting_managed_ssl_certificates it says "You can check the status of your certificate with the Admin API by using an AuthorizedCertificate.GET request."
I don't know what ID to pass to that API, but if I go to the neighbouring LIST API, I get some valid json, that looks like this:
{
    "certificates": [
        {
            "name": "apps/myapp/authorizedCertificates/16858526",
            "id": "16858526",
            "displayName": "managed_certificate",
            "domainNames": [
                "mydomain.app"
            ],
            "managedCertificate": {
                "lastRenewalTime": "1970-01-01T00:00:00Z"
            }
        }
    ]
}

(substituted 'myapp' and 'mydomain')
My custom domain ends with .app - and apparently they ONLY allow SSL. Have I bitten off more than I can chew here by introducing a chicken and egg situation - is it trying to verify the domain in order to set up the SSL, but the domain itself needs SSL from the start in order to work?
I am slightly confused about whether I need to enter the DNS records settings shown in the App Engine settings section below into Google Domains, or whether because I have left it on the "Use the Google Domains nameservers" setting this is configured automatically for me?
There is a section at the bottom called "Custom resource records" where you can enter A records.
I tried entering the "A" records shown on the Google App Engine settings section below, but it would only let me enter 1, and there are 4 showing.
It was my understanding that a domain could only have 1 A record, so why does it list 4 in the App Engine Settings section?
I am unsure as to what the primary problem is here. Is the domain not working because the SSL certificate is not configured correctly, or is the SSL certificate not working because the domain is not configured correctly?
Any ideas what I am missing or where to go from here or things to check much appreciated.
Comment: [As mentioned here](https://cloud.google.com/appengine/docs/flexible/java/mapping-custom-domains#before_you_begin), Google domains do not require verification with App Engine. The Domain should automatically show up in the section, Select the domain you want to use. I assume you went through the next steps to map the Domain to the application. Additionally, [as indicated on the doc](https://cloud.google.com/appengine/docs/flexible/java/mapping-custom-domains#dns_update), there is a need to update the DNS records at your domain registrar. Did you? Please ensure you follow the steps described
Comment: Yes, the "select the domain you want to use" selector shows the domain I registered with Google Domains, and yes, I went through the next steps to map the domain to the application.
Comment: I didn't update the DNS domain records at the domain registrar because like I say the domain registrar IS google, and it's got "Use the google domains nameservers" ticked instead of "Use custom nameservers". But it's not clear whether the "Custom resource records" section at the bottom needs to be filled in - if it does, which A record do I put in? Because it will only allow 1, and there are 4 showing in the AppEngine settings page. (Well, 4 IPv4 ones and 4 IPv6 ones)
Answer: Ah. The answer to this seems to be that you in fact can put all 4 IP addresses into the A-record. But that you have to put them all into the same record, rather than 4 records one with each.
It seems the way to use the UI to put multiple IP addresses into the one A record is to use this tiny 'plus' icon next to the text box.
It then adds another row with a text box where you can add another IP address.


When is $\mathfrak{S}_n \times \mathfrak{S}_m$ a subgroup of $\mathfrak{S}_p$?

Question: Inspired by another question, I wondered when $\mathfrak{S}_n \times \mathfrak{S}_m$ is isomorphic to a subgroup of $\mathfrak{S}_p$. Eliminating the obvious cases, the question becomes:

Let $n,m,p>1$ be such that $\mathfrak{S}_n \times \mathfrak{S}_m \hookrightarrow \mathfrak{S}_p$. Does it imply that $p \geq n+m$?

I was able to prove that the statement is true for $p \leq 10$ using David Ward's argument and the following easy results:
Claim 1: $\mathfrak{S}_n$ and $\mathfrak{A}_n$ are indecomposable.
Claim 2: If $\mathfrak{S}_n \times \mathfrak{S}_m \hookrightarrow \mathfrak{S}_p$ then $\mathfrak{S}_n \times \mathfrak{S}_m \hookrightarrow \mathfrak{A}_p$.

EDIT: Derek Holt gave a simple solution below, using however a difficult result. Therefore, an elementary solution would be appreciated.
EDIT: There is now a more elementary solution to this and also to the more general problem where there can be more than two direct factors on
https://mathoverflow.net/questions/167349
Comment: nice question, but what that $U_p$ means? Is that $A_p$? Thanks
Comment: @BabakS, that is a gothig-german $\,A\,$ , not a $\,U\,$ .
Comment: http://www.ams.org/mathscinet-getitem?mr=2265507 is a related question of when there is a maximal subgroup of this form. The $p$ are much larger than $n+m$.
Comment: @seirios: I think you can use the classification of maximal subgroups of $\mathfrak{A}_p$ to see it. Intransitive and imprimitive should work by induction. The primitive tend to be fairly small, but I'm not sure how to handle this case yet.
Comment: So for $p=11$ for instance, the only maximal subgroup that is not handle by induction are the Mathieu groups of degree 11, but its order is only divisible by 5 once, and not by 7, so $\mathfrak{S}_{m} \times\mathfrak{S}_{n}$ cannot be contained in that subgroup if $m \geq 7$ or if $5 \leq m < 7$  (since $n \geq 5$ too) or if $m < 5$ (since $n \geq 7$).  Obviously this isn't enough to handle general $p$, but it works for $p=11,12,13,14$, etc. individually.
Comment: Derek's answer uses the classification of maximal subgroups of $\mathfrak{S}_n$ and $\mathfrak{S}_m$ rather than $\mathfrak{S}_p$. Very simple.
Answer: Assume that $m+n>p$. Then at least one of $m,n$ - say $n$ - satisfies $n>p/2$. For $n \ge 7$, the only faithful transitive action of $S_n$ of degree less than $2n$ is the natural one. (See, for example,
Liebeck, Martin W.; Praeger, Cheryl E.; Saxl, Jan. A classification of the maximal subgroups of the finite alternating and symmetric groups. J. Algebra 111 (1987), no. 2, 365–383.)
So if $m+n \ge 13$, then there is a set of $n$ points on which $S_n$ acts naturally. Then the centralizer of $S_n$ in $S_p$ must fix every point in this orbit of $S_n$, so it has order at most $(n-p)!$, and hence it cannot contain $S_m$.
Comment: I don't really understand why the only faithful transitive action of $S_n$ of dregree less than $2n$ is the natural one. Is it a consequence of O'Nan-Scott theorem?
Comment: Well it's a nontrivial result! I gave a reference to a paper by Liebeck, Praeger and Saxl, which does indeed use the O'Nan Scott Theorem. There is also a 1980 paper of Praeger and Saxl, which says that a primitive permutation group of degree $n$ that does not contain $A_n$ has order at most $4^n$, which was proved before the classification of simple groups, so I I would guess that your question can be answered without using CFSG. There have been stronger results proved using the classification.
Comment: Thank you. I will not accept your answer yet expecting a possible elementary solution. +1.


Avoid local communication routed outside local network when using public domains

Question: i have set up a server running Nextcloud and some other tools.
To be able to access it from outside, i've already set-up DDNS and a DNS Entry for my domain nextcloud.mydomain.com referring to the DDNS, which works perfectly.
The problem is, when i use nextcloud.mydomain.com in my local network, connection is slow, because the connection is routed outside my network, using the hostname or IP everything is fine...
I checked with tracert/traceroute, and the connection is really routed one node away from my router and back.
I would have expected, that my FritzBox-Router will handle that, because it knows its own IP Address, but it doesnt...
Using /etc/hosts is not an option, because 1) that would break connection outside of the network 2) would need a setup for every device using it.
What is the best way to solve this issue?
My Traceroutes:
user@laptop:~ $ traceroute nextcloud.mydomain.com
traceroute to nextcloud.mydomain.com (*PUBLIC IP*), 30 hops max, 60 byte packets
 1  fritz.box (192.168.178.1)  10.601 ms  10.808 ms  10.362 ms
 2  ipservice-*PUBLIC IP*.pools.vodafone-ip.de (*PUBLIC IP*)  10.636 ms !X  10.631 ms !X  9.443 ms !X

AND
user@laptop:~ $ traceroute nextcloud
traceroute to nextcloud(192.168.178.150), 30 hops max, 60 byte packets
 1  nextcloud.fritz.box (192.168.178.150)  12.357 ms  14.189 ms  14.818 ms

Comment: Can you add the `traceroute`? You are probably behind a [Carrier-grade NAT](https://en.wikipedia.org/wiki/Carrier-grade_NAT), so your route does not have a public IP either. Some routers run a DNS resolver stub, which let's you add local entries.
Comment: @PiotrP.Karwasz i have added the traceroutes above...
Comment: You are officially behind a CGN, but to get back to the topic of your question, Mikael's solution is the usual one.
Answer: Do like most business IT environments (https://serverfault.com/help/on-topic): Set up an internal DNS service that points your domain names at the local addresses of the services you present. Everything on your network will find the shortest path without manual management of local hosts files.


quick question about the limit of a two-variable function as $x,y\to\infty$

Question: $$\lim_{x,y\to\infty} \frac{x-y}{x^2+y^2}\tag{$\star$}$$
I'm used to do the following substitution when I see $``x^2+y^2"$ and that $x,y\to 0$
$$x^2+y^2 = r^2,\;x=r\cos\theta,\;y=r\sin\theta$$
plug these values in the function and compute the limit as $r\to0$ I know I can do that because the only way for $x$ & $y$ to approach $0$ is $r$ approaching $0.$
I cannot do this substitution everytime because if for example: $(x,y)\to(-1,7)$ there's no value $u$ that guarantee me if $r\to u$ then $(x,y)\to(-1,7).$
but here since $x,y\to\infty$ I think that logically this phenomenon can only happen if $r\to\infty$ as well.
So computing $(\star)$ is the same as computing this :
$$
\lim_{r\to\infty} \frac{r\cos\theta-r\sin\theta}{r^2} =\lim_{r\to\infty} \frac{\cos\theta-\sin\theta}{r}=0.
$$
I'm 90% sure that what I've done is correct but I still want a confirmation and if possible show me other ways to compute this limit.
Sorry if this question sounds kinda dumb but I'm still new to multivariable calculus and today is my first time dealing with MVC limits.
Thank you !
Answer: Others can add and/or correct, but I'm not sure if you can do the polar trick. If $x$ and $y$ tend to infinity, then clearly $r \to \infty$. But if you have $r \to \infty$, then you don't necessarily have $x$ and $y$ to infinity since, for example: $x \to \infty$ and $y \to c$ (constant) will also lead to $r \to \infty$.

and if possible show me other ways to compute this limit.

Rewrite:
$$\left| \frac{x-y}{x^2+y^2} \right|
=\left| \frac{x}{x^2+y^2}- \frac{y}{x^2+y^2} \right|
\le \left| \frac{x}{x^2+y^2}\right|+ \left|\frac{y}{x^2+y^2} \right|$$
Now:
$$\left| \frac{x}{x^2+y^2} \right| \le \left| \frac{x}{x^2} \right| = \left| \frac{1}{x} \right| \to 0 \quad\mbox{ and }\quad \left| \frac{y}{x^2+y^2} \right| \le \left| \frac{y}{y^2} \right| = \left| \frac{1}{y} \right| \to 0$$
Alternatively, if you feel more comfortable with limits to $(0,0)$, substitute $\left( x,y \right) \to \left( \tfrac{1}{u},\tfrac{1}{v} \right)$ and take the limit $(u,v) \to (0^+,0^+)$ and you could follow up with your classical polar substitution.

With no other answers so far, I'll add this example: consider $f(x,y)=x+y$, then clearly:
$$\lim_{(x,y)\to (+\infty,+\infty)} \bigl( x+y \bigr) = +\infty$$
However, switching to polar coordinates, we get:
$$f(r,\theta) = r \left( \cos\theta + \sin\theta \right)$$
Now simply taking $r \to +\infty$, the limit:
$$\lim_{r \to +\infty}  \bigl( r \left( \cos\theta + \sin\theta \right) \bigr)$$
depends on $\theta$ since $\cos\theta + \sin\theta$ can be positive, negative or zero. This makes sense since fixing $\theta$ to a value outside the interval $(0,\tfrac{\pi}{2})$ would not correspond to $(x,y)\to (+\infty,+\infty)$.
Comment: @rapidracim Thanks for accepting but you may want to wait for some more input of others, specifically regarding your question on the polar substitution for the limit to $(+\infty,+\infty)$.
Comment: I think I've found a counterexample

$$\lim_{x,y \to \infty} \frac{x}{y^2}+x^2$$

here If I use the polar substitution I'll get $+\infty$. but wolfram-alpha says it doesn't exist because it is path dependent

do you think I can trust wolframalpha ? if it gave me a "value" maybe but since it told me it doesn't exist I presume other than computing the limit along two different paths and finding two different results (which actually proves that the limit D.N.E) a computer can't make such a conclusion (that the limit is path-dependant) using a different algorithm .
Answer: "but here since $x,y\to \infty$ I think that logically this phenomenon can only happen if $r\to \infty.$" The definition of $ x,y\to \infty,$ which you haven't given us, is probably exactly the same as  $r\to \infty.$ Let's assume this. You have correctly arrived at
$$f(r\cos t, r \sin t) = \frac{\cos t - \sin t}{r}.$$
This leads to
$$0\le |f(r\cos t, r \sin t)| = \frac{|\cos t - \sin t |}{r} \le \frac{|\cos t| + |\sin t|}{r} \le \frac{1 +1}{r} = \frac{2}{r}\to 0.$$
Thus $|f(r\cos t, r \sin t)|\to 0,$ which is the same as saying $f(r\cos t, r \sin t)\to 0.$


Find all polynomials that satisfy a functional equation

Question: I need help with this problem if anyone can contribute to solving this I would much appreciate it:

Find all polynomials $P$ that satisfy $P(1)=210$
and for every $x\in \mathbb{R}$: $$(x+10)P(2x)=(8x-32)P(x+6).$$
Comment: Welcome to MSE. What have you tried?
Comment: Plug in $x = \frac{1}{2}$, what do you get?
Comment: Also try $x= -5$
Comment: Ok thank you all for your contribution
Answer: $$P(x) = c (-8 + x) (-4 + x) (4 + x)$$
Comment: My solution is right. Who down voted it?
Comment: I didn't down vote it
Comment: upvote if you find it useful
Comment: at  least will even out
Comment: True i forgot to sum +6 f(x-6), now it is updated
Comment: the other answer is  incomplete
Answer: small hint
With $ x=-10 $, we get
$$P(-10+6)=P(-4)=0$$
and for $ x=4 $, it gives
$$P(8)=0$$
thus
$$P(x)=(x-8)(x+4)R(x)$$
with
$$R(1)=\frac{210}{-35}=-6$$
Comment: Subbing $x=2$ gives yet another root.
Comment: Thank you very much


proving $\lim\limits_{x\to \frac{\pi }{2}}\frac1{\cos x}\ne \infty $

Question: I have to prove the following equation for homework
$$\lim_{x\to \frac{\pi }{2}}\frac1{\cos x}\ne \infty $$
The proof must be done by proving that exists a $M>0$ for which for every $l>0$ exists an $x$ so that $0<|x-(\pi/2)|<l$ but $\lim\limits_{x\to \frac{\pi }{2}}\frac1{\cos x}\le  m$
I can't seem to figure this one out.
I would greatly appropriate anyone who tries to help me out :) Thanks
Comment: Did you intend capital $M$ and lower-case $m$ to be understood as being the same?  You shouldn't do that, since it's standard to sometimes use capital and lower-case letters to refer to different things in the same problem.
Comment: My (late) hint would be: first try to understand that $\lim_{x\to 0}\frac{1}{x}\neq\infty$.
Answer: First we use the geometry to find out what is really going on.  Then we will be ready to go to the $M$ and $l$ stuff. Very informally, if $\lim_{x\to \pi/2} \frac{1}{\cos x} =\infty$, that would mean that if $x$ is close but not equal to $\frac{\pi}{2}$ then $\frac{1}{\cos x}$ is big positive.
If $x$ is a tiny bit below $\frac{\pi}{2}$, then $\frac{1}{\cos x}$ is indeed big positive, since $\cos x$ is positive and close to $0$.  But if $x$ is a bit bigger than $\frac{\pi}{2}$, then $\cos x$ is close to $0$ but negative, so $\frac{1}{\cos x}$ is certainly not big positive. So the bad guys are the $x$ that are a bit bigger than $\frac{\pi}{2}$.
Now that we know what's going on, let's write a formal proof. I will try to use the symbols that you used.
What would it mean for the limit to be $\infty$? To save typing, and for the sake of generality, I will write for a while $a$ for $\frac{\pi}{2}$ and $f(x)$ for $\frac{1}{\cos x}$.
We have $\lim_{x\to a}f(x)=\infty$ if for any $M$, there is an $l>0$ such that for any $x$ such that $|x-a|<l$, then $f(x)>M$. You can think of it this way. Suppose we are given a specific big $M$, like $1000$, or $99999999$. We want to be able to exhibit a number $l$ such that if the distance $|x-a|$ of $x$ from $a$ is $<l$, then $f(x)$ is guaranteed to be $>M$.
Think of the number $M$ as a challenge, and of $l$ as a response. To the challenge "ensure that $f(x)>M$" we must always be able to come up with an appropriate response "if $|x-a|<l$, then I can guarantee that $f(x)>M$."  (The appropriate response $l$ will in general depend on $M$.)
The rest is easy. Let $M=17$. Can we come up with an $l$ such that if $\left|x-\frac{\pi}{2}\right|<l$, then $\frac{1}{\cos x}>17$?  Definitely not. For whatever $l$ we pick, there will be a number $x$ such that $\frac{\pi}{2}<x<\pi$ and $\left|x-\frac{\pi}{2}\right|<l$. And at any such number $x$, the number $\frac{1}{\cos x}$ will be negative, so definitely not bigger than $17$. So for  the challenge  $M=17$, there is no possible response $l$.
We conclude that it is not true that $\displaystyle\lim_{x\to \pi/2} \frac{1}{\cos x} =\infty$. Indeed, a small variant of the argument shows that the limit in this case does not exist.
Comment: You wrote $\displaystyle\lim_{x\to \pi/2} \frac{1}{\cos x} \ne \infty$.  I prefer not to do that, for writing it that way may carry the impression that the limit exists, but happens to be something other than $\infty$.
With some practice, this $M$, $l$ business, and related ideas, will become clearer to you. It is a genuinely subtle idea, and takes time to become fully absorbed.
Comment: Thanks - Awesome answer :)
Answer: If $x$ is slightly bigger than $\pi/2$, then $\cos x$ is negative.
Comment: Actually, the limit is $\infty$ if instead of gluing a $+\infty$ onto one end of the real line and $-\infty$ onto the other, you just add a single $\infty$ at both ends, making the line topologically a circle.  In trigonometry and when dealing with rational functions, that makes sense.
Comment: Would that be a "wheel"?
Answer: You need to prove that $$\lim_{x\to \frac{\pi }{2}^+}\frac1{\cos x} \neq \lim_{x\to \frac{\pi }{2}^-}\frac1{\cos x}.$$
This is trivial since for $x>\frac{\pi}{2}$, we have
$$\frac{1}{\cos x}\leq -1,$$
and similarly for $x<\frac{\pi}{2}$, we have
$$\frac{1}{\cos x}\geq 1.$$
This means $$\lim_{x\to \frac{\pi }{2}}\frac1{\cos x}$$ just do not exist.
Comment: @Jason: If you are limited to showing that there "exists a $M>0$ for which for every $l>0$ exists an $x$ so that $0<|x-(\pi/2)|0$, there are $x$ with $|x-\frac{\pi}{2}|<\delta$ so that $\frac{1}{\cos(x)}<-1$ and $x$ with $|x-\frac{\pi}{2}|<\delta$ so that $\frac{1}{\cos(x)}>+1$.
Comment: I think you mean $$\lim_{x\to\frac{\pi}{2}^+}\frac1{\cos x}\neq\lim_{x\to\frac{\pi}{2}^-}\frac1{\cos x}$$
Comment: Oh, yeah, right :)
Comment: @SantaZhang, You are correct this is a great answer but I am limited to proving this by the method stated in the question :)


My voice chest range is D#2-G#4.What is my voice type?

Question: I extended a little my voice chest range recently.It was G2-D4,now it's D#2-G#4.1) How to determine the type of voice by range? Chest or chest+head or chest + head + falsetto? 2) What is my voice type?
I used a site "singingcarrots" and app "Sing Sharp" to determine my vocal chest range.
I attached a link to cover on youtube.Maybe it helps.
P.S. It was recorded a long time ago and I don't hit notes right.
Cover on Johnny Cash Hurt
Comment: @Tim (I guess the easy answer is so they can integrate with pigeon-holed systems. You walk into a choir and they say "Basses over here, tenors over there," where do you stand? You order some sheet music that comes in either tenor or bass, which do you order? Of course, Alex, the answer sometimes comes down to the particular piece and *its* range. Plus, it has to do not just with what you can hit, but how much comfort and "vocal weight" you have on that note.
Comment: Why are folk so keen to pigeon-hole their voices???
Comment: I just wanna know who I am
Comment: @AlexReyder You're a singer whose range currently extends from D#2 to G#4. That's who you are.
Comment: Cheekiness aside, your range as you describe it places you securely as a bass. See [Accepted ranges for SATB choral works?](https://music.stackexchange.com/a/5979/70803).
Comment: @Aaron indeed, I get the impression that even the rigid operatic _Fach_ system is somewhat relaxed compared to earlier decades.  Alex: Sing what you sing well!  Identifying your voice type can help you identify repertoire that you sing well, but "I ought to be able to sing this because I am X" isn't very helpful with songs that you don't sing well.
Comment: You may have a label 'tenor' or 'bass', but it's more dependent on the quality of your voice in those ranges, particularly at their extremities. And what you're going to be expected/ing to sing.
Answer: From your chest range you'd be seen as bass or bass-baritone. But these classifications can not alone be made by range, but also need to take into account the quality of the voice within this range, what feels good to you and such stuff. Also if your voice still has potential in development whether that potential is rather up or down. A range of D#2-G#4 would encompass a middle bass register (about Eb2 - C4), a low baritone register (about F2 - F4), a high baritone register (about A2 - G4) or even a low tenor register (about C3 - A4). So try to evaluate in which of these regions you feel most at home in. Things being said, if your voice goes to a low Eb you're probably not a tenor, but a baritone or a versatile bass.
And yes, of course Falsetto voice range matters if you have a trained falsetto voice. If you are contratenor this matters.
Answer: How to determine the type of voice by range? Chest or chest+head or chest + head + falsetto?
Your chest voice is used to determine your vocal range. Falsetto is generally considered "extra", and head voice is somewhat ambiguous, but is generally considered either a version of falsetto, a "pre-falsetto" range, or a timbre, but nevertheless an extension of one's basic range. (Wikipedia)

Falsetto is not generally counted by classical purists as a part of the vocal range of anyone except countertenors. There are exceptions, however, such as the baryton-Martin which uses falsetto. (Wikipedia)

What is my voice type?
Please see Accepted ranges for SATB choral works?


IIS 7 redirect to url with specific port number

Question: I want to configure my website to redirect to a specific URL with a specific port.
For example, http://www.example.com should redirect to http://www.example.net:9090.
I configured the http redirect module in IIS 7 manager, but it always redirects to www.example.net without any specific port. How can I achieve this?
Answer: If you write "http://www.example.com" in a browser address bar, the default port used will always be 80.
For this question, I suggest you add a new website for this host on port 80 where you add a redirect in a page to the final page (the other port).
Try using a meta refresh tag in a html page to redirect to an address: <meta http-equiv="refresh" content="0;url=example.net:9090" />.
Comment: My problem is now when i get in to www.xxx.com, it only redirect me to www.yyy.com. What I expected is redirect to www.yyy.com:9090.
Comment: please use meta refresh tag in a htm page to redirect to a address:


Why is a printer not deployed to a specific station?

Question: I have my printers deployed through GP with success for every machine on the network.
One specific machine - is the exception. It's a MAC Air with W7 installed.
It's gperesult is pasted:
<code>Microsoft (R) Windows (R) Operating System Group Policy Result tool v2.0
Copyright (C) Microsoft Corp. 1981-2001

Created On 9/21/2011 at 9:19:37 AM

RSOP data for company\ranm on LTAIRRAN : Logging Mode
------------------------------------------------------

OS Configuration:            Member Workstation
OS Version:                  6.1.7601
Site Name:                   Default-First-Site-Name
Roaming Profile:             N/A
Local Profile:               C:\Users\ranm.company.000
Connected over a slow link?: No

COMPUTER SETTINGS
------------------
    CN=LTAIRRAN,OU=Laptops,OU=Default,OU=company Computers,DC=company
    Last time Group Policy was applied: 9/21/2011 at 8:30:19 AM
    Group Policy was applied from:      companyDC.company
    Group Policy slow link threshold:   500 kbps
    Domain Name:                        company
    Domain Type:                        Windows 2000

    Applied Group Policy Objects
    -----------------------------
        Default Domain Policy
        Firewall - Remote Administration
        Remove UAC
        SOPHOS Tasks Enabler
        WSUS Settings - All

    The following GPOs were not applied because they were filtered out
    -------------------------------------------------------------------
        Local Group Policy
            Filtering:  Not Applied (Empty)

    The computer is a part of the following security groups
    -------------------------------------------------------
        BUILTIN\Administrators
        Everyone
        BUILTIN\Users
        NT AUTHORITY\NETWORK
        NT AUTHORITY\Authenticated Users
        This Organization
        LTAIRRAN$
        Domain Computers
        System Mandatory Level

USER SETTINGS
--------------
    CN=Ran Machtinger,OU=Mng_Department,OU=company_Users,DC=company
    Last time Group Policy was applied: 9/21/2011 at 8:30:19 AM
    Group Policy was applied from:      companyDC.company
    Group Policy slow link threshold:   500 kbps
    Domain Name:                        company
    Domain Type:                        Windows 2000

    Applied Group Policy Objects
    -----------------------------
        Default Domain Policy
        Default Group Policy Object

    The following GPOs were not applied because they were filtered out
    -------------------------------------------------------------------
        Firewall - Remote Administration
            Filtering:  Not Applied (Empty)

        Local Group Policy
            Filtering:  Not Applied (Empty)

    The user is a part of the following security groups
    ---------------------------------------------------
        Domain Users
        Everyone
        BUILTIN\Administrators
        BUILTIN\Users
        NT AUTHORITY\INTERACTIVE
        CONSOLE LOGON
        NT AUTHORITY\Authenticated Users
        This Organization
        LOCAL
        APP_DEP_RW
        SALES_DEP_RW
        PR_DEP_RW
        RD_DEP_RW
        QA_DEP_RW
        MNG_DEP_RW
        High Mandatory Level
</code>
As you can see, pushprinterconnections is in the logon script.
I tried login with a different user on the same PC, same result - no printer.
The GP is the: Domain Default Policy.
It's security settings are for: Authenticated Users

even that the -log settings is set on the script, I can't find any log PPCuser/PPCMachine in it's corresponding directory.

What am I missing?
Answer: First place of research when something breaks with group policy or similar: Event Log on the local client.
Things that usually break printers via GPO and/or logon scripts:

Untrusted driver (as in not WHQL-certified). You have to manually deploy the driver(s) as administrator before pushing out printers.
Conflicting device. Are you sure that there are no local printers installed with the same name?

Things that usually break everything that has to do with logon scripts:

Incorrect time on the local client. Make sure it's in sync with the domain (net time /set). Also make sure that it's in the correct timezone.
Answer: Perhaps either the script or the exe isn't visible to the computer executing the policy, for whatever reason. The GPO seems fine. Checked the event log for Policy errors or tried a traced log on?


Sharepoint Access Denied to new site - I am the primary admin

Question: I keep getting access denied when trying to access my new site through a browser.
In central admin i am primary administrator of the web app, i can connect to it using sharepoint designer and edit files and save them. Just when i try to browse to the site i keep getting Access Denied.
Edit: How i created the site
In central admin i created a new web application (i was added as primary admin), than create a site collection (added as site collection admin), than reset iis, and went to access the site. I get access denied. However if i try to goto /_layouts/settings.aspx i have access to that, but when i click on some links there i get access denied. Going to the Users and Groups persmissions i am apart of the Site Owners group.
Answer: Are you using the browser directly on the server and getting a 401.1 error?
If so, it's probably due to the Loopback Adapter issue.  More information and possible workarounds are here:
You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or IIS 6
Comment: that is not the problem unfortunately.
Answer: I am having the same issue. Creating a new SSP / web application / site collection, but can get in with any account. I can also get directly in to /_layouts/settings.aspx and can even create new sites, but can't access them ..
Comment: Not exactly sure how I fixed the problem. I'm thinking it had something to do with the application pool / SSP service credentials, but I'm not sure.


node_load not show taxonomy terms

Question: i dont know why
the script node_load(7) output is :
public 'field_tags' =>
    array (size=1)
      'und' =>
        array (size=2)
          0 =>
            array (size=1)
              'tid' => string '2' (length=1)
          1 =>
            array (size=1)
              'tid' => string '3' (length=1)

why the field tags not filled with tag title ! it only shows tid's
does this is a normal behavior of Drupal node_laod that it only load's primary id's of relational contents like taxonomy terms
?
Answer: Yes, that is the correct and expected behaviour. Loading every entity referenced by a node every time it loads, could potentially get very heavy on the server very quickly. That's why referenced entities are lazy-loaded (albeit manually as far as core is concerned).
To load taxonomy term entities from the tid, you can use taxonomy_term_load(). If you want an (arguably) slightly more pleasant experience when working with entities/fields on code, check out the EntityMetadataWrapper class, which is part of the Entity API module.

node_load not show taxonomy terms


How can I replace drush @sites?

Question: Since Drush 9 the @sites alias to run a command on all available multi-site instances has been removed from Drush core.
$ drush @sites cr

  The alias @sites could not be found.

Is there a way to get the same behaviour that does not require me typing my 300 multi-site instance names in a config file?
Answer: Waiting something similar, I wrote this small script I called "drall" you may adapt:
#!/usr/bin/php
<?php

// Path to sites.php file.
include('web/sites/sites.php');

$done = [];
$argv = $_SERVER['argv'];

array_shift($_SERVER['argv']);

$parameters     = implode(' ', $_SERVER['argv']);
$commandPattern = "drush --uri=:key $parameters";

foreach ($sites as $key => $site) {

  if (count($argv) > 1 && !in_array($site, $done)) {

    $command = str_replace(':key', $key, $commandPattern);
    echo "Executing command `$command` on $site\n";
    `$command`;
    $done[] = $site;
  }
}

Use example:
$ ./drall cc render
Executing command `drush --uri=xxxxxxx cc render` on default
 [success] 'render' cache was cleared.

Hope there will be some @sites behaviors later, that was helpfull.
Although from this issue it doesn't look like it:

Drush 9 no longer supports executing a single command on multiple sites with alias lists (@A,@b,@c) or @sites. Neither of those syntaxes are available in any context. You may still use drush sa @group to see all aliases in a group; that is the only context in which Drush recognizes alias lists.
Comment: Thank you, the script works just fine. One thing which doestn work, are the promts. you cannot see them but can interact with them. Any ideas how to enhance your script?
Comment: tried `echo \`$command\`;` but it shows me only the output not the prompts
Comment: use `-y` at the end of your command, it will not show the y/n prompt this way.
Comment: What if I do want to see them? E.g. config-import.
Comment: maybe run it in a single site before
Answer: I'd simply place a lightweight loop into your ~/.bashrc or ~/.bash_profile or where ever you prefer. Just update the SITES=( foo bar ) array to your needs.
Source your bash file, cd into your multi-site root and call ddrush cim -y for example and it will iterate through all sites provided in the SITES array.
ddrush () {
  # Provide an array of sites you want to loop.
  SITES=( foo bar )

  # Validate and hint if no argument provided.
  if [ "${#}" -eq 0 ]; then
    echo "- ddrush: missing argument(s)"
    echo "EXAMPLE: ddrush cex -y"
  else
    # Loop:
    for SITE in "${SITES[@]}"; do
      echo "drush -l ${SITE} ${@}"
      drush -l "${SITE}" "${@}"
    done
  fi
}

You can use nearly the same for running a deployment script. Or you could easily provide multiple aliases like that. adrush, bdrush, cdrush – one for every multi-site environment you need to maintain.

I only now read you have 300 instances running. Respect! Well, then it might be easier to only provide an absolute path to the sites folder and have that scanned and then looped through automatically.
xdrush () {
  # Provide the absolute path to the sites directory.
  SITES="/var/www/MYMULTISITE/sites"

  # Validate and hint if no argument provided.
  if [ "${#}" -eq 0 ]; then
    echo "- xdrush: missing argument(s)"
    echo "EXAMPLE: xdrush cex -y"
  else
    PWD=${PWD}
    cd "${SITES}"
    # Loop:
    for SITE in $(ls -d */ | cut -f1 -d'/'); do
      # Skip default site.
      if [ ! "${SITE}" == "default" ]; then
        cd "${PWD}"
        echo "drush -l ${SITE} ${@}"
        drush -l "${SITE}" "${@}"
      fi
    done
  fi
}

Answer: An out-of-the-box solution is provided by a package named jigarius/drall.
I wrote that package and I've used it on a number of multi site Drupal installations.

How can I replace drush @sites?


How to prove $\sqrt{2}$ is irrational in Type Theory?

Question: Using Intuitionistic Type Theory, how would one go about proving $\sqrt{2}$ is irrational?
I read that we can not use law of excluded middle. (So does this mean we cannot use proof by contradiction).
So I assume we want to prove $\forall a,b\in \mathbb{N^2}: \lnot (a^2 = 2 b^2)$. In type theory this means we need to find an instance  $P$ of the type corresponding to the theorem. The type would be something like $\prod \limits_{a:\mathbb{N}}\prod \limits_{b:\mathbb{N}} NotEqualsQ(Square(a),Times(Two,Square(b))$. I assume. Then we might have to define these function recursively?
I'm not sure how you would find an instance of this proof.
Answer: Negation is defined $\neg A := A\to \bot$, the type of naturals $\mathbb N$ is defined inductively, and addition and multiplication are defined recursively.
To prove $\Pi_{a,b:\mathbb N}\neg(a^2=2b^2)$ we can introduce variables $a,b:\mathbb N$ and a proof that $a^2=2b^2$ like so:
$$a,b:\mathbb N, p : (a^2=2b^2) \vdash \bot$$
and the goal is to construct a term of type $\bot$. (Note: I suppose this could be called a "proof by contradiction" because we derive $\neg A$ from $A\vdash\bot$, but it does not require the excluded middle. A problematic "proof by contradiction" is when we derive $A$ from a proof of $\neg A\vdash \bot$.)
The idea is to construct $c,d:\mathbb N$ such that $(c^2=2d^2)$ and $\neg(2\div d)$, and then prove that $2\div d$, from which you obtain $\bot$. Constructing $c$ and $d$ can be done by splitting cases on whether $a$ and $b$ are even or odd, assuming you've proved something of the form $$(\forall k.\phi(2k)\times\phi(2k+1))\to(\forall n.\phi(n)).$$
For a more concrete justification, you could check out this proof in Coq.


What are the technical differences between skeleton and luge?

Question: In skeleton, participants run at the start, then dive onto their sled front-first.
In luge, participants begin on their sleds, and use their hands to start before lying back-first.
It has been documented that skeleton is slower than luge (and bobsled)(1).
What are the technical differences between skeleton and luge?
Answer: At first glance, skeleton and luge look very similar.  Both sports involve people racing down the ice track on tiny sleds, the only obvious difference between them being that luge riders race on their backs, feet first, and skeleton riders race on their bellies, head first.  However, despite the fact that skeleton is head first, luge is the more dangerous of the two, and there are several differences between the two sports.
Sleds
First is the sleds themselves.  A skeleton sled rides on top of tubular runners, and on the body side of the sled, there is a saddle to hold the rider in place.
Bottom of skeleton sled:

Top of skeleton sled:

A luge sled rides on top of steel blades that are much sharper than the tube blades of a skeleton sled.  This contributes to luge being faster than skeleton.
Luge sled:

Aerodynamics
Another reason luge is faster than skeleton is aerodynamics.  The feet-first position is more aerodynamic than head-first, because the relatively flat front of the skeleton helmet introduces drag.
Steering
The steering is very different between the two sleds as well.  In skeleton, the rider has a very good view of what is going on.  The rider steers by flexing his body.  Because of the saddle, they have a lot of body contact with the sled, and have a lot of control with small movements.  When they nudge their head a little, their body responds, and the sled responds as well.
Luge is much harder to control.  A luge rider lays on top of the sled, and there is no saddle holding them to the sled.  Laying feet first, it is much harder to see where you are going, and there is less body contact due to the lack of a saddle.  The runners of a luge sled are bowed up at the front and contact the riders legs.  Steering is done by a combination of pushing on the runners with your legs and flexing the sled with your shoulders.
Luge also has a 2-man variety as well.  Typically, the 2-man luge is slower because they start further down on the track, but it is much harder to steer because the man on top is the only one that can see, but the man on the bottom is the one that is most able to contribute to the steering.
Start
The races are started differently.  In skeleton, the rider starts running with the sled at the top of the track and belly flops on to the sled.  For luge, the rider starts sitting on the sled, and grabs handles attached to the track on either side.  He pulls the handles to start the sled moving, then pushes the ice on either side of the sled at the start of the race using spiked gloves, before laying back and assuming the race position.
Sources:

Shape: Luge vs. Skeleton Racing
Slate: They're both sliding on ice
How Stuff Works: How Luge Works
Answer: The sleds are much heavier in the skeleton, and thinner... where as you have a fiberglass sled in the luge and is designed so you put pressure on the runners to steer.
Comment: What does it mean to "put pressure on the runners to steer?"
Comment: A luge sled is designed to twist so by pushing against it with your shoulders and legs you could change which parts of the runners are touching the ice.
Comment: @Emyr Thanks...that's helpful. How would one steer in skeleton? Body weight?
Comment: Actually, skeleton sleds seem to be steered using twisting and weight-shifting too. The rules require a metal frame.
Comment: @Emyr Feel free to add your own answer. Although this answer provides some insight, it remains inconclusive.


Sum of two, three or four cubes, characterization?

Question:
Is there some nice characterization of natural numbers that are sum of two nonnegative integer cubes? What about three cubes? Four?

This seems quite hopeless to me, surely something is known about these problems and even if there are no necessary and sufficient conditions for a number to be a sum of two, or three, or four cubes, I think that there are at least either necessary ones, or sufficient ones.
Thanks for help.
This question arose as a result of a little bit of thinking on additive bases and an open question can every sufficiently large natural number be written as the sum of four nonnegative integer cubes.
Comment: There is a lot of posts here about the sum of three cubes, e.g., [here](https://math.stackexchange.com/questions/2399647/method-for-expressing-an-integer-as-the-sum-of-three-cubes?rq=1) and [here](https://mathoverflow.net/questions/138886/which-integers-can-be-expressed-as-a-sum-of-three-cubes-in-infinitely-many-ways).
Comment: https://en.wikipedia.org/wiki/Waring%27s_problem#Upper_bounds_for_G(k)
Answer: No simple characterization according to OEIS:
A003325        Numbers that are the sum of 2 positive cubes.


Unicode printing in vim

Question: I am working with text files that contain a lot of unicode characters (≼, ⊓, ⊔, ...). Vim displays them fine, but when I print they are replaced by a generic character. Gedit prints them without problem, but it's a bit of a pain to launch another editor just to print.
Is there a way to get vim (on Linux/Gnome) to print properly? I tried using vim-gnome, in hope that it would use the same infrastructure as gedit, but it does not.
Answer: Vim is only able to use 8-bit encoding for printing. If there is encoding that includes all those characters all you need is to use
set printencoding={encoding}

If there is not then you can't print it from vim directly. You can use :TOhtml command suggested by @DaoWen, do
:TOhtml
:w /tmp/print.html
:!command-that-makes-browser-print-a-file(I-do-not-know-one) /tmp/print.html
:!rm /tmp/print.html

. You can also use my formatvim plugin to print this to pdf through latex (don't forget to file bug reports: latex-xcolor output is untested):
:Format format latex-xcolor to /tmp/print.tex
:!pdflatex /tmp/print.tex && lp /tmp/print.pdf && rm /tmp/print.*

(you can use html output as well, but that will not make me know a command to print it). Of course, you can map these to a single key.
Answer: Try using the :TOhtml command to convert your document to output your buffer in HTML format. You should be able to print the resulting file from your browser.

Unicode printing in vim


Como abrir uma página de acordo com o link inserido no input?

Question: Quero fazer um formulário que quando eu colocasse o endereço (URL) em um campo e clicar no botão Enviar ir para o site inserido no campo. Como fazer isso?
Comment: Eita, three-hit-combo.
Comment: @Renan e eu sempre como *"Rubinho"*, sempre fico por ultimo.
Comment: Não foi de proposito Thiago, foi que todo mundo comentou ao mesmo tempo, mas o @Renan deve ser o *Barry Allen*, por um milionésimo de segundo o comentário dele chegou primeiro.
Comment: Ao invés de mudar o título da pergunta, marque uma resposta como correta. Aqui não é um fórum.
Comment: Pelo que você está dizendo, parece ser o caso de [marcar uma resposta como aceita](http://meta.pt.stackoverflow.com/questions/1078/). Aqui não escrevemos "resolvido" na questão. Se tem uma resposta que realmente te ajudou, marque-a como aceita. Se chegou sozinho à solução, poste a solução como resposta. Assim o conteúdo fica mais organizado e fácil de ser encontrado futuramente por outras pessoas com problemas parecidos.
Comment: Não coloque resolvido no titulo, o sistema tem checagem de resolvido proprio, somos um Q&A, basta marcar a resposta que lhe resolveu o problema como correta.
Comment: Calma feras... Desculpem aí!
Precisa de tudo isso não..
Comment: Não tenho costume de utilizar este site. Quando vocês visualizarem um erro, apenas o indique por favor!
Desnecessário.
Comment: @Thiago não foi de proposito, o pessoal só tava te orientando, não precisa se aborrecer, ninguem tá puxando tua orelha, só estão te explicando, não tem nada de desnecessário.
Comment: "Quando vocês visualizarem um erro, apenas o indique por favor! " Foi o que eles fizeram ¯\_(ツ)_/¯
Answer: Você pode utiliza javascript com  window.open ou window.location para fazer o que deseja.
Exemplo com window.open():
Ele vai abrir o url numa nova janela.
window.open('http://www.google.com');
Exemplo com window.location.href:
Ele vai abrir na janela atual
window.location.href = 'http://www.google.com';

Exemplo de utilização:
 <form>
    <input name="url" type="text" id="url">
    <input type="button" id="btn" value="Acessar" onClick="javascript: window.open(document.getElementById('url').value);" />
 </form>

O javascript pega o link digitado no campo de texto com ID url, e abre uma nova aba ou janela com window.open.
Answer: Segue um exemplo

document.getElementById('send').onclick = function(){
  let url = document.getElementById("url").value
  alert(url)
  window.open(url, "_self")
}
<input type="text" id="url">

<button id="send">Enviar</button>


Can a patch be safely unapplied?

Question: Can I assume that after a successful
patch < mypatch

the reverse
patch -R < mypatch

will always succeed, and make the previous changes exactly undone?
I know that there are several patch formats and certainly many patch/diff programs, so please if that's relevant specify to what versions/systems you relate.
Answer: Patch files are supposed to work in reverse perfectly. Generally speaking, patches merely list lines added and line removed. Using -R simply interchanges these too, making lines added look like lines removed, and lines removed look like lines added.
So long as you have not modified any thing after performing the patch, the removal should always work.

Can a patch be safely unapplied?


Not getting push notification from GCM after sending few notifications

Question: I want push notification by using GCM, all things are done properly, like API key & others.
I got success & also received notification, but after sending few notifications now i'm not getting any notification & getting following erro
{"multicast_id":7413445345804388431,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
please help for this, Thanx in advance
Answer: error":"MismatchSenderId it says that your sending push notifications from another sender id, not from your registered send id. please check your sender id properly.
Double check the Sender ID and APK_KEY, they must match or else you will get that MismatchSenderId error. In the Google API Console, look at the URL of your project:
Refer this link https://stackoverflow.com/a/11316399/964741
Comment: what i'm saying is initially i was getting notification, i didnt even change 1 letter from code otherwise i m not getting it now....rmbr no change in code
Comment: OK. may be you did't change in code. Please check all the values properly first. because if you did't change  you could't get any error instead of getting notifications..so please verify those values properly.
Comment: is there any chances that google block notifications after sending notifications at a time??


Can't save data for Address field

Question: I am trying to save data programmatically to an address field from the Address module.
I am not successful.
First, when I dsm() a node with the address field filled out, it looks like this:
        [field_addr] => Array
            (
                [x-default] => Array
                    (
                        [0] => Array
                            (
                                [langcode] =>
                                [country_code] => US
                                [administrative_area] => CA
                                [locality] => San Diego
                                [dependent_locality] =>
                                [postal_code] => 91945
                                [sorting_code] =>
                                [address_line1] => 123 main st
                                [address_line2] => apt 2
                                [organization] =>
                                [given_name] =>
                                [additional_name] =>
                                [family_name] =>
                            )

                    )

            )

However, no matter how I try to save it to my node, it doesn't work.
I create an array that looks like this:
Array
(
    [x-default] => Array
        (
            [0] => Array
                (
                    [address_line1] => Australian Club
                    [address_line2] => Royal Lane
                    [locality] => Sydney
                    [administrative_area] => NSW
                    [country] => Australia
                )

        )

)

Let's say with the name, $address_save
And then do the following:
$node->set('field_addr', $address_save);

No luck. My node saves with other fields, but this one doesn't. I've also tried it without the x-default key around it as well as without a delta, but neither of those work either.
How can I save values to an Address field inside of a node?
Answer: The problem here was due to Drupal failing silently (or obfuscating the error - maybe because I was running this in cron) but it was due to the address not having all of the required fields set to the correct values for the country in question - mainly using the actual country name instead of the country code.
Once the country code was swapped in it worked. I switched the country around to the country code like this:
function MY_MODULE_get_country_code($country) {
  $countries = MY_MODULE_country_list();
  $flipped_countries = array_flip($countries);
  $country_code = $flipped_countries[$country];
  return $country_code;
}

function MY_MODULE_country_list() {
  $countries = \Drupal\Core\Locale\CountryManager::getStandardList();
  foreach ($countries as $key => $value) {
    $countries[$key] = $value->__toString();
  }
  return $countries;
}

It worked correctly.
Comment: Would have been great if you posted your final solution. :(

Can't save data for Address field


Outlier Detection on skewed Distributions

Question: Under a classical definition of an outlier as a data point outide the 1.5* IQR from the upper or lower quartile, there is an assumption of a non-skewed distribution. For skewed distributions (Exponential, Poisson, Geometric, etc) is the best way to detect an outlier by analyzing a transform of the original function?
For example, distributions loosely governed by an exponential distribution, could be transformed with a log function - at which point is it acceptable to look for outliers based on the same IQR definition?
Comment: There are many questions on this site on assessing outliers. One thing you'd need to add here to get a reasonable answer is what you're really trying to do or find out. But for starters, the `1.5*IQR` definition of an outlier is not universally accepted. Try to unload your question and expand on the problem you're trying to solve.
Comment: The statement that a value in excess of 1.5 IQR is an outlier is simply nonsense. Data in excess of 1.5 IQR would be entirely consistent with an infinite number of distributions, and as the sample size becomes large, one could have almost perfect confidence that such data were NOT outliers.
Answer:
Under a classical definition of an outlier as a data point outide the 1.5* IQR from the upper or lower quartile,

This is the rule for identifying points outside the ends of the whiskers in a boxplot. Tukey himself would no doubt object to calling them outliers on this basis (he didn't necessarily regard points outside those limits as outliers). These would rather be points which - if your data was expected to be from a distribution somewhat similar to a normal distribution - one might subject to further investigation (such as checking you didn't transpose two digits, for example) -- at most these could be potential outliers. As Nick Cox points out in comments under this answer, a tail of many such points would be taken more as a indicator that a re-expression might be suitable than an indication of the need to regard the points as outliers.

there is an assumption of a non-skewed distribution.

I assumed by 'non-skewed' you mean symmetric. The two are not synonyms, but if you really mean non-skewed, we'd have to discuss with care what measure of skewness you're using, and we'd get tied up with issues of asymmetric cases with zero skewness. At least the symmetric case is not reliant on a particular choice of measurement and simpler to discuss. Then the assumption is more than just that it's symmetric. A heavy-tailed but symmetric distribution might have many points outside the bounds on that rule.

For skewed distributions (Exponential, Poisson, Geometric, etc) is the best way to detect an outlier by analyzing a transform of the original function?

That depends on what constitutes an outlier for your purposes. There's no single definition that's suitable for each purpose - indeed, generally you're probably better off doing other things that (say) picking outliers and omitting them.
For the exponential or geometric, you might do a similar calculation to that for a boxplot, but which would identify a similar fraction in the right tail only (you won't have low-end points identified in an exponential or geometric)$^{\dagger}$ ... or you might do something else.
$\dagger$ In large samples from a normal distribution, the boxplot marks about 0.35% of points at each end, or about 0.7% in total. For an exponential you might mark some multiple of the median, for example. If you wanted to tag roughly 0.7% of points in total for an actual exponential, that would suggest marking points beyond about 7.1 times the median.
Marking points above 7.1 times the median for n=1000 will typically hit between 0.4% to 1.1% of values:
ae <- rexp(1000)
table( ae > 7.1*median(ae) )

FALSE  TRUE
  993     7

For example, distributions loosely governed by an exponential distribution, could be transformed with a log function - at which point is it acceptable to look for outliers based on the same IQR definition?

That totally depends on what you mean by "acceptable". Note, however that -
i) the resulting distribution (from taking logs of an exponential variable) isn't actually symmetric, but distinctly left-skew.

As a result, you'll usually only mark points in the left end (i.e. close to zero, where you expect exponential values to be anyway) rather than in the right (where the "outliers" might be), unless they're really extreme.
ii) suitability of such  a rule is going to be heavily dependent on what you're doing.
If you're concerned about the odd strange value affecting your inference, in general, you're probably better off using robust procedures than formally identifying outliers.
If you really do want to use a normal-based rule for transformed exponential or Poisson data, I'd at least suggest applying it to the square root$^{\ddagger}$ for a Poisson (as long as the mean isn't too small, it should be roughly normalish) and to cube root or even fourth root for the exponential (and perhaps, by extension, the geometric).
$\ddagger$ or perhaps $\sqrt{X+\frac{3}{8}}$, as in the Anscombe transform

For an exponential, in large samples the cube-root approach will tend to mark points only in the upper tail (at roughly the same rate it marks them in the upper tail for a normal) and the fourth-root approach marks points in both tails (slightly more in the lower tail, in total at something near 40% of the rate it does so for a normal). Of the possibilities, the cube root makes more sense to me than the other two, but I wouldn't necessarily advise using this as some hard and fast rule.
As noted in some of my answers to other questions, a Weibull distribution is close to symmetric for shape parameter in a broad interval near 3.6 (exactly where it's closest depends on how you measure it), and fairly close to a normal. This suggests that rather than the cube root or fourth root with exponential variavles, something in the vicinity the 3.6-th root should very near symmetric, but cube roots and fourth roots are still quite reasonable.
Comment: @muraveill Indeed -- but there's not always 0.7% of points outside $(Q_1-1.5\times \text{IQR},Q_3+1.5\times \text{IQR})$ which is the boxplot rule that's under discussion.
Comment: "A heavy-tailed but symmetric distribution might have many points outside the bounds on that rule.". There are always exactly 50% of all points within the IQR, aren't they?
Comment: @user603 The term "[exponential distribution](http://en.wikipedia.org/wiki/Exponential_distribution)" (also see [here](http://mathworld.wolfram.com/ExponentialDistribution.html)) without any modifying adjective (like "shifted" or "two-parameter") most conventionally refers to the one-parameter version. Some people do call the shifted version "the exponential distribution", but that's relatively rare; only slightly more common than calling the shifted lognormal distribution "the lognormal distribution".
Comment: @user603 Oh, sorry, a simple miscommunication - in that case yes, I don't think we have any substantive disagreement -- where there's any possibility of large outliers to the left, the approach I mentioned *makes no sense at all*. I simply wasn't attempting to deal with any potential that situation (but in my defence, it didn't look to me like the OP considered it as a possibility - I doubt taking logs would have come to mind if it were).
Comment: @Glen_b The upper rejection threshold for the exponential in your answer assumes that the shift parameter (or theta) is known. I think this should be mentioned.
Comment: @user603 One the other hand, it's not hard to adapt the large-sample rule I gave to a two-parameter exponential case (subtract the minimum observation from every observation, omit the zero, apply the rule, add back the zero, add the minimum back), but then I would also actually be worried about different things (the transformation approach wouldn't work as is, and I would be much more worried about outliers at the left end). But then ought I talk about generalizations of the Poisson case as well (shifted, zero truncated,...)?
Comment: @Glen_b: Even setting aside the other issues you mention, it seems to me that the approach you propose (subtract the minimum observation from every observation, ..., add the minimum back) would not work in general. For example, in the second example in my answer, it would return an estimate of $\hat{\sigma}\approx11$ (using the 7.1 cut-off you propose). I agree with you that the 'exponential' most often refers to the one parameter version and that assuming $\theta$ known makes the problem considerably simpler.
Comment: @User603 Now I'm not sure if we're even talking about the same thing. The multiplying by 7.1 isn't to produce an estimate of the scale parameter, but to produce an extreme-tail cut-off to "mark as an outlier", as in the original question, but in a way that would identify a similar proportion as outliers as you'd get with using the boxplot rule on normal data. In your second example, the rule correctly identifies all 20 observations you multiplied by 100. It does not attempt to end up with a robust estimate of scale.
Answer: I will answer your questions in the opposite order in which you asked them, so that the exposition proceeds from the specific to the general.
First, let us consider a situation where you can assume that except for a minority of outliers, the bulk of your data can be well described by
a known distribution (in your case the exponential).
If $x$ has pdf:
$$p_X(x)=\sigma^{-1}\mbox{exp}\left(\frac{-(x-\theta)}{\sigma}\right),\;x>0;\sigma>0$$
then $x$ is said to follow an exponential distribution (the special case where we set $\theta=0$ is called the one-parameter or standard exponential distribution).
The usual MLE estimator of the parameters are [0,p 506]:
$$\hat{\theta}=\min_i x_i$$
and
$$\hat{\sigma}=\mbox{ave}_ix_i-\min_i x_i$$
Here is an example in R:
n<-100
theta<-1
sigma<-2
set.seed(123) #for reproducibility
x<-rexp(n,rate=1/sigma)+theta
mean(x)-min(x)

the MLE of $\sigma$ is $\approx2.08$.
Unfortunately, the MLE estimates are very sensitive to the presence of outliers. For example, if I corrupt the sample by replacing 20% of the $x_i$'s by $-x_i$:
m<-floor(0.2*n)
y<-x
y[1:m]<--y[1:m]
mean(y)-min(y)

the MLE  of $\sigma$ based on the corrupted sample is now
$\approx11.12$(!).
As a second example, if I corrupt the sample by replacing 20% of the $x_i$'s by $100x_i$ (say if the decimal place was accidentally misplaced):
m<-floor(0.2*n)
z<-x
z[1:m]<-100*z[1:m]
mean(z)-min(z)

the MLE  of $\sigma$ based on this second corrupted sample is now
$\approx54$(!).
An alternative to the raw MLE is to (a) find the outliers using a robust  outlier identification rule, (b) set them aside as spurious data and (c) compute the MLE  on the non spurious part of the sample.
The most well known of these robust outlier identification rule is the med/mad rule proposed by Hampel[3] who attributed it to Gauss (I illustrated this rule here). In the med/mad rule, the rejection threshold are based on the assumption that the genuine observations in your sample are well approximated by a normal distribution.
Of course,  if you have extra information (such as knowing that the distribution of the genuine observations is well approximated by a poisson distribution as in this example)
 there is nothing to prevent you from transforming your data and using the  baseline outlier rejection rule (the med/mad) but this strikes me as a bit  awkward to transform the data to preserve what is after all an ad-hoc rule.
It seems much more logical to me to preserve the data but adapt the rejection
rules. Then, you would still use the 3 step procedure I described in the first link above, but with rejection threshold adapted to the distribution you suspect the good part of the data has. Below, I give the rejection rule in situations where the genuine observations are well fitted by an exponential distribution. In this case, you can construct good rejection thresholds using  the following rule:
1) estimate $\theta$ using [1]:
$$\hat{\theta}'=\mbox{med}_ix_i-3.476\mbox{Qn}(x)\ln2$$
The Qn is a robust estimate of scatter that is not geared towards symmetric data. It is widely implemented, for example in the R package robustbase. For exponential distributed data, the Qn is multiplied by consistency factor of $\approx3.476$, see [1] for more details.
2) reject as spurious all observations outside of [2,p 188]
$$[\hat{\theta}',9(1+2/n)\mbox{med}_ix_i+\hat{\theta}']$$
(the factor 9 in the rule above is obtained as the 7.1 in Glen_b's answer above, but using a higher cut-off. The factor (1+2/n) is small sample correction factor that was derived by simulations in [2]. For large enough sample sizes, it is essentially equal to 1).
3) use the MLE  on the non spurious data to estimate $\sigma$:
$$\hat{\sigma}'=\mbox{ave}_{i\in H}x_i-\mbox{min}_{i\in H}x_i$$
where $H=\{i:\hat{\theta}'\leq x_i \leq 9(1+2/n)\mbox{med}_ix_i+\hat{\theta}'\}$.
using this rule on the previous examples, you would get:
library(robustbase)
theta<-median(x)-Qn(x,constant=3.476)*log(2)
clean<-which(x>=theta & x<=9*(1+2/n)*median(x)+theta)
mean(x[clean])-min(x[clean])

the robust estimate of $\sigma$ is now
$\approx2.05$ (very close to the MLE value when the data is clean).
On the second example:
theta<-median(y)-Qn(y,constant=3.476)*log(2)
clean<-which(y>=theta & y<=9*(1+2/n)*median(y)+theta)
mean(y[clean])-min(y[clean])

The robust estimate of $\sigma$  is now
$\approx2.2$ (very close to the value we would have gotten without the outliers).
On the third example:
theta<-median(z)-Qn(z,constant=3.476)*log(2)
clean<-which(z>=theta & z<=9*(1+2/n)*median(z)+theta)
mean(z[clean])-min(z[clean])

The robust estimate of $\sigma$  is now
$\approx2.2$ (very close to the value we would have gotten without the outliers).
A side benefit of this approach is that it yields a subset of indexes of
 suspect observations which should be set aside from the rest of the data, perhaps to be studied as object of interest in their own right (the members
 of $\{i:i\notin H\}$).
Now, for the general case where you do not have a good candidate distribution
to fit the bulk of your observations beyond knowing that a symmetric distribution won't do, you can use the adjusted boxplot[4]. This is a generalization of the boxplot that takes into account a (non parametric and outlier robust) measure of skewness of your data (so that when the bulk of the data is symmetric is collapses down to the usual boxplot). You can also check this answer for an illustration.

[0]  Johnson N. L.,  Kotz S.,  Balakrishnan N. (1994). Continuous Univariate Distributions, Volume 1, 2nd Edition.
[1] Rousseeuw P. J. and  Croux C. (1993).
Alternatives to the Median Absolute Deviation.
Journal of the American Statistical Association, Vol. 88, No. 424, pp. 1273--1283.
[2] J. K. Patel, C. H. Kapadia, and D. B. Owen, Dekker  (1976).
Handbook of statistical distributions.
[3] Hampel (1974). The Influence Curve and Its Role in Robust Estimation. Journal of the American Statistical Association
Vol. 69, No. 346 (Jun., 1974), pp. 383-393.
[4] Vandervieren, E., Hubert, M. (2004) "An adjusted boxplot for skewed distributions". Computational Statistics & Data Analysis
Volume 52, Issue 12, 15 August 2008, Pages 5186–5201.
Answer: First, I'd question the definition, classical or otherwise.  An "outlier" is a surprising point. Using any particular rule (even for symmetric distributions) is a flawed idea, especially nowadays when there are so many huge data sets. In a data set of (say) one million observations (not all that big, in some fields), there will be many many cases beyond the 1.5 IQR limit you cite, even if the distribution is perfectly normal.
Second, I'd suggest looking for outliers on the original data. It will nearly always be more intuitive. For instance, with income data, it is quite common to take logs. But even here I'd look for outliers on the original scale (dollars or euros or whatever) because we have a better feel for such numbers. (If you do take logs, I'd suggest log base 10, at least for outlier detection, because it is at least a little intuitive).
Third, when looking for outliers, beware of masking.
Finally, I am currently researching the "forward search" algorithm proposed by Atkinson and Riani for various sorts of data and problems. This looks very promising.
Comment: For a similar question you argued, using transformations for "substantive reason not statistical ones". I have been working on a dataset that has as many as 96 variables (a bankruptcy dataset) in which the task is (binary) classification. In that, all variables are in the range of 0 and 1 indicating that those must be proportional data. But, a few variables, though proportions, have values up till 10^10 digits. In order to contain those within 0 and 1, I divided the values by 10 ^ 10. I wonder whether I could use the transformed variables in the ML (classification) model or not?


Ahlfors elementary mappings of regions

Question: In the section "A survey of elementary mappings", Ahlfors talks about various types of regions that can be mapped to the unit disc.  What I'm confused about are the methods and regions he's talking about.

He writes

The main tools at our disposal are linear transformations and transformations by a power, by the exponential function, and by the logarithm

by this does he mean that we can use linear transformations and transformations by a power, which we implement using the exponential and the logarithm?  Its a bit confusingly worded.

He then talks about regions whose boundary consists of two circular arcs with common end points.  Is this simply describing a crescent shaped region?  I've been visualising this as the intersection of two great circles on the Riemann sphere, like an orange slice
He then generalises to a circular triangle with two right angles.  he then says if the third angle has a vertex $a$, and if the sides from $a$ meet again at $b$.  Surely this is only has two sides, and is therefore not a triangle?
Answer:
I don't think so. I think he means linear transformations, integral powers and $\exp$ and $\log$.

He may mean arbitrary powers
$$
z \to z^a = \exp(a \log(z))
$$
for any $a$.
I haven't looked at Ahlfors for a long time. You can probably tell from the surrounding text, where there should be examples.

A crescent or a lens (which is a fat orange slice).

Imagine a lens (with angle $a$). Cut that lens into two pieces by a circle that crosses both lens arcs at a right angle.

In this picture all eight triangles have circular sides and two right angles.  (Remember the exterior triangle.)
Comment: so for point 3, where does the vertex $b$ where the two sides meet again go?  If they meet again at a point isn't that just the same as 2?
Comment: See my edit, with a picture.

Ahlfors elementary mappings of regions


Why does C to F# work?

Question: What's the theory behind this?  (Or does it NOT 'work'?)
Comment: Can you define "work"?
Comment: Related: [Why does the chord progression (i-)#IV-i sound acceptable?](https://music.stackexchange.com/questions/64464/why-does-the-chord-progression-i-iv-i-sound-acceptable), where you, Laurence, have the top-voted answer! (?)
Comment: No.  But, along with 'what's the theory behind...' it frequently appears in questions here.
Comment: @LaurencePayne these questions typically come up in an example piece which gives a lot of context. You can ask questions like this if you want, but you get back what you put in. Just listing chord progressions with no context won't yield as good of a result as an example that uses it.
Comment: @LaurencePayne there's still chromatic movement in your example so voice leading is still actively in play.  It doesn't go away just because most of your line is an arpeggio. If you are trying to make a point about needing to define what "works" means this isn't going to get you there.
Comment: To my mind, "tritone substitution/relation" explains a lot... makes both interpreted as V7's...
Answer: I'm hesitant to answer this, because by your own admission you can't define "work," which suggests you might not even know when a proper answer has appeared. Furthermore, you give no hints as to style; an answer to this question in a first-semester harmony course would be very different from the answer in a sixth-semester course for composition majors. But I'll offer some thoughts.
Schenkerian Theory
From a strict Schenkerian standpoint, one could say that this doesn't "work." By this I mean that this progression does not fit within the framework of Schenkerian theory.
In the abstract to "The ♯IV(♭V) Hypothesis: Testing the Limits of Schenker's Theory of Tonality," the authors state that

Our ♯IV/♭V Hypothesis is based on Schenkerian theory's predictions that if ♯IV/♭V sonorities appear in a tonal context, then they are always indirectly related to the tonic; thus, whenever ♯IV/♭V Stufen are interpreted as being directly related to the tonic or are not explainable in a convincing way as indirectly related, either the analysis is incorrect or the work must be deemed non-tonal.

As your excerpt is currently written, I don't see a way to interpret your F♯ (that is, ♯IV) as being anything but directly related to tonic, because there are no chords other than tonic to which it could relate.
Furthermore, the F♯ is a tritone away from C, and the C is a tritone away from F♯. This means that, from a purely tonal standpoint, it's impossible to tell which pitch is tonic since each chord is equidistant from the other. (Metrical concerns, however, do give C a slight edge.)
Schenkerian Theory, Part II
If, however, you attach a D and G chord at the end, we could view the F♯ as combined with the D creating applied motion to G (V). In doing so, we no longer relate the ♯IV to tonic, but rather to V. This then qualifies as a correct tonal progression within the Schenkerian framework.
Note that that is only one way to fit this progression into a Schenkerian framework. Another would be to insert an E♭ chord between the C and F♯. Doing so that causes us to reinterpret the F♯ as G♭, and we might then interpret the G♭ as ♭III of ♭III (that is, ♭III of E♭).
Neo-Riemannian Theory
From a neo-Riemannian standpoint, we can view this as a PRPR transformation:
P(C)    =  Cm      (read as "The parallel of C is Cm."
R(Cm)   =  E♭      (read as "The relative of Cm is E♭.")
P(E♭)   =  E♭m
R(E♭m)  =  G♭   =  F♯

Perhaps unexpectedly, this is in line with the second Schenkerian interpretation of ♭III/♭III.

All of this is to say that the answer all depends on how you define "work."
But I hope you aren't trying to point out that questions that ask how something "works" are not fit for this site. There's a big difference between questions about mode mixture and applied chords (which both date back to the 18th century at least!) and the quintessential tonality-defying progression of two chords a tritone apart.
Comment: @LaurencePayne I'm aware, and I specify as much in my answer. I just thought it would be helpful, in light of the Schenkerian framework, to show how this progression could be made to fit.
Comment: Your Schenkerian analysis seems to be of a different sequence - one containing additional chords.  I'd be more interested in an analysis of THIS progression.
Answer: F#s resolve upwards to Gs. C#s down to Cs. Cs resolve upwards to C#s, Gs resolve downwards to F#s. So it has a bit of an ambiguous tonal center. And it just alternates, which reinforces the feel.
It's also chord planing which makes the tritone relationship somewhat melodic instead of harmonic.
Comment: Tritone intervals are used heavily in certain types of music (jazz, for instance). Even playing an F# chord on top of a C7 chord has a nice, rich "jazzy" sound. I use this C7(b9b5) chord frequently in my playing. Also, when following a typical circle-of-fifths progression, it's common to delay the resolution of each chord to the next by inserting jumping to the tritone, then resolving to the second chord (for instance, C7 to F# down  to F).
Comment: Planing is typically just complete parallel motion.
Comment: @LaurencePayne Not that I know of. I think planing means that it's the same chord flavor, especially when one or more of the chords are not in the same diatonic key (like it's not much in the way of planing to go I-IV-V-I).
Answer: In the commentary below the question, it seems like the definition of a chord progression "working" is part of what needs to be addressed here. I can't speak for anyone else, but when I see questions like this I tend to interpret them as something more like "X progression seems to be outside the world of basic common-practice theory, but I nevertheless hear it as a reasonable harmonic connection. What is the nature of X that makes it sound like a reasonable connection despite its apparent deviation from basic theory?"
Framed in that way, there are several possible responses (assuming the questioner is correct that X isn't already clearly a part of basic common-practice theory): 1) Actually, this is a thinly veiled version of a thing that really is fairly standard; 2) although X doesn't follows such and such constraints of basic theory, it does follow such and such other constraints in a way that offsets it; or 3) this is far enough outside the norms of basic theory that the reason it works might well be its divergence from standards.
Implicit in all of this is the fact that, for the most part, something "working" ultimately just means some person likes it. For instance, I don't recognize the example you provide, but it isn't particularly to my taste. In one sense I might say that it doesn't "work." But if we engage with the discussion from that angle, we gain very little—you like it, I don't, but we haven't really learned anything beyond each others' opinions. Objectively speaking, we have to acknowledge that, somewhere out there, for virtually any possible combination of notes there's at least somebody that likes it. It "works" for them. My job, in answering the question on a site like this, is therefore to offer possible music-theoretical reasons for the potential usefulness or interest in a particular progression and to explain it.
So with this particular example, I think I'd go somewhere in between answer 2) and 3) above. One thing that potentially works (in a #3 sense) in this progression is its flouting of the norms of root progressions standard to a lot of Western music. It forces a striking "freshness" to the combination despite its repetition. It contains a cross-relation (C–C#) which directly contradicts the presumed tonic and forcefully defies categorization into any particular major/minor key. In fact, as others point out, the strict symmetry of a tritone relation (F# precisely bifurcates a C–C octave and vice-versa) injects a potentially exciting tension between two different tonal centers with each chord potentially both the "away" and the "home" harmony. Only metric emphasis tends to privilege either.
Contrasting a bit with that freshness, however, is the relative closeness of two notes in the chords in terms of pure parsimonious voice leading. The C and the G need only move (in contrary motion no less!) a single half step to reach C# and F#, leaving a reflection of the tritone root relation in the distance between E and A#. Alternatively, the C could be heard as splitting into one half-step motion up to C# and one whole step motion down to A#(Bb) while the E and the G converge on F# with a whole and half step respectively. Contrary to your comment on the question, these parsimonious connections tend to be heard as significant regardless of whether they are pursued on the surface of the music. To be sure, if I play a C major chord down low and then play an E minor chord up high, then I am significantly lessening the surface connection of the chords by ignoring the two potential common tones. But the latent connection between them and octave equivalence would lead it to still have a significant connective impact. The surface certainly doesn't always follow the connections literally, but that doesn't mean they aren't affecting the sound of the connection.
Add to this the fact that the two chords are connected by having the same quality, and we have some elements providing a few close(ish) connections with a few other elements providing significant tension. Such combinations can be quite compelling, despite (or because of?) this particular one being extremely rare in the common practice era.
Answer: Just to add to the excellent answers about harmonic reasons it works...
It works because it repeats.  The first time I hear C to F# it sounds wrong.  But each time I hear it after that, especially if the melody is interesting,  it makes more and more sense.
I'd encourage you to start with a C chord, pick any unrelated chord, and then alternate between the two.  It will sound less and less wrong, and more and more like you meant to do it.
Comment: And with repetition, the 'kooky-ness' will decrease.   Pity!
Answer: In the context of C to F# given the implication is F#7. Dom7th chords universally work in resolution to any other dominant 7th(as these chords are wrappers for diminished 7ths). The implication after the F# is C7. Hence one has C7 F#7(the 7ths being implied from the context). If the chords were major 7ths it would unlikely "work". In this case it is tritone substitutions. F# = F# A# C# (E) = Gb Bb Db E which is connected to an incomplete C7b5b9(A sort of French +6). So, in a proper context it is simply a type of C7 chord.
Comment: I'm not sure I follow you. Do you mean as implied dominant seventh chords, you could have `C7 F#7 Fmaj7` where the `F#7` is just the tritone substitute for `C7`?
Comment: Or did you mean the first chord is incomplete `C7` and the second is an incomplete `C7b5b9` enharmonically respelled using `F# A# C#` instead of `Gb Bb Db`, and it's not two chords, but two voicings and alterations of a `C` dominant seventh chord?
Answer: You could say it "works" simply because it's kooky. Depending on the point of the music that might be exactly how it should "work."
But, if the idea is to try to force it into a tonal analysis, then it seems fair to change around the style, and find a why that a progression from a C major chord to an F♯ major chord is not outlandish.
If we make some chord tone omissions, and change the voicing, we have the outline for a phrygian cadence, where the implied chords are Em to F♯ major. The Em chord needs only one alteration, raising the B to C to provide our C major chord. Progression C to F# doesn't fit a diatonic scale, but it does fit nicely with a double harmonic scale.

Admittedly this is a far stretch from the original example marked with a swing tempo. But, if we consider C to F# generally, we can make it work in an exotic way with the double harmonic scale, and it's a sort of "modal cousin" to a phrygian cadence.
Comment: I think you nailed it with 'It's kooky'.  I'm amused (and rather disappointed) to see how many people have tried to concoct a functional excuse!
Comment: @Laurence Was that not the entire point of your question? To solicit explanations?
Comment: No.  The point was to explore the concept, so often encountered in this forum, of a progression 'working'.

Why does C to F# work?


SettingWithCopyWarning even when using .loc

Question: Why am i getting SettingWithCopyWarning in this code? I know that when defining a new Dataframe, i need to use .copy(), but that doesn't help.
<code>   def calc_quantity(input_df):
        when = input_df['SecurityId'].str.endswith(
            'TMS') | input_df['SecurityId'].str.endswith('TDS')
        input_df['Quantity'] = input_df['Quantity'].fillna(0).astype(float)
        input_df['Quantity'].loc[when] *= 100
            'TMS') | input_df['SecurityId'].str.endswith('TDS').copy()
        input_df['Quantity'] = input_df['Quantity'].fillna(0).astype(float).copy()
        input_df['Quantity'].loc[when] = input_df['Quantity'].loc[when]*100
        return input_df['Quantity']
</code>
Comment: This is because `input_df` is already subselection of the original dataframe. So wherever you filter input_df, you need to add `.copy`
Comment: always put full error message (starting at word "Traceback") in question (not in comments) as text (not screenshot, not link to external portal). There are other useful information.
Comment: I've changed to  ```def calc_quantity(input_df):
                                   when = input_df['SecurityId'].str.endswith(
                                            'TMS') | input_df['SecurityId'].str.endswith('TDS').copy()
                                   input_df['Quantity'] =
                                   input_df['Quantity'].fillna(0).astype(float).copy()
                                   input_df['Quantity'].loc[when] =
                                 input_df['Quantity'].loc[when].copy()*100    return input_df['Quantity']  ```          but got some warning
Comment: put it in question - it will be more readable and more people will see it.
Comment: put it in question-Done
Answer: The warning typically is a result of chained assignments and you can read more about it in this answer and this blog post also goes into great detail.
If you wish to turn it off, you can use:
<code>pd.options.mode.chained_assignment = None
</code>


PERL Can't locate object method "echo" via package "IO::File" at ./echo.pl

Question: I'm learning Perl by following the book "Learning Perl the Hard Way" by Allen B. Downey. It instructs me to execute the following code "echo.pl":
#! /usr/bin/perl

use strict;

sub echo {
    my @params = @_;
    print "@params\n";
}

echo ARGV

Testing the code returns:
$./echo.pl TEST NOW
Can't locate object method "echo" via package "IO::File" at ./echo.pl
line 10.

It should return:
TEST NOW

What is wrong?
Answer: echo ARGV

is interpreted by Perl as "indirect object notation", i.e. the same as
ARGV->echo

ARGV
 is a special file handle, its methods come form IO::File - but there's no echo method there.
Answer: The book is online here. This program is on page 4 (going by the page numbers). It is:
sub echo {
    print "@_\n";
}
echo @ARGV

So this is just a typo. You have ARGV where you wanted @ARGV.
That book is from 2003. A lot has changed in Perl since then. You might well be better off looking at Modern Perl instead.
Answer: what you are looking for should be this.
#!/usr/bin/perl
use warnings;
use strict;

sub echo {
     my @params = @_;
     print "@params\n";
}

echo(@ARGV);


Cortar imagem com PHP

Question: Existe algum outro código em PHP para recortar uma imagem vindo do banco MySQL?
Eu estou usando esse, mas está dando um problema com slider do wow slider
Segue o código:
<?php
//

$largura = $HTTP_GET_VARS['largura'];
$altura = $HTTP_GET_VARS['altura'];

$jpeg = $HTTP_GET_VARS['end'];

if($d=getimagesize($jpeg)){
    if (!$largura or $largura==0) $largura = ($altura*$d[0])/$d[1];
    if (!$altura or $altura==0) $altura = ($largura*$d[1])/$d[0];
    $p_final = $largura/$altura;
    $p_orig = $d[0]/$d[1];

    if ($p_orig >= $p_final) {
        $nova_largura = ($d[0]-(($largura*$d[1])/$altura))/2;
        $x_i = $nova_largura;
        $x_f = $d[0]-$nova_largura*2;

        $y_i = 0;
        $y_f = $d[1];
    } else {
        $x_i = 0;
        $x_f = $d[0];

        $nova_altura = ($d[1]-(($altura*$d[0])/$largura))/2;
        $y_i = $nova_altura;
        $y_f = $d[1]-$nova_altura*2;
    }

    header('Content-type: image/jpeg');

    $src = imagecreatefromjpeg($jpeg);
    $dst = ImageCreateTrueColor($largura, $altura);
    $white = imagecolorallocate($dst,255,255,255);
    imagefill($dst,0,0,$white);

    imagecopyresampled($dst,$src,0,0,$x_i,$y_i,$largura,$altura,$x_f,$y_f);
    imagejpeg($dst, null, 98);
    imagedestroy($dst);
    imagedestroy($src);
}
?>

Answer: Use a biblioteca Timthumb para fazer isso.

Pegue ela aqui

Ela é usada da seguinte maneira:

Onde:
w = Width que você quer para a imagem
h = Height que você quer para a imagem
Ele aceita diversos parâmetros que você pode encontrar na documentação. É só seguir os exemplos
Comment: Ghilherme Louro, muito obrigado pela informação, deu certinho aqui!!! Valeu mesmo!!!

Cortar imagem com PHP


convergence of a real sequence

Question: Consider a real sequence $(x_k)$ for $k=0,1,2,\dots$ as $x_0=1$ and for $k>0$
$$ x_k=x_{k-1}+\frac{\gamma}{k}x_{k-1}^2,\qquad (\gamma>0).$$
I wonder to show that the sequence is bounded (thus convergent). I appreciate any idea for proving that.
Hint: Numerical experiments suggest me that if and only if $\gamma<1$ the sequence is bounded.
Comment: Which begs the question -- what are the numerical experiments? They should show divergence even by eyeballing,  since the rate is at least logarithmic.
Comment: Is your $\gamma>0$ ?
Comment: yes! I forgot to mention that. I will edit the question
Comment: Note that $x_k\geqslant1$ for every $k\geqslant0$, hence $x_k\geqslant x_{k-1}+\frac{\gamma}k$ for every $k\geqslant1$ hence $x_k\geqslant1+\gamma\sum\limits_{i=1}^k\frac1i$ for every $k\geqslant1$, in particular, $x_k\to\infty$ when $k\to\infty$ (for every $\gamma>0$).
Comment: @Did Thank you! I refer you to my reply to Umberto P.
Answer: Since $\gamma > 0$ you have that $\{x_k\}$ is increasing and in particular $x_k \ge 1$ for all $k$.  Since $$x_k - x_{k-1} = \frac{\gamma}{k} x_{k-1}^2$$ you get $$x_{n} - x_0 = \sum_{k=1}^n (x_k - x_{k-1}) = \sum_{k=1}^n \frac{\gamma}k x_{k-1}^2 \ge \gamma \sum_{k=1}^n \frac 1k.$$
That is,
$$x_n \ge 1 + \gamma \sum_{k=1}^n \frac 1k$$ so that the sequence is unbounded as $n \to \infty$.
Comment: You are right! thank you. The point was that after seeing your answer I found out that I had a mistake in the sequence; there is a difference between my numerical experiments and the sequence I have here. What I really want is not the current form but the other one. I think about it again and if I fail I ask it here again. Thank you for your reply anyway. @Umberto P.

convergence of a real sequence