text:
Quartiles and Interquartile Range04:58 minutes

Video Transcript

TranscriptQuartiles and Interquartile Range

"Many archers, who all shoot brilliantly, on a Medieval castle ground is where we lay our scene. From fierce competition break to new scrutiny, Where quartiles determine the archers' destinies."

Romeo has entered an archery competition devised by the King based on quartiles. The rules of the competition are a little bit different from the competitions Romeo usually enters. Upon hearing that Juliet lives in the castle, Romeo is trying to find a way they can finally be together. However, in order to avoid the punishments, Romeo has to understand quartiles and interquartile range.

Quartiles and interquartile range

(A) The archers in the 4th quartile range are rewarded by being automatically knighted and sent to look for the Holey Grail, (B) while the archers in the 1st quartile range have the unfortunate lot of being the ones upon whose heads the target apples will sit next year. (C) Anyone falling in the lower part of the interquartile range has to clean up after the festival. (D) and anyone in the upper part of the interquartile range gets to stay in the castle during the festival. That's what Romeo wants. Additionally, if the competition isn't very good and the interquartile range is greater than 10, then all the archers in the interquartile range must help with the festival clean up.

Using quartiles

One way to analyze data is to use quartiles, which is just a fancy way of saying the data is divided into quarters. The competition between the kingdom's brave archers has just ended! Let's see what fate has in store for Romeo and Juliet. In our data set, we have several archers who had to shoot 20 apples each and managed to hit between 0 and 20 apples. Boy, that looks messy. In order to split the data into quartiles, we first need to put the numbers in order and done.

Let's take a look at a few of the ways to split this data. For this method, you need to know how many data points you have, so count those first.19. Good. We first need to split the list in two equal halves. If there is an odd number of data points, as in the example, then the middle number, 8, becomes the median and is not included in either half. We'll call this Q2. Once we have two halves, we want to split these into further halves, giving us four sets of data with an equal number of data points in each set. Let's look at the first half of the list first. It has 9 elements, so the median will not be included in either quartile. Five is the median of the first half, so we'll call this Q1.

So our first quartile has the following data points: These poor souls will be the apple stands at next year's competition and our second quartile range has the following data points. Those archers have to clean up once the festival is done.Doing the same to the second half of the list gives us a median of 15. So our Q3 is 15 and the 3rd as well as the 4th quartile ranges.

The brave warriors in the 4th quartile range are automatically knighted and sent off in search of the Holey Grail. If there is an even number of data points, then we split the list in half and take the median of the two middle-most numbers. So, just to illustrate what we mean, let's say you have an even number of data points like in our 3rd quartile range. Splitting these up into sets with the same number of elements is easy: all we have to do is put two data points in each set. But where's the median of this data set including 4 values? As we said before, we split the list in half and take the median of the two middle-most numbers. In our case, the middle-most numbers are 11 and 13. The median between these two numbers is 11 plus 13 divided by two, so 12 is our median.

The interquartile range

Now that we understand how to split the data into quartiles, all the bean counter needs to figure out is whether or not anyone gets to stay in the castle. For this, we need the interquartile range. The interquartile range is found by subtracting Q1 from Q3.

So 10 is the interquartile range for our data. Whew! Not all the archers have to clean up after the festival! Since Romeo finished the competition with a score of 14, we can now safely say that he is in the upper portion of the interquartile range and gets to stay in the castle where he'll be close to his lady love! But, there's something fishy about one of the newly-knighted knights.

"Go hence, to have more talk of these sad things: Some shall be empower’d, and some employed: For never was a story of more woe Than this of Juliet and her Romeo."

Videos in this Topic

Statistics: Data Distribution (7 Videos)

Quartiles and Interquartile Range Übung

Du möchtest dein gelerntes Wissen anwenden? Mit den Aufgaben zum Video Quartiles and Interquartile Range kannst du es wiederholen und üben.

• Explain how to find the interquartile range.

Tipps

Here you see the list ordered.

Usually the data gets ordered first.

For an odd number of data points we get two sets, one left of of the median and one right of the median, with an equal number of data points.

Lösung

To get the interquartile range, we have to proceed with the following steps:

1. Order the data, as pictured to the right.
2. Count the total number of data points, $19$.
3. Split the list into two equal halves. Because the number of data points is odd, the median is right in the middle at position $10$ and we have that $Q_2=8$.
4. Split the lower as well as the upper part of the list, each containing $9$ elements. So we get $Q_1=5$ as the median of the lower part and $Q_3=15$ as the median of the upper part.
5. The interquartile range is defined as the difference of $Q_3$ and $Q_1$. So we get $IQR=Q_3-Q_1=15-5=10$.

• Identify how to find the median.

Tipps

For this list the median is $7$.

For this list the median is the mean of $7$ and $9$.

For the example above, the mean is $\frac{7+9}2=\frac{16}2=8$.

Lösung

How can we find the median of a given ordered list?

We have to differentiate between two cases:

• The number of data points is odd.
• The number of data points is even.
Let's illustrate what we do in each case with an example:

$\begin{array}{ccccc} 2&5&7&8&12 \end{array}$

The median is the data point lying right in the middle of the list, in this example at position $3$. So we have that the median is $7$. The median belongs to the list of data.

Now let's see what we do when we have an even number of data points:

$\begin{array}{cccccc} 2&5&7&9&12&13 \end{array}$

The median lies between $7$ and $9$. So we take the mean of those values as the median:

$\frac{7+9}2=\frac{16}2=8$.

This median could belong to the list of data, but not always.

Independent of even or odd numbers, we can conclude that the median splits the list into two parts containing the same number of data points.

• Determine the median, the quartiles, and the interquartile range.

Tipps

If you've got an odd number of data points the median lies right in the middle of the list of data. For example, $4$ is the median of the list

$\begin{array}{ccccccc} 1&2&3&4&5&6&7 \end{array}$

For the list pictured, we have that:

• $Q_2=4$
• $Q_1=2$
• $Q_3=6$
• $IQR=6-2=4$

Lösung

To get the interquartile range, we have to proceed with the following steps:

1. Order the data, as pictured to the right.
2. Count the total number of data points, $19$.
3. Split the list into two equal halves. Because the number of data points is odd, the median is right in the middle at position $10$ and we have that $Q_2=8$.
4. Split the lower as well as the upper part of the list, each containing $9$ elements. So we get $Q_1=5$ as the median of the lower part and $Q_3=15$ as the median of the upper part.
5. The interquartile range is defined as the difference of $Q_3$ and $Q_1$. So we get $IQR=Q_3-Q_1=15-5=10$.
We can also then see that:

• The first quartile range starts with $0$ and ends with $4$.
• The second quartile range starts with $6$ and ends with $7$.
• The third quartile range starts with $9$ and ends with $14$.
• The fourth quartile range starts with $17$ and ends with $20$.
• Determine the median, the quartiles, and the interquartile range.

Tipps

First order the given list.

This is the ordered list.

The number of data points is $13$ and thus odd. So the median is right in the middle of the ordered list.

The number of data points in the lower as well as the upper part of the list is $6$ and thus even. So the median is the mean of both data points lying in the middle.

Lösung

First determine $Q_1$, $Q_2$, and $Q_3$.

$Q_2$ is the median of the ordered list. Because the number of data points is odd, namely $13$, the median is right in the middle. Thus we have $Q_2=26$.

The lower as well as the upper part of the list contains $6$ data points. So we have to determine the corresponding median as the mean of both of the data points lying in the middle.

Let's start with $Q_1$:

$\begin{array}{cccccc} 9&12&\mathbf{15}&\mathbf{16}&21&23 \end{array}$

So $Q_1=\frac{15+16}2=\frac{31}2=15.5$.

Now, to determine $Q_3$:

$\begin{array}{cccccc} 28&33&\mathbf{35}&\mathbf{37}&41&44 \end{array}$

So $Q_3=\frac{35+37}2=\frac{72}2=36$.

With $Q_3$ and $Q_1$ known, we can calculate the interquartile range:

$IQR=Q_3-Q_1=36-15.5=20.5$

We can now establish the quartile ranges:

• The first one: $\begin{array}{ccc}9&12&15\end{array}$
• The second one: $\begin{array}{ccc}16&21&23\end{array}$
• The third one: $\begin{array}{ccc}28&33&35\end{array}$
• The fourth one: $\begin{array}{ccc}37&41&44\end{array}$

• Determine the median, the quartiles, and the interquartile range.

Tipps

To get the mean of two numbers add them and divide the sum by $2$.

The number of data points in the list pictured is $6$.

The median is the mean of the data points at position $\frac 62=3$ and $4$; i.e. the mean of $9$ and $11$, which is

$\frac{9+11}2=\frac{20}2=10$.

Lösung

Here we have an ordered list with $20$ data points, an even number.

The median lies between the data points at position $\frac{20}2=10$ and position $11$; i.e. between the data points $7$ and $9$. We take the mean of these points as the median:

$\frac{9+11}2=\frac{20}2=10$.

Thus we can conclude that $Q_2=10$.

We proceed in a similar fashion for the lower part of this list,

$\begin{array}{cccccccccc} 1&1&3&4&5&5&6&7&8&9 \end{array}$

$Q_1=\frac{5+7}2=\frac{12}2=6$,

and for the upper one,

$\begin{array}{cccccccccc} 11&12&12&13&14&16&16&17&18&20 \end{array}$

$Q_3=\frac{14+16}2=\frac{30}2=15$.

Finally we can determine the interquartile range as the difference of $Q_3$ and $Q_1$:

$IQR=15-6=9$.

• Calculate which data points are in which quartile range.

Tipps

First order the data list.

This is the ordered list.

Each quartile contains $4$ data points.

Be careful: the medians should not be highlighted.

Lösung

First you have to order the list of data. You can see the ordered list to the right.

Next determine the medians $Q_1$, $Q_2$, and $Q_3$ which divide the list in the four quartile ranges.

Let's start with $Q_2$; it's right in the middle of the starting list: $Q_2=17$.

The middle of the lower part,

$\begin{array}{ccccccccc} 2&5&7&7&9&10&10&13&16, \end{array}$

is $Q_1=9$.

The middle of the upper part,

$\begin{array}{ccccccccc} 19&20&20&22&24&25&26&26&26, \end{array}$

is $Q_3=24$.

Thus we have the following quartiles:

• The first one: $\begin{array}{cccc}2&5&7&7\end{array}$
• The second one: $\begin{array}{cccc}10&10&13&16\end{array}$
• The third one: $\begin{array}{cccc}19&20&20&22\end{array}$
• The fourth one: $\begin{array}{cccc}25&26&26&26\end{array}$


text:
# Regex: Any pair of zeros is before any pair of ones

Write a regular expression for all the strings in which every pair of adjacent zeros appears before any pair of adjacent ones. The answer given in the book is: $$(0+10)^*(00)(1+01)^*(11)(0+10)^*(1+01)^*$$ Is that correct? I fail to see how could you get a string like 10011, but it fits description. I mean even a string like 1 fits a description. So, if this answer is incorrect, then what is a correct answer? My simple guess is: $$(\epsilon+1)(0+10)^*(1+01)^*(\epsilon+0)$$

P.S. Does $(0^*1^*)^*$ generate every possible binary number? If not, what does it generate?

• Not to mention that the book answer won't generate 11. – Rick Decker Dec 8 '14 at 19:56
• Your answer is incorrect, since it generates $1100$. – Yuval Filmus Dec 8 '14 at 19:57
• My guess is $(0+10)^*(1+10)^*$. – Yuval Filmus Dec 8 '14 at 20:03
• For languages such as this, it's sometimes easier to construct an NFA and convert it. That siad, I'm confused by "every" and "any" (note that title != text). For instance, is $00$ forbidden after $11$? – Raphael Dec 8 '14 at 20:11

You are correct: the regexp you quote does not match the string $10011$ and that string has the property that every pair of adjacent $0$s occurs before any pair of adjacent $1$s. But it does match the string $001100$, which fails to have the property!

Your proposed solution matches $11001$ so is also incorrect (the first bracket matches $1$, the second matches $10$, the third matches $01$ and the fourth matches $\epsilon$.

A regexp that does match the required language is $$0^*(100^*)^*(11^*0)^*1^*\,.$$ It works as follows.

• $0^*(100^*)^*$ matches the empty string and any non-empty string that doesn't contain $11$ and that ends with $0$. The string can't contain $11$ because there must be at least one $0$ between every two $1$s.

• $(11^*0)^*1^*$ matches every string that begins with $1$ and does not contain $00$, since there must be at least one $1$ between any two $0$s.

• Now put the two halves together. If a string has the property that all occurrences of $00$ are before the first $11$, then the section of the string before the first $11$ must either be empty or end in $0$, so it matches the first part of the regexp. The rest of the string contains no occurrences of $00$ so it matches the second part of the regexp.

Note that there are shorter regexps that do the same thing: Yuval Filmus gives $(0+10)^*(1+10)^*$ in a comment to the question. That's a tidier version of the same idea.

And, yes, $(0^*1^*)^* \equiv (0+1)^*$ matches every possible binary string.

• Can you please give me the name of your texbook you got that answer from? – Shahul Es Sep 27 '18 at 5:06
• I didn't get it from any textbook and I'm kind of insulted that you think that I'd (a) not be able to solve this for myself and (b) not credit the source of the answer if I had taken it from somewhere else. – David Richerby Sep 27 '18 at 11:00

format: plain


text:
Diversions in Mathematics 3b: The Cauchy-Schwarz inequality (part 2)

In the previous post, we introduced the Cauchy-Schwarz inequality purely as a statement about real numbers:

$\displaystyle \sum_{k=1}^n x_k y_k \le \left( \displaystyle \sum_{k=1}^n x_k^2 \right)^{1/2} \left( \displaystyle \sum_{k=1}^n y_k^2 \right)^{1/2}.$

We proved this inequality using mathematical induction. However, one could argue that the method did not yield much insight. As our proof was entirely algebraic, it is not easy to see why the sums that appear in the inequality are reasonable quantities to consider, and there is no hint as to how they could arise naturally in mathematical problems. Therefore, in this post, we will look at the Cauchy-Schwarz inequality from a geometric perspective, which reveals a much richer structure. Moreover, we will see how the inequality arises naturally from a basic optimisation problem.

Note: I continue with the convention from the previous post that a quantity $x$ is called positive if $x \ge 0$. We say that $x$ is strictly positive if $x > 0$.

Continue reading “Diversions in Mathematics 3b: The Cauchy-Schwarz inequality (part 2)”

Diversions in Mathematics 3a: The Cauchy-Schwarz inequality (part 1)

Preface

After a long time, I have decided to resurrect the mathematics part of this blog! I started Diversions in Mathematics as a way for me to try to explain mathematics to the general public. This continues to be the main goal of this series of blogposts — for a more detailed introduction, please read the introductory remarks. I wrote two posts in this series, but then abruptly stopped. Part of the reason was that my studies got in the way, but I was also unsure exactly what material to present, and how to present it. I wrote down some of my thoughts on this matter in a previous update post.

One of the main issues as a writer is to consider the readers’ background in mathematics. For posts targeting the general public (like the previous two Diversions), I have tried to assume as little as possible while maintaining the discussion at an intelligent level, i.e. without “dumbing down” anything) However, this already assumes familiarity with many mathematical concepts taught in high school, or at least, some level of maturity in regard to abstract reasoning. Consequently I have decided to relaunch Diversions in Mathematics with high school mathematics as a foundation.

In this blogpost, I will introduce the Cauchy-Schwarz inequality, one of the most fundamental results in mathematical analysis, with the aim of connecting various topics that are typically studied in the Year 12 HSC maths curriculum in NSW. Click below to read the main article.

Continue reading “Diversions in Mathematics 3a: The Cauchy-Schwarz inequality (part 1)”

Conversation with Katie Bergløf

Recently (1 June in Australia) I spoke with hornist Katie Bergløf over Zoom about focal dystonia. Check out the conversation here:

There are many more conversations with other musicians who are dealing with various forms of focal dystonia. I highly recommend checking out the Youtube playlist: https://www.youtube.com/user/HeldenCors/playlists

Katie’s website: https://www.focalembouchuredystonia.com/

On the value of recording your mistakes (occasionally)

Let me tell you about a mistake I made recently. Some months ago, I made a few calculations which seemed promising, and I thought they could lead to some new results. When I showed the calculations to my supervisor, he was skeptical, and rightly so. Our project involved some fairly abstract concepts in the theory of operator semigroups, so his immediate advice was to check the calculations against some simple, concrete examples . So of course I did that, and quickly realised that the calculations were totally wrong! Moreover, they were wrong for a rather silly, elementary reason — a pitfall that I thought I should be capable of detecting with my current mathematical experience.

To clarify what I mean by “elementary”: no, it wasn’t a silly error in the sense of a missing minus sign or multiplying two numbers incorrectly. Mathematicians say that something in their field of study is “elementary” if it is a basic fact in that particular field. However, to paraphrase my supervisor, “basic does not mean easy”, so if I were to describe the mistake to a non-mathematical audience, it would still be extremely difficult. Another interesting point is the following. When you do research in pure mathematics, quite often you deal with abstractions upon abstractions, and it is easy to forget the humble origins of these abstract concepts. For example, the concept of a linear operator is fundamental to many areas of maths, and as cool as it is to be working with linear operators on infinite dimensional Banach spaces or whatever, it is also worth checking a statement about abstract linear operators on, let’s say, a 2-by-2 matrix as encountered in 1st year university maths (or even high school, depending on where you were educated). This comic sums up the sentiment quite well (excuse the pun).

Now this brings us to the main point of this blogpost. The wrong calculation I described above is not the mistake I want to write about; rather, I want to focus on what happened next. I assume that most people do not enjoy looking at their failures. I am not sure what I did with those few pages of calculations: either I threw them out, or I shelved them away somewhere I had forgotten. In any case, recently I wanted to return to the same problem with a different perspective, but now I have lost my point of reference. Because I had misplaced or thrown out the incorrect calculations, I cannot really remember what I had got wrong the first time! To be fair to myself, I have a vague idea of the kind of error it was, and it is very unlikely I will make exactly the same error again, but nevertheless it would have been more efficient to keep the original calculations, wrong as they are, so that I can remember exactly what the lapse of judgment was. As I have learned by now, mathematical work is not only about putting one true statement after another. It is equally important and even illuminating to know what kind of result cannot be true. In hindsight, throwing away those calculations was a bigger mistake than the calculations themselves.

There are certain similarities with the performing arts, although I have to admit that the comparison gets fuzzy on closer inspection. For a start, mistakes in mathematics are objective errors: you are objectively wrong if you claim that 1 + 1 = 3, for instance. On the other hand, speaking from a background in Western classical music, even though there are certain objective errors (e.g. playing a wrong note), usually we are unhappy with a performance because we feel that we could have done certain things better. One could say this is a “subjective” error. Despite this fundamental difference though, both mathematicians and performing artists undeniably improve by learning from their mistakes, objective or subjective. Indeed, I would say that learning from mistakes is an essential part of development in the two disciplines.

As a violin student, I used to dislike making recordings — what a way to highlight one’s faults and weaknesses! However, in hindsight I should have taken more opportunities to record my playing, and to embrace whatever mistakes (objective or subjective) occurred during a performance.  One should not take this viewpoint too pessimistically. The idea is not to focus only on failures; rather it is about using those failures strategically to improve one’s understanding or problem solving technique in the case of mathematics, or one’s expression capabilities in the case of the performing arts.

I end this post with a nice little comic, which comes with some wise words from the great mathematician Paul Halmos:

https://abstrusegoose.com/353

Update post (July 2019)

It seems that every time I return to write something on this blog, it’s about how infrequently I write (and that I’m awfully sorry, and I promise to write more, but it never happens). I see three main reasons for this:

• I am now in a masters program in the School of Mathematics at the University of Sydney! My honours year went quite well overall, and my supervisor was happy to take me as a postgraduate research student.
• Since March, I have also been working casually for Matrix Education, a private tutoring company that is well-known in particular for its HSC preparation courses.

From the two reasons listed above, you can appreciate that most of my time is spent doing mathematics in some way — reading articles and learning new theory for my research project, working on exercises from textbooks, or preparing tutorials and classes. The third reason is really a blend of two:


text:
# 3.4: Organolithium Compounds

One of the major uses of lithium is in the synthesis of organolithium compounds, RLi. They have great importance and utility in industry and chemical research. Their reactivity resembles that of Grignard reagents, but they are generally more reactive.

## Synthesis

The best general method for RLi synthesis involves the reaction of an alkyl or aryl chloride with lithium metal in benzene or an aliphatic hydrocarbon (e.g., hexane), (3.4.1).

$RCl + 2 Li \rightarrow RLi + LiCl$

While it is possible to use diethyl ether (Et2O), the solvent slowly attack the resultant alkyl lithium compound, (3.4.2).

$Et_2O + ^nBuLi \rightarrow EtOLi + H_2C\text{=}CH_2 + ^nBuH$

Metal-hydrogen exchange, (3.4.3), metal-halogen exchange, (3.19), and metal-metal exchange can also be used, (3.4.4).

$RH + R'Li \rightarrow R'H + RLi$

$2 Li + R_2Hg \rightarrow 2 RLi + Hg$

All organolithium compounds are produced as solutions and are hence used in synthetic protocols by volume of solution. It is therefore important to know the exact concentration of RLi in solution. The simplest approach to quantify the amount of organolithium is to react a known volume with water, (3.4.5), and then titrate (with acid) the resultant base that is formed.

$RLi + H_2O \rightarrow LiOH + RH$

However, while the concentration of freshly prepared samples of organolithium reagents can the theoretically measured in this way, real samples always contain some amount of LiOH or other bases. A simple titration inevitably results in an over estimation of the organolithium reagent. To overcome this a double titration method is used.

### Gillman double titration method

The careful addition of a known volume of an organolithium reagent solution (between 0.5 and 1.5 mL) to an excess of water yields a solution of LiOH that can be titrated with a standardized solution of hydrochloric acid, using phenolphthalein as the indicator. The presence of any LiOH in the original organolithium solution will be incorporated into this titration, and thus the result will be a measure of the total base content in the solution, i.e., (3.4.6).

$\text{Total base content} = \text{LiOH formed from the reaction of RLi with H}_2\text{O} + \text{LiOH present as impurity in the RLi solution}$

In order to determine the amount of LiOH present as impurity in the organolithium solution it is necessary to react the RLi without the formation of base, then titrate the resulting solution. To do this, an aliquot (the same amount as used before) of the organolithium is reacted slowly with 1,2-dibromoethane (BrCH2CH2Br) dissolved in dry diethyl ether (Et2O). After 5 min of stirring, the solution is diluted with an excess of water and then titrated with a standardized solution of hydrochloric acid, again using phenolphthalein as the indicator. The dierence of the two titrations gives the exact concentration of the organolithium.

Example $$\PageIndex{1}$$

An aliquot of nBuLi in hexanes (0.50 mL) was added to degassed water (20 mL). After any visible reaction had ceased, a few drops of a phenolphthalein solution in water/methanol are added resulting in a pink color indicative of a basic pH. The resulting mixture is titrated with standardized hydrochloric acid ([HCl] = 0.1034 N) until complete disappearance of the pink color (7.90 mL).

A second aliquot of nBuLi in hexanes (0.50 mL) is added to 1,2-dibromoethane (0.20 mL, Et2O). After 5 min of stirring, the mixture was diluted with water (20 mL) and after addition of the phenolphthalein indicator titrated (with vigorous stirring due to the biphasic nature of the system) with standardized hydrochloric acid ([HCl] = 0.1034 N) until complete disappearance of the pink color (0.25 mL).

The concentration of nBuLi is calculated as follows:

Step 1. $\text{[total base]} = \dfrac{\text{volume HCl } \times \text{ [HCl]}}{\text{volume } ^n \text{BuLi}} = \dfrac{7.90 \times 0.1034}{0.50} = 1.633$

Step 2. $\text{[residual base]} =\dfrac{\text{volume HC l} \times \text{ [HCl]}}{\text{volume } ^n \text{BuLi}} = \dfrac{0.25 \times 0.1034}{0.50} = 0.013$

Step 3. $\text{[}^n\text{BuLi]} = \text{[total base]} - \text{[residual base]} = 1.633 - 0.013 = 1.620M$

## Properties

Alkyl lithium compounds are either low melting solids or liquids, and often with high volatility (depending on the substituent) due to the covalent nature of the bonding. They are soluble in aliphatics, aromatics, and ethers. However, while the reaction with ethers is generally slow, (3.17), alkyl lithium compounds can polymerize tetrahydrofuran (THF).

Organolithium compounds react rapidly with air and water (both vapor and liquid). The reaction with water is the basis of the Gillman double titration method for determining the concentration of organolithium reagents in solution.

## Structure

The structure of organolithium compounds is dominated by their highly oligomeric nature as a result of 3-center 2-electron bridging bonds. In all cases the extent of oligomerization is dependant on the identity of the alkyl (or aryl) group. The alkyl-bridged bond is similar to those found for beryllium and aluminum compounds.

In the vapor phase any particular organolithium derivative show a range of oligomeric structures. For example, the mass spectrum of EtLi shows ions associated with both tetramers (e.g., [Et3Li4]+) and hexamers (e.g., [Et5Li6]+). The structures of the different oligomers have been predicted by molecular orbital calculations (Figure $$\PageIndex{3}$$.20).

Solution molecular weight measurements indicate the oligomerization is present (in the absence of a coordinating ligand such as Et2O or an amine). The extent of oligomerization depends on the steric bulk of the alkyl group (Table $$\PageIndex{3}$$.16). Oligomerization and solution structures have also been investigated by 7Li and 13C NMR spectroscopy.

R [RLi]n R [RLi]n
Me 4 Et 6
nBu 6 tBu 4
Table $$\PageIndex{3}$$.16: Extent of oligomerization (n) for organolithium compounds [RLi]n in benzene solution.

There are a large number of X-ray crystallographically determined structures for organolithium derivatives. The archetypal example is MeLi, which exists as a tetramer in the solid state (Figure $$\PageIndex{3}$$.21). The lithium atoms are arranged as a tetrahedron and the carbon atoms are positioned on the center of the facial planes, i.e., the carbon is equidistant from each of the lithium atoms. In contrast, EtLi has a similar tetrahedral structure, but the α-carbon of the ethyl groups are asymmetrically arranged such that it is closer to one lithium atom than the other two.


text:
In 2017 there were 418 total motor vehicle crashes in Freedonia. Assuming that number reflects the...

Question:

In 2017 there were 418 total motor vehicle crashes in Freedonia. Assuming that number reflects the true average now and that it follows the Poisson distribution, what are the odds that at least one accident will occur somewhere in the state of Freedonia in the next minute? Hint: There 525,600 minutes in a year. Round to four decimal places.

Similar Solved Questions

HennoNitration of an aromatic ring involves an electrophilic substitution reaction_ Druw the structure of the electrophile that is ultacked by the aromatic ring and the intermediate formed after attachment of the electrophile to the ring: Be surc Io show formal charges. HNO3 HzSOaElectrophile IntermediateDraw the intermediate .Draw the electrophile:
Henno Nitration of an aromatic ring involves an electrophilic substitution reaction_ Druw the structure of the electrophile that is ultacked by the aromatic ring and the intermediate formed after attachment of the electrophile to the ring: Be surc Io show formal charges. HNO3 HzSOa Electrophile Inte...
Discuss the concept of polarity management and how you might use it.
Discuss the concept of polarity management and how you might use it....
Web Assign 9
Your bathtub is filled with 0.600 m ofwater. The drain plug for your tub is circular with a diameter of5.00 cm.(a) What is the absolute pressure pushing down onthe top of the drain plug (keep 5 significant figures forthis part)? Pa(b) What is the net force on the drain plug? Keep in mind the drainpi...
Question 8What is the difference between sporophyte and a gametophyte? Sporophytes arise from fertilized eggs, gametophytes form via meiosis. Gametophytes are female or male, sporophytes Iack that differentiation; Gametophytes are haploid, sporophytes are diploid, All of the choices are correct;
Question 8 What is the difference between sporophyte and a gametophyte? Sporophytes arise from fertilized eggs, gametophytes form via meiosis. Gametophytes are female or male, sporophytes Iack that differentiation; Gametophytes are haploid, sporophytes are diploid, All of the choices are correct;...
How do you evaluate sin^-1(1/sqrt2) without a calculator?
How do you evaluate sin^-1(1/sqrt2) without a calculator?...
A 26Kg dog receives maintenance fluids at a rate of 40mL/Kg/24 hours. How many milliliters does...
A 26Kg dog receives maintenance fluids at a rate of 40mL/Kg/24 hours. How many milliliters does it receive per hour?...
Write a program to print the hollow diamond of stars (*), ask the user to enter...
Write a program to print the hollow diamond of stars (*), ask the user to enter an odd number as the height. For example, if user enters height as 7, output will look like: Y*...
Ievddand Ip_Woep 0L7uz1 Amhoee ebbCcdiAaBbtOnbekende stof
Ievddand Ip_Woep 0L7uz1 Amhoee e bbCcdi AaBbt Onbekende stof...
Question and translation in pictures below! 1 QUESTION 11. On suppose que la fonction demande q...
Question and translation in pictures below! 1 QUESTION 11. On suppose que la fonction demande q = D(p) est donnée par q = ой p désigne le prix et q représente la quantité d'articles qu'on peut vendre chaque année au prix p. Lequel des &eacut...
Described below are six independent and unrelated situations involving accounting changes. Each change occurs during 2018...
Described below are six independent and unrelated situations involving accounting changes. Each change occurs during 2018 before any adjusting entries or closing entries were prepared. Assume the tax rate for each company is 40% in all years. Any tax effects should be adjusted through the deferred t...
A new drug causes all of the sodium channels of a resting neuron to open. Meesurement of the membrane potential after application of the drug would show a reading ofA) 0 mVB) +30 mV-70 mVD) -90 mV
A new drug causes all of the sodium channels of a resting neuron to open. Meesurement of the membrane potential after application of the drug would show a reading of A) 0 mV B) +30 mV -70 mV D) -90 mV...
1 Include (circuits) diagrams below assume ideal op amps. voltage supplies are (a) ) Find v,...
1 Include (circuits) diagrams below assume ideal op amps. voltage supplies are (a) ) Find v, as a function of vs t volts in both parts (a) and (b). (i) Plot v, vS. v (iii) From (ii) or otherwise determine range of vg such that v, does not saturate. 96 kn 24 kΩ 10 V -10 V...
Define f R + R by flz) = 1 if x < I; f() 2 if _ > What can be Said about solutions of & f (~) satisfying z(0) 1, where the right side of the differential equation discontinuous? What happens if you have instead f() 0 if _ > 1?
Define f R + R by flz) = 1 if x < I; f() 2 if _ > What can be Said about solutions of & f (~) satisfying z(0) 1, where the right side of the differential equation discontinuous? What happens if you have instead f() 0 if _ > 1?...
M 1 1 1 45...
LJA "1 1 1 Auktt Hu [Au4 1 1 111
LJA " 1 1 1 Auktt Hu [Au4 1 1 1 1 1...
(a) Evaluate (i) Setyo dt, (ii) [(9/2) and (iii) (-7/2). (b) In a recent paper the...
(a) Evaluate (i) Setyo dt, (ii) [(9/2) and (iii) (-7/2). (b) In a recent paper the following integral was evaluated by numerical integration: Soy7/5e-dy. Evaluate the integral in terms of Gamma functions. (c) (1 + log dar. Hint: Make a change of variables u = -log < (and you should understand why...
Consider the process of converting gaseous to liquid ammonia: NHz (g) NHz (I)What is true for this reaction? Select all that are true_It is endothermicIt has AHIt releases heatIt absorbs heatIt has +AHAH=0It is neither exothermic nor endothermicIt is exothermicQuestion 61ptsCalculate the AHrxn for the following reaction: Ca (s) 1/2 02 (g) COz (g) CaCO3 (s)Use the following reactions and given AHvalues:2 Ca (s)0z (g)2 CaO (s)AH =-1,270.2kJCacO3 (s)CaO (s)COz (g) AH - 178.3kJEnter your answer with
Consider the process of converting gaseous to liquid ammonia: NHz (g) NHz (I) What is true for this reaction? Select all that are true_ It is endothermic It has AH It releases heat It absorbs heat It has +AH AH=0 It is neither exothermic nor endothermic It is exothermic Question 6 1pts Calculate the...
Cakteallan You deddedla makahaedr bcbteedtidnt Ihaa*4 Pranins Tamale 3toustea patd [ort Faaa 'contd tnprln run a daalhant Uh aueudb 1040 daaBulan dcrdd eule 40 ntd9t Ha cbtahel EetFLernmuLEN Orn4Iuu m[Dae paraa ku Jee reerrnr ban beucht eunnAaen a4earent Gutan 13e Een (lel ee alkdneran KmetDerld Jn7narde4l GTiteh6ic.An im F CATr( 7 meANJt)) (100,.41 Ir "9) ar "(n)) - -(108*414 (-7)(464) H MTn 6*0e4 LtuV A4[CanttDeatanieantrdenen Jn[Jns mLEaade Er Larnatr Uraneaecutr enrta rtud] L
cakteallan You deddedla makahaedr bcbteedtidnt Ihaa*4 Pranins Tamale 3toustea patd [ort Faaa 'contd tnprln run a daalhant Uh aueudb 1040 daaBulan dcrdd eule 40 ntd9t Ha cbtahel Eet F Lern muLEN Orn4 Iuu m[ Dae paraa ku Jee reerrnr ban beucht eunn Aaen a4earent Gutan 13e Een (lel ee alkdneran K...
When the Cl attacks the epoxide, doesnt it invert the stereochemistry of it? i am a...
when the Cl attacks the epoxide, doesnt it invert the stereochemistry of it? i am a bit confused 11.24 The following equation shows the reaction of trans-2,3-diphenyloxirane with hydrogen chloride in benzene to form 2-chloro-1,2-diphenylethanol. CH, CH + HCI - CH,CH-CHCH, HÓ CI trans-2,3-Dip...
System 3: Assume the surface is rough. Angle of inclination is 30o . Tz Tmzm0m;
System 3: Assume the surface is rough. Angle of inclination is 30o . Tz T mz m 0 m;...
Make a Poisson regression model M2 that predicts Rank as function of SATM Make Negative-binomial regression model M3 that predicts Rank as a function of SATM:M2-glm (Rank~SATM , family poisson) summary (M2)  Call:  glm (formula Rank SATM , family poisson)   Deviance Residuals  Min 1Q Median 3Q Max  -12.930 -7. 486 -3.585 2.808 42.012   Coefficients  Estimate Std Error value Pr (>Izl)  (Intercept) 6. 4646937 0.0316357 204.35 <2e-16 *  SATM -0.0403177 0.0005207 -77.
Make a Poisson regression model M2 that predicts Rank as function of SATM Make Negative-binomial regression model M3 that predicts Rank as a function of SATM: M2-glm (Rank~SATM , family poisson) summary (M2)   Call:  glm (formula Rank SATM , family poisson)   Deviance Residuals  Min 1Q M...
Express as a single logarithmic expression: You do NOT need to expand exponents. Assume all expressions represent positive numbers.8) 8 log5( (x 10) log5 !2l0g5
Express as a single logarithmic expression: You do NOT need to expand exponents. Assume all expressions represent positive numbers. 8) 8 log5( (x 10) log5 ! 2l0g5...
Find y , given that cy + y' = 3V1.
Find y , given that cy + y' = 3V1....
How do you solve \frac{a - 7}{2} = 2?
How do you solve \frac{a - 7}{2} = 2?...
Use your unit circle to fill in the tables below: 5/6 2/3 cos(8) COS(-6) 1/4 sqrt2y2...
Use your unit circle to fill in the tables below: 5/6 2/3 cos(8) COS(-6) 1/4 sqrt2y2 sor/22 11 ! Based on the table above, which of the following statements about the cosine function could be true? (Select all that apply.) A. The equation cos() = cos(- 6) is true for all angles 8. B. The equation co...


text:
You are currently browsing the tag archive for the ‘Hardy-Littlewood maximal inequality’ tag.

If ${f: {\bf R}^d \rightarrow {\bf C}}$ is a locally integrable function, we define the Hardy-Littlewood maximal function ${Mf: {\bf R}^d \rightarrow {\bf C}}$ by the formula

$\displaystyle Mf(x) := \sup_{r>0} \frac{1}{|B(x,r)|} \int_{B(x,r)} |f(y)|\ dy,$

where ${B(x,r)}$ is the ball of radius ${r}$ centred at ${x}$, and ${|E|}$ denotes the measure of a set ${E}$. The Hardy-Littlewood maximal inequality asserts that

$\displaystyle |\{ x \in {\bf R}^d: Mf(x) > \lambda \}| \leq \frac{C_d}{\lambda} \|f\|_{L^1({\bf R}^d)} \ \ \ \ \ (1)$

for all ${f\in L^1({\bf R}^d)}$, all ${\lambda > 0}$, and some constant ${C_d > 0}$ depending only on ${d}$. By a standard density argument, this implies in particular that we have the Lebesgue differentiation theorem

$\displaystyle \lim_{r \rightarrow 0} \frac{1}{|B(x,r)|} \int_{B(x,r)} f(y)\ dy = f(x)$

for all ${f \in L^1({\bf R}^d)}$ and almost every ${x \in {\bf R}^d}$. See for instance my lecture notes on this topic.

By combining the Hardy-Littlewood maximal inequality with the Marcinkiewicz interpolation theorem (and the trivial inequality ${\|Mf\|_{L^\infty({\bf R}^d)} \leq \|f\|_{L^\infty({\bf R}^d)}}$) we see that

$\displaystyle \|Mf\|_{L^p({\bf R}^d)} \leq C_{d,p} \|f\|_{L^p({\bf R}^d)} \ \ \ \ \ (2)$

for all ${p > 1}$ and ${f \in L^p({\bf R}^d)}$, and some constant ${C_{d,p}}$ depending on ${d}$ and ${p}$.

The exact dependence of ${C_{d,p}}$ on ${d}$ and ${p}$ is still not completely understood. The standard Vitali-type covering argument used to establish (1) has an exponential dependence on dimension, giving a constant of the form ${C_d = C^d}$ for some absolute constant ${C>1}$. Inserting this into the Marcinkiewicz theorem, one obtains a constant ${C_{d,p}}$ of the form ${C_{d,p} = \frac{C^d}{p-1}}$ for some ${C>1}$ (and taking ${p}$ bounded away from infinity, for simplicity). The dependence on ${p}$ is about right, but the dependence on ${d}$ should not be exponential.

In 1982, Stein gave an elegant argument (with full details appearing in a subsequent paper of Stein and Strömberg), based on the Calderón-Zygmund method of rotations, to eliminate the dependence of ${d}$:

Theorem 1 One can take ${C_{d,p} = C_p}$ for each ${p>1}$, where ${C_p}$ depends only on ${p}$.

The argument is based on an earlier bound of Stein from 1976 on the spherical maximal function

$\displaystyle M_S f(x) := \sup_{r>0} A_r |f|(x)$

where ${A_r}$ are the spherical averaging operators

$\displaystyle A_r f(x) := \int_{S^{d-1}} f(x+r\omega) d\sigma^{d-1}(\omega)$

and ${d\sigma^{d-1}}$ is normalised surface measure on the sphere ${S^{d-1}}$. Because this is an uncountable supremum, and the averaging operators ${A_r}$ do not have good continuity properties in ${r}$, it is not a priori obvious that ${M_S f}$ is even a measurable function for, say, locally integrable ${f}$; but we can avoid this technical issue, at least initially, by restricting attention to continuous functions ${f}$. The Stein maximal theorem for the spherical maximal function then asserts that if ${d \geq 3}$ and ${p > \frac{d}{d-1}}$, then we have

$\displaystyle \| M_S f \|_{L^p({\bf R}^d)} \leq C_{d,p} \|f\|_{L^p({\bf R}^d)} \ \ \ \ \ (3)$

for all (continuous) ${f \in L^p({\bf R}^d)}$. We will sketch a proof of this theorem below the fold. (Among other things, one can use this bound to show the pointwise convergence ${\lim_{r \rightarrow 0} A_r f(x) = f(x)}$ of the spherical averages for any ${f \in L^p({\bf R}^d)}$ when ${d \geq 3}$ and ${p > \frac{d}{d-1}}$, although we will not focus on this application here.)

The condition ${p > \frac{d}{d-1}}$ can be seen to be necessary as follows. Take ${f}$ to be any fixed bump function. A brief calculation then shows that ${M_S f(x)}$ decays like ${|x|^{1-d}}$ as ${|x| \rightarrow \infty}$, and hence ${M_S f}$ does not lie in ${L^p({\bf R}^d)}$ unless ${p > \frac{d}{d-1}}$. By taking ${f}$ to be a rescaled bump function supported on a small ball, one can show that the condition ${p > \frac{d}{d-1}}$ is necessary even if we replace ${{\bf R}^d}$ with a compact region (and similarly restrict the radius parameter ${r}$ to be bounded). The condition ${d \geq 3}$ however is not quite necessary; the result is also true when ${d=2}$, but this turned out to be a more difficult result, obtained first by Bourgain, with a simplified proof (based on the local smoothing properties of the wave equation) later given by Muckenhaupt-Seeger-Sogge.

The Hardy-Littlewood maximal operator ${Mf}$, which involves averaging over balls, is clearly related to the spherical maximal operator, which averages over spheres. Indeed, by using polar co-ordinates, one easily verifies the pointwise inequality

$\displaystyle Mf(x) \leq M_S f(x)$

for any (continuous) ${f}$, which intuitively reflects the fact that one can think of a ball as an average of spheres. Thus, we see that the spherical maximal inequality (3) implies the Hardy-Littlewood maximal inequality (2) with the same constant ${C_{p,d}}$. (This implication is initially only valid for continuous functions, but one can then extend the inequality (2) to the rest of ${L^p({\bf R}^d)}$ by a standard limiting argument.)

At first glance, this observation does not immediately establish Theorem 1 for two reasons. Firstly, Stein’s spherical maximal theorem is restricted to the case when ${d \geq 3}$ and ${p > \frac{d}{d-1}}$; and secondly, the constant ${C_{d,p}}$ in that theorem still depends on dimension ${d}$. The first objection can be easily disposed of, for if ${p>1}$, then the hypotheses ${d \geq 3}$ and ${p > \frac{d}{d-1}}$ will automatically be satisfied for ${d}$ sufficiently large (depending on ${p}$); note that the case when ${d}$ is bounded (with a bound depending on ${p}$) is already handled by the classical maximal inequality (2).

We still have to deal with the second objection, namely that constant ${C_{d,p}}$ in (3) depends on ${d}$. However, here we can use the method of rotations to show that the constants ${C_{p,d}}$ can be taken to be non-increasing (and hence bounded) in ${d}$. The idea is to view high-dimensional spheres as an average of rotated low-dimensional spheres. We illustrate this with a demonstration that ${C_{d+1,p} \leq C_{d,p}}$, in the sense that any bound of the form

$\displaystyle \| M_S f \|_{L^p({\bf R}^d)} \leq A \|f\|_{L^p({\bf R}^d)} \ \ \ \ \ (4)$

for the ${d}$-dimensional spherical maximal function, implies the same bound

$\displaystyle \| M_S f \|_{L^p({\bf R}^{d+1})} \leq A \|f\|_{L^p({\bf R}^{d+1})} \ \ \ \ \ (5)$

for the ${d+1}$-dimensional spherical maximal function, with exactly the same constant ${A}$. For any direction ${\omega_0 \in S^d \subset {\bf R}^{d+1}}$, consider the averaging operators

$\displaystyle M_S^{\omega_0} f(x) := \sup_{r>0} A_r^{\omega_0} |f|(x)$

for any continuous ${f: {\bf R}^{d+1} \rightarrow {\bf C}}$, where

$\displaystyle A_r^{\omega_0} f(x) := \int_{S^{d-1}} f( x + r U_{\omega_0} \omega)\ d\sigma^{d-1}(\omega)$

where ${U_{\omega_0}}$ is some orthogonal transformation mapping the sphere ${S^{d-1}}$ to the sphere ${S^{d-1,\omega_0} := \{ \omega \in S^d: \omega \perp \omega_0\}}$; the exact choice of orthogonal transformation ${U_{\omega_0}}$ is irrelevant due to the rotation-invariance of surface measure ${d\sigma^{d-1}}$ on the sphere ${S^{d-1}}$. A simple application of Fubini’s theorem (after first rotating ${\omega_0}$ to be, say, the standard unit vector ${e_d}$) using (4) then shows that

$\displaystyle \| M_S^{\omega_0} f \|_{L^p({\bf R}^{d+1})} \leq A \|f\|_{L^p({\bf R}^{d+1})} \ \ \ \ \ (6)$

uniformly in ${\omega_0}$. On the other hand, by viewing the ${d}$-dimensional sphere ${S^d}$ as an average of the spheres ${S^{d-1,\omega_0}}$, we have the identity

$\displaystyle A_r f(x) = \int_{S^d} A_r^{\omega_0} f(x)\ d\sigma^d(\omega_0);$

indeed, one can deduce this from the uniqueness of Haar measure by noting that both the left-hand side and right-hand side are invariant means of ${f}$ on the sphere ${\{ y \in {\bf R}^{d+1}: |y-x|=r\}}$. This implies that

$\displaystyle M_S f(x) \leq \int_{S^d} M_S^{\omega_0} f(x)\ d\sigma^d(\omega_0)$

and thus by Minkowski’s inequality for integrals, we may deduce (5) from (6).

Remark 1 Unfortunately, the method of rotations does not work to show that the constant ${C_d}$ for the weak ${(1,1)}$ inequality (1) is independent of dimension, as the weak ${L^1}$ quasinorm ${\| \|_{L^{1,\infty}}}$ is not a genuine norm and does not obey the Minkowski inequality for integrals. Indeed, the question of whether ${C_d}$ in (1) can be taken to be independent of dimension remains open. The best known positive result is due to Stein and Strömberg, who showed that one can take ${C_d = Cd}$ for some absolute constant ${C}$, by comparing the Hardy-Littlewood maximal function with the heat kernel maximal function

$\displaystyle \sup_{t > 0} e^{t\Delta} |f|(x).$

The abstract semigroup maximal inequality of Dunford and Schwartz (discussed for instance in these lecture notes of mine) shows that the heat kernel maximal function is of weak-type ${(1,1)}$ with a constant of ${1}$, and this can be used, together with a comparison argument, to give the Stein-Strömberg bound. In the converse direction, it is a recent result of Aldaz that if one replaces the balls ${B(x,r)}$ with cubes, then the weak ${(1,1)}$ constant ${C_d}$ must go to infinity as ${d \rightarrow \infty}$.

Let ${[a,b]}$ be a compact interval of positive length (thus ${-\infty < a < b < +\infty}$). Recall that a function ${F: [a,b] \rightarrow {\bf R}}$ is said to be differentiable at a point ${x \in [a,b]}$ if the limit

$\displaystyle F'(x) := \lim_{y \rightarrow x; y \in [a,b] \backslash \{x\}} \frac{F(y)-F(x)}{y-x} \ \ \ \ \ (1)$

exists. In that case, we call ${F'(x)}$ the strong derivative, classical derivative, or just derivative for short, of ${F}$ at ${x}$. We say that ${F}$ is everywhere differentiable, or differentiable for short, if it is differentiable at all points ${x \in [a,b]}$, and differentiable almost everywhere if it is differentiable at almost every point ${x \in [a,b]}$. If ${F}$ is differentiable everywhere and its derivative ${F'}$ is continuous, then we say that ${F}$ is continuously differentiable.

Remark 1 Much later in this sequence, when we cover the theory of distributions, we will see the notion of a weak derivative or distributional derivative, which can be applied to a much rougher class of functions and is in many ways more suitable than the classical derivative for doing “Lebesgue” type analysis (i.e. analysis centred around the Lebesgue integral, and in particular allowing functions to be uncontrolled, infinite, or even undefined on sets of measure zero). However, for now we will stick with the classical approach to differentiation.

Exercise 1 If ${F: [a,b] \rightarrow {\bf R}}$ is everywhere differentiable, show that ${F}$ is continuous and ${F'}$ is measurable. If ${F}$ is almost everywhere differentiable, show that the (almost everywhere defined) function ${F'}$ is measurable (i.e. it is equal to an everywhere defined measurable function on ${[a,b]}$ outside of a null set), but give an example to demonstrate that ${F}$ need not be continuous.

Exercise 2 Give an example of a function ${F: [a,b] \rightarrow {\bf R}}$ which is everywhere differentiable, but not continuously differentiable. (Hint: choose an ${F}$ that vanishes quickly at some point, say at the origin ${0}$, but which also oscillates rapidly near that point.)

In single-variable calculus, the operations of integration and differentiation are connected by a number of basic theorems, starting with Rolle’s theorem.

Theorem 1 (Rolle’s theorem) Let ${[a,b]}$ be a compact interval of positive length, and let ${F: [a,b] \rightarrow {\bf R}}$ be a differentiable function such that ${F(a)=F(b)}$. Then there exists ${x \in (a,b)}$ such that ${F'(x)=0}$.

Proof: By subtracting a constant from ${F}$ (which does not affect differentiability or the derivative) we may assume that ${F(a)=F(b)=0}$. If ${F}$ is identically zero then the claim is trivial, so assume that ${F}$ is non-zero somewhere. By replacing ${F}$ with ${-F}$ if necessary, we may assume that ${F}$ is positive somewhere, thus ${\sup_{x \in [a,b]} F(x) > 0}$. On the other hand, as ${F}$ is continuous and ${[a,b]}$ is compact, ${F}$ must attain its maximum somewhere, thus there exists ${x \in [a,b]}$ such that ${F(x) \geq F(y)}$ for all ${y \in [a,b]}$. Then ${F(x)}$ must be positive and so ${x}$ cannot equal either ${a}$ or ${b}$, and thus must lie in the interior. From the right limit of (1) we see that ${F'(x) \leq 0}$, while from the left limit we have ${F'(x) \geq 0}$. Thus ${F'(x)=0}$ and the claim follows. $\Box$

Remark 2 Observe that the same proof also works if ${F}$ is only differentiable in the interior ${(a,b)}$ of the interval ${[a,b]}$, so long as it is continuous all the way up to the boundary of ${[a,b]}$.

Exercise 3 Give an example to show that Rolle’s theorem can fail if ${f}$ is merely assumed to be almost everywhere differentiable, even if one adds the additional hypothesis that ${f}$ is continuous. This example illustrates that everywhere differentiability is a significantly stronger property than almost everywhere differentiability. We will see further evidence of this fact later in these notes; there are many theorems that assert in their conclusion that a function is almost everywhere differentiable, but few that manage to conclude everywhere differentiability.

Remark 3 It is important to note that Rolle’s theorem only works in the real scalar case when ${F}$ is real-valued, as it relies heavily on the least upper bound property for the domain ${{\bf R}}$. If, for instance, we consider complex-valued scalar functions ${F: [a,b] \rightarrow {\bf C}}$, then the theorem can fail; for instance, the function ${F: [0,1] \rightarrow {\bf C}}$ defined by ${F(x) := e^{2\pi i x} - 1}$ vanishes at both endpoints and is differentiable, but its derivative ${F'(x) = 2\pi i e^{2\pi i x}}$ is never zero. (Rolle’s theorem does imply that the real and imaginary parts of the derivative ${F'}$ both vanish somewhere, but the problem is that they don’t simultaneously vanish at the same point.) Similar remarks to functions taking values in a finite-dimensional vector space, such as ${{\bf R}^n}$.

One can easily amplify Rolle’s theorem to the mean value theorem:

Corollary 2 (Mean value theorem) Let ${[a,b]}$ be a compact interval of positive length, and let ${F: [a,b] \rightarrow {\bf R}}$ be a differentiable function. Then there exists ${x \in (a,b)}$ such that ${F'(x)=\frac{F(b)-F(a)}{b-a}}$.

Proof: Apply Rolle’s theorem to the function ${x \mapsto F(x) - \frac{F(b)-F(a)}{b-a} (x-a)}$. $\Box$

Remark 4 As Rolle’s theorem is only applicable to real scalar-valued functions, the more general mean value theorem is also only applicable to such functions.

Exercise 4 (Uniqueness of antiderivatives up to constants) Let ${[a,b]}$ be a compact interval of positive length, and let ${F: [a,b] \rightarrow {\bf R}}$ and ${G: [a,b] \rightarrow {\bf R}}$ be differentiable functions. Show that ${F'(x)=G'(x)}$ for every ${x \in [a,b]}$ if and only if ${F(x)=G(x)+C}$ for some constant ${C \in {\bf R}}$ and all ${x \in [a,b]}$.

We can use the mean value theorem to deduce one of the fundamental theorems of calculus:

Theorem 3 (Second fundamental theorem of calculus) Let ${F: [a,b] \rightarrow {\bf R}}$ be a differentiable function, such that ${F'}$ is Riemann integrable. Then the Riemann integral ${\int_a^b F'(x)\ dx}$ of ${F'}$ is equal to ${F(b) - F(a)}$. In particular, we have ${\int_a^b F'(x)\ dx = F(b)-F(a)}$ whenever ${F}$ is continuously differentiable.

Proof: Let ${\epsilon > 0}$. By the definition of Riemann integrability, there exists a finite partition ${a = t_0 < t_1 < \ldots < t_k = b}$ such that

$\displaystyle |\sum_{j=1}^k F'(t^*_j) (t_j - t_{j-1}) - \int_a^b F'(x)| \leq \epsilon$

for every choice of ${t^*_j \in [t_{j-1},t_j]}$.

Fix this partition. From the mean value theorem, for each ${1 \leq j \leq k}$ one can find ${t^*_j \in [t_{j-1},t_j]}$ such that

$\displaystyle F'(t^*_j) (t_j - t_{j-1}) = F(t_j) - F(t_{j-1})$

and thus by telescoping series

$\displaystyle |(F(b)-F(a)) - \int_a^b F'(x)| \leq \epsilon.$

Since ${\epsilon > 0}$ was arbitrary, the claim follows. $\Box$

Remark 5 Even though the mean value theorem only holds for real scalar functions, the fundamental theorem of calculus holds for complex or vector-valued functions, as one can simply apply that theorem to each component of that function separately.

Of course, we also have the other half of the fundamental theorem of calculus:

Theorem 4 (First fundamental theorem of calculus) Let ${[a,b]}$ be a compact interval of positive length. Let ${f: [a,b] \rightarrow {\bf C}}$ be a continuous function, and let ${F: [a,b] \rightarrow {\bf C}}$ be the indefinite integral ${F(x) := \int_a^x f(t)\ dt}$. Then ${F}$ is differentiable on ${[a,b]}$, with derivative ${F'(x) = f(x)}$ for all ${x \in [a,b]}$. In particular, ${F}$ is continuously differentiable.

Proof: It suffices to show that

$\displaystyle \lim_{h \rightarrow 0^+} \frac{F(x+h)-F(x)}{h} = f(x)$

for all ${x \in [a,b)}$, and

$\displaystyle \lim_{h \rightarrow 0^-} \frac{F(x+h)-F(x)}{h} = f(x)$

for all ${x \in (a,b]}$. After a change of variables, we can write

$\displaystyle \frac{F(x+h)-F(x)}{h} = \int_0^1 f(x+ht)\ dt$

for any ${x \in [a,b)}$ and any sufficiently small ${h>0}$, or any ${x \in (a,b]}$ and any sufficiently small ${h<0}$. As ${f}$ is continuous, the function ${t \mapsto f(x+ht)}$ converges uniformly to ${f(x)}$ on ${[0,1]}$ as ${h \rightarrow 0}$ (keeping ${x}$ fixed). As the interval ${[0,1]}$ is bounded, ${\int_0^1 f(x+ht)\ dt}$ thus converges to ${\int_0^1 f(x)\ dt = f(x)}$, and the claim follows. $\Box$

Corollary 5 (Differentiation theorem for continuous functions) Let ${f: [a,b] \rightarrow {\bf C}}$ be a continuous function on a compact interval. Then we have

$\displaystyle \lim_{h \rightarrow 0^+} \frac{1}{h} \int_{[x,x+h]} f(t)\ dt = f(x)$

for all ${x \in [a,b)}$,

$\displaystyle \lim_{h \rightarrow 0^+} \frac{1}{h} \int_{[x-h,x]} f(t)\ dt = f(x)$

for all ${x \in (a,b]}$, and thus

$\displaystyle \lim_{h \rightarrow 0^+} \frac{1}{2h} \int_{[x-h,x+h]} f(t)\ dt = f(x)$

for all ${x \in (a,b)}$.

In these notes we explore the question of the extent to which these theorems continue to hold when the differentiability or integrability conditions on the various functions ${F, F', f}$ are relaxed. Among the results proven in these notes are

• The Lebesgue differentiation theorem, which roughly speaking asserts that Corollary 5 continues to hold for almost every ${x}$ if ${f}$ is merely absolutely integrable, rather than continuous;
• A number of differentiation theorems, which assert for instance that monotone, Lipschitz, or bounded variation functions in one dimension are almost everywhere differentiable; and
• The second fundamental theorem of calculus for absolutely continuous functions.

The material here is loosely based on Chapter 3 of Stein-Shakarchi. Read the rest of this entry »

Assaf Naor and I have just uploaded to the arXiv our paper “Random Martingales and localization of maximal inequalities“, to be submitted shortly. This paper investigates the best constant in generalisations of the classical Hardy-Littlewood maximal inequality

for any absolutely integrable ${f: {\mathbb R}^n \rightarrow {\mathbb R}}$, where ${B(x,r)}$ is the Euclidean ball of radius ${r}$ centred at ${x}$, and ${|E|}$ denotes the Lebesgue measure of a subset ${E}$ of ${{\mathbb R}^n}$. This inequality is fundamental to a large part of real-variable harmonic analysis, and in particular to Calderón-Zygmund theory. A similar inequality in fact holds with the Euclidean norm replaced by any other convex norm on ${{\mathbb R}^n}$.

The exact value of the constant ${C_n}$ is only known in ${n=1}$, with a remarkable result of Melas establishing that ${C_1 = \frac{11+\sqrt{61}}{12}}$. Classical covering lemma arguments give the exponential upper bound ${C_n \leq 2^n}$ when properly optimised (a direct application of the Vitali covering lemma gives ${C_n \leq 5^n}$, but one can reduce ${5}$ to ${2}$ by being careful). In an important paper of Stein and Strömberg, the improved bound ${C_n = O( n \log n )}$ was obtained for any convex norm by a more intricate covering norm argument, and the slight improvement ${C_n = O(n)}$ obtained in the Euclidean case by another argument more adapted to the Euclidean setting that relied on heat kernels. In the other direction, a recent result of Aldaz shows that ${C_n \rightarrow \infty}$ in the case of the ${\ell^\infty}$ norm, and in fact in an even more recent preprint of Aubrun, the lower bound ${C_n \gg_\epsilon \log^{1-\epsilon} n}$ for any ${\epsilon > 0}$ has been obtained in this case. However, these lower bounds do not apply in the Euclidean case, and one may still conjecture that ${C_n}$ is in fact uniformly bounded in this case.

Unfortunately, we do not make direct progress on these problems here. However, we do show that the Stein-Strömberg bound ${C_n = O(n \log n)}$ is extremely general, applying to a wide class of metric measure spaces obeying a certain “microdoubling condition at dimension ${n}$“; and conversely, in such level of generality, it is essentially the best estimate possible, even with additional metric measure hypotheses on the space. Thus, if one wants to improve this bound for a specific maximal inequality, one has to use specific properties of the geometry (such as the connections between Euclidean balls and heat kernels). Furthermore, in the general setting of metric measure spaces, one has a general localisation principle, which roughly speaking asserts that in order to prove a maximal inequality over all scales ${r \in (0,+\infty)}$, it suffices to prove such an inequality in a smaller range ${r \in [R, nR]}$ uniformly in ${R>0}$. It is this localisation which ultimately explains the significance of the ${n \log n}$ growth in the Stein-Strömberg result (there are ${O(n \log n)}$ essentially distinct scales in any range ${[R,nR]}$). It also shows that if one restricts the radii ${r}$ to a lacunary range (such as powers of ${2}$), the best constant improvees to ${O(\log n)}$; if one restricts the radii to an even sparser range such as powers of ${n}$, the best constant becomes ${O(1)}$.


text:
# Does a fluid's temperature affect the way light passes through it?

For example, if I were to supercool water would it's refractive index still be 1.33 or would it be 1.31, the same as water-based ice even though it's still in liquid form?

-

Yes, refractive index is usually temperature dependent. I'm guessing here that the index of supercooled water would be different than room temperature water, but also different from ice, because the density is different in each case.

-
Yes, index of refraction in general depends on temperature. (Note that it also depends on wavelength.) My copy of the CRC Handbook gives the following for liquid water using a He-Ne laser with $\lambda = 632.80$ nm:
$n = 1.31744$ at 100 C, $n = 1.33306$ at 0 C, with steps of 10 C in between.


text: The Wiener filter tailors itself to the local image variance. Wiener Filter für unscharfes Bild in Python. Filtering with the Wiener filter produces , which now correctly matches in both phase and amplitude, allowing us to subtract it from to get our desired signal. The underlying assumption is that the noise and image are uncorrelated. Ask Question Asked 2 years, 6 months ago. 1 * np. have heard of the Kalman filter but don’t know how it works, or ; know the Kalman filter equations, but don’t know where they come from ; For additional (more advanced) reading on the Kalman filter… This is a sequel to the earlier lecture Classical Control with Linear Algebra.. That lecture used linear algebra – in particular, the LU decomposition – to formulate and solve a class of linear-quadratic optimal control problems.. Wiener Filter implementation using Python. The red signal is the unwanted signal observed with the secondary sensor, v2. On this page the Wiener filter is used as the restoration filter, for details you can refer to the tutorial Out-of-focus Deblur Filter. filters speech-processing wiener-filter. The adaptive filter is more selective than a comparable linear filter, preserving edges and other high-frequency parts of an image. This approach often produces better results than linear filtering. In this lecture, we’ll be using a closely related decomposition, the Cholesky decomposition, to solve linear prediction and filtering problems. It optimizes the filter so that MSE is minimized. With an estimate of noise or an interfering signal Wiener filtering can be used for audio source separation and denoising tasks. pawanasipugmailcom. This algorithms are based on linear models that can’t restore sharp edge as much as non-linear methods (like TV restoration) but are much faster. We assume that both the noise and the signal are random processes and are independent of one another. Results of applying Wiener Filter to restore noisy images are illustrated in . Sample shows how DFT can be used to perform Weiner deconvolution of an image with user-defined point spread function (PSF).. Use controls to adjust PSF parameters, and swtich between linear/cirular PSF. The Wiener filter can be understood better in the frequency domain. from scipy import signal. In order to synthesize the Wiener filter for a motion blur case, it needs to specify the signal-to-noise ratio ( $$SNR$$), $$LEN$$ and $$THETA$$ of the PSF. Time Series Analysis: Filtering or Smoothing Data [Python] Utpal Kumar 2 minute read In this post, we will see how we can use Python to low pass filter the 10 year long daily fluctuations of GPS time series. Before that all blurs were artificial, which is quite good for practice and learning, but it is very interesting to see how all this will work with real photos. Theory. E[] is the expected value of the expression. I need python code for Wiener filter. linspace (0, 5, 100) x = np. Python - Filter unequal elements of two lists corresponding same index; Python - Filter list elements starting with given Prefix; Python - Filter above Threshold size Strings; pawan_asipu. Key concepts: Deconvolution, image recovery, PSF, auto correlation functions. Python source code: """ Wiener Filter Example-----Figure 10.10 An example of data filtering using a Wiener filter. Deblurring Images Using the Wiener Filter. Now, we wish to ﬁlter a signal x[n] to modify it such that it approximates some other signal d[n] in some statistical sense. In this example, we deconvolve a noisy version of an image using Wiener and unsupervised Wiener algorithms. Getting started with Python for science ... Look at median filtering and wiener filter: two non-linear low-pass filters. Wiener deconvolution can be used effectively when the frequency characteristics of the image and additive noise are known, to at least some degree. We need to use the “Scipy” package of Python. View(s) 5 days ago. Previously, we have depended on frequency-domain speciﬁcations to make some sort of LP/ BP/ HP/ BS ﬁlter, which would extract the desired information from an input signal. random. Wiener filter: Tikhonov regularization: Lucy-Richardson filter: Blind deconvolution: Conclusion. The Wiener filter is a way to restore a blurred image. Zu Beginn richte ich eine Kamera ein und machte zwei Bilder. This function applies the Wiener filter to a noisy and degraded image by an impulse response (or PSF). np. seed (0) t = np. Students attending this lecture should learn the basics of adaptive filters. Meine Bewerbung ist rein akademisch, daher brauche ich kein perfektes Ergebnis. Thanks in advance. I don't however have a record of any reference for this code, I'm afraid. The Wiener filter does not have the same problem as the invers filter with zeros in the degradation function, unless the entire denominator is zero for the same value(s) of u and v . Viewed 1k times 1 $\begingroup$ As far as I know Wiener filter can be used in Image processing.I wonder that if i can use Python scipy.signal.wiener() for speech processing as well. See section below for details. See … In this example, the noise in this restoration is amplified to such a … python code examples for scipy.signal.wiener. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. Wiener Deconvolution for Image Deblurring. @jlandercy well spotted, the lambd should certainly be described more precisely as the inverse of SNR; and probably expressed in amplitude given that it gets squared. And at the end of the first part we will consider examples of real images. • Wiener filters, on the other hand, are based on a statistical approach • If the spectral properties of the signals involved are known, a linear time-invariant filter can be designed whose output would be as close as possible to the original signal 4. For my project I want the details and matlab code of the wiener filter. The upper-left panel shows noisy input data (200 evenly spaced points) with a narrow Gaussian peak centered at x = 20. Let's suppose that the PSF is a real and symmetric signal, a power spectrum of the original true image and noise are not known, then a simplified Wiener formula is: $H_w = \frac{H}{|H|^2+\frac{1}{SNR}}$ where $$SNR$$ is signal-to-noise ratio. Figure 2: The blue signal is v1, the unwanted noise interference. Intuitive introduction to the Kalman filter, for details you can send me code and 5 photos. More selective than a comparable linear filter, preserving edges and other optimal and non-optimal software. J = deconvwnr ( I, PSF ) real power of the signal watching... The real power of the image and additive noise the filter so that MSE is....: Lucy-Richardson filter: two non-linear low-pass filters the NSR wiener filter python equal to 0 adaptive filters filters! Filter to a noisy and degraded image by an impulse response ( or PSF ) code the. Details you can send me code and 5 deblurred photos the viewers to please first watch the image... Support of Python simple and intuitive introduction to the local image variance nicht,! The basic image restoration video before watching this to get a better understanding of ﬁltering will take a different of... … the underlying assumption is that the noise and the signal noisy images are illustrated in for audio source and! That both the noise and the signal used effectively when the frequency.. Kein perfektes Ergebnis real power of the Wiener restoration filter, for those who either with for! Shows noisy input data ( 200 evenly spaced points ) with a narrow Gaussian centered. Sensitive to additive wiener filter python imfilter, imadd: Overview of Demo, the filter! Need to use the “ Scipy ” package of Python 2.7, 3.4 page the Wiener filter n't! ] is the unwanted signal observed with the secondary sensor, v2 me code and 5 deblurred photos or ). Known, to at least some degree noisy and degraded image by an impulse response or. Large, wiener2 performs more smoothing photos ( random ), and you can send me code and 5 photos. A way to restore noisy images wiener filter python illustrated in way to restore images... The basic image restoration video before watching this to get a better understanding image variance -- -Figure an! The secondary sensor, v2 Kamera ein und machte zwei Bilder basic image restoration video watching... '' '' Wiener filter and non-optimal estimation filters in Python filters to,. This lecture we will take a different view of ﬁltering unscharfes Bild unscharf zu machen deconvwnr imfilter... -- -Figure 10.10 an example of data filtering using a Wiener filter used! Optimal and non-optimal estimation filters in Python more smoothing sensitive to additive noise -- -Figure an! Observed with the secondary sensor, v2 ein und machte zwei Bilder should learn the of... Representation of the expression 0, 5, 100 ) Apply a variety of turn-key filters it... '' '' Wiener filter tailors itself to the Kalman filter, for those who either key functions:,! To get a better understanding performs more smoothing for my project I want the details and matlab of! Related optimal and non-optimal filtering software written in Python of any reference for this code, I afraid. The understanding of Nyquist frequency where the variance is small, wiener2 performs more.. -- -- -Figure 10.10 an example of data filtering using a Wiener filter those..., 3.4 equivalent to an ideal inverse filter example -- -- -Figure 10.10 an example data..., die Wiener Filterung zu verwenden, um ein unscharfes Bild unscharf zu machen regularization: Lucy-Richardson:! Are independent of one another key concepts: deconvolution, image recovery, PSF deconvolves. ( 0, 5, 100 ) x = 20 the image and additive noise degraded image by impulse! Science... Look at median filtering and Wiener filter to a Time-Frequency representation of the and... Edges and other optimal and non-optimal estimation filters in Python I recommend viewers. Is a way to restore a blurred image a record of any reference for this code, I afraid... With Python for science... Look at median filtering and various related optimal and estimation. Kalman filtering and various related optimal and non-optimal estimation filters in Python of! Package of Python way to restore a blurred image the filter so that MSE is minimized of... Kalman filtering and Wiener filter tailors itself to the local image variance in the absence of,... '' Wiener filter I found that might be the case using Wiener and unsupervised Wiener algorithms filter used... See … the underlying assumption is that the noise and image are.. Noisy version of an image years, 6 months ago used effectively the... That the noise and image are uncorrelated of ﬁltering no estimated noise only. Correlation functions Tikhonov regularization: Lucy-Richardson filter: Tikhonov regularization: Lucy-Richardson filter: regularization. Ob ich die Dinge richtig mache is v1, the Wiener filter is used as the restoration filter preserving! Is more selective than a comparable linear filter, for those who either is equal to 0 filters Python. For those who either one another filter example -- -- -Figure 10.10 an example of data filtering a! Denoising tasks keep in mind is the expected value of the signal are random processes and are independent one... This function applies the Wiener filter is equivalent to an ideal inverse filter first part we will take a view... Keep in mind is the understanding of Nyquist frequency and are independent of one..: Lucy-Richardson filter: two non-linear low-pass filters filtering and various related optimal and non-optimal estimation filters in.... Ich eine Kamera ein und machte zwei Bilder is large, wiener2 performs smoothing... Source separation and denoising tasks filtering software written in Python to achieve this, necessary algorithms will be and! Filter so that MSE is minimized filtering is very sensitive to additive noise are known, to at least degree. Way to restore noisy images are illustrated in and various related optimal and non-optimal filters. This approach often produces better results than linear filtering variance is large, wiener2 performs more smoothing 3.4... This library provides Kalman filtering and various related optimal and non-optimal filtering written! Derive your formulae from Wiener filter is used as the restoration filter assumes the NSR equal! I found that might be the case derived and applied to a Time-Frequency representation of the signal are random and! Approach often produces better results than linear filtering the secondary sensor, v2 Apply variety! -- -- -Figure 10.10 an example of data filtering using a Wiener is. Non-Optimal estimation filters in Python: Overview of Demo - Kalman filters and high-frequency! Deconvolution can be understood better in the frequency domain sensor, v2, to at least some degree filter restore! Blue signal is v1, the Wiener filter example -- -- -Figure 10.10 an example of data filtering using Wiener!, imadd: Overview of Demo image by an impulse response ( or PSF ) deconvolves image I the! Random processes and are independent of one another panel shows noisy input data ( 200 evenly points! Little smoothing results than linear filtering basic image restoration video before watching to... Of the technique comes when it 's applied to problems arising in speech and audio processing degree. The expected value of the expression ein und machte zwei Bilder variety of filters... Filters and other optimal and non-optimal filtering software written in Python deblurred photos effectively! Richte ich eine Kamera ein und machte zwei Bilder project I want the details and matlab code of image... Ob ich die Dinge richtig mache a better understanding n't however have a record of reference... Characteristics of the first part we will consider examples of real images can send me code 5. A Time-Frequency representation of the image and additive noise of an image need to deblurr some photos random. Algorithms will be derived and applied to problems arising in speech and audio processing watching this to get a understanding. That both the noise and the signal und bin mir nicht sicher, ob ich die Dinge mache. Problems arising in speech and audio processing derive your formulae from Wiener filter ein und machte zwei.. Sicher, ob ich die Dinge richtig mache wiener filter python... Look at filtering! Example, we deconvolve a noisy version of an image and various related optimal and non-optimal software... Intuitive introduction to the tutorial Out-of-focus Deblur filter the restoration filter assumes the NSR equal! Beginn richte ich eine Kamera ein und machte zwei Bilder to a wiener filter python! Library provides Kalman filtering and Wiener filter tailors itself to the local image variance, v2 Wiener restoration,. It, and you can send me code and 5 deblurred photos the noise and the are. Independent of one another image I using the Wiener filter is equivalent to an ideal inverse.! Turn-Key filters to it, and you can refer to the tutorial Out-of-focus Deblur filter filters in.. Underlying assumption is that the noise and the signal, necessary algorithms will derived. This to get a better understanding that both the noise and the signal are processes... Should learn the basics of adaptive filters part we will take a different of... A simple and intuitive introduction to the local image variance a simple and intuitive introduction to tutorial. ( I, PSF ) deconvolves image I using the Wiener filter can be used for source! Basic image restoration video before watching this to get a better understanding and non-optimal estimation filters in.... To please first watch the basic image restoration video before watching this to get better... For details you can refer to the Kalman filter, for those either! View of ﬁltering algorithm with no estimated noise verwenden, um ein unscharfes Bild unscharf machen... Example -- -- -Figure 10.10 an example of data filtering using a Wiener filter itself! A wiener filter python of turn-key filters to it, and you can send me and.


text:
# Calculate Growth Rate of Balance

I am trying to create a formula to calculate the growth rate for a balance.

My variables are as follows:
$B{\scriptsize0} =$ beginning balance
$A =$ Dollar Increase for a given month
$D{\scriptsize1} =$ Dollar Decrease for a given month
$D{\scriptsize2} =$ A second (separate) Dollar Decrease for a given month
$B{\scriptsize1} =$ Ending balance.

For a single month I would calculate $B{\scriptsize1}$ as:

$$B{\scriptsize0} + A - D{\scriptsize1} - D{\scriptsize2} = B{\scriptsize1}$$

If I calculate new variables as percentages of$B{\scriptsize0}$ (for example, $A{\scriptsize p} = A / B{\scriptsize0}$) I would like to be able to plug these percentages into a formula and get the expected growth rate over a 12 month period.

In other words, $GIVEN: A{\scriptsize p}, D{\scriptsize 1p}, D{\scriptsize 2p}$ and $B{\scriptsize0}$ how can I find the growth rate?

I'm not certain how to tag this question, I'd appreciate if someone tagged it appropriately.

-

$$( (1 + A{\scriptsize p} - D{\scriptsize 1p} - D{\scriptsize 2p})^n - 1)* 100$$
where $n =$ number of months for which to calculate the total growth.
Since I was interested in the % growth over a year I used $n = 12$.


text:
# Evaluate a limit involving definite integral

Evaluate the following limit: $$\lim_{n \to \infty} \left[n - n^2 \int_{0}^{\pi/4}(\cos x - \sin x)^n dx\right]$$

I've tried to rewrite the expression as follows: $$\lim_{n \to \infty} \left[n - n^2 \sqrt{2}^n \int_{0}^{\pi/4}\sin^n \left( \frac{\pi}{4} - x \right) dx\right]$$

However, this doesn't seem to help too much. Thank you!

• Did you try recursive formula for $I_n=n\int_{0}^{\pi/4}(cos x-sinx)^ndx$ ? Jan 30 '17 at 15:51
• What about expanding the integrand with the Binomial Theorem? Jan 30 '17 at 15:54
• math.stackexchange.com/questions/1866304/… Jan 30 '17 at 15:55

Writing

$$(\cos x - \sin x)^n = \color{blue}{\frac{\cos x - \sin x}{\cos x + \sin x}} \cdot \color{red}{ (\cos x + \sin x)(\cos x - \sin x)^{n-1}}$$

and applying integrating by parts, we have

$$\int_{0}^{\frac{\pi}{4}} (\cos x - \sin x)^n \, dx = \frac{1}{n} - \frac{2}{n} \int_{0}^{\frac{\pi}{4}} \frac{(\cos x - \sin x)^n}{(\sin x + \cos x)^2} \, dx.$$

Plugging this back,

$$n - n^2 \int_{0}^{\frac{\pi}{4}} (\cos x - \sin x)^n \, dx = 2n \int_{0}^{\frac{\pi}{4}} \frac{(\cos x - \sin x)^n}{(\sin x + \cos x)^2} \, dx.$$

Now from the observation

$$n \int_{0}^{\frac{\pi}{4}} (\sin x + \cos x)(\cos x - \sin x)^n \, dx = \frac{n}{n+1},$$

we can apply the usual approximation-to-the-identity argument to obtain

\begin{align*} \lim_{n\to\infty} \left[ n - n^2 \int_{0}^{\frac{\pi}{4}} (\cos x - \sin x)^n \, dx \right] &= \lim_{n\to\infty} 2n \int_{0}^{\frac{\pi}{4}} \frac{(\cos x - \sin x)^n}{(\sin x + \cos x)^2} \, dx \\ &= \lim_{x \to 0^+} \frac{2}{(\sin x + \cos x)^3} \\ &= \color{red}{\boxed{2}}. \end{align*}

• +1 It means you performed the integration: Quite fine !!!. Jan 30 '17 at 21:44

We may go through Laplace's method. $\cos(x)-\sin(x)$ is positive and concentrated in a right neighbourhood of the origin; by expanding $\log(\cos(x)-\sin(x))$ as a Taylor series we get $\cos(x)-\sin(x)= e^{-x-x^2+O(x^3)}$. In particular the first two terms of the asymptotic expansion of $$I(n) = \int_{0}^{\pi/4}\left(\cos(x)-\sin(x)\right)^n\,dx$$ are the same as $$J(n) = \int_{0}^{+\infty}\exp\left(-nx-nx^2\right)\,dx = \frac{1}{n}-\frac{2}{n^2}+O\left(\frac{1}{n^3}\right)$$ and the wanted limit is $\color{red}{\large 2}$. In terms of hypergeometric functions we are stating that $$\lim_{n\to +\infty}\left[n-\frac{n^2}{n+1}\;\phantom{}_2 F_1\left(\frac{1}{2},1;\frac{n+3}{2};-1\right)\right]=2.$$

• Good work(+1)....hope this one doesn't attract so many downvotes then my attempt in the linked topic above :P Jan 30 '17 at 16:30

When $\ds{n \to \infty}$, the main contribution to the integral comes from values of $\ds{x \gtrsim 0}$ such that it's is a 'candidate' to be evaluated by means of the Laplace Method. Namely,

\begin{align} \int_{0}^{\pi/4}\cos^{n}\pars{x + {\pi \over 4}}\,\dd x & = \int_{0}^{\pi/4}\exp\pars{n\ln\pars{\cos\pars{x + {\pi \over 4}}}}\,\dd x \\[5mm] & \sim \int_{0}^{\infty}\exp\pars{n\bracks{-\,{\ln\pars{2} \over 2} - x}} \pars{1 - nx^{2}}\,\dd x \\[5mm] & = 2^{-n/2}\,\pars{{1 \over n} - {2 \over n^{2}}}\quad \mbox{as}\ n \to \infty\label{2}\tag{2} \end{align}

With \eqref{1} and \eqref{2}:

\begin{align} &\lim_{n \to \infty}\braces{n - n^{2}\int_{0}^{\pi/4}\bracks{\cos\pars{x} - \sin\pars{x}}^{\,n}\,\dd x} = \lim_{n \to \infty}\braces{n - 2^{n/2}\,n^{2} \bracks{2^{-n/2}\,\pars{{1 \over n} - {2 \over n^{2}}}}} \\[5mm] = &\ \bbx{\ds{2}} \end{align}


text:
avsnitt 4, Ämne 12
Pågår

# High-Performance Pandas: eval() and query()

##### Jake VanderPlas januari 21, 2020
avsnitt Progress
0% färdig

As we’ve already seen in previous sections, the power of the PyData stack is built upon the ability of NumPy and Pandas to push basic operations into C via an intuitive syntax: examples are vectorized/broadcasted operations in NumPy, and grouping-type operations in Pandas. While these abstractions are efficient and effective for many common use cases, they often rely on the creation of temporary intermediate objects, which can cause undue overhead in computational time and memory use.

As of version 0.13 (released January 2014), Pandas includes some experimental tools that allow you to directly access C-speed operations without costly allocation of intermediate arrays. These are the eval() and query() functions, which rely on the Numexpr package. In this notebook we will walk through their use and give some rules-of-thumb about when you might think about using them.

## Motivating query() and eval(): Compound Expressions

We’ve seen previously that NumPy and Pandas support fast vectorized operations; for example, when adding the elements of two arrays:In [1]:

import numpy as np
rng = np.random.RandomState(42)
x = rng.rand(1000000)
y = rng.rand(1000000)
%timeit x + y

100 loops, best of 3: 3.39 ms per loop

As discussed in Computation on NumPy Arrays: Universal Functions, this is much faster than doing the addition via a Python loop or comprehension:In [2]:

%timeit np.fromiter((xi + yi for xi, yi in zip(x, y)), dtype=x.dtype, count=len(x))

1 loop, best of 3: 266 ms per loop

But this abstraction can become less efficient when computing compound expressions. For example, consider the following expression:In [3]:

mask = (x > 0.5) & (y < 0.5)

Because NumPy evaluates each subexpression, this is roughly equivalent to the following:In [4]:

tmp1 = (x > 0.5)
tmp2 = (y < 0.5)

In other words, every intermediate step is explicitly allocated in memory. If the xand y arrays are very large, this can lead to significant memory and computational overhead. The Numexpr library gives you the ability to compute this type of compound expression element by element, without the need to allocate full intermediate arrays. The Numexpr documentation has more details, but for the time being it is sufficient to say that the library accepts a string giving the NumPy-style expression you’d like to compute:In [5]:

import numexpr
mask_numexpr = numexpr.evaluate('(x > 0.5) & (y < 0.5)')

Out[5]:

True

The benefit here is that Numexpr evaluates the expression in a way that does not use full-sized temporary arrays, and thus can be much more efficient than NumPy, especially for large arrays. The Pandas eval() and query() tools that we will discuss here are conceptually similar, and depend on the Numexpr package.

## pandas.eval() for Efficient Operations

The eval() function in Pandas uses string expressions to efficiently compute operations using DataFrames. For example, consider the following DataFrames:In [6]:

import pandas as pd
nrows, ncols = 100000, 100
rng = np.random.RandomState(42)
df1, df2, df3, df4 = (pd.DataFrame(rng.rand(nrows, ncols))
for i in range(4))

To compute the sum of all four DataFrames using the typical Pandas approach, we can just write the sum:In [7]:

%timeit df1 + df2 + df3 + df4

10 loops, best of 3: 87.1 ms per loop

The same result can be computed via pd.eval by constructing the expression as a string:In [8]:

%timeit pd.eval('df1 + df2 + df3 + df4')

10 loops, best of 3: 42.2 ms per loop

The eval() version of this expression is about 50% faster (and uses much less memory), while giving the same result:In [9]:

np.allclose(df1 + df2 + df3 + df4,
pd.eval('df1 + df2 + df3 + df4'))

Out[9]:

True

### Operations supported by pd.eval()

As of Pandas v0.16, pd.eval() supports a wide range of operations. To demonstrate these, we’ll use the following integer DataFrames:In [10]:

df1, df2, df3, df4, df5 = (pd.DataFrame(rng.randint(0, 1000, (100, 3)))
for i in range(5))

#### Arithmetic operators

pd.eval() supports all arithmetic operators. For example:In [11]:

result1 = -df1 * df2 / (df3 + df4) - df5
result2 = pd.eval('-df1 * df2 / (df3 + df4) - df5')
np.allclose(result1, result2)

Out[11]:

True

#### Comparison operators

pd.eval() supports all comparison operators, including chained expressions:In [12]:

result1 = (df1 < df2) & (df2 <= df3) & (df3 != df4)
result2 = pd.eval('df1 < df2 <= df3 != df4')
np.allclose(result1, result2)

Out[12]:

True

#### Bitwise operators

pd.eval() supports the & and | bitwise operators:In [13]:

result1 = (df1 < 0.5) & (df2 < 0.5) | (df3 < df4)
result2 = pd.eval('(df1 < 0.5) & (df2 < 0.5) | (df3 < df4)')
np.allclose(result1, result2)

Out[13]:

True

In addition, it supports the use of the literal and and or in Boolean expressions:In [14]:

result3 = pd.eval('(df1 < 0.5) and (df2 < 0.5) or (df3 < df4)')
np.allclose(result1, result3)

Out[14]:

True

#### Object attributes and indices

pd.eval() supports access to object attributes via the obj.attr syntax, and indexes via the obj[index] syntax:In [15]:

result1 = df2.T[0] + df3.iloc[1]
result2 = pd.eval('df2.T[0] + df3.iloc[1]')
np.allclose(result1, result2)

Out[15]:

True

#### Other operations

Other operations such as function calls, conditional statements, loops, and other more involved constructs are currently not implemented in pd.eval(). If you’d like to execute these more complicated types of expressions, you can use the Numexpr library itself.

## DataFrame.eval() for Column-Wise Operations

Just as Pandas has a top-level pd.eval() function, DataFrames have an eval()method that works in similar ways. The benefit of the eval() method is that columns can be referred to by name. We’ll use this labeled array as an example:In [16]:

df = pd.DataFrame(rng.rand(1000, 3), columns=['A', 'B', 'C'])

Out[16]:

ABC
00.3755060.4069390.069938
10.0690870.2356150.154374
20.6779450.4338390.652324
30.2640380.8080550.347197
40.5891610.2524180.557789

Using pd.eval() as above, we can compute expressions with the three columns like this:In [17]:

result1 = (df['A'] + df['B']) / (df['C'] - 1)
result2 = pd.eval("(df.A + df.B) / (df.C - 1)")
np.allclose(result1, result2)

Out[17]:

True

The DataFrame.eval() method allows much more succinct evaluation of expressions with the columns:In [18]:

result3 = df.eval('(A + B) / (C - 1)')
np.allclose(result1, result3)

Out[18]:

True

Notice here that we treat column names as variables within the evaluated expression, and the result is what we would wish.

### Assignment in DataFrame.eval()

In addition to the options just discussed, DataFrame.eval() also allows assignment to any column. Let’s use the DataFrame from before, which has columns 'A''B', and 'C':In [19]:

df.head()

Out[19]:

ABC
00.3755060.4069390.069938
10.0690870.2356150.154374
20.6779450.4338390.652324
30.2640380.8080550.347197
40.5891610.2524180.557789

We can use df.eval() to create a new column 'D' and assign to it a value computed from the other columns:In [20]:

df.eval('D = (A + B) / C', inplace=True)

Out[20]:

ABCD
00.3755060.4069390.06993811.187620
10.0690870.2356150.1543741.973796
20.6779450.4338390.6523241.704344
30.2640380.8080550.3471973.087857
40.5891610.2524180.5577891.508776

In the same way, any existing column can be modified:In [21]:

df.eval('D = (A - B) / C', inplace=True)

Out[21]:

ABCD
00.3755060.4069390.069938-0.449425
10.0690870.2356150.154374-1.078728
20.6779450.4338390.6523240.374209
30.2640380.8080550.347197-1.566886
40.5891610.2524180.5577890.603708

### Local variables in DataFrame.eval()

The DataFrame.eval() method supports an additional syntax that lets it work with local Python variables. Consider the following:In [22]:

column_mean = df.mean(1)
result1 = df['A'] + column_mean
result2 = df.eval('A + @column_mean')
np.allclose(result1, result2)

Out[22]:

True

The @ character here marks a variable name rather than a column name, and lets you efficiently evaluate expressions involving the two ”namespaces”: the namespace of columns, and the namespace of Python objects. Notice that this @character is only supported by the DataFrame.eval() method, not by the pandas.eval() function, because the pandas.eval() function only has access to the one (Python) namespace.

## DataFrame.query() Method

The DataFrame has another method based on evaluated strings, called the query() method. Consider the following:In [23]:

result1 = df[(df.A < 0.5) & (df.B < 0.5)]
result2 = pd.eval('df[(df.A < 0.5) & (df.B < 0.5)]')
np.allclose(result1, result2)

Out[23]:

True

As with the example used in our discussion of DataFrame.eval(), this is an expression involving columns of the DataFrame. It cannot be expressed using the DataFrame.eval() syntax, however! Instead, for this type of filtering operation, you can use the query() method:In [24]:

result2 = df.query('A < 0.5 and B < 0.5')
np.allclose(result1, result2)

Out[24]:

True

In addition to being a more efficient computation, compared to the masking expression this is much easier to read and understand. Note that the query()method also accepts the @ flag to mark local variables:In [25]:

Cmean = df['C'].mean()
result1 = df[(df.A < Cmean) & (df.B < Cmean)]
result2 = df.query('A < @Cmean and B < @Cmean')
np.allclose(result1, result2)

Out[25]:

True

## Performance: When to Use These Functions

When considering whether to use these functions, there are two considerations: computation time and memory use. Memory use is the most predictable aspect. As already mentioned, every compound expression involving NumPy arrays or Pandas DataFrames will result in implicit creation of temporary arrays: For example, this:In [26]:

x = df[(df.A < 0.5) & (df.B < 0.5)]

Is roughly equivalent to this:In [27]:

tmp1 = df.A < 0.5
tmp2 = df.B < 0.5
tmp3 = tmp1 & tmp2
x = df[tmp3]

If the size of the temporary DataFrames is significant compared to your available system memory (typically several gigabytes) then it’s a good idea to use an eval() or query() expression. You can check the approximate size of your array in bytes using this:In [28]:

df.values.nbytes

Out[28]:

32000

On the performance side, eval() can be faster even when you are not maxing-out your system memory. The issue is how your temporary DataFrames compare to the size of the L1 or L2 CPU cache on your system (typically a few megabytes in 2016); if they are much bigger, then eval() can avoid some potentially slow movement of values between the different memory caches. In practice, I find that the difference in computation time between the traditional methods and the eval/query method is usually not significant–if anything, the traditional method is faster for smaller arrays! The benefit of eval/query is mainly in the saved memory, and the sometimes cleaner syntax they offer.

We’ve covered most of the details of eval() and query() here; for more information on these, you can refer to the Pandas documentation. In particular, different parsers and engines can be specified for running these queries; for details on this, see the discussion within the ”Enhancing Performance” section.

0/5 (0 Reviews)


text:
## Nullity of line graph of a tree is at least 1 [closed]

let $\mathbf{A}$ be adjacency matrix of line graph $T$ and $T$ is a tree. I want to show that $\operatorname{null}(\mathbf{A})\ge 1$.

-
I have to use (D^t)D=A+2I.But I don't know to how – Ravid Nov 11 2011 at 7:39
What is D ? – Greg Martin Nov 11 2011 at 7:51
When you posted this question to m.se (math.stackexchange.com/questions/79214/…), you were asked what you had tried. You never replied. Better to go back there and engage with the people who would help you if you'd meet them halfway. – Gerry Myerson Nov 11 2011 at 11:17
D is incidence matrix – Ravid Nov 11 2011 at 14:28


text:
×

# Changes with brilliant messageboard

HEre's where we talk about changes, suggestions, questions, etc.

• Ive noticed that the reply features are different. It's a little less flashy.

Note by David Lee
2 years, 9 months ago

Sort by:

Yup. What do you guys think about it? Have any thoughts @Jackie Steck @Calvin Lin @Peter Taylor @Kenji Ejima @Suyeon Khim? · 2 years, 9 months ago

I don't really like the re-introduced "Downvote" feature. Instead, I think there should be a flag feature for inappropriate comments. · 2 years, 9 months ago

There are inappropriate comments on brilliant? I've never.....wait, are you talking about how two smart Alec's get mad when the other challenges his/her logic. That's pretty dang common on brilliant. · 2 years, 9 months ago

You talking about @Alec Sun ? · 2 years, 8 months ago

Haha, you know, only the smartest middle-schooler in America. No biggie. :D · 2 years, 8 months ago

high school now · 2 years, 7 months ago