For what integers $n$, do we have $30n+11=6x^2+5y^2$ for some integers $x,y$?

Question: I am trying to find all integers $m$ such that $m$ is relatively prime to 30, and $m=6x^2+5y^2$ for some integers $x,y$. Note that we must have: $y$ is odd, $(y,3)=1=(x,5)$. Using these conditions, I was able to show that $m=11$ or $29$ mod $30$. So I was first trying to handle the case $m=11$ mod 30. Note that $11=6\cdot1^2+5\cdot1^2$, but $41$ is not of the form $6x^2+5y^2$. So I was wondering, for which $n$  do we have $30n+11=6x^2+5y^2$? Also, for such $n$, can we obtain $x$ and $y$ satisfying $30n+11=6x^2+5y^2$?
Comment: mistake to use mod 30, correct is mod 120.  Legendre symbol $$  (-120|41)  = (3|41) = (41|3)  = (2|3) = -1. $$
Comment: There is usually no requirement that $x \neq y$ in these representations so your representation of $11$ is good.
Answer: The values to look for are mod 120,  specifically $11, 29, 59, 101 \pmod{120}.$  There is a fairly clean theory about primes that are represented by a binary form. Since the class number $h(\mathbb Z[\sqrt{-30}]) = 4$  but there is one form in each genus, the primes $p = 5 x^2 + 6 y^2 $  are described precisely by congruences.
Other than the primes $2,3,5,$  the primes  such that $(-120|p) = 1$ are represented as such:
$$
\begin{array}{ccccccc}
1. & 1,&31,&49,&79, & \pmod{120}& :: \; \; x^2 + 30 y^2 \\
2. & 17,&23,&47,&113, & \pmod{120}& :: \; \; 2x^2 + 15 y^2 \\
3. & 13,&37,&43,&67, & \pmod{120}& :: \; \; 3x^2 + 10 y^2 \\
6. & 11,&29,&59,&101, & \pmod{120}& :: \; \; 5x^2 + 6 y^2 \\
\end{array}
$$
Products of such primes are represented by one of the four forms, specified by Gauss composition. For example, $11 \cdot 29 = 319 = 17^2 + 30 \cdot 1^2 = 7^2 + 30 \cdot 3^2.$ Suppose we call the forms 1,2,3,6, where the last one is for $6 y^2 + 5 x^2.$  For a product of such "good" primes, write each one with a code 1,2,3,6. Then multiply,  table $1^2 = 2^2 = 3^2 = 6^2 = 1.$  Next $2 \cdot 3 = 6$ and $2 \cdot 6 = 3.$ Finally $3 \cdot 6 = 2.$   Well, here is a $2 \cdot 3 = 6.$ As in $17 \cdot 13 = 221 = 5 \cdot 5^2 + 6 \cdot 4^2 = 5 \cdot 1^2 + 6 \cdot 6^2 $
<code>all values  mod 120
       0       5       6      11      14      20      21      24      26      29
      30      35      36      44      45      50      51      54      56      59
      60      66      69      74      75      80      84      86      90      96
      99     101     104     110     114     116

prime to 120:   11,  29,  59, 101

primes

       5      11      29      59     101     131     149     179     251     269
     389     419     461     491     509     659     701     821     941     971
    1019    1061    1091    1109    1181    1229    1259    1301    1451    1499
    1571    1619    1709    1811    1901    1931    1949    1979    2069    2099
    2141    2309    2339    2381    2411    2459    2531    2549    2579    2621
    2699    2741    2789    2819    2861    2909    2939    3011    3221    3251
    3299    3371    3389    3461    3491    3539    3581    3659    3701    3779
    3821    3851    3989    4019    4091    4139    4211    4229    4259    4349
    4421    4451    4691    4931    5021    5051    5099    5171    5189    5261
</code>
$$  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc     \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc $$
<code> form  1     x^2 + 30 y^2
       0       1       4       9      16      25      30      31      34      36
      39      46      49      55      64      66      79      81      94     100
     111     120     121     124     129     130     136     144     145     151
     156     169     174     184     196     199     201     220     225     226
     241     255     256     264     270     271     274     279     286     289
     295     306     316     319     324     334     345     351     354     361
     370     376     391     400     409     414     430     439     441     444
     466     471     480     481     484     489     495     496     505     514
     516     520     526     529     544     559     561     576     580     594
     601     604     606     624     625     631     649     655     670     676

 form   2    2 x^2 + 15 y^2
       0       2       8      15      17      18      23      32      33      47
      50      60      62      65      68      72      78      87      92      98
     110     113     128     132     135     137     143     153     158     162
     167     177     185     188     200     207     215     222     233     240
     242     248     257     258     260     263     272     288     290     297
     302     303     312     335     338     348     353     368     375     377
     383     392     393     398     402     407     423     425     440     447
     450     452     465     473     482     503     510     512     527     528
     537     540     542     548     558     572     575     578     585     590
     593     612     617     632     638     647     648     663     668     690

 form   3   3 x^2 + 10 y^2
       0       3      10      12      13      22      27      37      40      43
      48      52      58      67      75      85      88      90      93     102
     108     115     117     118     138     147     148     157     160     163
     165     172     187     192     198     202     208     232     235     237
     243     250     253     262     268     277     282     283     298     300
     307     310     325     333     340     352     358     360     363     372
     373     387     390     397     403     408     432     435     442     453
     460     468     472     490     493     502     507     517     522     523
     538     547     550     552     565     588     592     597     598     603
     613     628     637     640     643     652     660     667     675     678

 form   6    5 x^2 + 6 y^2
       0       5       6      11      20      24      26      29      44      45
      51      54      59      69      74      80      86      96      99     101
     104     116     125     131     134     141     149     150     155     170
     176     179     180     186     195     204     216     221     230     234
     236     245     251     261     269     275     276     294     296     299
     314     320     326     330     339     341     344     374     384     389
     395     396     404     405     411     416     419     429     459     461
     464     470     474     486     491     500     501     506     509     524
     531     536     539     554     555     564     566     596     600     605
     611     614     620     621     629     645     650     659     666     680
</code>
$$  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc     \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc $$
Comment: In [this answer](https://math.stackexchange.com/a/4442381/248217) I explore the factorization characteristics on class 4 domains when the class group is _specifically Klein-four_. Would this result be connected with that property of $\mathbb Z>\sqrt{-30}]$?
Comment: @OscarLanzi  Hi. The unusually clean setup is due to having one class per genus, for positive forms this is Euler's Idoneal Numbers. https://en.wikipedia.org/wiki/Idoneal_number   I will see if I can come up with one class per genus but eight genera, this might require indefinite forms. Take a few minute at least.  Quicker than expected, idoneal number 105,  class number eight, all forms square to the identity,      420:  < 1, 0, 105>     420:  < 2, 2, 53>     420:  < 3, 0, 35>     420:  < 5, 0, 21>     420:  < 6, 6, 19>     420:  < 7, 0, 15>     420:  < 10, 10, 13>     420:  < 11, 8, 11>
Comment: Alright, 16 genera, one class per genus, Discriminant      -5460     h :   16     Squares :    1     cubes :   16     Fourths :    1
    5460:  < 1, 0, 1365>    5460:  < 2, 2, 683>    5460:  < 3, 0, 455>    5460:  < 5, 0, 273>    5460:  < 6, 6, 229>    5460:  < 7, 0, 195>    5460:  < 10, 10, 139>    5460:  < 13, 0, 105>    5460:  < 14, 14, 101>    5460:  < 15, 0, 91>    5460:  < 21, 0, 65>    5460:  < 26, 26, 59>    5460:  < 30, 30, 53>    5460:  < 35, 0, 39>    5460:  < 37, 4, 37>    5460:  < 42, 42, 43>
Comment: [OEIS A000926](https://oeis.org/A000926) reports that the class group for the relevant discriminants is indeed $(\mathbb Z/2\mathbb Z)^n$, which is the Klein four-group for $\mathbb Z[\sqrt{-30}] (n=2)$.
Comment: I made your class number rendering more precise (giving the ring, not just the discriminant which may apply to other rings). Feel free to roll back if you want.
Answer: if n>0, then left hand side is positive, and 30n+11 chooses an ellipse from right-hand side which contains an ellipse for each value in $\{ (x,y) | f(n,x,y)=g(n,x,y), (n,x,y) \in (Z,Z,Z) \}$ where $f(n,x,y)=30n+1$ and $g(n,x,y)=6x²+5y²$. After you realize that it's just an ellipse for positive values of the left hand side, then the next step is to realize that the integers are a grid that needs to intersect the ellipse.


Twitter user data - Fixed Effects Logit the right/only choice?

Question: I'm wondering whether a fixed-effects (logit) model fits the purpose of my study, and would like to get some feedback or ideas which other models could potentially be useful:
I have an unbalanced panel (daily observations, 3 months time period) with Twitter user data. Among the independent variables are

number of followers
is the user verified (binary)
number of tweets on that day
time between tweet
...

the dependent variable is binary (0,1).
As far as I understand, the fixed effects model does not consider the variance between the individuals. However, isn't the variance between the user what really matters here? Given that I suspect that there is much less variation for the independent variables within each user (e.g. the number of followers does not increase so much during the study period. Also whether or not a user is a verified user does not change).
Still, I understand the advantages of the fixed-effects model, given that there are likely individual time-constant differences between the users (e.g. intelligence, talent,...) which the FE model would control for. Is there a model that accounts for individual fixed effects but still considers between variance?
Also, in case I wanted to do a follow-up cluster analysis with the variables that turned out to be statistically significant in the regression, wouldn't I need to consider the between variance in the regression in the first step, because any cluster algorithm essentially tries to separate (between) users.
Thanks a lot for your help and ideas!
Answer: I'll reply to your first and second questions but I cannot help you with the last (the one about clustering).
1) Isn't the variance between the user what really matters here?
You are correct that FE uses only within observation variation (all that doesn't vary over time is dropped from the equation). This is because you want to get rid of unobserved heterogeneity to deal with omitted variable bias. That is the point of using FE. If there is little variation over time, it makes not much sense to use FE models, as it is less efficient than other panel data models.
2) Is there a model that accounts for individual fixed effects but still considers between variance?
As for models that use both within and between variation, there are RE (random effects) models. They model individual unobserved heterogeneity as individual random effects, with the trade-off that you have to assume that these effects are uncorrelated to the other predictors. You can augment them to allow for correlated random effects with what is called Mundlak-Chamberlain approach (Woodridge has a paper on how to use these models in unbalanced panels).
A bit of extra advice
Above all, though, you should think well about how your data meets the assumptions of the models you are trying to use. You are dealing with network data, and network data is not independently and identically distributed, mainly because who follows whom depends on who the other people are following (e.g. there is transitivity, reciprocity, etc) and because there are all sorts of spill over effects between individuals. These characteristics of network data are what makes it really interesting, but they also require specialised statistical models. Most panel models assume cross-sectional independence (i.e. that the series of observations for each subject are independent from the series of observations of the other subjects), and that is not met by network data.


Sounds used by music instructors to induce pauses in people playing or singing

Question: I would like to know whether it is common for music teacher instructors, and, perhaps, also with musical orchestra directors, but perhaps not, to introduce special sounds, in special ways, by means of some object, or even with their voice, to induce a pause in the instrument players or singers (and, whether, there are some sounds that will work in general to get the player or singer to pause, by inducing a blockage in their brain's functioning, with the sound, perhaps even in measured ways, maybe even with the player's or singer's cooperation, or whether it is just me).
Thank you for your suggestions.
It would be nice to see a few videos of examples of how people do this or how this is done in practice (if you know what I'm talking about).
Thanks.
Comment: When conducting youth ensembles (in rehearsals, not performance) I'll often just "SH!!" loudly at problematic rests; it gets attention, and we're already conditioned to respond by hesitating.
Answer: In educational settings, definitely yes.
For ear training, especially rhythmic dictation, I've seen various sounds or actions suggested during rests to help time the rest. Similarly for (student) choral groups learning the rhythm of a new piece.
And example would be saying the solfège syllables in time and clapping, stomping, tapping, or otherwise using a noise not made with the mouth for rests.
When learning complicated rhythms on my own, I've worked on ways to move or make a small sound or say something for a rest.
Comment: Are you thinking solfege *timing* names - most players are more aware of solfege *pitch* names?
Comment: @Tim Maybe I wasn't clear. I was talking about saying the solfège names of the notes without singing in time and then clapping on rests (as one example). It's an exercise to get a student chorale to be rhythmically together without worrying about intonation, etc. Just focusing on the timing.
Answer: A violin teacher I had used to sniff instead of playing, when he got to rests. Most of us will probably count out loud through the rests. Nodding or shrugging shoulders works as well - if that's what you mean.
Comment: @CarlWitthoft - I'd have thought it obvious I meant during practice/rehearsal. Obviously not that obvious. Obviously, by performance time, the rests would be looking after themselves, I'd hope. And it would seem that OP is asking about instructors, etc, who would be  - instructing.
Comment: Say what now?  If I caught a fellow musician (chamber or large ensemble) counting audibly, I'd feed them their instrument.  Doesn't happen.
Answer: So far as groups with a conductor/music director go, the conductor will NOT make any sounds during performances (unless it's in the score; thanks PDQ Bach).  For student and lower-level groups, the director may well count out beats through tough passages in early rehearsals until the players learn their charts properly.
Speaking specifically about pauses: these are either GP (grand pause) or cesura or post-fermata situations, and the conductor's baton clearly indicates when to stop and when to start up again.
Comment: I knew a choral conductor who, when he got to the grand pause at the end of the Hallelujah Chorus, would try to keep anybody from singing during the rest by dropping his arms entirely, clamping them to his sides as if in a straight jacket, and staying frozen until the rest had passed.


A question of formality regarding limits

Question: Let $f$ be a differentiable function over $\mathbb{R}$, with its derivative being a continuous function. Let there be a function $g$ s.t. $\lim_{x \to 0} g(x) = 0$.
Now I'm required to show that $f'(0) = \lim_{x \to 0} \frac{f(x+g(x)) - f(g(x))}{x}$
The solution seems almost obvious from the definition yet I find myself dealing with two variables and two limits, my question is how would I formally write the transitions leading to this equality, using the definition of the derivative at $x = 0$?
Thanks a million!
Comment: are you required to prove f '(0) or f(0)?
Answer: from the principal definition of a derivative we know that :
$$f'(t) = \lim_{x \to 0} \frac{f(t + x) - f(t)}{ x}$$
for $f '(0)$ instead of substituting $0$ in the definition we use $g(x)$ since its limit is zero as $x \to 0$.
we thus get:
$$f '(0) = \lim_{x \to 0} \frac{f(g(x) + x) - f(g(x))}{x}$$
Comment: -1. This is hardly formal. It's hard to think that that this didn't already occur to the OP


Does the lip really vibrate at the same frequency of a brass instrument?

Question: The resonance of woodwind brass instruments can be modeled after a closed cylindrical pipe and calculated by the equation f = (nv)/(4L) where n denotes the number of harmonics, v the velocity of sound propagating in air, and L the length of the pipe. For a trumpet that has tube length of about 1.4m, the resonating frequencies would be:
f = (nv)/(4L) = (343n)/(4*1.4) = 61.3n = 61Hz, 184Hz, 306Hz, 429Hz...

The sound of a trumpet ranges from email@example.com up to firstname.lastname@example.com. I tried as hard as I can vibrating (buzzing) my lips, but I can hardly get my mouth to vibrate more than perhaps a few tens Hz without getting sore. It's hard to believe, even with practice, that a person can possibly vibrate his lips hundreds of Hertz, let alone over a 1000Hz (or do they?).
Do woodwind brass instrument players really vibrate their lips as quickly as the pipe resonates?
Comment: The players might not be able to vibrate that fast, but the instrument might interact with the lips (kind of a feedback loop) to make this happen. Note that the trumpet is not a woodwind.
Comment: A closed cylindrical pipe only produces odd-numbered harmonics. The bell flare and the mouthpiece together allow a trumpet to produce all the harmonic series, not just the odd-numbered ones.
Comment: The given hertz figures don't match those [here](https://pages.mtu.edu/~suits/notefreqs.html), but are in the correct order of magnitude.
Comment: @Tom you're right. Brass, not woodwind. Question amended.
Answer: At least for trumpet, yes, the lips really vibrate that quickly.

For a high trumpet note, the lips may vibrate at more than 1000 vibrations per second. This is fast, but remember that the muscles are not contracting at that rate: the muscles in the brass player's lips exert almost constant tension, and it is the elastic and aerodynamic forces on the lips that produce the vibration. (SOURCE: this site also has pages devoted to various woodwinds, so you may find similar information there.)

Trumpet players often practice "buzzing" our lips on various pitches — for example, playing a scale lips only (we also do the same kind of practice mouthpiece only). The trumpet becomes a tool to focus that sound. However, this can be quite difficult and take significant practice. It's generally easier to form pitches with the trumpet than without, but even with, it can take years to develop the ability to play higher pitches.
Comment: Come to that, as my son has just pointed out, the vocal cords also have to vibrate pretty fast, which does not seem to surprise the questioner as much!
Comment: Vocal cords, as @PJTraill mentions, are a very apt comparison.  The muscles don't themselves vibrate the lips or vocal cords at 1000Hz (or whatever frequency).  They *tense* the lips/cords, and then the airflow causes the tensed surfaces to vibrate.  Whatever fatigue/pain occurs is not caused by the vibration, but by the tension.
Comment: @KMC I wouldn't say there's *no* damage.  From my limited time with the trumpet, I can say that your lips can *hurt* after playing for a while.  This is one of the reasons I gave up playing it after a few years.  I imagine professionals build up tolerance for that, but I never got there.  (I'll stick with the piano, thank you very much.)
Comment: Maynard Ferguson!    :-)
Comment: Just mind boggling to know that the lips can vibrate that quickly without damaging the soft tissues
Comment: @DarrelHoffman good to get a perspective of an actual trumpet player and I know none of them. A great point PJTriall brought up - I guess a slight difference in that is when I tried buzzing as quick a I can I can't help but kept spitting all over the place so at 1000Hz my mouth would basically split like machine gun which is physically impossible if I image.  But like Tom comment mentioned, there's some feedback mechanism that opens my mouth without needing the player exerting all the muscular force of splitting air (or saliva in my case) constantly at that frequency.
Comment: @KMC when developing endurance for trumpet, you develop both the muscles that support the embouchure, but also the ability for your lips to withstand playing for extended periods. Those both usually improve together, but depending on what you're doing, you can reach the limit of one or the other. For the former, it's just soreness/cramping of the cheeks, for the latter, the soft tissue of the lips definitely begins to hurt. As an aside, if you try "buzzing" into an opening that you make with your fingers you can get much higher pitches more easily and is akin (though not quite) to a mouthpiece
Comment: If your lips hurt, then you probably are not providing enough diaphragmatic breath control (leaving out beginner students here).  The more work your thorax muscles do, the less stress on those in your mouth.
Comment: @kmc "I can't help but kept spitting all over the place" - And now you know why trumpets have spit valves! But seriously, did you try buzzing your lips in air or with a mouthpiece? It is easier to do with a mouthpiece.
Comment: @KMC Very much an *ex*-trumpet player.  I only played for a few years in middle school, a *long* time ago.  I'm sure there are many people on this site with more recent and professional experience.
Answer: Yes, the lips really do vibrate at that frequency. Any material or object can vibrate at pretty much any frequency, if they're driven at that frequency. For example, when you get a medical ultrasound, your body tissues are vibrating at something like 100-1000 kHz.
Your physical intuition is being misled by the fact that your body's frequencies of free vibration are more specific and limited. For example, if you sit perched on a high stool and swing your leg like a pendulum, its frequency will be on the order of 1 Hz. Dogs pant at the natural frequency of their chest and diaphragm, which is on the order of 10 Hz.
In the case of the trumpet, the frequency of free vibration isn't what's relevant. The lips are strongly coupled to the air column of the trumpet. The harmonic frequencies of the air column are the ones at which the lips get driven.
Comment: Curious what you mean by "dogs pant at the natural frequency of their chest and diaphragm, which is on the order of 10Hz." It gives me a mental picture of a dog inhaling and exhaling ten times a second, which is much faster than my observations. A random chihuahua video I found on Youtube shows panting at maybe 4Hz.
Comment: According to google, medical ultrasound is in the range 2-18 MHz


IE conditional comments for HTML class?

Question: I need to have the following html classes with IE conditional comments in my Drupal 8 site:

Ideally I would use html_attributes.addClass see this question: Safe to add a class attribute to the HTML element via the theme?
I tried this:

But it seems once you add a class to html_attributes then its printed every time, so my final instance which should only have a class of no-js instead has this:
no-js lt-ie10 lt-ie9 no-js lt-ie10 no-js

Comment: addClass I guess should add only once.. I didn't know that: (
Comment: This behaviour is a feature, so the code is working as expected, you just need to do things differently to get the required result for this use case (see my answer below).
Answer: Your best bet is to print the class attributes separately, and use the without twig filter, then hard code the IE stuff, e.g.

https://www.drupal.org/node/1823416
https://www.drupal.org/docs/8/theming/twig/filters-modifying-variables-in-twig-templates

IE conditional comments for HTML class?


SLES11 random unreachability from a single machine

Question: I'm experiencing a very weird problem and I am lost hard now. I have set up several Suse SLES 11 SP2 machines since my company tries switching to SUSE. And every single machine with SLES 11 has this specific issue:
Once installed, everything works fine. However if one connects from a Debian Machine (Squeeze and Wheezy) or Putty (latest version) via SSH, the connection occasionally drops and the machine stays unreachable from that machine only. If I then connect to it via some random server, it works, while I cannot even ping that machine from my machine.
More Details:

tcpdump on the machine sees my own ping attempts but no reply is being sent
SSH simply times out while that happens
restarting the network interface or rebooting resolves the issue temporarily
occurs randomly between 1 minute in and several hours
all machines are on the same subnet
all machines are connected to a cisco switch, no VLAN configured on this subnet
checked for IP theft (maybe a laptop sleeping and awaking randomly to do stuff), no success
to complete the mess, connections from a RedHat6 machine (exactly the same hardware) never experience this issue
the e1000e module is being used on all these machines (except for windows with putty of course), updating to the latest firmware on one or both sides did not help
Network Cables have also been switched - no success
the eeprom_fix_82574_or_82583 did not fix this issue, even though that issue was present on some of these machines
installing a Debian on these problematic machines resolves the issue, but is not wanted for company reasons...

So here I am, completely clueless... Does anyone have even the slightest idea what is wrong here?
Comment: Okay, I was wrong about one thing: my machine is NOT on the same subnet as the other machines. A buddy said he never had these problems - he is on the same subnet. My machine is in a different one, which should be able to connect without trouble.
Traceroute reveals that from my machine to the server it takes one station to get there. From the server to my machine it takes two stations(!). So after some time the router sends a RIP package, suggesting a more direct route. My machine accepts it, the SUSE machines don't. How can I fix that?
Answer:
tcpdump on the machine sees my own ping attempts but no reply is being sent

In GNU/Linux, tcpdump can see packets blocked by local iptables firewall, so if you don't see any reply being sent, it's either due to inbound ICMP blocked, or lack of ARP entry of source.
To diagnose these issues, -e switch of tcpdump is helpful, as it prints out link-layer addresses, and while analysing traffic make sure to capture ARP traffic as well.
To rule out probability of ARP (easy), you can add static/permanent ARP entries to see if issue goes away. If after adding static ARP entries, it goes then probably someone is stealing ARPs or some ARP filtering is going on.
Comment: I think the issue is wrong, as I've overlooked a routing issue factor, described as added info above... my bad. still it helped me getting these lost packages, which led to that error possiblity.
Comment: Are you sure that's a `RIP` packet, and not some [ICMP Redirect](http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Redirect) packet ? There are couple of [`icmp` related sysctl knobs](http://lxr.linux.no/linux+v3.8.1/Documentation/networking/ip-sysctl.txt#L816) in Linux which you might like to play with.
Comment: I've tracked down random connection loss problems with SLES 11 machines to a network issue definitely related to SLES 11 only.

The Issue:
Connections to SLES 11 Servers using SSH from a different subnet stop working at random. Even Ping fails from my machine. A different machine in my subnet however CAN ping while I cannot.
The issue does **not** happen when the machine connecting is on the same subnet as the SLES server.
Comment: Because of Packet Loss (found using tcpdump) exactly the moment the connection happens, our net admin suggested SLES 11 probably doesn't handle RIP packets correctly by default. Indeed RedHat, Debian, Windows etc. do not appear to have this issue in the very same setup.
Comment: Routing Infos while it works:
http://pastebin.com/HkjsaG45
Comment: Okay, this is DEFINITELY a RIP issue. Made an Update to the pastebin info.
http://pastebin.com/mLWFJ1FJ
Comment: Thanks. iptables is uninvolved, as it is empty and allowing everything. Stuff like apparmor or selinux are disabled.
I have tried tcpdump -e and discovered TCP Retransmissions occuring exactly when the connection drops.
After 5 Minutes or so, Ping started working again, SSH wont (get's stuck at debug2: channel 0: open confirm rwindow 0 rmax 32768). Also a lot of ARP requests and replies are piling up. Still working myself into this...
Comment: Also lots of TCP Retransmissions when trying SSH now AFTER it stopped working.
Comment: Did you try adding static ARP entries? Also look in switch's CAM table for the MACs of affected hosts, if switch is aware of them.
Answer: Thanks to abbe, I've found a solution to this problem:
Simply. Disable. Iptables.
Completely, that is, by disabling the kernel modules from loading at boot time as well as disabling the firewall beforehand in Yast.
Create this file and reboot, then check with lsmod if iptables is still loaded:

nano /etc/modprobe.d/netfilter.conf

alias ip_tables off
alias iptable off
alias iptable_nat off
alias iptable_filter off
alias x_tables off
alias nf_nat off
alias nf_conntrack_ipv4 off
alias nf_conntrack off

Afterwards, the routing issue resolved itself with the unnecessary routing point in between already removed, so it is now just a single hop instead of two right from the start.
Source: http://backstage.soundcloud.com/2012/08/shoot-yourself-in-the-foot-with-iptables-and-kmod-auto-loading/
Comment: From looking at your pastes, it seems like your routing is messed up. Disabling `iptables` is just causing it to see ICMP redirect messages which were probably blocked due to firewall.

For `RIP`, you need a RIP daemon (to update local routing table based on updates from RIP), which seems unlikely.

A solution would be to audit/fix both forward/reverse routing between hosts to avoid relying on ICMP redirect messages.


Estimating joint distribution from observed samples of the marginals

Question: Let's say I have two (normal) random variables $A1$ and $A2$ and during a random process, at each time instant, I am collecting a sample for each one of them.
Given the samples I collected, I can calculate two normal distributions to describe $A1$ and $A2$, respectively $\mathcal{N}(\mu_1, \sigma_1)$ and $\mathcal{N}(\mu_2, \sigma_2)$.
I want to know, given my estimated Gaussians and the samples I collected, how to calculate the joint probability distribution of the random vector $(A1, A2)$.
Answer: You can't compute joint distribution from marginals. Check this thread for much simper case with computing joint probability from individual probabilities.
In case of normal distributions, as in your question, imagine that you have two marginal distributions, each normal. Say that you are in lucky situation, that you know in advance that their joint distribution is bivariate normal, know the means and variances and the only thing that is unknown to you is the correlation parameter $\rho$. Unfortunately, if you know only marginals then you can't say anything about $\rho$, since there can be any correlation between the two variables, so there is unlimited number of bivariate normal distributions that can lead to such marginals. Moreover, it can be even more extreme and the variables can be marginally normal, but jointly not.
Comment: The way I interpreted the question, they're asking "given the samples", how do they produce a joint distribution. The marginal distributions are from the samples, so really the question is asking how to convert samples (aka, time series data) into a joint distribution.


AWS Boto3: The security token included in the request is invalid for AWS FORECAST

Question: I am trying to query forecast arn in aws but getting the following error :
<code>import boto3
client = boto3.client('forecastquery')
response = client.query_forecast(
    ForecastArn=' ',
    StartDate='2018-12-31T00:00:00',
    EndDate='2019-12-31T23:00:00',
    Filters={
        'item_id':' '
    }
    )
print(response)
</code>

botocore.exceptions.ClientError: An error occurred
  (UnrecognizedClientException) when calling the QueryForecast
  operation: The security token included in the request is invalid.
Comment: Is your key valid? Check the credentials in `~/.aws/credentials`.
Comment: Try calling another service (eg S3 `list_buckets()`) to check whether this problem has anything to do with Forecast or not.
Answer: Check the region which you are using. There are few region which required to be enabled. Below regions need to be enable first before using them.
Africa (Cape Town) - af-south-1,
Asia Pacific (Hong Kong) - ap-east-1,
Europe (Milan) - eu-south-1,
Middle East (Bahrain) - me-south-1.
While forecasting these regions might also coming into consideration but as these regions are disabled by default therefore you are getting an error. check out document - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions


Dúvida sobre imagens no Android

Question: as imagens devem ficar na pasta drawable ou mipmap no meu projeto Android?
Eu venho utilizando a pasta mipmap. Existe alguma diferença na utilização dessas pastas em um projeto Android?
Answer: De acordo com um blogpost do Google:

It's best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device's current density.

Ou seja, É uma boa prática utilizar a pasta mipmap exclusivamente para se colocar os ícones que serão utilizados na aplicação.
Qualquer outro asset de imagem deve ser colocado na pasta drawable.

Dúvida sobre imagens no Android


Insert text into large existing file

Question: I have a file that contains about 2000 lines of text that I need to add a few lines to. My initial solution was to just copy the existing file to a new file and then add a few lines at the end of it. That was until I realized that the last line in the file had to always be the last line. So now I need to add my new lines before that one line of text. I know that I can just read the entire file, save it to my program and then write everything to a new file with my extra lines included. But since the file has that many lines I wanted to know if it was a better way to do it.
Comment: From a performance perspective it would be much better if you could append the new lines to the end of the file instead of prepending them. You would need to reverse things in your application, of course, if that is a requirement.
Comment: @Robert I know, this is why that was my initial solution. But the line that is currently the last line has to always be the last line.
Answer: You will need to copy it into a new file. There's no way to inject data into the middle of a file, unfortunately.
However, you don't have to load it into memory to do that. You can use a StreamReader and read only one line at a time, or better yet, the System.IO.File.ReadLines method.
int newLineIndex = 100;
string newLineText = "Here's the new line";
using (var writer = new StreamWriter(outputFileName))
{
    int lineNumber = 0;
    foreach (var line in File.ReadLines(inputFileName))
    {
        if (lineNumber == newLineIndex)
        {
            writer.WriteLine(newLineText);
        }
        else if (lineNumber > 0)
        {
            writer.WriteLine();
        }

        writer.Write(line);

        lineNumber++;
    }
}

Of course, this becomes substantially easier if you're comfortable assuming that the new line will always go at index zero. If that's the case, I'd be tempted to forgo much of this, and just go with a simple Stream.CopyTo after writing the first line. But this should still work.
string newLineText = "Here's the new line";
using (var writer = new StreamWriter(outputFileName))
using (var reader = File.OpenRead(inputFileName))
{
    writer.WriteLine(newLineText);

    reader.CopyTo(writer.BaseStream);
}

Of course, there are any number of ways to perform this, with different trade-offs. This is just one option.
Comment: It actually doesn't matter where the new lines go, as long as they are not the last lines in the file. And with that in mind, you suggest that I create a new file, write my new lines to the start of that and then copies the old file?
Comment: @JesperEvertsson Yeah, that's probably what I would do. I added a bit of an example of how I'd probably think about adding them to the beginning.
Comment: I tried impelemting your second solution, but for me that adds the new line at the end of the file
Comment: @JesperEvertsson Interesting. I'm not sure why that would be happening on the second one. The first one would have had that problem, I realize now, and I've edited to fix that a bit. But the second one should be fine for that.
Comment: I used a modified version of the first solution you provided and now it works as intended.
Answer:
that I can just read the entire file, save it to my program and then write everything to a new file with my extra lines included.

Not everything needs to be written. Just write the inserted lines and lines after the inserted lines to the original file, starting from the position (byte index) of the inserted lines.
Comment: The problem with this is that I don't know how big the file will be in advance and it varies from file to file
Comment: @JesperEvertsson Read it into your problem, find the position of the insertion, and then write the new lines and the affected lines.

Insert text into large existing file


Evaluating $\lim_{x\to0} \frac{ax-\arctan(ax)}{bx-\arctan(bx)}$

Question: I struggle with solving this with L'Hospital technique:

$$\lim_{x\to0} \frac{ax-\arctan(ax)}{bx-\arctan(bx)} \tag{1}$$

It should be:
$$\lim_{x\to0} \dfrac{a-\dfrac{a}{a^2x^2+1}}{b-\dfrac{b}{b^2x^2+1}} \tag{2}$$
I end up with:
$$\frac{a-a/1}{b-b/1} \tag{3}$$
Which is $0/0$.
Just the same as if I didn't use l'Hospital method.
Same if "tan" is used instead of "arctan".
Yet, it seems it is solvable.
Any clue in order to get me on the right path?
Thanks.
Comment: *L'Hospital* would be better.
Comment: I don't know, I translate literally in english what I use in French :-)
Comment: I am French and I always learnt and used *L'Hospital*. Just our of curiosity, may I ask where you are located ?
Comment: A single application  of L'Hopital's Rule and some simplification gives you the answer.
Comment: I saw an autograph of the guy once.  He wrote *Lhospital*.  Of course the conventions of French spelling have changed in the past 250 years.
Comment: Sure, but a family name hardly changes over the years.
Answer: Hint:
Use
$$a-\dfrac a{a^2x^2+1}=\dfrac{a^3x^2}{a^2x^2+1}$$
Alternatively
Using Are all limits solvable without L'Hôpital Rule or Series Expansion
$$\lim_{x\to0}\dfrac{ax-\arctan(ax)}{(ax)^3}=\dfrac13$$
Comment: @BachirMessaouri, By your method $$\lim_{x\to}\dfrac{a^3x^3}{b^3x^3}=?$$
Comment: @BachirMessaouri, Using my link,
$$\dfrac{ax-\arctan(ax)}{bx-\arctan(bx)}=\dfrac{a^3}{b^3}\cdot\dfrac{\dfrac{ax-\arctan(ax)}{(ax)^3}}{\dfrac{bx-\arctan(bx)}{(bx)^3}}$$
Comment: @BachirMessaouri,  Do you know $$\lim_{h\to0}\dfrac hh=1?$$
Comment: @BachirMessaouri  $$a-\dfrac a{a^2x^2+1}=\dfrac{a(a^2x^2+1)-a}{a^2x^2+1}=?$$
Comment: Thanks. Doesn't your numerator still produce a zero when applying the limit?
PS: I don't see anything that resemble to my case in your link and I don't understand how the last line produces a 1 on the numerator. Any further help would be appreciated.
Comment: I spoke too soon. I still don't see it. How are you having a^3x^3/b^3x^3 from your line above (with a^3x^2)? I'm lost.
Comment: I see that you can simplify x^3/x^3 but how did you get there from a^3x^2/a^2x^2+1 (sorry, I really try)?
Comment: This one I got. it's the transition from "a^3x^2/a^2x^2+1"  to" ^3^3" that I don't (thank you for your patience)
Comment: @BachirMessaouri,  Take out $$\lim_{x\to0}\dfrac{b^2x^2+1}{a^2x^2+1}$$
Comment: I start to see where you are going and why you end up with a^3/b^3 by simplifying. What's beyond me is why you would take those two out (in your last comment) as what you are taking out is mixing b^2 and a^2. How in the world can you simplify "b^2x^2+1/a^2x^2+1....." and get 1/1?. Obviously it's there in front of my face and I don't see it.
Comment: Ok, this charade thing, piece by piece got me confused. Now I see it. You cancel out  the extra pieces AFTER applying the limit which leaves you with the a^3/b^3. I was understanding that you made the simplification before applying the limit which got me very confused. Thank you for your help.
Answer: $\lim_{x \to 0} \frac {ax - \arctan (ax)} {bx - \arctan (bx)}=\lim_{x \to 0} \frac {a-a/(1+a^{2}x^{2})} {b-b/(1+b^{2}x^{2})}$. Simplify this ratio.  The limit is $\frac {a^{3}} {b^{3}}$ since the ratio  simplifies to $\frac {a^{3}} {b^{3}} \frac {1+b^{2}x^{2}} {1+a^{2}x^{2}}$ after cancelling $x^{2}$.
Comment: Thank you very much. I hesitated to consider your answer as the one (because it is), but lab bhattacharjee made the effort to tell the same thing you did repeatedly. I just didn't get it right away. Thanks!
Comment: @BachirMessaouri My intention was only to point out that instead of directly putting $x=0$ after one application of L'Hopital's Rule you could have done some simplification to get the answer. My comment has nothing  to do with voting or approval. I think you were right in approving Lab Bhattacarjee's answer.
Answer: We have
$$
\lim_{x\to0} \dfrac{ax-\arctan(ax)}{bx-\arctan(bx)} = \lim_{x\to0}\frac{\sin\left(ax-\arctan(ax)\right)}{\sin\left(bx-\arctan(bx)\right)} = \lim_{x\to 0}\frac{\sin(a x)-a x \cos(ax)}{\sin(b x)-a x \cos(b x)}\frac{\sqrt{1+b^2x^2}}{\sqrt{1+a^2x^2}}
$$
now discarding $\frac{\sqrt{1+b^2x^2}}{\sqrt{1+a^2x^2}}$ we follow with
$$
\lim_{x\to 0}\frac{\sin(a x)-a x \cos(ax)}{\sin(b x)-a x \cos(b x)}
$$
Applying l'Hopital twice now, we obtain easily as result
$$
\frac{a^3}{b^3}
$$
Answer: You just keep on applying L'Hopital's rule. After three times you will get$$\lim_{x\to0}\frac{ax-\arctan(ax)}{bx-\arctan(bx)}=\frac{2a^3}{2b^3}=\left(\frac ab\right)^3.$$
Comment: @BachirMessaouri But you can.
Comment: It appears that single applcation of the Theorem is enough.
Comment: I didn't know we could use the derivative technique multiple times and still get a valuable answer.


How can I make Drupal use token for summary instead of breaking at ?

Question: I'm using "Long text with summary" fields for some different content types.
Right now the summaries are rendered until the first -tag (the web site already contains ~5000 nodes) but I would like to use a token created by a module that I'm currently using for the meta description of each page.
How can I use a token to display a nodes summary in a standard taxonomy node listing?
Answer: Assuming you're using Drupal 7, you can change how the content type is displayed in 'manage display'. You need to make sure you are using the correct view mode (probably teaser) which can be selected in the top left. You can then set the format to 'Summary or trimmed' and adjust the trim length by clicking the cog button.
Comment: Yes I'm using Drupal 7
Comment: Hi there, I've added some more information as I don't think I answered the question fully!
Comment: While this might work I would like to use a module I'm already using for the meta description tag that breaks near a character count but at a sentence break. The module creates a token, could that token be selected some way in the 'manage display' settings. I can't see it there now.
Comment: Hmm, if you're wanting to heavily customise the taxonomy listing pages I'd recommend replacing them with views. There's already a view built for this - it's listed at the bottom of the admin/structure/views page. I'm not sure of the details of the module you're using but I'd have thought that should allow you to output the data you need.


Roulette probability

Question: In a roulette game, a player bet only on the Red color (we are given that the probability of Red is 18/38). The player will stop playing after at least one winning or losing 11 rounds in a row. On the first game he bets \$1, in the 2nd game he bets \$2, and in the $i$th game he bets $2^{i-1}$. If he won, he will get the money that he bet on, else he lose the money he bet on.
(meaning that if he won/lost a game he can start a new round and bet from \$1 again)
 1. How much he will earn if he wins the $i$th game?
 2. What is the expected value of the number of rounds?
Comment: The house always wins.  See: http://www.amazon.com/The-Eudaemonic-Pie-Thomas-Bass/dp/0595142362/ref=sr_1_1?ie=UTF8&qid=1371772918&sr=8-1&keywords=eudemonic+pie
Comment: Which course is this homework for?
Answer: Hint:  try calculating the outcome of winning the first, second, third, fourth games.  The pattern should be clear, then prove it.  For the expected value, you need the chance he loses $11$ games in a row.  What is that?
Comment: i edited the question, i hope now it's more clear,
thanks ross!
Comment: @guestCS:  it was clear before.  Have you been able to make any progress given the hint?
Comment: with the first question yes, the 2nd no progress
Comment: If your probability for winning is $p$, the probability for losing is $q = 1-p$. Independent random events(such as your roulette example or throwing a dice), allow you to multiply the probabilities.$$$$
E.g. scoring 6 twice in a row with a dice has a probability of one out of six, times one out of six: $\frac{1}{6}*\frac{1}{6}=\frac{1}{36}$.
Comment: the chance he lost a bet is 20/38, if he loses 11 rounds in a row that's 11*(20/38) so the expected value is ~5.798?
Comment: @guestCS:  No, losing $11$ in a row is $(\frac {20}{38})^{11}\approx 0.00086$  You multiply the chances.  So you have $0.99914$ chance of winning $1$ and that chance of losing ?

Roulette probability


How can I see/use/log the exception when "customErrors mode="On""?

Question: I have this in my web.config:
<customErrors mode="On" defaultRedirect="~\Error" >
</customErrors>

And a simple ErrorController:
public class ErrorController : Controller
{
  public ViewResult Index()
  {
    return View("Error");
  }
}

What I want to do is to log the error to some file, before returning the Error view. However I cannot seem to find an example on how to access the thrown exception inside my controller. Any help appreciated.
Answer: I would suggest using something like an external library for this, for example Elmah. Elmah intercepts all exceptions and log them, so you should never have to register an exception by your self (If you don't want to log something very specific). Elmah can be configured to save to file, in memory, database etc.
Download the nuget-package.
To configure Elmah to use file instead of in memory:
<elmah>
  <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~\App_Data\" />
</elmah>

If you want to use the dashboard to see the error logs instead of looking directly in your logfile, you should reach it on yourdomain/elmah.axd
Don't forget to activate authentication for the dashboard, before deploying to production.
Comment: It will work on both `on` and `off`. Usually you want to log exceptions/error all the time. So the error logging is actually separated from how you present errors to the user.


Can you accurately check if a supposedly "circular" object is, in fact, circular only by measuring distances between points on its circumference?

Question: This question was inspired by this thread I just saw on Space Exploration Stack Exchange:
https://space.stackexchange.com/questions/39163/did-feynman-cite-a-fallacy-about-only-circles-having-the-same-width-in-all-direc
where an anecdote is mentioned regarding how that the famous physicist Richard Feynman realized that part of the fault for the 1986 Space Shuttle Challenger disaster lie in not realizing that "a circle is not the only figure which has the same width in all directions".
Basically, it seems, the inspectors had tried to verify that the fuel tank sections, which are tubes and need to have cross-sections which are almost exactly perfect circles at the points at which they join together, in order to ensure a good fitting-together thereof with no leaks, by naively measuring the diameter over and over in different places and seeing that all the diameter results seemed to agree, and hence concluded the tanks were "circular".
And the problem with this is that there are non-circular shapes which have the same "diameter" at all points - a famous example being the so-called Reuleaux triangle which, if used to form the cross-section of a drill bit and then such suitably mounted, can be used to quickly and usefully make squarish holes with rounded corners.
And this, to me, raises a question: is there any way to, using only the ability to measure between points on the object's circumference, and no other points, determine if that object is or is not circular?
In more formal mathematical terms, if we have a closed plane curve $C$, then what are the conditions on the distances
$$d(a, b)$$
between points $a, b \in C$, that are necessary and sufficient for circularity of the curve?
Comment: With two tape measures, we can exploit the [Power of a Point theorem](https://en.wikipedia.org/wiki/Power_of_a_point). Fix $A$, $B$, $C$ on the curve, and let $D$ be a variable test point, say, on the $\stackrel{\frown}{AB}$ not containing $C$. Stretch tape measures from $A$ to $B$ and from $C$ to $D$; let them meet at $P$. Provided $P$ lies in the curve's interior (if it doesn't, then you have don't even have convexity), then $D$ lies on the circumcircle of $\triangle ABC$ if and only if $|AP||BP|=|CP||DP|$. Test other arcs similarly. (Note: This doesn't require finding a center or diameter.)
Comment: @SquishyRhode : A diameter can be defined more generally as a segment between two points on the periphery whose length is maximal. Thus, you can identify it by fixing one end of the tape measure and then varying the other end until you find the maximum. There is no need to know the center.
Comment: Constant diameter (width) is how we typically define roundness, btw. Circularity requires constant radius.  Why do you bring up the Reuleaux triangle; why is it even a thought? I ask because it seem as though you allow yourself to use the ruler to make measurements of the diameter.  You recognize that constant diameter doesnt equate to circle, and thats why you bring up those special shapes.  If you are allowed to use the ruler to measure out diameters, why then can you not measure out radii, thus answering your own question?
Comment: @SquishyRhode : As said, because to do so, you need the _center point_. If all you have on hand is a ruler and pen (which is the rules I'm imagining), how are you going to find and then track that accurately?
Comment: You recognize that you need a center identified to measure out radii. This is true. But you need that anyway if you measure out diameters, do you not?  I seem to be confused by what you are and are not allowed to use/know because you dont seem to be consistent on that.
Comment: Ah. yes, I understand what youre saying. This allows for objects with a certain "asymmetry" (loosely used).  If you sample more than one of these "diameters" and fail to find a single point of convergence between all such diameters, then you know your shape is not "symmetric". Thats what you do. Measure out a large sample of these "largest diameters". Firstly, if any one of them is different from the others then its not a circle.  Secondly, if any pair of diameters intersect at a different point from the rest, it isnt a circle. Thirdly, the rest is a statistical confidence game.
Comment: Since a circle is the only figure in a plane with constant (nonzero) curvature, we should be able to measure the curvature at each point along the tube and check that it's (within tolerance of) constant. This comes down to approximating second derivatives in the x and y directions, which you can do with a tape measure (and too much free time)
Comment: Since you have a tape measure rather than a ruler it might be long enough to locate two diameters simultaneously. Then you could read off the distance from their intersection - i.e. the centre of the circle - and verify constant radius (you might however need four hands for this).
Comment: @Tom Collinge : Finding the center isn't necessarily the problem. The problem is how you mark that, to high accuracy, with only a tape measure and a big gaping void around where that center is located.
Comment: If you can find two diameters simultaneously you can measure the distance from their intersection to the edge without needing to mark the point.
Comment: @Tom Collinge : You may need to measure more than two diameters, though. I should specify that only a single tape measure is allowed.
Comment: A long enough tape measure can bend and find two diameters at once giving the "radius" to four points: then repeat.
Comment: @Tom Collinge : Perhaps, if the "tape measure" is also suitably flexible, i.e. like the cloth ones and not the metal ones. But I've also edited the question to hopefully clarify what I am after.
Answer: A closed curve is a circle with points $a,b$ as diameter if and only if all points $c$ on the curve satisfy $d(a,c)^2+d(c,b)^2=d(a,b)^2$.
Comment: I.e. a diameter subtends a right angle at the circumference.


How to go from $\frac{\|g_{k+1}\|}{\|g_{k}\|^2} \leq c$ to $\frac{\|x_{k+1} - x_*\|}{\|x_{k} - x_*\|^2} \leq c$ as $k\to \infty$

Question: I am reading a paper where
$$\frac{\|g_{k+1}\|}{\|g_{k}\|^2} \leq c \tag{1}$$ as $k\to \infty$ where $g_k = g(x_k) \stackrel{\Delta}{=} \nabla f(x_k)$ and $\| \nabla^2 f(x_k)\| \leq L_H$. Then, it is stated that from Taylor expansion of $g_k$ and $g_{k+1}$ around $x_*$ and from $g(x_*)=0$ we get
$$\frac{\|x_{k+1} - x_*\|}{\|x_{k} - x_*\|^2} \leq c \tag{2}$$ as $k\to \infty$. I know that the Taylor expansion is
$$g_{k+1} = \nabla f (x_k + p_k) = \nabla f (x_k) + \int_{0}^{1} \nabla^2 f (x_k + t p_k) p_k dt$$ with $p_k = x_{k+1} - x_k$ but I found it confusing to apply it in $x_*$ instead of $x_k$. The most possibly useful relation I have found is
$$\nabla f_k -\nabla f_* = \int_{0}^{1} \nabla^2 f (x_k + t(x_* -x_k))(x_k - x_*)dt \tag{3}$$ in the proof of Theorem 3.5 in [1] but again I could not understand how it is derived from Taylor's theorem in Theorem 2.1 in [1]. Taking the norm of $(3)$ we get
$$\begin{aligned}\| \nabla f_k\| \leq & \underbrace{\|\nabla f_k \|}_{0}+ \|\int_{0}^{1} \nabla^2 f (x_k + t(x_* -x_k))(x_k - x_*)dt \| \\ \leq & \underbrace{\|\nabla f_k \|}_{0}+ \int_{0}^{1} \|\nabla^2 f (x_k + t(x_* -x_k))(x_k - x_*)\|dt \leq L_H \|x_k - x_* \|\end{aligned}\tag{4}$$ where $\|\nabla^2 f(x) \| \leq L_H$ is used. Similarly for step $k+1$ we get
$$\| \nabla f_{k+1}\| \leq \|x_{k+1} - x_* \|$$ which get as close to $(2)$. Could you please someone help to proceed?
[1]Jorge Nocedal, Numerical Optimization
Comment: @Math_Buddy Thanks for the  response. You can see the end of the proof of Theorem 13 [here](https://arxiv.org/pdf/1705.05933v3.pdf) and more specifically, eq. (82).
Comment: The same fact can be found in the end of the proof of Corollary 4.8 [here](https://people.maths.ox.ac.uk/cartis/papers/ARCpI.pdf).
Comment: Can someone explain why $$\nabla f_k -\nabla f_* = \int_{0}^{1} \nabla^2 f (x_k + t(x_* -x_k))(x_k - x_*)dt$$ using $$g_{k+1} = \nabla f (x_k + p_k) = \nabla f (x_k) + \int_{0}^{1} \nabla^2 f (x_k + t p_k) p_k dt$$? You can found this equation in Theorem 3.5 book Jorge Nocedal, Numerical Optimization.
Comment: your first line is just $n$ dimensional version of:
$$f'(a) - f('b) = \int_0^1 f''(a + t(b-a))(b-a)dt$$
Comment: Can You give The link of the paper!!!
Comment: Okay!!! Thank You!!!❤
Comment: You have some type of iteration $x_{k+1} = h(x_k)$ right? The standard way is to then use:
$$0 = g(x^*) = g(x_k) + \nabla g(x_k)\cdot(x^*-x_k) + \nabla^2 g(\epsilon)(x^*-x_k)^2/2$$
and then use the iterative formula for $x_{k+1}$ to express $x_{k+1}-x^*$ in terms of $x_k-x^*.$
Comment: @dezdichado Thanks for the response. In this case I do not think that $x_{k+1} = h(x_k)$ is explicitly given. I think it is more appropriate manipulation of Taylor along with $\nabla f(x_*)=0$. I would really appreciated If you can take a look in the links .
Comment: In general, having gradients converging to zero is not enough to ensure that the iterates will converge to anything in particular. As a simple example, consider the sequence $x_k = k$ and $f(x) = e^{-x^2}$. Then, $g = f'$ is 2-Lipschitz (easy to heck) and $g_k = -2x_ke^{-x_k^2} = -2ke^{-k^2}$ is converging to 0, yet $x_k$ does nto converge at all. If you exclude examples like this one by assuming that there is a unique stationary point and that the function is coercive, I still find it dubious that quadratic convergence of $g(x_k)$ would imply quadratic convergence of $x_k$.
Comment: To add to my previous comment: I believe you would need some form of error bound. Take a look at this paper: https://arxiv.org/pdf/1606.00269.pdf. It's focused on linear convergence, not quadratic, but it gets my point across, hopefully.
Answer: REVISED
From Theorem 2.1 in your citation $[1]$ we have: for $p_k=h_k=x_{k}-x_{*}$ and $x_k$ is a sequence of points in $\textbf{R}^N$ such that $\lim_{k\rightarrow \infty}x_k=x_{*}$ , $\nabla f(x_{*})=0$, $\nabla^2 f(x_{*})\neq 0$. Hence for all $x$ in an open ball $B$ with center $x_{*}$ we have  $||\nabla^2f(x)||>0$.
$$
\nabla f(x_k)=\nabla f(x_{*}+h_k)=\nabla f (x_*)+\int^{1}_{0}\nabla^2 f(x_{*}+th_k)h_kdt\Rightarrow
$$
$$
\nabla f(x_k)=\int^{1}_{0}\nabla^2 f(x_{*}+th_k)h_kdt.\tag 1
$$
Since $L_H\geq ||\nabla^2f(x)||\geq L'>0$ : $(2)$ in $B$, we get
$$
||g_k||=||\int^{1}_{0}\nabla^2 f(x_{*}+th_k)h_kdt||\leq \int^{1}_{0}||\nabla^2f(x_*+th_k)||\cdot ||h_k||dt=
$$
$$
\leq L_H\int^{1}_{0}dt(||h_k||)=L_H ||h_k||.
$$
Also it holds from the definition of norm of matrices $A,B$, where $A\in M_{n\times n}$ and $B\in M_{n\times 1}$ that $||A\cdot B||\leq ||A||\cdot ||B||$ hence we can define $\Gamma(A,B)$ to be such that $\Gamma(A,B)=\frac{A\cdot B}{||A||\cdot ||B||}$. (Note that $\Gamma(A,B)$ is a vector and if $A\in M_{n\times n}$, $B\in M_{n\times 1}$, then $\Gamma=\Gamma(A,B)\in M_{n\times 1}$ and $0\leq ||\Gamma(A,B)||\leq 1$ see also Matrix Norm provited that $B$ is small enough and positive). One can see that one such norm is
$$
||A||_2:=\left(\sum^{n}_{i,j=1}|a_{i,j}|^2\right)^{1/2}\textrm{, }A\in M_{n\times n}
$$
and
$$
||B||_2:=\left(\sum^{n}_{i=1}|b_i|^2\right)^{1/2}\textrm{, }B\in M_{n\times 1}.\tag 2
$$
Hence there holds if $A,C\in M_{n\times n}$ and $B\in M_{n\times 1}$
$$
i)\textrm{  }||A||_2\geq 0\textrm{ and }||A||_2=0\Leftrightarrow A=0
$$
$$
ii)\textrm{  }||cA_2||_2=|c|\times ||A||_2
$$
$$
iii)\textrm{  }||A+C||_2\leq ||A||_2+||C||_2
$$
$$
iv)\textrm{  }||A\cdot C||_2\leq ||A||_2\cdot ||C||_2
$$
$$
v)\textrm{  }||A\cdot B||_2\leq ||A||_2||B||_2.
$$
Also if $A=(a_{i,j})_{n\times n}$ and $0<||A||_2\leq 1$, then exists $i_0,j_0$ such that $a_{i_0,j_0}\neq 0$ and for all $i,j\Rightarrow |a_{i,j}|\leq 1$ and if $B=(b_{i,j})_{n\times 1}$ and $0<||B||_2\leq 1$, then exists $i_0$ such that $b_{i_01}$ and for all $i$, $0<|b_{i,1}|\leq 1$. In our case it is
$$
A=\nabla^2f(x_{*}+th_k)\in M_{n\times n}\textrm{ and  }\Gamma_k(t),g_k,h_k\in M_{n\times 1}.
$$
Also
$$
\Gamma_k(t)=\frac{\nabla^2f(x_{*}+th_k)\cdot h_k}{||\nabla^2f(x_{*}+th_k)||_2\cdot ||h_k||_2}.
$$
Hence
$$
g_k=\int^{1}_{0}\nabla^2f(x_{*}+th_{k})\cdot h_kdt=\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\cdot ||h_k||_2\Gamma_k(t)dt=
$$
$$
=||h_k||_2\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\Gamma_k(t)dt.
$$
Here $\Gamma_k(t)=\sum^{n}_{j=1}\Gamma^{(j)}_{k}(t)\left(\overline{e}_{j}\right)^T$, where $\overline{e}_1=\{1,0,0,\ldots,0\}$, $\overline{e}_{2}=\{0,1,0,\ldots,0\}$,$\ldots$, $\overline{e}_{N}=\{0,0,0,\ldots,1\}$ is the usual base of $\textbf{R}^{n}$ and $\Gamma^{(j)}_{k}(t)$ are continuous functions of a single variable in $\textbf{R}$ such that $0\leq ||\Gamma_k(t)||_2\leq 1\Rightarrow 0\leq |\Gamma^{(j)}_k(t)|\leq 1$, (since we can choose such norm). Hence in our case it is
$$
g_k=||h_k||_2\cdot \int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\left(\sum^{n}_{j=1}\Gamma^{(j)}_{k}(t)(\overline{e}_j)^T\right)dt=
$$
$$
=||h_k||_2\cdot \sum^{n}_{j=1}\left(\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_{k}(t)dt\right)(\overline{e}_j)^T.
$$
Hence
$$
||g_k||_2=||h_k||_2\cdot ||\sum^{n}_{j=1}\left(\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_{k}(t)dt\right)(\overline{e}_j)^T||_2.
$$
But
$$
0<||\sum^{n}_{j=1}\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_k(t)dt(\overline{e}_j)^T||_2=
$$
$$
=\left(\sum^{n}_{j=1}\left|\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt\right|^2\right)^{1/2}\leq C.
$$
Otherwise for all $j$ it would hold
$$
\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt=0\Rightarrow ||g_k||_2=0\Rightarrow g_k=0,
$$
for a certain $k=k_0\in\textbf{N}$ hence we have two points $x_{k_0},x_{*}\in B$, such that $\nabla f(x_{*})=\nabla f(x_{k_0})=0\Rightarrow \exists \xi\in B: \nabla^2f(\xi)=0$, which is imposible (see Mean value theorem). If we have two distinct points $P_1,P_2$ near each other with zero gradient, then exists point $P_0$ near $P_1,P_2$ such that Hessian is zero at $P_0$.
Thus from not vanish of
$$
||\sum^{n}_{j=1}\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt(\overline{e}_j)^T||_2=
$$
$$
=\left(\sum^{n}_{j=1}\left|\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt\right|^2\right)^{1/2}
$$
we have that exists at least one $j=j_0$ such that
$$
0<m^{(j_0)}_k\leq \left|\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j_0)}_{k}(t)dt\right|.
$$
Hence from the continuity of all $\Gamma^{(j)}_{k}(t)$, we can write for some costants $m,M$ such that $0<m<M<\infty$ that
$$
0<m ||h_k||_2\leq ||g_k||_2\leq ||h_k||_2 M.
$$
Hence
$$
\frac{m ||h_{k+1}||_2}{M^2 ||h_k||_2^2}\leq\frac{||g_{k+1}||_2}{||g_k||_2^2}\leq \frac{M||h_{k+1}||_2}{m^2||h_k||_2^2}
$$
Hence we have using $||g_{k+1}||_2\leq c ||g_k||_2^2$ that
$$
||h_{k+1}||_2\leq c \frac{M^2}{m}||h_k||_2^2=c' ||h_k||_2^2\textrm{, when }k>>1.
$$
Note

In this way $||.||_2$ it is a traditional norm plus the condition $||A\cdot x^{T}||\leq ||A||_2\cdot ||x^{T}||_2$. For $A$ given and $x^T$ small enough (where $x=\{x^{(1)},x^{(2)},\ldots,x^{(n)}\}$).

We have
$$
S=||\sum^{n}_{j=1}\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt(\overline{e}_j)^T||_2=
$$
$$
=||\sum^{n}_{j=1}\left(\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt\right)(\overline{e}_j)^T||_2=
$$
$$
||\left(
\begin{array}{cc}
\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(1)}_k(t)dt\\
\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(2)}_k(t)dt\\
\ldots
\\
\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(n)}_k(t)dt
\end{array}
\right)||_2
$$
Hence from relation $(2)$, we get
$$
S=\left(\sum^{n}_{j=1}\left|\int^{1}_{0}||\nabla^2f(x_{*}+h_kt)||_2\Gamma^{(j)}_{k}dt\right|^2\right)^{1/2}
$$
Comment: @Thoth. I have added a note (see Note-(2)) in my proof. If you want to ask something else please feel free to ask.
Comment: Thanks for the response. In (1) $h_k$ shouldn't have transpose? In addition, (2) how is formed? If you apply norm in (1) shouldn't have an inequality?
Comment: Thanks for the response! When $\cos(\theta)=\frac{A\cdot B}{||A||\cdot ||B||}$ is applied, $A$ is $\nabla^2f (x_* + t h_k)$ which is a matrix and $B$ is $h_k$ which is not a matrix. $B$ shouldn't be a matrix too?  In other words, can we apply $\cos(\theta)=\frac{A\cdot B}{||A||\cdot ||B||}$ in this case?
Comment: @Thoth. $B=h_k$ is also a matrix $n\times 1$ i.e. $h_k=\left(x^{(1)}_{k}-x^{(1)}_{*},x^{(2)}_{k}-x^{(2)}_{*},\ldots,x^{(N)}_k-x^{(N)}_{*}\right)^{T}$.
Comment: Thanks for he response. I found it strange because in this case  $\cos(\theta)=\frac{A\cdot B}{||A||\cdot ||B||}$ involves both spectral norm and $\ell_2$ norm for vectors but the definition is only about the norm between matices. This way $cos (\theta_k) = \Gamma$ is not $n \times n $ matrix but a $n \times 1$ vector. Am I suspicious without reason? Could you please explain a little?
Comment: @Thoth. However for to use the second mean value theorem for integrals needs $||\nabla^2 f(x_{*}+th_{k})||$ to be descreasing. This thing need to be established somehow.
Comment: @Thoth. Clearly it holds for some $n\times 1$ matrix $\Gamma=\Gamma_{k}(t)$ the relation: $\nabla^2f(x_{*}+t h_{k}) h_{k}=||\nabla^2f(x_{*}+th_k)||\cdot ||h_k||\cdot \Gamma_{k}(t)$. Hence $0<||\Gamma_k(t)||\leq 1$. You can replace everywhere you have $\cos(\theta_k(t))$ the matrix $\Gamma_k(t)$. The elements of $\Gamma$ are bounded by -1 and 1, also are continuous $\ldots$ etc.
Comment: Thanks for the response. Can you give me a reference for the mean value theorem where the definition requires $||\nabla^2 f(x_{*}+th_{k})||$ to be decreasing? Mean value theorem is needed in your calculations to bound $\|g_k\|$?

Alternatively, if we  use $\| \nabla^2 f(x) \| \leq L_H$, can we bound $\|\nabla^2 f(x +th)\|$  by $L_H$ at the beginning of the calculations and write

$$ \| \int_{0}^{1} \nabla^2 f(x + th)  h  dt \|  \leq  \int_{0}^{1} \|\nabla^2 f(x + th)  h\|  dt   \leq  \int_{0}^{1} \|\nabla^2 f(x + th) \| \| h\|  dt  \leq L_H \| h\|$$
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/137371/discussion-between-nikos-bagis-and-thoth).
Comment: @Thoth. Please see the new proof and tell me your opinion.
Comment: Thanks for the edit. I have written some technical questions  in the chat room. Can you please address them in your answer?
Comment: Given $$0<||\sum^{n}_{j=1}\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_k(t)dt(\overline{e}_j)^T||_2\leq C$$ how do we know that $$\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_k(t)dt > 0$$ in order to set them all to zero in $$\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt=0$$ and conclude in contradiction? Could you please provide some details on this?
Comment: Thanks again for the entire effort and your time so far! I have two more things that I do not fully understand. First shouldn't we have inequality instead of equality in
$$0<||\sum^{n}_{j=1}\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_k(t)dt(\overline{e}_j)^T||_2=\left(\sum^{n}_{j=1}\left|\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt\right|^2\right)^{1/2}$$ Secondly, based on the continuity of $\Gamma^{(j)}_{k}(t)$ you write

$$0<m ||h_k||_2\leq ||g_k||_2\leq ||h_k||_2 M.$$ Why is that? Could you please elaborate a little more?
Comment: The first question is answered by the fact that $||(.)||_2$ is the 2-norm of $n\times 1$ matrix. The second question is answered by the fact that when $k$ is finite $g_k$ is never zero, otherwise it will exists a finite $k_0$ such that $g_{k_0}=0$. Hence $\nabla f(x_{k_0})=\nabla f(x_{*})=0$. Hence for some $\xi$ there will be $\nabla^2 f(\xi)=0$, which is imposible. Hence exists $m$ constant such that $0<m ||h_{k}||_2<||g_k||_2$.
Comment: Thanks for the response. For the first question-answer I know [that](https://math.stackexchange.com/questions/2427430/sum-of-norms-vs-norm-of-sums-proof) $\left|\left|\sum_{i=1}^nx_i\right|\right|\leq \sum_{i=1}^n \left|\left|x_i\right|\right|$ which does not fit with $$||\sum^{n}_{j=1}\int^{1}_{0}||\nabla^2 f(x_{*}+th_k)||_2\cdot \Gamma^{(j)}_k(t)dt(\overline{e}_j)^T||_2=\left(\sum^{n}_{j=1}\left|\int^{1}_{0}||\nabla^2f(x_{*}+th_k)||_2\Gamma^{(j)}_k(t)dt\right|^2\right)^{1/2}$$ Could you please help on this part? What do I miss?
Comment: Bagis thank you very much now it is clear. I have another one question. In the beginning of your answer you stated that $\|\nabla^2 f(x_{*}) \|\neq 0$ in order to proceed. Does this proof applies only for strictly convex problems? Could you please explain what will happen in the proof if $\|\nabla^2 f(x_{*})\| = 0$?
Answer: For simplicity in notation assume $x_*=0$ from now on. It looks as if you work in Euclidean space $V={\Bbb R}^n$ (but the result in fact holds in any Banach space). $|\cdot|$ denotes norm in $V$ and $\|\cdot\|$ is the induced  operator (or matrix) norm in $L(V)$.
In order for this to work you  need that
the Jacobian $J=Dg(0)=D^2f(0)$ be invertible, i.e. there exists $0<\alpha\leq \beta<+\infty$ so that
$$ \alpha |x| \leq |J x| \leq \beta |x|, \ \ \forall\ x\in V.$$
$f$ should also be $C^2$ so that for any $\epsilon>0$ there is $\delta(\epsilon)>0$ so that $\|Dg(x)-J\| < \epsilon$ for $|x|<\delta(\epsilon)$.We have
$$ g(x) = g(x)-g(0) = \int_0^1 \left( \frac{d}{dt} g(tx)\right) dt =
\left(\int_0^1 Dg(tx) \; dt \right)x. $$ Taking $\epsilon=\alpha/2$ we get  for $|x|<\delta(\alpha/2)$
$$ |g(x)-Jx| = \left| \int_0^1 \left( Dg(tx)-Dg(0)\right) dt \ x \right|
 \leq \left\|  \int_0^1 \left( Dg(tx)-Dg(0)\right) dt \right\|\ |x| \leq \alpha/2 |x|,$$
so we get for such $x$:
$$ \alpha/2 \; |x| \leq |g(x)| \leq (\beta+\alpha/2) \; |x| .$$
From this the equivalence of (1) and (2) follows (with distinct constants $c$) when the points are close enough to $x_*$ ($=0$).
For example, if $|x_k|,|x_{k+1}|<\delta$ and
$|g(x_{k+1})|/|g(x_k)|^2 \leq c$ then
$|x_{k+1}| / |x_k|^2 \leq c \times \frac{2}{\alpha} \times (\beta+\alpha/2)^2$.
Comment: $J$ need not be postive definite. But it must be invertible, so no zero eigenvalues. Otherwise, for $|x|>0$, the value of $|g(x)|$ may be arbitrarily close to zero.  Not sure what you need for understanding the integrals. The first expresses that $g$ is the integral of its derivative (which I then calculate). The second uses the trivial identity:  $Jx=Dg(0)x = \int_0^1 Dg(0) x \; dt$. I have added one direction (1) implies (2) just using the previous upper/lower bound on $|g(x)|/|x|$.
Comment: For the $\delta=\delta(\epsilon)$ part you could just as well say: For any $\epsilon$ there is $\delta$ such that... In the present context you could say given $\epsilon=\alpha/2$ (which is what we need in the end because we want to get a non-zero lower bound for $g(x)$) there is $\delta>0$ such that ... etc....
If $v\neq 0$ is in the kernel of $J$ then for $x=v$ you have no control of what happens to $g(v)$. It could e.g. simply equal zero if $g(x)=Jx$.
Comment: Thanks for the response! I am trying to get into your point. You assume that $J$ is positive definite. Can we relax this by assuming positive semi-definiteness? From the technical point of view I do not understand the calculations with the integrals involving $g$. Could you please provide some more details? In addition, the upper bound of $| g(x) - Jx|$ is $\epsilon a / 2$  more correctly? Finally, could you please provide some more details on how  $(1) \equiv (2)$ is implied when using the last inequality?
Comment: Thanks for the comment and the edit! I have two questions. Why $| g(x)|$ goes to zero if $J$ has zero eigenvalue?  In addition, I have some questions about $|x|<\delta(\epsilon)$? Why we need that? In addition, I am not used to bounds like $\delta(\epsilon)$. I mean using $\delta$ as a function of $\epsilon$. In the same scope, why do we use $\epsilon = a/2$? Could you please provide some details?
Comment: Thanks for the response again. I am trying to understand the example. So if there is a zero eigenvalue, then there might $a=0$ witch makes $| g(x) - Jx| \leq a |x| = 0$ which implies $g(x)=Jx$? In addition, a last question I hope. We define $| g(x) - Jx| $ to reach arithmetically the finally result but is there any intuition to compare $g(x)$, i.e., the gradient, with $Jx$, i.e., a Hessian-vector product? In other words, I am trying to understand the rationale as I didn't do it my self. Any help is highly appreciated.
Comment: Not quite sure that I understand your questions and e.g. the meaning of 'to reach arithmetically the final result'? The last phrase in my previous comment was about what happens for a quadratic $f$ (i.e. linear $g(x)=Jx$) and non-invertible $J$.
In any case if this is about some Newton iteration for getting to a critical point, then in any case you need $D^2 f$ to be nicely invertible at $x^*$ (so it is a non-degenerate critical point). If there is a zero eigenvalue then all the analysis goes havoc.


Center only one element inside of a div with tailwind

Question: I'm struggling with TailwindCSS and I'm a bit lost. I'm trying to create a nav with some elements inside, but I want one of the elements to be centered in the middle of the nav, ignoring the other elements inside. I tried this:

Here goes content more larger

 than ocuppies a bit mmore

Content that I want in the center on the nav

Other content

This is the center

With justify-between the space is almost what I want (elements 1 and 2 at start and end), but it puts the same space between elements, and de div with id 2 is not centered regarding the nav
Is it possible to maintain the divs 1 and 2 at the end of the nav but centering the div with id 2 ignoring the other elements?
Any help would be appreciated. Thanks in advance
EDIT
I tried another approach that would be the key, but I don't know if it's the right path. I change flex by grid, doing this

Here goes content more larger

 than ocuppies a bit mmore

Content that I want in the center on the nav

Other content

This is the center

Here goes content more larger

 than ocuppies a bit mmore

Content that I want in the center on the nav

Other content

And this is the result:
Comment: You will probably need fixed width for your elements. With dynamic content, I'm afraid it's very hard to achieve the layout you want
Answer: I assume that you simply want the central component somewhat left as shown in the image below.
so I had added a left margin according to the screen size

Here goes content more larger

 than ocuppies a bit mmore

Content that I want in the center on the nav

Other content

This is the center

Please find the code here


Confusion regarding Confidence Intervals

Question: Suppose we have $2$ independent population parameters $p_1$ and $p_2$, such that the $90$% ( symmetric ) confidence intervals for $p_1$ and $p_2$ are given by $ (0.411, 0.498) $ and $(0.473, 0.567)$ respectively. Now, according to the original question ( copied verbatim ) , supposing that the $90 $% interval for $p_1$ lies entirely below the interval for $p_2$, how confident are we to conclude that $p_1 < p_2$?
Now, assuming that I have understood the problem correctly, I feel that this question does not make sense to me because $(0.411, 0.498)$ does not lie completely behind $(0.473,0.567)$. The question is, am I right in claiming so?
Next, assuming the problem is simply "How confident are we to conclude that $p_1 < p_2 $ ", given their $2$ $90$% symmetric confidence intervals as above, how would we go about approaching it, if it is even possible?
Answer: When we say that an interval has confidence 95% we mean that in repeated sampling we would find that intervals constructed in the same way would cover the true value of the parameter about 95% of the times: the confidence is the probability
of coverage in repeated experimentation.
Now, I do not think you can talk about "How confident are we to conclude that $p_1<p_2$" when no confidence interval is involved: $p_1 < p_2$ that will be either true or false. Perhaps from a Bayesian point of view you could talk about the posterior probability that $p_1 < p_2$ given that something happens, but that is an entirely different sort of statement than what goes under the name of confidence.
Comment: Yes, so what? My answer was that you cannot properly talk of "the confidence that $p_1 < p_2$".
Comment: ok, I understand your point now. Thank you!


How to read accidentals in medieval music "modern" notation?

Question: I am writing an instrumental orchestration of De Machaut's Messe de Nostre Dame, Kyrie. I found scores in IMSLP here and here.
These scores show accidentals above notes, sometimes in parenthesis. I am not sure how to treat those. Listening to performances, it seems that some are used and some are not, notably, the ones in parenthesis aren't while the ones without sound like "regular" accidentals before the note.
I believe that the harmony is hexachordal, however, any analysis I try to make in order to explain which accidentals should appear where fails at some point (can provide details if needed).
What are the rules for the accidental placements and their performance?
Also, in the first link, the score has "bridges" over groups of notes which I understood to be modernized ligatures. How should those be treated? (I can ask a separate question on this if requested.)
Edit: apparently Wikipedia has the answer.
Comment: "Listening to performances, it seems that some are used and some are not" - there are differences of opinion between scholars, and also performers who take the exact contents the original manuscript copy as the equivalent of holy writ, which it never was. Also, tastes have changed over time. If you compare a modern-notation edition made in the 19th century with a recent one, you will probably find the 19th-century version was converted into something closer to major and minor scales and common practice harmony than what current scholarship would consider to be "informed performance practice".
Comment: The brackets are transcribing ligatures in the original notation. For your orchestration, you can safely ignore them. For the accidentals, though, it would be best to get the most recent edition you can find from a library and then trust the editor and use the "editorial accidentals" above the staff. If it is a good edition, then the editor is a musicologist who knows more about medieval musica ficta than can be found on Wikipedia.
Answer: That is a modern transcription of musica ficta.
Musica ficta entry at Wikipedia
Musica ficta entry at Brittanica.com
The original music did not usually contain accidentals within the music.  Musicians were expected to fill them in as needed.  Most of the in-music accidentals (except possibly for B and B flat) are likely editorial additions.  The ones without parentheses are those that the publisher considers mandatory (or that did, after all, have some indication in the source), the others are merely possible but do not reflect the publisher's opinion.
The modern listener tends to find versions with most of the accidental suggestions more natural but that's partly due to modern ears being more accustomed to major/minor tonality than modal tonality.
Answer: They all mean the same thing and tell you to play the note notated no matter the case, but why they are there is different for each.

When it is to the left of note as normal, it is just a typical accidental that the composer wrote in.
When it is to the left of note as normal, but is also in a parenthesis, then it is a courtesy accidental. This kind of accidental is to remind you this accidental is applied to the note, but is not needed and is more for reminder purposes.
When it is above the note, it is an editor's suggestion. It was not in the original score, but it may make more sense than what the original score contained. You can play either what's written with, or without, the accidental above the note.
Comment: In practice, if I choose to apply one of the optional accidentals, do I need to apply others too?
Comment: @user1803551 You would typically want to with playing them or ignoring them. If you mix them then you may not get the desired affect you want which is either a very true to the original piece or a more modern sound.
Comment: This answer completely misses the point that early music had "ficta" where the performer was supposed to infer the accidentals. In modern editions the editor will often supply them, since performers don't usually have that skill themselves.


How to print barcode labels on standard printer?

Question: I am using barcode creation module to create barcode labels on standard printer.while giving print option it is not showing any barcode labels on print preview.
How can i able to see my labels?
It shows this error.

The directory /var/www/html/transgenic/sites/default/files/barcodes is not writable or not exist or something else wrong. You can not print barcodes without correct settings.
An error occurred while generating the barcode.
The directory /var/www/html/transgenic/sites/default/files/barcodes is not writable or not exist or something else wrong. You can not print barcodes without correct settings.
Answer: You have to set the permissions right. try 'chmod 755 -R /var/www/html/transgenic/sites/default/files/barcodes' Do this with the same account as the webserver uses.


getting delayed value using javascript Date.now()

Question: output of this code is always getting delayed by 25-30 milliseconds. Why?
i tried same using Webworker, even then output was delayed.
How to fix this issue?
I want almost perfect output for the following code.

var j = 0;
var start = Date.now();
setInterval(function() {
  j++;
  if (j % 10 == 0) {
    var end = Date.now();
    console.log(end - start);
  }

}, 50);
Comment: What's your final use-case? (I suspect `console.log` isn't it...)
Answer: Javascript intervals does not guarantee that the function is called at the exact time, just that it is called "sometime after" the amount of time specified.
This link explains a bit about window.performance timing which you might be able to use, depending on what browsers you need to support. You can look at the answers in this question for some code examples.


Definition of a simple function in fine structure theory

Question: I have a few questions on the definition of a simple function and I hope someone can help me with them.
First let me give some context. Let $E$ be a set or a proper class. We say a function or relation is $\text{rud}_E,$ if it is rudimentary in $E$. And for any transitive set $U$, $\text{rud}_E(U)$ denotes the closure of $U$ under $\text{rud}_E$ functions. We say $U$ is $\text{rud}_E$ closed iff $\text{rud}_E(U) \subseteq U$. Also the structures we deal with here are of the form $\langle M, \in, E\cap M\rangle$.
This is the definition:

Call a function $f:V^k \rightarrow V$, where $k \lt \omega$, simple iff the following holds true: if $\varphi(v_0, v_1, \dots, v_k)$ is $\Sigma_0$ in the $\mathcal{L}_{\in,E}$, then $\varphi(f(v_1', \dots, v_k'), v_1, \dots, v_k)$ is equivalent over transitive $\text{rud}_E$ closed structures to a $\Sigma_0$ formula in the same language.

So here are my questions:

Since we say simple with no mention of $E$(like simple$_E$ for example), does it mean that we quantify over all $E$, in the definition? Or we don't mention it, because we have already fixed $E$?
The equivalent formula that we get in the definition, is it uniform? Meaning that: Do we expect to have one formula that is equivalent over all structures mentioned above to the original formula? Or do we get one equivalent formula for each structure?(The latter seems extreme to me, as it would require lots of coding of syntax and such.)
And lastly, it seems to me that the restriction to $\text{rud}_E$ closed structures is redundant. Since if this holds for all transitive structures, then it certainly does for $\text{rud}_E$ closed structures. And if it holds for all $\text{rud}_E$ closed structures, given an arbitrary structure $\langle M, \in, E\cap M\rangle$, we can look at $\langle \text{rud}_E(M), \in, E\cap \text{rud}_E(M)\rangle$ and then by absoluteness we can come back down, because the formula in question is $\Sigma_0$. So is the restriction to $\text{rud}_E$ closed structures necessary?

EDIT I:
The definition here can be found in Ralf Schindler's book "Set Theory: Exploring Independence and Truth", the edition for Feb. $28$ $2014$, Page $70$, in the middle of the proof of lemma $5.11$.

EDIT II:
I also would really appreciate if someone could put the definition above in terms of symbols and mathematical language, since I think that could resolve both my first two questions and some other minor questions that I have.
Comment: What text is this from?
Comment: @NoahSchweber, it is from Ralf Schindler's book. I have added a more precise reference in the edit.
Comment: For the second, I *believe* the definition is uniform for $E$, as many theorems and concepts  (like the canonical global well-ordering over $J_\alpha$) on Jensen's article on Fine structure theory appears uniform.
Comment: For the first, I think both interpretations are equally correct, and they are the same. Schindler defined $E$-simple function for *all* $E$ uniformly. By not mentioning any conditions for $E$, we can indirectly quantify $E$, and it could turn into an explicit qualification by using the universal introduction over the metatheory.
Comment: @HanulJeon, thanks! Can you please expand a bit more on your second comment? I don't seem to understand it correctly. What I mean by my first question is that do we either mean that (1) once given a formula we find an equivalnet formula over transitive rud$_E$ closed structures for that E that we have fixed? Or (2) once given a formula we find an equivalnet formula over transitive rud$_E$ closed structures for all E at once?(which again needs coding of syntax for proper class E's, to write this formula in $\mathcal{L}_\in$.)
Comment: The point I want to say is, the fixed $E$ in your (1) is still arbitrary, as we assume nothing on $E$. Hence I think the universal quantifier for $E$ is suppressed in (1).
Comment: Also, I could somewhat deviate the main issue in the initial comment: uniformity. As far as I caught, (1) could mean the definition possibly depends on $E$. However, the definition of simple functions is already uniform for $E$ in context.
Comment: I read (1) as "For each $E$, we have a definition of simple functions...", and (2) as "There is a definition schema, which does not depend on $E$, of simple functions..." The definition of simple function already follows (2).
Comment: (Sorry, the gist of the comment is changed. I am also confusing about meta-language associated issues. Also, I am going to sleep, as here it is almost 4 a.m, so any further comments will be delayed.)
Comment: @HanulJeon, okay. So I think I have come to some conclusion. What I had in mind with (2) was something like this: we have coded everything in ZFC and the definition is in ZFC and not the meta-theory, and we say $f$ is simple iff for all $\phi$ we have some $\psi$ which for all $E$, over any rud$_E$ structure, $\phi(f)$ and $\psi$ are equivalent. But I suppose what you are saying, is that all this is defined in the meta-theory and $E$ is just a "free variable" in the meta-language of our meta-theory, right? If this is the case, then I think I can get behind that.
Comment: @HanulJeon, also I would appreciate it if you could tell me your opinion on my third question, when you are back. Also have you seen this definition somewhere else? Maybe I could get a better idea of it, by looking around.
Comment: Yes. $E$ includes any proper class, so I think there is no way to quantify it (unless we use NBG or MK or something similar) on the theory we are working on. This is the reason why I think the quantification lies in the metatheory.
Comment: The only references I have seen the definition of the simple function are Jensen's original paper, which just contains a simpler definition (it consider the case $E=0$) or Schindler's chapter in *Handbook of Set theory* (I cannot remember the definition, but I guess it is identical with what you are using.)
Answer: Let me try to give some input. So first of all, this definition appears in a proof, so it should be understood in the context of the proof. The $E$ is fixed in the statement of the lemma and thus it is not quantified over in the definition, so what simple means in the proof maybe should be called $E$-simple and being $E$-simple can be different from being $F$-simple for $E\neq F$.
Regarding your second question, in the definition it is not required that the equivalent $\Sigma_0$-formula is uniform in the structures. To finish the proof, one only needs that all $\operatorname{rud}_E$-functions are simple in this sense (as this is quite tedious to do, this statement was packaged as an exercise). The uniformity is not relevant. Anyhow, doing this exercise reveals that for $\operatorname{rud}_E$-functions these formulas can be chosen uniformly. Indeed even more is true: In the same way as one can associate natural numbers to first order formulas by looking at how they are build from the atomic formulas and the connectives, one can do this with rudimentary functions. There is then a recursive map $\eta:\operatorname{Fml}_{\in, E}\times\omega\rightarrow\operatorname{Fml}_{\in, E}$ so that whenever $f$ is $\operatorname{rud}_E$ and $\varphi$ is a $\Sigma_0$ $\{\in, E\}$-formula then $\varphi(f(v_0, \dots, v_n), w_0, \dots , w_m)$ is equivalent to $\eta(\varphi, k)(v_0, \dots, v_n, w_0,\dots, w_m)$ over any transitive $\operatorname{rud}_E$-closed structure, where $k$ is the natural number associated to $f$. [Again, E is fixed here]
Lastly, the reason why one quantifies over not just all transitive but moreover $\operatorname{rud}_E$-closed strucures is simply that the question whether $\varphi(f(v_0, \dots, v_n), w_0, \dots , w_m)$ is equivalent to $\psi(v_0, \dots, v_n, w_0, \dots , w_m)$ over a structure $\mathcal M=(M, \in, E)$ only makes sense if $M$ is closed under $f$. It means
$$\text{for all }x_0,\dots, x_n, y_0,\dots y_m\in M\ \mathcal M\models \varphi(f(x_0, \dots, x_n), y_0, \dots , y_m)\Leftrightarrow\psi(x_0, \dots, x_n, y_0, \dots , y_m)$$
after all.
Comment: Many thanks for the answer. I actually had emailed prof. Schindler about this and he sent me an email a few hours ago and I didn't have the time to post it. I'm sorry. He pretty much said the same thing and raised another good point regarding my last question, even if $f$ were total on $M$, then since it's defining formula need not be $\Sigma_0$, we can't use absoluteness in my argument to come back down. I also have one minor question. Since I suspect that not every simple function is rud$_E$, shouldn't we include a clause in the definition that the structures are closed under $f$ too?
Comment: There you can just use $\Sigma_0$-absoluteness.
Comment: Yes on should do that. One could also limit the definition only to rudimentary in E functions as this is all we care about.
Comment: Also if it's not inappropriate, I have a question from the lemma itself. In the last paragraph of the lemma, since $f$ is simple, we have that $v_0 \in f(v_1, \dots, v_k)$ is equivalent over $\text{rud}_E(U \cup \{U\})$ to a $\Sigma_0$ formula. Then how do we deduce that $x$ is $\Sigma_0^{(U\cup\{U\}, \in, E)}(\{x_1, \dots,x_n\})$? By the simplicity of $f$, we have that $x$ is $\Sigma_0^{(\text{rud}_E(U\cup\{U\}), \in, E)}(\{x_1, \dots,x_n\})$.
Comment: Oh, I get it now. Many thanks!


A Question about Hessian of log function (general form)

Question:
Sincerely hope to ask how to obtain the RHS?
Should I consider ln(10) among the process of d(log(x))/dx?
Thanks!
Comment: That is just a direct computation. Think of this as a matrix equality and check each entries.
Answer: We can avoid computing the components of the Hessian individually by using the multivariable chain and product rules.
I'll assume that $f$ is differentiable and positive on an open set $\Omega \subset \mathbb R^N$.
Let $g(x) = \log f(x)$ for all $x \in \Omega$.  By the chain rule,
\begin{equation}
g'(x) = f(x)^{-1} f'(x).
\end{equation}
(Note that $f'(x)$ is a $1 \times N$ row vector.)
It follows that
\begin{align}
\nabla g(x) &= g'(x)^T \\
&= f(x)^{-1} \nabla f(x).
\end{align}
The Hessian of $g$ is given by $\nabla^2 g(x) = q'(x)$, where $q(x) = \nabla g(x)$.
The product rule and the chain rule tell us that
\begin{align}
\nabla^2 g(x) &= q'(x) \\
&= -f(x)^{-2} \nabla f(x) \nabla f(x)^T + f(x)^{-1} \nabla^2 f(x).
\end{align}


Resolvent for Neumann Laplacian operator

Question: I want to find the resolvent for the Laplacian with Neumann boundary conditions:
$$D(A)=\{f\in W^{2,1}(0,1):f'(0)=f'(1)=0\},\quad f\mapsto Af:=f''. $$
I know that $0$ is an eigenvalue with eigenspace spanned by the constant one function. I need to compute the resolvent $R(\lambda, A):=(\lambda-A)^{-1}$ for $\lambda<0$ which are in the resolvent set of $A$.
My try 1: Let $f\in L^1(0,1)$ and $R(\lambda,A)f=g$. Then $f=(\lambda-A)g=\lambda g - g''$. Therefore $$
\begin{align*}\int_0^1 f^2(y)\, dy &= \lambda \int_0^1g(y)f(y)dy-\int_0^1f(y)g''(y)\, dy\\
&= \lambda \int_0^1g(y)f(y)dy+\int_0^1 f'(y)g'(y)\, dy\\
&=\lambda \int_0^1g(y)f(y)dy+ f'(1)g(1)-f'(0)g(0)-\int f''(y)g(y)\, dy.
\end{align*}$$
However, I'm not sure how to proceed from here. Any reference where the resolvent is explicitly computed would also be sufficient.
Edit:
My try 2: I tried to solve by variation of parameters and would appreciate if someone verifies it:
Let $\lambda\in (-\infty,0)\cap \rho(A)$ and $\mu=-\lambda$. The solution of the auxiliary equation is $g_c(x) = A \cos\sqrt{\mu}x + B\sin \sqrt{\mu}x$ and the Wronskian is $\sqrt{\mu}$. By variation of parameters: $$\sqrt{\mu}g_p(x)= \cos \sqrt{\mu} x\int_0^x \sin \sqrt{\mu} t f(t)\, dt-\sin \sqrt{\mu} x \int_0X\cos \sqrt{\mu} t f(t)\, dt.$$
So the solution is $$g(x)=A \cos\sqrt{\mu}x + B\sin \sqrt{\mu}x+\frac{1}{\sqrt \mu}\left(\cos \sqrt{\mu} x\int_0^x \sin \sqrt{\mu} t f(t)\, dt-\sin \sqrt{\mu} x \int_0^x\cos \sqrt{\mu} t f(t)\, dt \right).$$
Differentiating:
$$g'(x)=-\sin \sqrt{\mu} x\left(A \sqrt{\mu} + \int_0^x \sin \sqrt{\mu} t f(t)\, dt\right)+\cos\sqrt{\mu} x\left(B \sqrt{\mu} -\int_0^x \cos\sqrt{\mu} tf(t)\, dt\right).$$
Using $g'(0)=0$, we get $B=0$ and using $g'(1)=0$, we get
$$A=-\frac{1}{\sqrt{\mu}} \int_0^1 \sin \sqrt{\mu} t f(t)\, dt.$$
Thus $$R(\lambda,A)f=\frac{1}{\sqrt{\mu}}\left(\cos \sqrt{\mu} x\int_x^1 \sin \sqrt{\mu} f(t)\, dt -\sin \sqrt{\mu} x\int_0^x \cos \sqrt{\mu} t f(t)\, dt\right).$$
Is this correct?
Answer: Essentially what you are asking is how to solve the inhomogenous ODE
$$g''-\lambda g=f$$
subject to Neumann boundary conditions. For this I suggest you use variation of parameters, which will eventually give you an expression for $g$ in terms of $f$ and the solutions of the homogenous equation $g''-\lambda g=0$. Here are two sources for this technique, the first more applied the second with some proofs. You may also consult an ODE textbook.
Comment: It looks right to me! To be absolutely sure you could verify that it solves the ODE, but the fundamental solutions and Wronskian are correct so the solution should be as well.
Comment: I tried doing it by the method you suggested. Can you check it?
Comment: Can you look at my [similar question](https://math.stackexchange.com/q/4075160/904807)?


Vector Autoregression model without using past values of predicted value

Question: I have 16 time series: A, B, C ... P.
And I am trying to use Vector Autoregression model to capture the relationship between A and other series.
But when I use VAR, I found that the model relies too much on the past values of A.
So I want to remove past values of A from the model.
I want to describe A only using series B, C ... P.
Is there any way to implement this or enforce such constraint in VAR?
I am using statsmodels.tsa.api in Python.
Thank you for the help.
Answer: A VAR model is efficiently estimated with equation-by-equation OLS. If you restrict certain coefficients to be zero (which is what dropping lags of the dependent variable amounts to), you may gain some efficiency with a GLS type approach, also known as seemingly unrelated regressions. You would still get consistent estimates when simply running an OLS regression of A on the lags of B to P, though (provided your restriction is correct, of course - also, you may or may not care about such consistency if, for example, your ultimate goal is, e.g., forecasting).
It may be worth asking, though, what "relying too much" is to mean. In my experience, it is - intuitively, I would say - not uncommon that own lags are more important than cross lags, so maybe your VAR captures that strong own-dependence just right instead of "relying too much"?
I cannot help you with Python, but in R, such an approach can for example be implemented with the systemfit package. Alternatively, you could use the vars package using the restrict command.