text:
# MATH 323 Lecture 9

« previous | Tuesday, September 25, 2012 | next »

## Euclidean Vector Space

${\displaystyle {\vec {x}}={\begin{bmatrix}x_{1}\\x_{2}\end{bmatrix}}\in \mathbb {R} ^{2}}$

In general, euclidean space is defined by any ${\displaystyle \mathbb {R} ^{n}}$

${\displaystyle \|{\vec {x}}\|={\sqrt {{x_{1}}^{2}+{x_{2}}^{2}}}}$ is Euclidean length of a 2D vector.

Arbitrary: ${\displaystyle \|{\vec {x}}\|={\sqrt {{x_{1}}^{2}+{x_{2}}^{2}+\dots +{x_{n}}^{2}}}}$

### Scalar Multiplication

Multiply all components by scaling factor ${\displaystyle \alpha }$

${\displaystyle \alpha \,{\vec {x}}={\begin{bmatrix}\alpha \,x_{1}\\\alpha \,x_{2}\end{bmatrix}}}$ scales vector

• stays parallel
• ${\displaystyle \alpha >0}$ → result vector is same direction as original
• ${\displaystyle \alpha <0}$ → result vector is in opposite direction.

Arbitrary: ${\displaystyle \alpha \,{\vec {x}}={\begin{bmatrix}\alpha \,x_{1}\\\alpha \,x_{2}\\\vdots \\\alpha \,x_{n}\end{bmatrix}}}$

Apply operation to corresponding components

{\displaystyle {\begin{aligned}{\vec {x}}+{\vec {y}}&={\begin{bmatrix}x_{1}+y_{1}\\x_{2}+y_{2}\end{bmatrix}}\\{\vec {x}}-{\vec {y}}&={\begin{bmatrix}x_{1}-y_{1}\\x_{2}-y_{2}\end{bmatrix}}\end{aligned}}}

Arbitrary: ${\displaystyle {\vec {x}}\pm {\vec {y}}={\begin{bmatrix}x_{1}\pm y_{1}\\x_{2}\pm y_{2}\\\vdots \\x_{n}\pm y_{n}\end{bmatrix}}}$

## Matrix Space

${\displaystyle \mathbb {R} ^{m\times n}}$ represents space of ${\displaystyle m\times n}$ matrices

Let ${\displaystyle V}$ be a set with the operation of addition and scalar multiplication:

### Closure Properties

1. ${\displaystyle x\in V\implies \alpha \,x\in V\quad \forall \alpha \in \mathbb {R} }$
2. ${\displaystyle x,y\in V\implies x+y\in V}$

### Axioms

1. ${\displaystyle x+y=y+x\quad \forall x,y\in V}$ (commutativity of addition)
2. ${\displaystyle (x+y)+z=x+(y+z)\quad \forall x,y,z\in V}$ (associativity of addition)
3. ${\displaystyle \exists 0\in V~:~x+0=x\quad \forall x\in V}$ (additive identity)
4. ${\displaystyle \forall x\in V\exists y\in V~:~x+y=0}$ (additive inverse; ${\displaystyle y}$ denoted ${\displaystyle -x}$)
5. ${\displaystyle \alpha (x+y)=\alpha \,x+\alpha \,y\quad \forall \alpha \in \mathbb {R} \quad x,y\in V}$ (distributive 1)
6. ${\displaystyle (\alpha +\beta )x=\alpha \,x+\beta \,x\quad \forall \alpha ,\beta \in \mathbb {R} }$ (distributive 2)
7. ${\displaystyle (\alpha \,\beta )x=\alpha (\beta \,x)\quad \forall \alpha ,\beta \in \mathbb {R} }$ (associativity of multiplication)
8. ${\displaystyle \exists 1\in V~:~1\cdot x=x\quad \forall x\in V}$ (multiplicative identity)

### Examples

#### Sets

${\displaystyle W=\left\{(a,2)~|~a\in \mathbb {R} \right\}\subset \mathbb {R} ^{2}}$ represents the line ${\displaystyle y=2}$. ${\displaystyle W}$ is not space since it does not satisfy the closure properties: let ${\displaystyle \alpha =100}$; ${\displaystyle (100\,a,200)\not \in W}$

#### Continuous Functions

${\displaystyle f,g\in C[a,b]}$ represents the space of continuous functions on the interval ${\displaystyle [a,b]}$. All axioms and closure properties are satsified for this space.

#### Polynomials

Focus on ${\displaystyle x^{n}}$ for ${\displaystyle n\in \mathbb {N} }$.

A polynomial ${\displaystyle P(x)=a_{0}+a_{1}\,x+a_{2}\,x^{2}+\dots +a_{n}\,x^{n}}$

degree of ${\displaystyle P}$ (denoted ${\displaystyle \deg P(x)}$) is ${\displaystyle n}$ (max power of ${\displaystyle x}$)

Let ${\displaystyle P_{n}}$ represent all polynomials of degree < ${\displaystyle n}$. ${\displaystyle P_{n}}$ satisfies all properties and axioms and is therefore spaaaaaace!

### Theorem

${\displaystyle V}$ is vector space, ${\displaystyle x\in V}$, then

1. ${\displaystyle 0\cdot x=0}$
2. ${\displaystyle x+y=0\implies y=-x}$ (additive inverse is unique)
3. ${\displaystyle (-1)x=-x}$

#### Proof

1. ${\displaystyle x=1\cdot x=(1+0)x=x+0x\rightarrow x-x=0x=0}$
2. ${\displaystyle -x=-x+0=-x+(x+y)=0+y=y}$
3. ${\displaystyle 0=0x=(1+(-1))x=x+(-1)x\rightarrow (-1)x=x}$

### Subspace

For a space ${\displaystyle V}$, ${\displaystyle W\subseteq V}$ is a subspace of ${\displaystyle V}$ if it also satisfies the closure properties

#### Example

${\displaystyle S=\left\{{\begin{bmatrix}x_{1}\\3\,x_{1}\end{bmatrix}}~{\big |}~x_{1}\in \mathbb {R} \right\}}$ is a subspace of ${\displaystyle \mathbb {R} ^{2}}$ since it satisfies the closure properties


text:
## Rémi Bardenet’s seminar

Posted in Kids, pictures, Statistics, Travel, University life with tags , , , , , , , , , , , , , on April 7, 2016 by xi'an

Next week, Rémi Bardenet is giving a seminar in Paris, Thursday April 14, 2pm, in ENSAE [room 15] on MCMC methods for tall data. Unfortunately, I will miss this opportunity to discuss with Rémi as I will be heading to La Sapienza, Roma, for Clara Grazian‘s PhD defence the next day.  And on Monday afternoon, April 11, Nicolas Chopin will give a talk on quasi-Monte Carlo for sequential problems at Institut Henri Poincaré.

## MCMskv #5 [future with a view]

Posted in Kids, Mountains, R, Statistics, Travel, University life with tags , , , , , , , , , , , , , , , , on January 12, 2016 by xi'an

As I am flying back to Paris (with an afternoon committee meeting in München in-between), I am reminiscing on the superlative scientific quality of this MCMski meeting, on the novel directions in computational Bayesian statistics exhibited therein, and on the potential settings for the next meeting. If any.

First, as hopefully obvious from my previous entries, I found the scientific program very exciting, with almost uniformly terrific talks, and a coverage of the field of computational Bayesian statistics that is perfectly tuned to my own interest. In that sense, MCMski is my “top one” conference! Even without considering the idyllic location. While some of the talks were about papers I had already read (and commented here), others brought new vistas and ideas. If one theme is to emerge from this meeting it has to be the one of approximate and noisy algorithms, with a wide variety of solutions and approaches to overcome complexity issues. If anything, I wish the solutions would also incorporate the Boxian fact that the statistical models themselves are approximate. Overall, a fantastic program (says one member of the scientific committee).

Second, as with previous MCMski meetings, I again enjoyed the unique ambience of the meeting, which always feels more relaxed and friendly than other conferences of a similar size, maybe because of the après-ski atmosphere or of the special coziness provided by luxurious mountain hotels. This year hotel was particularly pleasant, with non-guests like myself able to partake of some of their facilities. A big thank you to Anto for arranging so meticulously all the details of such a large meeting!!! I am even more grateful when realising this is the third time Anto takes over the heavy load of organising MCMski. Grazie mille!

Since this is a [and even the!] BayesComp conference, the current section program chair and board must decide on the  structure and schedule of the next meeting. A few suggestions if I may: I would scrap entirely the name MCMski from the next conference as (a) it may sound like academic tourism for unaware bystanders (who only need to check the program of any of the MCMski conferences to stand reassured!) and (b) its topic go way beyond MCMC. Given the large attendance and equally large proportion of young researchers, I would also advise against hosting the conference in a ski resort for both cost and accessibility reasons [as we had already discussed after MCMskiv], in favour of a large enough town to offer a reasonable range of accommodations and of travel options. Like Chamonix, Innsbruck, Reykjavik, or any place with a major airport about one hour away… If nothing is available with skiing possibilities, so be it! While the outdoor inclinations of the early organisers induced us to pick locations where skiing over lunch break was a perk, any accessible location that allows for a concentration of researchers in a small area and for the ensuing day-long exchange is fine! Among the novelties in the program, the tutorials and the Breaking news! sessions were quite successful (says one member of the scientific committee). And should be continued in one format or another. Maybe a more programming thread could be added as well… And as we had mentioned earlier, to see a stronger involvement of the Young Bayesian section in the program would be great! (Even though the current meeting already had many young researcher  talks.)

## MCMskv #4 [house with a vision]

Posted in Statistics with tags , , , , , , , , , , , , on January 9, 2016 by xi'an

Last day at MCMskv! Not yet exhausted by this exciting conference, but this was the toughest day with one more session and a tutorial by Art Own on quasi Monte-Carlo. (Not even mentioning the night activities that I skipped. Or the ski break that I did not even consider.) Krys Latunszynski started with a plenary on exact methods for discretised diffusions, with a foray in Bernoulli factory problems. Then a neat session on adaptive MCMC methods that contained a talk by Chris Sherlock on delayed acceptance, where the approximation to the target was built by knn trees. (The adaptation was through the construction of the tree by including additional evaluations of the target density. Another paper sitting in my to-read list for too a long while: the exploitation of the observed values of π towards improving an MCMC sampler has always be “obvious” to me even though I could not see any practical way of doing so. )

It was wonderful that Art Owen accepted to deliver a tutorial at MCMskv on quasi-random Monte Carlo. Great tutorial, with a neat coverage of the issues most related to Monte Carlo integration. Since quasi-random sequences have trouble with accept/reject methods, a not-even-half-baked idea that came to me during Art’s tutorial was that the increased computing power granted by qMC could lead to a generic integration of the Metropolis-Hastings step in a Rao-Blackwellised manner. Art mentioned he was hoping that in a near future one could switch between pseudo- and quasi-random in an almost automated manner when running standard platforms like R. This would indeed be great, especially since quasi-random sequences seem to be available at the same cost as their pseudo-random counterpart. During the following qMC session, Art discussed the construction of optimal sequences on sets other than hypercubes (with the surprising feature that projecting optimal sequences from the hypercube does not work). Mathieu Gerber presented the quasi-random simulated annealing algorithm he developed with Luke Bornn that I briefly discussed a while ago. Or thought I did as I cannot trace a post on that paper! While the fact that annealing also works with quasi-random sequences is not astounding, the gain over random sequences shown on two examples is clear. The session also had a talk by Lester Mckey who relies Stein’s discrepancy to measure the value of an approximation to the true target. This was quite novel, with a surprising connection to Chris Oates’ talk and the use of score-based control variates, if used in a dual approach.

Another great session was the noisy MCMC one organised by Paul Jenkins (Warwick), with again a coherent presentation of views on the quality or lack thereof of noisy (or inexact) versions, with an update from Richard Everitt on inexact MCMC, Felipe Medina Aguayo (Warwick) on sufficient conditions for noisy versions to converge (and counterexamples), Jere Koskela (Warwick) on a pseudo-likelihood approach to the highly complex Kingman’s coalescent model in population genetics (of ABC fame!), and Rémi Bardenet on the tall data approximations techniques discussed in a recent post. Having seen or read most of those results previously did not diminish the appeal of the session.

## convergence for non-Markovian simulated AAs

Posted in Books, pictures, Statistics with tags , , , on December 24, 2015 by xi'an

Mathieu Gerber (formerly CREST) and Luke Bornn have arXived a paper on the almost sure convergence of simulated annealing algorithms when using a non-Markovian sequence that can be in the limiting case completely deterministic and hence use quasi-Monte Carlo sequences. The paper extends the earlier Gerber and Bornn (2015) that I missed. While the paper is highly technical, it shows that under some conditions a sequence of time-varying kernels can be used to reach the maximum of an objective function. With my limited experience with simulated annealing I find this notion of non-iid or even non-random both worth investigating and somewhat unsurprising from a practitioner’s view in that modifying a standard simulated annealing algorithm with steps depending on the entire past of the sequence usually produces better performances.

## discussions on Gerber and Chopin

Posted in Books, Kids, Statistics, University life with tags , , , , , , , , , , , , , , , on May 29, 2015 by xi'an

As a coincidence, I received my copy of JRSS Series B with the Read Paper by Mathieu Gerber and Nicolas Chopin on sequential quasi Monte Carlo just as I was preparing an arXival of a few discussions on the paper! Among the [numerous and diverse] discussions, a few were of particular interest to me [I highlighted members of the University of Warwick and of Université Paris-Dauphine to suggest potential biases!]:

1. Mike Pitt (Warwick), Murray Pollock et al.  (Warwick) and Finke et al. (Warwick) all suggested combining quasi Monte Carlo with pseudomarginal Metropolis-Hastings, pMCMC (Pitt) and Rao-Bklackwellisation (Finke et al.);
2. Arnaud Doucet pointed out that John Skilling had used the Hilbert (ordering) curve in a 2004 paper;
3. Chris Oates, Dan Simpson and Mark Girolami (Warwick) suggested combining quasi Monte Carlo with their functional control variate idea;
4. Richard Everitt wondered about the dimension barrier of d=6 and about possible slice extensions;
5. Zhijian He and Art Owen pointed out simple solutions to handle a random number of uniforms (for simulating each step in sequential Monte Carlo), namely to start with quasi Monte Carlo and end up with regular Monte Carlo, in an hybrid manner;
6. Hans Künsch points out the connection with systematic resampling à la Carpenter, Clifford and Fearnhead (1999) and wonders about separating the impact of quasi Monte Carlo between resampling and propagating [which vaguely links to one of my comments];
7. Pierre L’Ecuyer points out a possible improvement over the Hilbert curve by a preliminary sorting;
8. Frederik Lindsten and Sumeet Singh propose using ABC to extend the backward smoother to intractable cases [but still with a fixed number of uniforms to use at each step], as well as Mateu and Ryder (Paris-Dauphine) for a more general class of intractable models;
9. Omiros Papaspiliopoulos wonders at the possibility of a quasi Markov chain with “low discrepancy paths”;
10. Daniel Rudolf suggest linking the error rate of sequential quasi Monte Carlo with the bounds of Vapnik and Ĉervonenkis (1977).

The arXiv document also includes the discussions by Julyan Arbel and Igor Prünster (Turino) on the Bayesian nonparametric side of sqMC and by Robin Ryder (Dauphine) on the potential of sqMC for ABC.

## Quasi-Monte Carlo sampling

Posted in Books, Kids, Statistics, Travel, University life, Wines with tags , , , , , , , , , , , , on December 10, 2014 by xi'an

“The QMC algorithm forces us to write any simulation as an explicit function of uniform samples.” (p.8)

As posted a few days ago, Mathieu Gerber and Nicolas Chopin will read this afternoon a Paper to the Royal Statistical Society on their sequential quasi-Monte Carlo sampling paper.  Here are some comments on the paper that are preliminaries to my written discussion (to be sent before the slightly awkward deadline of Jan 2, 2015).

Quasi-Monte Carlo methods are definitely not popular within the (mainstream) statistical community, despite regular attempts by respected researchers like Art Owen and Pierre L’Écuyer to induce more use of those methods. It is thus to be hoped that the current attempt will be more successful, it being Read to the Royal Statistical Society being a major step towards a wide diffusion. I am looking forward to the collection of discussions that will result from the incoming afternoon (and bemoan once again having to miss it!).

“It is also the resampling step that makes the introduction of QMC into SMC sampling non-trivial.” (p.3)

At a mathematical level, the fact that randomised low discrepancy sequences produce both unbiased estimators and error rates of order

$\mathfrak{O}(N^{-1}\log(N)^{d-}) \text{ at cost } \mathfrak{O}(N\log(N))$

means that randomised quasi-Monte Carlo methods should always be used, instead of regular Monte Carlo methods! So why is it not always used?! The difficulty stands [I think] in expressing the Monte Carlo estimators in terms of a deterministic function of a fixed number of uniforms (and possibly of past simulated values). At least this is why I never attempted at crossing the Rubicon into the quasi-Monte Carlo realm… And maybe also why the step had to appear in connection with particle filters, which can be seen as dynamic importance sampling methods and hence enjoy a local iid-ness that relates better to quasi-Monte Carlo integrators than single-chain MCMC algorithms.  For instance, each resampling step in a particle filter consists in a repeated multinomial generation, hence should have been turned into quasi-Monte Carlo ages ago. (However, rather than the basic solution drafted in Table 2, lower variance solutions like systematic and residual sampling have been proposed in the particle literature and I wonder if any of these is a special form of quasi-Monte Carlo.) In the present setting, the authors move further and apply quasi-Monte Carlo to the particles themselves. However, they still assume the deterministic transform

$\mathbf{x}_t^n = \Gamma_t(\mathbf{x}_{t-1}^n,\mathbf{u}_{t}^n)$

which the q-block on which I stumbled each time I contemplated quasi-Monte Carlo… So the fundamental difficulty with the whole proposal is that the generation from the Markov proposal

$m_t(\tilde{\mathbf{x}}_{t-1}^n,\cdot)$

has to be of the above form. Is the strength of this assumption discussed anywhere in the paper? All baseline distributions there are normal. And in the case it does not easily apply, what would the gain bw in only using the second step (i.e., quasi-Monte Carlo-ing the multinomial simulation from the empirical cdf)? In a sequential setting with unknown parameters θ, the transform is modified each time θ is modified and I wonder at the impact on computing cost if the inverse cdf is not available analytically. And I presume simulating the θ’s cannot benefit from quasi-Monte Carlo improvements.

The paper obviously cannot get into every detail, obviously, but I would also welcome indications on the cost of deriving the Hilbert curve, in particular in connection with the dimension d as it has to separate all of the N particles, and on the stopping rule on m that means only Hm is used.

Another question stands with the multiplicity of low discrepancy sequences and their impact on the overall convergence. If Art Owen’s (1997) nested scrambling leads to the best rate, as implied by Theorem 7, why should we ever consider another choice?

In connection with Lemma 1 and the sequential quasi-Monte Carlo approximation of the evidence, I wonder at any possible Rao-Blackwellisation using all proposed moves rather than only those accepted. I mean, from a quasi-Monte Carlo viewpoint, is Rao-Blackwellisation easier and is it of any significant interest?

What are the computing costs and gains for forward and backward sampling? They are not discussed there. I also fail to understand the trick at the end of 4.2.1, using SQMC on a single vector instead of (t+1) of them. Again assuming inverse cdfs are available? Any connection with the Polson et al.’s particle learning literature?

Last questions: what is the (learning) effort for lazy me to move to SQMC? Any hope of stepping outside particle filtering?

## a probabilistic proof to a quasi-Monte Carlo lemma

Posted in Books, Statistics, Travel, University life with tags , , , , , on November 17, 2014 by xi'an

As I was reading in the Paris métro a new textbook on Quasi-Monte Carlo methods, Introduction to Quasi-Monte Carlo Integration and Applications, written by Gunther Leobacher and Friedrich Pillichshammer, I came upon the lemma that, given two sequences on (0,1) such that, for all i’s,

$|u_i-v_i|\le\delta\quad\text{then}\quad\left|\prod_{i=1}^s u_i-\prod_{i=1}^s v_i\right|\le 1-(1-\delta)^s$

and the geometric bound made me wonder if there was an easy probabilistic proof to this inequality. Rather than the algebraic proof contained in the book. Unsurprisingly, there is one based on associating with each pair (u,v) a pair of independent events (A,B) such that, for all i’s,

$A_i\subset B_i\,,\ u_i=\mathbb{P}(A_i)\,,\ v_i=\mathbb{P}(B_i)$

and representing

$\left|\prod_{i=1}^s u_i-\prod_{i=1}^s v_i\right| = \mathbb{P}(\cap_{i=1}^s A_i) - \mathbb{P}(\cap_{i=1}^s B_i)\,.$

Obviously, there is no visible consequence to this remark, but it was a good way to switch off the métro hassle for a while! (The book is under review and the review will hopefully be posted on the ‘Og as soon as it is completed.)

format: plain


text:
# [Tex/LaTex] Installing .sty package for Texstudio on Ubuntu 20.04

installingpackagestexstudioUbuntu

How to install a .sty package that is missing when a tex file is being built by Texstudio for Ubuntu 20.04? Any method would work for me, but preferably a method via terminal or preamble of the tex file would be the most useful.

First of mathcomp seems to just provide some symbols to write units. Nowadays the latex standard is to use the siunitx package instead.

Regarding mathcomp and texlive-latex-recommended from Ubuntu. Ubuntu splits TeXLive into several Ubuntu packages (not to be confused with LaTeX packages, they often contain many latex packages). Given that mathcomp is not a widely used package it is unlikely that it is listed in texlive-latex-recommended, might be easier to just install it all texlive-all I think it is called(?)

Personally I don't use TeXLive from Ubuntu as I'd like to get the latest updates so I use the upstream one (see http://tug.org/texlive).

If you use Ubuntu and the TeXLive that Ubuntu provides the way you figure out which Ubuntu package a given latex package belongs to is to make sure you have apt-file installed

sudo apt install apt-file
sudo apt-file update

Run the latter command from time to time.

Then search a latex package via for example

apt-file search mathcomp.sty

and here it tells me

texlive-science: /usr/share/texlive/texmf-dist/tex/latex/mathcomp/mathcomp.sty

so I would need to install texlive-science


text:
## Chapter 20: Exercises

1. (*)Obtain info from a mono audio file: Write a MATLAB script that can read the wave file "welcome.wav" and display the following information within this script.
1. Number of sample points.
2. Samping rate.
3. Bit resolution
4. Number of channels.
5. Time duration of the recording (in terms of seconds)
1. µ°T¸ê®ÆÂI¼Æ
2. ¨ú¼ËÀW²v
3. ¸ÑªR«×¡]¨CÓ¨ú¼ËÂI¥Ñ¦h¤Ö¦ì¤¸¨Óªí¥Ü¡^
4. Án¹D¼Æ
5. ¿ýµ®É¶¡ªø«×¡]¥H¬í¬°³æ¦ì¡^
3. (*)Obtain info from a stereo audio file: Repeat the previous exercise with a MATLAB program to obtain the same information from the wave file "flanger.wav".
4. «½Æ¤W¤@ÃD¡]µ{¦¡ÀÉ¦W¬° wavInfo02.m¡^¡A¦ý¬O±NÀÉ®×§ï¬° flanger.wav¡]¦¹ÀÉ®×¦ì©ó¥»®Ñ©Òªþ¥úºÐ¤§¤¤¡^¡C¤@¯ëªº CD µ¼Ö¬O±Ä¥ÎÂùÁn¹D¿ýµ¡A¨ú¼ËÀW²v¬O 44.1 kHz¡A¸ÑªR«×¬O 16 bits/sample¡C½Ð°Ý¦b³o¼Ëªº±¡ªp¤U¡A¤@º¥|¤ÀÄÁªººqY¬O¼g¦¨ wav ÀÉ®×¡A·|¤j¬ù¦û±¼¦h¤ÖµwºÐªÅ¶¡¡H¡]¥Ñ¦¹²ßÃD§A´N¥i¥Hª¾¹D MP3 ¡BWMA¡BAAC µ¥À£ÁY¥\¯àªº¥i¶Q¤F¡I¡^
5. ½Ð®Ú¾Ú¤U¦Cµ{¦¡½X¦^µª°ÝÃD¡C [y, fs]=wavread('welcome.wav'); wavplay(y,1.0*fs,sync); wavplay(y,1.2*fs,sync);
1. 'sync' ¥Nªí¤°»ò·N«ä¡H
2. ¦pªG§ï¬°§â²Ä¤@Ó 'sync' §ï¬° 'async'¡A·|¦³¤°»ò®t§O¡H
Ans:
1. 'sync' ¥Nªí±Nµ°T¸ê®Æ´§Ç°e¨ì³â¥z¼½©ñ¡C
1. wavplay(y, 0.5*fs, 'async');
2. wavplay(-y, fs, 'sync');
3. wavplay(-y, -fs, 'sync');
4. wavplay(flipud(y), fs, 'sync');
1. sound(y, fs)
2. sound(y, fs*2)
3. sound(y*2, fs)
4. sound(y*2, fs*2)
8. MATLAB ¨Ï¥Î wavread Åª¤J wav ÀÉ®×¤§«á¡A·|±Nµ°T¸ê®ÆÀx¦s¦¨¦óºØ¸ê®Æ«¬ºA¡H¦bþÓ°Ï¶¡¡H
1. int, [-10,10]
2. double, [-1,1]
3. int, [-32768,32767]
4. double, [-10,10]
9. wav ÀÉ®×¤º³¡Àx¦sµ°T¸ê®Æªº¸ê®Æ«¬ºA¡A³Ì±¨£ªº¬Oþ¨âºØ¡H?¨ä¼ÆÈ½d³ò¬°¦ó¡H
Ans:
1. uint8 (unsigned 8-bit integers), [0, 255]
2. int16 (signed 16-bit integer), [-32768, 32767]
Ans:
1. uint8 ==> (x-128)/128.
2. int16 ==> x/32768.
11. ¡u§Ö¼Ö¹|¡vÂ²ÃÐ¦p¤U¡G
¢²¢²¢³¢´¢x¢´¢³¢²¢±¢x¢°¢°¢±¢²¢x¢²¡D¢± ¢± ¡ß¢x

Ans: semitone=[60 62 64 65 67]; % Conversion from the simple score to semitone simpleScore=[3 3 4 5 5 4 3 2 1 1 2 3 3 2 2]; beat=[1 1 1 1 1 1 1 1 1 1 1 1 1.5 0.5 2]; fs=8000; signal=[]; for i=1:length(simpleScore); time=linspace(0, beat(i)/2, fs*beat(i)/2); f=440*2^((semitone(simpleScore(i))-69)/12); y=sin(2*pi*f*time); signal=[signal y]; end sound(signal, fs);
12. (*)Wave recording: Write a MATLAB script to record 10 seconds of your utterance such as "My name is Roger Jang and I am a senior student at the CS department of National Taiwan University". Save your recording as myVoice.wav. Other recording parameters are: sample rate = 16 KHz, bit resolution = 16 bits. Please use the script to print out answers to the following questions within the MATLAB window.
1. How much space is taken by the audio data in the MATLAB workspace?
2. What the data type of the audio data?
3. How do you compute the amount of the required memory from the recording parameters?
4. What is the size of myVoice.wav?
5. How many bytes is used in myVoice.wav to record overheads other than the audio data itself?
13. ½Ð¼g¤@¬q MATLAB µ{¦¡ recordMyVoice01.m¡A¿ý¤U§AÁ¿ªº¤@¬q¸Ü¡G¡u§Ú¬Oxxx¡A¤µ¦~xx·³¡A¬Oxx¤j¾Çxx¨tx¦~¯Åªº¾Ç¥Í¡v¡A¨Ã±N¤§Àx¦s¦¨ÀÉ®× myvoice.wav¡C¿ýµ±ø¥ó¦p¤U¡G¿ýµ®É¶¡¬O 10 ¬í¡A¨ú¼ËÀW²v¬O 11025 Hz¡A¸ÑªR«×¬O 8 bits/sample¡C½Ð°Ý¡G
1. ¬ÛÃöªºµ°TÅÜ¼Æ¦b MATLAB ªº¤u§@ªÅ¶¡¦û±¼¦h¤Ö°O¾ÐÅé¡H
2. ¦¹ÅÜ¼Æªº¸ê®Æ«¬ºA¬O¤°»ò¡H
4. myvoice.wav ªºÀÉ®×¤j¤p¬°¦ó¡H
5. ÀÉ®×¥Î¤F¦h¤Ö¦ì¤¸²Õ¨Ó°O¿ý°£¤Fµ°T¸ê®Æ¥H¥~ªº¸ê°T¡H
15. (**)Create the illusion of a moving sound source: Record your own voice of "my name is xxx and I am a student at xxx university", and save the mono recording to myVoice.wav. Write a MATLAB script that can read the audio data from myVoice.wav, duplicate the audio data to create a stereo audio, and then modify the volume of each channels such that the playback can create an illusion that the sound source is moving between your two speakers. (Hint: You can observe the waveforms of the two channels in flanger.wav.)
16. (*)Reverse playback: Write a MATLAB script to accomplish the following tasks:
1. Record your utterance of "we" and play it backwards. Does it sound like "you"? (Please save the result to a wave file and demo its playback to the TA.)
2. Record your utterance of "you" and play it backwards. Does it sound like "we"? (Please save the result to a wave file and demo its playback to the TA.)
3. Record your utterance of "¤W®ü¦Û¨Ó¤ô¨Ó¦Û®ü¤W" (for Chinese students) or "We are you" (for international students) and play it backwords. What does it sound like? (Please save the result to a wave file and demo its playback to the TA.)
4. Record your utterance of "¤@¤G¤T¥|¤¤»¤C¤K¤E¤Q" and play it backwards. Which digits can you recognize? Why?
5. Can you think of any other utterances that sound meaningful when played backwords?
18. (*)Audio signal manipulation: Write a MATLAB script to record your utterance of "today is my birthday". Try to explain the playback effect you observe after you try the following operations on the audio signals.
1. Multiply the audio signals by -1.
2. Reverse the audio signals in time axis.
3. Multiply the audio signals by 10.
4. Replace each sample by its square root.
5. Replace each sample by its square.
6. Clip the waveform such that sample data out of the range [-0.5, 0.5] are set to zero.
7. Modify the waveform such that samples in the range [-0.5, 0.5] are set to zero; samples out of the range [-0.5, 0.5] are moved toward zero by the amount 0.5.
19. (*)°ò¥»¿ýµ: ½Ð¥Î MATLAB ¼g¤@¤p¬qµ{¦¡¡A¶i¦æ¿ýµ¤T¬í¡A¿ýµªº¤º®e¬O¡u¥xÆW¤j¾Ç¸ê°T¨t¡v¡A¨ä¤¤¨ú¼ËÀW²v¬O 16 KHz¡A¸ÑªR«×¬O 8 ¦ì¤¸¡A½Ð±Nµ°TÀx¦s¦¨ myVoice.wav ÀÉ®×¡C
1. ½Ð°ÝÀÉ®×¤j¤p¬°¦ó¡H
¡]´£¥Ü¡G·|¥Î¨ìªº«ü¥O¦³ wavrecord, wavwrite, flipud, sign, sound µ¥¡C¡^
20. (*)Audio signal grafting: Write a MATLAB script to accomplish the following tasks. (You need to find the boundaries by trials and errors, and put the related boundary indices into your MATLAB program for creating the required audio segments.)
• For Mandarin-speaking student: Record your utterance of "²MµØ¤j¾Ç¸ê°T¨t" and save it to a file first.
1. If you connect the consonant part of "¤j" to the vowel part of "¨t", can you get the sound of "¦a"? (Please save the result to a wave file and demo its playback to the TA.)
2. If you connect "¨t" to the vowel part of "¤j", can you get the sound of "¤U"? (Please save the result to a wave file and demo its playback to the TA.)
• For international students: Record your utterance of "keep it simple" and save it to a file.
1. Can you get the sound of "pimple" by connecting some portions of "Keep" and "simple"? (Please save the result to a wave file and demo its playback to the TA.)
2. Can you get the sound of "simplest" by connect some portions of your recording? (Please save the result to a wave file and demo its playback to the TA.)
21. (**)Experiments on the sample rate: Write a MATLAB script to record your utterance of "my name is ***" with a sample rate of 32 KHz and 8-bit resolution. Try to resample the audio signals at decreasing sample rates of 16 KHz, 8 KHz, 4 KHz, 2 KHz, 1 KHz, and so on. At which sample rate you start to have difficulty in understanding the contents of the utterance?
22. (**) Experiments on adding noise: Write a MATLAB script to record your utterance of "my name is ***" with a sample rate of 8 KHz and 8-bit resolution. We can add noise to the audio signals by using the following program snippet: k = 0.1; y2 = y + k*randn(length(y), 1); % Add noise sound(y2, 8000); % Playback plot(y2); Increase the value of k by 0.1 each time and answer the following questions.
1. At what value of K you start to have difficulty in understanding the content of the playback?
2. Plot the waveforms at different values of k. At what value of k you start to have difficulty in identifying the fundamental period of the waveform?
23. (**)Voice signal encryption: Write a function that can take a wave file, encrypt it, and save it as another wave file. The I/O format is
myEncrypt(inputFileName, outputFileName);

where "inputFileName" is a string specifying the input wave file, and "outputFileName" is a string specifying the output wave file. The encryption process is like this (assuming y is the original signal and z is the encrypted signal):
1. z=y;
2. if y(i)>0, z(i)=1-y(i) for all i
3. if y(i)<0, z(i)=-1-y(i) for all i
4. z=flipud(z);
Note that:
• The encrypted file can be converted to the original file using the same function.
• Be aware that this is a naive encryption; better methods exist.
24. (*)Create Sine waves:
1. Create a sine wave of 4-second duration and 440-Hz frequency, with a sample rate of 16000.
2. Create a sine wave of 4-second duration, 16000-Hz sample rate, with a frequency linearly varying from 0 to 800 Hz.
25. (**)Generate sine wave with time-varying frequencies: Write a function to generate a sine wave with time-varying frequencies. The I/O format is
outputSignal=mySine(duration, freq);

where freq is a two-element vector [f1, f2], indicating the frequency of the sine wave should change linearly from f1 (for the first sample point) to f2 (for the last sample point). Note that
• The sample rate is 16 KHz.
• The first sample is zero, starting from time 0. (In other words, the time vector is (0:duration*fs-1)/fs, and the function to invoke is "sin".)
Note that he instantaneous frequency of $y=sin(2\pi\phi(t))$ is $\phi'(t)$. Therefore you can use the following conditions to find $\phi(t)$: $$\left\{ \begin{matrix} \phi'(t)=at+b,\\ \phi'(0)=f_1,\\ \phi'(duration-1/fs)=f_2,\\ sin(2\pi\phi(0))=0.\\ \end{matrix} \right.$$
Hint: Here is a snippet for generating a 3-second sine wave of 440Hz: duration=3; f=440; fs=16000; time=(0:duration*fs-1)/fs; y=sin(2*pi*f*time); plot(time, y); sound(y, fs);
26. (*)Create sirens: Use combination of sine waves to generate the sound of sirens (that you usually hear from an ambulance). Here is an example.
27. (**)Create beats:
1. Create a sine wave y1 of 3-second duration and 440-Hz frequency, with a sample rate of 16000.
2. Create a sine wave y2 of 3-second duration and 444-Hz frequency, with a sample rate of 16000.
3. Try "sound(y1+y2, fs)", what do you hear? Please use math derivation to explain such phenomenon of "acoustic beats". What is the frequency of the beats in this case?
28. (**)Create time-varying beats:
1. Create y1 as the previous exercise.
2. Create y2 which has a time-varying frequency from 440-Hz to 500-Hz (which changes linearly with time).
3. Try to play y1+y2 and explain what you hear.
29. (**)Resample audio signals: Write a MATLAB script to resample the audio signals in "sunday.wav" such that new waveform has a new sample rate of 11025. Plot these two waveform in the suplot(2, 1, 1). Plot their absolute difference in subplot(2, 1, 2).
°ß¤@¤£¦PÂI¡A¬O©Ò¶Ç¦^¨Óªºµ°TÅÜ¼Æ y ¬O¾ã¼ÆÈ¡A¦pªG nbits ¬O 8¡A«h y ªº½d³ò¥²¶·¤¶©ó -128 ¨ì 127 ¤§¶¡¡F¦pªG nbits ¬O 16¡A¨º»ò y ªº½d³ò´N·|¤¶©ó -32768 ¦Ü 32767 ¤§¶¡¡C ¡]´£¥Ü¡G§A¥²¶·¥ýÁA¸Ñ wavread() ªº¥Îªk¡C¡^
31. (**)¦p¦ó«Ø¥ßµ®Ø: ½Ð¼g¤@Ó¨ç¼Æ buffer2.m¡A¥Îªk¦p¤U
framedY = buffer2(y, frameSize, overlap);
>> y=[1 2 3 4 5 6 7 8 9 10 11 12 13 14]; >> buffer2(y, 4, 1) ans = 1 4 7 10 2 5 8 11 3 6 9 12 4 7 10 13
¥t¡A½Ð°Ý³oÓ¨ç¼Æ buffer2.m ©M Signal Processing Toolbox ¤¤ªº buffer ¨ç¼Æ¦³¦ó¤£¦P¡H
32. (*)¨ú¼ËÀW²vªº¼vÅT: ½Ð¥Î MATLAB ¼g¤@¤p¬qµ{¦¡¡A¶i¦æ¿ýµ¨â¬í¡A¿ýµªº¤º®e¬O¡u§Ú¬O¬Y¬Y¬Y¡v¡A¨ä¤¤¨ú¼ËÀW²v¬O 32 KHz¡A¸ÑªR«×¬O 8 ¦ì¤¸¡A½Ð±Nµ°TÀx¦s¦¨ myVoice2.wav ÀÉ®×¡C½Ð¹ï°T¸¹¶i¦æ«·s¨ú¼Ë¡]Resample¡^¡AÅý¨ú¼ËÀW²vÅÜ¦¨ 16 KHz, 8 KHz, 4 KHz, 2 KHz ...µ¥µ¥¡A½Ð°Ý·í¨ú¼ËÀW²v±¼¨ì¦h§C®É¡A§A¤w¸gÅ¥¤£¥X¨Óì¥ýªºÁnµ¡H
33. (*)Âø°Tªº¼vÅT: ½Ð¥Î MATLAB ¼g¤@¤p¬qµ{¦¡¡A¶i¦æ¿ýµ¨â¬í¡A¿ýµªº¤º®e¬O¡u§Ú¬O¬Y¬Y¬Y¡v¡A¨ä¤¤¨ú¼ËÀW²v¬O 8 KHz¡A¸ÑªR«×¬O 8 ¦ì¤¸¡C°²³]µ°T°T¸¹¬O¦s¦b¤@Ó¦æ¦V¶q y¡A§ÚÌ¥i¥H¥H¤U¦C¤è¦¡¥[¤JÂø°T¡G
k = 0.1; y2 = y + k*randn(length(y), 1); % ¥[¤JÂø°T sound(y2, 8000); % ©ñµ plot(y2);
·í k È¥Ñ 0.1¡B0.2¡B0.3 µ¥ºCºC¼W¤j®É¡AºCºC§AªºÁnµ·|¶V¨Ó¶V¼Ò½k¡C
1. ½Ð°Ý¨ì k È¬O¦h¤Ö®É¡A§A·|Å¥¤£¥X¨Óì¥ýÁ¿¸Üªº¤º®e¡H
2. ½Ð°Ý¨ì k È¬O¦h¤Ö®É¡A§A·|¬Ý¤£¥X¨Ó y2 ¥]§t¤@¬qÁnµªº°T¸¹¡H¡]´«¨¥¤§¡A¦b©ñ¤j y2 ªº¹Ï§Î«á¡A§A¤w¸g¬Ý¤£¥X¨Ó¦³°ò¥»¶g´Áªº¦s¦b¡C¡^
34. (**)«·s¨ú¼Ë: ½Ð¥Î interp1 «ü¥O¡A¹ï myVoice2.wav ªºµ°T¶i¦æ«·s¨ú¼Ë¡AÅý¨ú¼ËÀW²vÅÜ¦¨ 11025 Hz¡A¨Ã±Nµ²ªGÀx¦s¦¨ myVoice3.wav¡C


text:
# Gamma Function

1. Oct 30, 2005

### amcavoy

I am wondering how the following statement holds true:

$$\Gamma\left(\frac{1}{2}\right)=\int_0^{\infty}e^{-x}x^{-\frac{1}{2}}\,dx=\sqrt{\pi}$$

I know how to show that:

$$\int_0^{\infty}e^{-x^2}\,dx=\frac{\sqrt{\pi}}{2}$$

But I can't seem to apply that method (converting to a double-integral) to the gamma function. Any ideas?

Thanks.

Last edited: Oct 30, 2005
2. Oct 30, 2005

### Hurkyl

Staff Emeritus
$$\int_0^{+\infty} e^{-x^2} \, dx$$

and

$$\int_0^{+\infty} e^{-x} x^{1/2} \, dx$$

look a lot different... after all, one has $-x^2$ in the exponent, and the other has $-x$...

3. Oct 30, 2005

### amcavoy

Yeah, I just figured that since the results look similar, there may be a way to rearrange that gamma function to make it look like the other. --I guess not.

Would you suggest integration by parts to solve this? That is the only way I can think of, but it doesn't seem too promising because I can't get rid of that fractional exponent. Is there some sort of trick to this?

Thanks again.

4. Oct 30, 2005

### Hurkyl

Staff Emeritus
I never said you couldn't. :tongue: My post was a hint!

5. Oct 30, 2005

### saltydog

One method is to use Laplace Transforms:
First calculate:
$$\Gamma(x+1)=\int_0^{\infty}e^{-\beta}\beta^{x}d\beta$$
let:
$$\beta=st$$
$$\Gamma(x+1)=s^{x+1}\int_0^{\infty}e^{-st}t^x dt$$
rearrange, equate to the Laplace transform of $t^{x}$ and then let x=-1/2. Can you finish it?
Also, shouldn't your integral have $x^{-1/2}$?

6. Oct 30, 2005

### benorin

yep

Yes, it should, for $\Gamma(z)=\int_{t=0}^{\infty}e^{-t}t^{z-1}dt$ for $z\in\mathbb{C}$ such that $\Re(z)>0$.
Hence $\Gamma\left(\frac{1}{2}\right)=\int_{t=0}^{\infty}e^{-t}t^{-\frac{1}{2}}dt$, apply the substitution $x=\sqrt t \Rightarrow dx=\frac{1}{2}t^{-\frac{1}{2}}dt$ to get
$\Gamma\left(\frac{1}{2}\right)=2\int_{t=0}^{\infty}e^{-x^{2}}dx = \sqrt\pi$

Last edited: Oct 30, 2005
7. Oct 30, 2005

### amcavoy

Thanks a lot everyone for the help. I like that last substitution to change it into the form I am familiar with. Thank you

8. Oct 31, 2005

### Hurkyl

Staff Emeritus
Do you understand why he thought to use that substitution in the first place? (Hint: my hint is why, though he probably knew it without my hint) Will you think to look at that next time you get stuck on an integral?

9. Oct 31, 2005

### amcavoy

Yes, thank you both very much.


text:
1. ## Hypotenuse-leg criterion

---------------------------------------------------------

We have seen that there is no generally reliable SSA(Side Side Angle) criterion for congruence. If the angle part of such a correspondence is a right angle, the criterion is reliable. Justify this so-called Hypotenuse-leg criterion (which is abbriviated HL).

2. ## hypotenuse-leg criterion

Originally Posted by chil2e


text:
Next Meeting: January 6: Social gathering Next Installfest: TBD Latest News: Nov. 18: Club officer elections Page last updated: 2004 Mar 07 09:59
Re: [vox-tech] How to Generate Colorized Table Slides for Presentation?

# Re: [vox-tech] How to Generate Colorized Table Slides for Presentation?

On Sun 07 Mar 04,  4:06 AM, Mike Simons <msimons@moria.simons-clan.com> said:
> On Sat, Mar 06, 2004 at 10:28:26PM -0800, Peter Jay Salzman wrote:
> > On Sun 07 Mar 04, 12:44 AM, Mike Simons <msimons@moria.simons-clan.com> said:
> > > http://simons-clan.com/~msimons/tt/
> > >
> > > (ps: if using the dvi you'll need to say xdvi -paper usr s.dvi)
> > >
> > > At the end of the first page you will see the \hline from the second table...
> > > I would like that to not appear on the first page.
> > >
> > > At the end of the second page it chops a table in half (which I'd like
> > > to avoid)... I've tried putting optional \pagebreak[3] but they are
> > > ignored... I've also tried non-splitting row completes \\*, which
> > > don't seem to help... I also tried adding comments to the end of every
> > > line (for some reason I remember that as some gotcha from long time ago).
> > >
> > > If anyone has ideas how to fix, hints would be wonderful...
> >
> > i thought bill had this problem awhile ago.  our archives stink, so you
> > might just want to ask him.
>
> Well I don't know about our archives stinking...
> grepmail on my 30 meg vox-tech archive takes a few seconds.

well, i guess our archive are awesome.  the search utility is *useless*.
it doesn't even always print mail correctly.  don't GET me started...

grepmail sounds interesting.  from its name, i assume it knows mbox and
can print out entire messages based on grep patterns.  does it thread?

> I think I've come to the conclusion that I'll tell latex to put a .5
> inch boarder around the page, pick a readable font size, figure out how
> many lines fit in a given page, and have my perl stuff spit out long tables
> of the correct length for a page... using pagebreak when needed.

sure.  if you feel up to it, it might be nice to post a summary of your
task at hand and solution.  prolly a lot of writing, but i'd sure be

> Also from reading over the archives, it seems to me that tex/latex is
> very stagnate.  latex2e was released sometime in 1994 and version 3
> project which started then... doesn't really have anything released.
>
> Sigh...

true.  the dev team is a little secretive.  but here's what we can
expect from latex 3:

http://www.latex-project.org/guides/ltx3info/node4.html

pete

--
Make everything as simple as possible, but no simpler.  -- Albert Einstein
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


text:
# The Arnold – Serre debate

I have read (but I cannot now find where) that Arnold & Serre had a public debate on the value of Bourbaki. Does anyone have more details, or remember or know what was said?

-
I have also heard of such a debate, but rather as an ongoing debate involving many interviews, opinion pieces in journals like Bulletin de la SMF, informal discussions at a tea before or at a dinner after a seminar talk, etc. rather than a single debate in from of an audience given at one single place. But perhaps there was indeed such a formal debate, that I have not heard of. –  Joël Jan 4 at 23:37
Given that Arnold liked very much to use the expression criminal bourbakization', I'm sure any such debate would have been lively. –  Nikita Sidorov Jan 5 at 0:01

I was there. Arnol'd is one of my big mathematical heros, but I found the whole thing really sad. It was in French, but my French is decent. Arnol'd began his part with a phrase I've heard him say before: `In Russia it is impolite to talk ill of the dead, so I will not talk about Bourbaki'' and then he proceeded to lambast
Bourbaki in as nasty a way as you've ever read in any of his writings. I just felt like hanging my head. It was embarrassing watching him insult French Mathematics in front of 500 French men and saying things that seemed silly. It went on from there, Serre with a kind of sad understated dignity, not fighting, Arnol'd wanting a fight, hurling insults. The two barely even addressed each other. And yes, he did mention Toth, and if memory serves, he stated that Toth was probably Thales and had most likely come up with Newton's inverse square law. For me, the whole event was sad, embarrassing, and myth-crushing. Well, us mathematicians, we are all humans.

-
cool story brother –  Wicht Jan 5 at 23:21
@Wicht Please clarify what you mean. There is this: knowyourmeme.com/memes/cool-story-bro –  Todd Trimble Jan 5 at 23:50
I mean it in the literal sense, it is really a cool story. Wish I had been there man –  Wicht Jan 7 at 1:04
@Wicht Thanks for responding. "Cool" isn't the word I would have used myself; it seems sad and embarrassing as Richard says, considering that Arnol'd was in many respects a great and brilliant man. –  Todd Trimble Jan 7 at 23:21

Arnold's account of this debate (in Russian) is here: http://www.mccme.ru/edu/index.php?ikey=viarn_burbaki&post=25742517_1256 and here http://vivovoco.rsl.ru/VV/PAPERS/NATURE/BURBAKI.HTM

Let me translate few words from the beginning.

Serre challenged me with this motivation: "I wanted to tell about the influence of Bourbaki on mathematics. If everyone will speak the same, especially panegyrics, this will be boring. Thus I started to search who would express an opposite opinion to mine. After having leafed through the list of mathematicians of the world, I understood that this must be you."

The duel happened on 13 of March 2001 in Institute Poincare.

Then he describes Serre's speach and his own. According to Arnold's account, his talk in the debates is published as "Mathematics and Physics: a parent and a child, or sisters?" English translation: Physics-Uspekhi, 1999, 42, 12 1205-1217. Here is a free version: http://ufn.ru/en/articles/1999/12/c/

However, comparison of dates shows that this cannot be the true text of Arnold's talk in the debates. I re-read the account of the duel (cited in the beginning) and on my opinion 90% of what Arnold says there (about Serre and about other things) is just not true. Unlike this account, the paper in Physics-Uspekhi looks reasonable, when Arnold writes about math.

My impression is that I also read Serre's talk somewhere. But I cannot find any trace of it in the Internet. So all we have this biased (to say the least) account by Arnold.

-
I wish to warn you that this Arnold account is pure delirium, nonsense. Perhaps this is the reason no one cared to translate it. –  Alexandre Eremenko Jan 5 at 1:37
I disagree about Russo. Once I located the exact source of Arnold's theories about "Egyptian god Toth". This is some obscure speculative book written in Russian in the middle XIX century, which Arnold happened to read in his childhood. Serious historical research does not confirm anything of what Arnold says about Egyptians etc. On the other hand, on my opinion, Russo is a serious researcher, though he exaggerrates sometimes. –  Alexandre Eremenko Jan 5 at 2:09
Why "hidden"? What I mean, Arnold is almost always wrong when it comes to historical details. For example in the paper in Physics-Uspekhi, he says that "Descartes did not accept Newton's ideas". Newton was 8 years old when Descartes died:-) –  Alexandre Eremenko Jan 5 at 5:31
So, Arnold was right from the point of view of the "bourbakist logic" :) –  R W Jan 5 at 6:09
Actually, I would be very interested in following up on this literature by professional historians disputing his accounts, whether or not it is boring. –  Todd Trimble Jan 5 at 17:54

It appears that there was an event on Bourbaki, for a general audience, at the Institut Henri Poincaré (Paris) on march 13th, 2001, with Arnold and Serre.

The announcement says:

J-P. Serre : L'apport de Bourbaki, V. Arnold : Mathématiques et Physique. Arnold et Serre sont deux des plus grands noms de l'histoire des mathématiques. Ils ont des conceptions "épistémologiques" très différentes. Leur confrontation, exceptionnelle en public, devrait intéresser tous ceux qu'intéressent une réflexion sur les Sciences.

Translating roughly to: Serre: The contribution of Bourbaki, Arnold: Mathematics and Physics. Arnold and Serre are two of the greatest names in the history of mathematics. They have very different 'epistemological' conceptions. Their confrontation, exceptional in public, should be ineteresting for everyone interested in reflections on the sciences.

Also, Pierre Colmez mentions a debate (put under quotation marks) between Arnold and Serre on Bourbaki, recalling how the latter began his contribution. I cannot be sure if this is this event he is talking about, but it would fit very well as it was not really debate but two talks yet still somehow set up one against the other, so a debate in quotation marks.

Regarding things that were said, it is recalled (by Colmez) that Arnold began with a list of bad deeds of the "Bourbaki criminals" [criminels bourbakistes], including the inclusion of $0$ among the natural numbers, something about the meaning of A implies B [that I do not understand/cannot translate], and that children cannot calculate anymore on account of Bourbaki -- recalling an anecdote about a child who in reply to the question "what is $2+5$?", said it is $5+2$ since addition is commutative [this anecdote was the starting point there, although it appears that while this apparently happened, it was actually a joke/prank of the child, whose parents were mathematicians and who is today also a mathematician].

-
What is criminal is that there isn't a recording of the event :-( –  Mariano Suárez-Alvarez Jan 5 at 0:32
I think the A implies B thing is the usual "not A or B" vs. "here is a proof of B from A that isn't 'A and not A, therefore B'"? Not sure of this. –  David Jan 5 at 0:59
I was that child. –  Joël Jan 5 at 2:35
! Would you be willing to tell the story of how it happened? –  Marius Kempe Jan 5 at 3:02
It started as a joke, that I made when I was 11, a little similar in spirit to this one ( smbc-comics.com/?id=3227#comic ), though obviously less funny, that was transmitted and deformed by adults until it reached Arnold. I had a professor in middle-school (sixth, fifth, and fourth grade in the french scholar system, roughly from 11 to 14) who taught us math in a very formal fashion, starting with set theory . Once jokingly (he was intimidating even when he was joking), instead of a serious question he asked the class "combien font 2+5?" and i answered "5+2". –  Joël Jan 5 at 5:23


text:
# Reusing LaTeX code to achieve a consistent layout

What is the best approach to reusing the same layout for numerous tables, paragraphs etc. which share the same structure but different content? Is the best method to use custom commands/macros?

-
Write a (maybe private, maybe simple) package in which you define the macros. –  Leo Liu Aug 12 '12 at 6:30

As David Carlisle and Leo Liu have already pointed out, if you anticipate spending significant amounts of time in the future writing papers using LaTeX, it's definitely an excellent idea to create customized macros, say to standardize the layout and other formatting-related issues of your papers. Indeed, TeX and LaTeX are very much designed to make this possible.

Naturally, there's no single "best" approach to creating such a collection of macros. The macros are there to serve your needs, and what works for you needn't work for others (and vice versa). Some general guidelines do apply though, I think:

• Assuming you use LaTeX, you'll probably want to collect the macros in a "style file" and store this file somewhere in the TeX directory tree where it can be found when you invoke it with a \usepackage command.
• As with any computer program, use lots of comments to leave signposts regarding your thinking when you write and/or modify macros. You may understand perfectly right now what you're doing today, but when you get back to the code after some weeks or months have passed, you'll be most grateful to yourself for having provided copious comments. Providing comments also greatly simplifies the task of tracking down and fixing any bugs in your code.
• Identify which LaTeX packages you always (or almost always) tend to load for your documents. Some candidate packages might be amsmath, eurosym, and calc. If there are such packages, you should probably load them in your style file.
• Structure the package like a little document in its own right. Have an introduction (likely consisting of comments only), followed by sections related to matters such as page layout (possibly using the geometry package), the format of the table of contents (possibly using the tocloft package), the format of the references and citations (e.g., do you use a citation management package such as natbib?), graphics support (graphicx), formatting of numbers and scientific units (e.g., with the siunitx package), hyperlinking and cross-referencing (hyperref and cleveref), etc.
• Formatting figures and tables consistently is a challenge, and practice makes perfect (or, at the very least, very good). For these two groups of objects, the main pieces of advice I would give is (i) to familiarize yourself thoroughly with the properties of the various tabular-like environments (to name but a few: tabular, tabular*, tabularx, tabulary, longtable, and a host of others) and (ii) to develop a consistent style regarding the layout of tables (and figures) and to stick with it. E.g., should the caption always be at the top or the bottom of the respective float? Either approach can work, but it's up to you to make the choice. There are packages such as ctable that can help structure the creation of tables in consistent way. Be sure to figure out whether these packages' built-in formatting standards are to your liking and/or whether you can modify parts of these packages to suit your needs.

Separately, be prepared to provide some ex ante flexibility regarding the LaTeX packages that should be loaded and any custom code that should be executed by your package. Not all LaTeX packages should be loaded always (see below for an example). With some planning ahead, it's straightforward to disable parts of your package by setting a single option; that's much easier, and substantially less error-prone, than having to comment out various instructions on a case-by-case basis (which might be called a form of "ex post" flexibility, I suppose).

• Assume, for instance, that you write working papers that need to be formatted differently depending on whether they are to be circulated as (i) one-off submissions to colleagues, co-authors, and others -- in which case you can fully implement your personal style preferences; (ii) working papers in your university department's working paper series; and (iii) articles in a scholarly journal. Your department and the journals you submit papers to almost certainly have "house styles" for formatting-related matters. (Hopefully, these styles have written up as LaTeX style files for you to download and include.) Naturally, you don't want your package to conflict with the additional style files you may need to load in order to adhere to your department's or journal's formatting requirements.

• To deal with this rather common contingency, it's helpful to group the package's contents into two separate parts:

• One part should contain all directives related to broadly defined formatting issues, such as page size (e.g., "A4" or "US letter" size), margin widths, line spacing, font sizes, fonts, spacing above and below floats, styles for various sectioning headers, etc.

• The other part should include all macros and directives not linked to formatting issues. Among these could be specialized math macros you've set up, hyphenation exception patterns for words that tend to occur in your documents (e.g., if you cite an author named Gottlieb, you may want to add the command \hyphenation{Gott-lieb} so as to avoid seeing the name be hyphenated as Got-tlieb!), as well as instructions for loading packages related to graphics support, color, hyper-linking of cross-references and citations, and cross-referencing itself. Usually, the formatting requirements of journals and academic departments don't specify anything special for the latter types of packages.

• Once you've (re)organized your package in this manner, you can define (i) a Boolean "variable" that controls whether the formatting-related section of the package should be executed or not (its default value should be "true"), and (ii) a package option named, say, noformattingcode, which changes the value of the Boolean variable to "false." This could be done along the following lines:

\newif\if@formattingcode\@formattingcodetrue
\DeclareOption{noformattingcode}{\@formattingcodefalse}
... % various other option declarations, etc.
\ProcessOptions\relax

\if@formattingcode % if true, execute the following instructions until \fi
% all stuff broadly related to formatting of document
\fi
...

If you set the option noformattingcode when you load your package, you're telling LaTeX to skip over the part that's in the scope of the \if@formattingcode conditional.

Happy TeXing!

-
Thanks, very thorough. Much appreciated. –  Aram Kocharyan Aug 13 '12 at 13:30

As a general rule it is a good idea to put macros and settings in a package so they can be reused. That is essentially the main point of TeX being a macro language.

One thing to consider though is any other non TeX systems whith which the document sources are going to be used. TeX itself (and extensions such as e-tex, xetex, luatex) are very consistently implemented and any TeX macros will work the way on any system. However increasingly people convert TeX sources to other formats. Conversion to HTML and e-books for example, or MathJax dynamically interpreting TeX-like markup in a web page. Most of these systems do not understand the full TeX language, and so the more you use interesting features in your definitions, the harder it is to use the sources in non-TeX systems.

An extreme example is the plain TeX file http://mirrors.ctan.org/macros/plain/contrib/misc/xii.tex Many TeX-to-something translators fail to understand that file at all. (Some do, tex4ht and latexml for example.)

-
Thanks, packages it is. –  Aram Kocharyan Aug 13 '12 at 13:29

I wasn't sure how to provide this information, but using Mico's answer I set up a couple \if@s in my local package file that conditionally call packages, but was getting a compile error LaTeX Error: \RequirePackage or \LoadClass in Options Section. The exact TeX was like this, compiled with pdfLaTeX:

\ProvidesPackage{tablemwe}

\newif\if@formattingcode\@formattingcodetrue
\DeclareOption{noformattingcode}{\@formattingcodefalse}

\if@formattingcode % if true, execute the following instructions until \fi
\usepackage{tikz}
\fi

This may be obvious to more experienced users, but after declaring options in a package, you have to add a \ProcessOptions command. Additionally, you can separate the \newif and \DeclareOption from the actual \if statement. The same example as above is corrected to look like this:

\ProvidesPackage{tablemwe}

\newif\if@formattingcode\@formattingcodetrue
\DeclareOption{noformattingcode}{\@formattingcodefalse}
\ProcessOptions
% Other code can come here, calling packages, renew commands, etc.
\if@formattingcode % if true, execute the following instructions until \fi
\usepackage{tikz}
\fi

-
Thanks for pointing out the need to mention that if one has various \DeclareOption statements in one's package, one also needs to provide a \ProcessOptions instruction. I've added this piece into the pseodo-code in my answer. –  Mico Aug 16 '12 at 10:54


text:
Creates a task to export an EE Image to their EE Assets. This function is a wrapper around ee$batch$Export$image$toAsset(...).

ee_image_to_asset(
image,
assetId = NULL,
overwrite = FALSE,
pyramidingPolicy = NULL,
dimensions = NULL,
region = NULL,
scale = NULL,
crs = NULL,
crsTransform = NULL,
maxPixels = NULL
)

## Arguments

image

The image to be exported.

description

assetId

The destination asset ID.

overwrite

Logical. If TRUE, the assetId will be overwritten if it exists.

pyramidingPolicy

The pyramiding policy to apply to each band in the image, a dictionary keyed by band name. Values must be one of: "mean", "sample", "min", "max", or "mode". Defaults to "mean". A special key, ".default", may be used to change the default for all bands.

dimensions

The dimensions of the exported image. It takes either a single positive integer as the maximum dimension or "WIDTHxHEIGHT" where WIDTH and HEIGHT are each positive integers.

region

The lon,lat coordinates for a LinearRing or Polygon specifying the region to export. It can be specified as nested lists of numbers or a serialized string. Defaults to the image's region.

scale

The resolution in meters per pixel. Defaults to the native resolution of the image asset unless a crsTransform is specified.

crs

The coordinate reference system of the exported image's projection. Defaults to the image's default projection.

crsTransform

A comma-separated string of 6 numbers describing the affine transform of the coordinate reference system of the exported image's projection, in the order: xScale, xShearing, xTranslation, yShearing, yScale, and yTranslation. Defaults to the image's native CRS transform.

maxPixels

The maximum allowed number of pixels in the exported image. The task will fail if the exported region covers more pixels in the specified projection. Defaults to 100,000,000. **kwargs: Holds other keyword arguments that may have been deprecated, such as 'crs_transform'.

## Value

Other image export task creator: ee_image_to_drive(), ee_image_to_gcs()

## Examples

if (FALSE) {
library(rgee)
library(stars)
library(sf)

ee_users()
ee_Initialize()

# Define study area (local -> earth engine)
# Communal Reserve Amarakaeri - Peru
rlist <- list(xmin = -71.13, xmax = -70.95,ymin = -12.89, ymax = -12.73)
ROI <- c(rlist$xmin, rlist$ymin,
rlist$xmax, rlist$ymin,
rlist$xmax, rlist$ymax,
rlist$xmin, rlist$ymax,
rlist$xmin, rlist$ymin)
ee_ROI <- matrix(ROI, ncol = 2, byrow = TRUE) %>%
list() %>%
st_polygon() %>%
st_sfc() %>%
st_set_crs(4326) %>%
sf_as_ee()

# Get the mean annual NDVI for 2011
qa <- image$select("pixel_qa") cloud <- qa$bitwiseAnd(32L)$And(qa$bitwiseAnd(128L))$Or(qa$bitwiseAnd(8L))
mask2 <- image$mask()$reduce(ee$Reducer$min())
image <- image$updateMask(cloud$Not())$updateMask(mask2) image$normalizedDifference(list("B4", "B3"))
}

ic_l5 <- ee$ImageCollection("LANDSAT/LT05/C01/T1_SR")$
filterBounds(ee$FeatureCollection(ee_ROI))$
filterDate("2011-01-01", "2011-12-31")$map(cloudMaskL457) # Create simple composite mean_l5 <- ic_l5$mean()$rename("NDVI") mean_l5 <- mean_l5$reproject(crs = "EPSG:4326", scale = 500)
mean_l5_Amarakaeri <- mean_l5$clip(ee_ROI) # Move results from Earth Engine to Drive assetid <- paste0(ee_get_assethome(), '/l5_Amarakaeri') task_img <- ee_image_to_asset( image = mean_l5_Amarakaeri, assetId = assetid, overwrite = TRUE, scale = 500, region = ee_ROI ) task_img$start()
ee_l5 <- ee$Image(assetid) Map$centerObject(ee_l5)


text:
# Collatz Conjecture Or The 3n + 1 Problem

A conjecture, in Mathematics, is a conclusion or proposition that is considered to be true because of supporting evidence. But no definitive proof or disproof exists. This article will look at one such conjecture, the Collatz.

## What is the Collatz conjecture?

Consider a sequence defined as follows:

• if n is even, then the next number will be half of it: n/2
• if n is odd, then the next number will be one more than three times n: 3n + 1

The Collatz conjecture states that this sequence will eventually reach 1, no matter what number we started with.

A couple of examples will make this clearer.

Because 5 is odd, the next number will be

$3 * 5 + 1 = 15 + 1 = 16$

16 is even, so the next number will be

$\frac{16}{2} = 8$

The next numbers will be 4, 2, 1
The full sequence is: 5, 16, 8, 4, 2, 1

Let’s take another example.

Because 12 is even, the next number will be

$\frac{12}{2} = 6$

The next number will be

$\frac{6}{2} = 3$

Followed by

$3 * 3 + 1 = 10$

And then

$\frac{10}{2} = 5$

and from this point on, the sequence follows the first example. Hence the full sequence is:

$12, 6, 3, 10, 5, 16, 8, 4, 2, 1$

So, both the sequences eventually reach 1.

Once the sequence reaches 1, continuing it results in the infinite loop:

$1 => 4 => 2 => 1.$

The function f(n) which generates a Collatz sequence can formally be written as:

$f(n)= \begin{array}{cc} \{ & \begin{array}{cc} \frac{n}{2} & (n \bmod 2)=0 \newline 3 n+1 & (n \bmod 2)=1 \newline \end{array} \end{array}$

The operations performed on each number, halving if even, and tripling and adding one if odd, are called Collatz operations. The root of the sequence is its starting number. In the examples above, 5 and 12 are the roots. The numbers in a given sequence, as well as the sequence as a whole, are also called the orbits of the root.

## Other Names for the Collatz conjecture

The Collatz conjecture has many other names: the Ulam conjecture, Kakutani’s problem, Thwaite’s conjecture, Hasse’s algorithm, Syracuse problem, and sometimes, just 3N + 1.

## Hailstone Numbers

The numbers in a Collatz sequence are sometimes called hailstone numbers. This is because the numbers in the sequence tend to go both up and down, much like hailstones in a cloud. The figure below demonstrates this for the root 27.

## Stopping Time and Total Stopping Time

Suppose a0 is the positive integer we start with and the sequence we get by repeatedly performing the Collatz operations is a(0), a(1), a(2), … and so on.

$A_{n}= \begin{array}{cc} \{ & \begin{array}{cc} \frac{A_{n-1}}{2} & (A_n \bmod 2)=0 \newline 3 * A_{n-1} & (A_n \bmod 2)=1 \newline \end{array} \end{array}$

The smallest sequence index i for which a(i) < a0 is called the stopping time for a0. If there is no such index i, the stopping time for a0 is said to be infinity.

Take the sequence for the number 5:

$a(0) = 5 \newline a(1) = 16 \newline a(2) = 8 \newline a(3) = 4 \newline$

Note that 4 < 5, (a(3) < a(0))
Hence, the stopping time for number 5 is i = 3.

The smallest sequence index k for which a(k) = 1 is called the total stopping time for a0. If there is no such index k, the total stopping time for a0 is said to be infinity.

Again, for the number 5:

$a(0) = 5 \newline a(1) = 16 \newline a(2) = 8 \newline a(3) = 4 \newline a(4) = 2 \newline a(5) = 1 \newline$

Hence, the total stopping time for number 5 is k = 5.

On looking at the orbits, it becomes plain that a power of 2 (i.e., 2n) must appear in the sequence for it to reduce to 1. Once a power of 2 appears, the halving operation is the only one that is performed, as every halving operation produces an even number till 1 is reached. In the sequences above,16 is the power of 2, which eventually leads the sequence to 1.

No obvious connection has been observed between the starting number and the total stopping time. The total stopping time for 26 is 10, but that for 27 is 111.

The graph above shows a plot of the total stopping times (x-axis) and the number of occurrences (y-axis) for all numbers from 1 to 100 million.

The figure above shows all roots which have a total stopping time of less than 20. All paths converge at 1, which is at the center of the circle.

## Cycle length

In the Collatz sequences for positive integers, once we reach the value 1, we get a cycle where sequence elements keep taking the value 1 periodically.

Suppose a(k) = 1:

$a(k) = 1 \newline => a(k+1) = 3*a(k)+1 = 4 \newline => a(k+2) = \frac{a(k+1)}{2} = 2 \newline => a(k+3) = \frac{a(k+2)}{2} = 1 \newline$

Hence

$1 => 4 => 2 => 1 => 4 => 2 => …$

Since the value 1 recurs once every 3 elements, we say that the cycle length or cycle period is 3.

## Extended or Generalized Collatz conjecture

So far, we have only looked at Collatz sequences starting with positive integers. The Collatz conjecture has been extended to all integers (including zero and negative integers) and all rational numbers with odd denominators. In these cases, the Collatz sequence does not always reach the value 1. But the sequence will always reach a cycle that then keeps repeating.

### Zero

Consider a(k) = 0:

$a(k) = 0 \ :even \newline => a(k+1) = \frac{a(k)}{2} = 0 \ :even$

Cycle of length 1.

Note that, for integers, the only way to reach this cycle is to start the sequence with a(0) = 0.

### Negative integers

The extended conjecture states that for all negative integers, the Collatz sequences will eventually reach one of the three cycles described below.

#### Cycle 1

$a(k) = -1 :odd \newline => a(k+1) = 3*a(k)+1 = -2 :even \newline => a(k+2) = \frac{a(k+1)}{2} = -1 :odd \newline$

Cycle of length 2.

#### Cycle 2

$a(k) = -5 : odd \newline => a(k+1) = 3*a(k)+1 = -14 : even \newline => a(k+2) = \frac{a(k+1)}{2} = -7 : odd \newline => a(k+3) = 3*a(k+2) +1 = -20 : even \newline => a(k+4) = \frac{a(k+3)}{2} = -10 : even \newline => a(k+5) = \frac{a(k+4)}{2} = -5 : odd \newline$

Cycle of length 5.

#### Cycle 3

$a(k) = -17 : odd \newline => a(k+1) = 3*a(k)+1 = -50 : even \newline => a(k+2) = \frac{a(k+1)}{2} = -25 : odd \newline => a(k+3) = 3*a(k+2) +1 = -74 : even \newline => a(k+4) = \frac{a(k+3)}{2} = -37 : odd \newline => a(k+5) = 3*a(k+4) +1 = -110 : even \newline => a(k+6) = \frac{a(k+5)}{2} = -55 : odd \newline => a(k+7) = 3*a(k+6) +1 = -164 : even \newline => a(k+8) = \frac{a(k+7)}{2} = -82 : even \newline => a(k+9) = \frac{a(k+8)}{2} = -41 : odd \newline => a(k+10) = 3*a(k+9) +1 = -122 : even \newline => a(k+11) = \frac{a(k+10)}{2} = -61 : odd \newline => a(k+12) = 3*a(k+11) +1 = -182 : even \newline => a(k+13) = \frac{a(k+12)}{2} = -91 : odd \newline => a(k+14) = 3*a(k+13) +1 = -272 : even \newline => a(k+15) = \frac{a(k+14)}{2} = -136 : even \newline => a(k+16) = \frac{a(k+15)}{2}= -68 : even \newline => a(k+17) = \frac{a(k+16)}{2} = -34 : even \newline => a(k+18) = \frac{a(k+17)}{2} = -17 : odd \newline$

Cycle of length 18.

## Rational numbers with odd denominators

Rational numbers with odd denominators are considered to be odd or even when their numerators are odd or even respectively in the simplest form.

There seem to be many more possible cycles for rational numbers with odd denominators. But the Collatz sequences for these numbers also reach a cycle.

Let’s look at some examples.

1. a(0) = ⅓
$a(0) = ⅓ : odd \newline => a(1) = 3*a(0)+1 = 2 : even \newline => a(2) = \frac{a(1)}{2} = 1 : odd \newline$

… and we get a cycle 1 => 4 => 2 => 1 ... of length 3.

1. a(0) = ⅕
$a(0) = ⅕ : odd \newline => a(1) = 3*a(0)+1 = ⁸⁄₅ : even \newline => a(2) = \frac{a(1)}{2} = ⅘ : even \newline => a(3) = \frac{a(2)}{2} = ⅖ : even \newline => a(4) = \frac{a(3)}{2} = ⅕ : odd \newline$

… and we get a cycle ⅕ => ⁸⁄₅ => ⅘ => ⅖ => ⅕ … of length 4.

1. a(0) = -⅓
$a(0) = -⅓ : odd \newline => a(1) = 3*a(0)+1 = 0 : even \newline$

c. … and we get a cycle 0 -> 0 … of length 1.

## The current state of the conjecture

The Collatz conjecture has not been proved to be true for all positive integers. However, it has been verified for every number till 268. It is comparatively easy to prove for a given number. But it is a lot more difficult to prove for all numbers.

In 1976 Riho Terras showed that, after repeated application of the Collatz function, for almost all numbers the Collatz sequence for n ends up less than n. Showing that the numbers in the sequence consistently get smaller is one path to showing that they eventually get to 1.

In 2019, Terence Tao, one of the world’s greatest living mathematicians, improved on this result. Tao proved that for almost all numbers the Collatz sequence for n ends up much lower than n: below ⁿ⁄₂, below n1/2, or below ln(n) (the natural log of n). So, for almost every number, we can guarantee that its Collatz sequence goes as low as we want.

The conjecture is easy to understand but difficult to prove (the word "diabolical" is often used to describe the problem). One mathematician said, "Mathematics is not yet ready for such problems". Another mathematician, Jeffrey Lagarias, the greatest living authority on the conjecture, has said, "This is an extraordinarily difficult problem, completely out of reach of present-day mathematics".

What is so intriguing about the Collatz conjecture is its simplicity. Anyone can start playing with it and take a shot at proving or disproving it. It is also incredibly addictive. No wonder Lagarias routinely advises young mathematicians against working on the conjecture at the start of their careers.

The Collatz conjecture is possibly the simplest, unsolved problem in mathematics. It has not been possible to solve it with the mathematical theories known today. So, mathematicians must develop new theories to prove or disprove it. Therein lies the importance of this conjecture.


text:
# Tutorial

This tutorial is designed to step new users through the basics of setting up a signac data space, defining and executing a simple workflow with signac-flow, and analyzing the data.

## Basics

### Initializing the data space

In this tutorial, we will perform a simple study of the pressure-volume (p-V) relationship of a noble gas. As a first approximation, we could model the gas as an ideal gas, so the ideal gas law applies:

$p V = N k_B T$

Therefore, we can assume that the volume $$V$$ can be directly calculated as a function of system size $$N$$, Boltzmann’s constant $$k_B$$, and temperature $$T$$.

To test this relationship, we start by creating an empty project directory where we will place all the code and data associated with this computational study.

~ $mkdir ideal_gas_project ~$ cd ideal_gas_project/
~/ideal_gas_project $We then proceed by initializing the data space within a Python script called init.py: # init.py import signac project = signac.init_project("ideal-gas-project") for p in range(1, 10): sp = {"p": p, "kT": 1.0, "N": 1000} job = project.open_job(sp) job.init() The signac.init_project() function initializes the signac project in the current working directory by creating a configuration file called signac.rc. The location of this file defines the project root directory. We can access the project interface from anywhere within and below the root directory by calling the signac.get_project() function, or from outside this directory by providing an explicit path, e.g., signac.get_project('~/ideal_gas_project'). Note The name of the project stored in the configuration file is independent of the directory name it resides in. We can verify that the initialization worked by examining the implicit schema of the project we just created: ~/ideal_gas_project$ signac schema
{
'N': 'int([1000], 1)',
'kT': 'float([1.0], 1)',
'p': 'int([1, 2, 3, ..., 8, 9], 9)',
}

The output of the $signac schema command gives us a brief overview of all keys that were used as well as their value (range). Note The job.init() function is idempotent, meaning that it is safe to call it multiple times even after a job has already been initialized. It is good practice make all steps that are part of the data space initialization routine idempotent. ### Exploring the data space The core function that signac offers is the ability to associate metadata — for example, a specific set of parameters such as temperature, pressure, and system size — with a distinct directory on the file system that contains all data related to said metadata. The open_job() method associates the metadata specified as its first argument with a distinct directory called a job workspace. These directories are located in the workspace sub-directory within the project directory and the directory name is the so called job id. ~/ideal_gas_project$ ls -1 workspace/
03585df0f87fada67bd0f540c102cce7
22a51374466c4e01ef0e67e65f73c52e
71855b321a04dd9ee27ce6c9cc0436f4
# ...

The job id is a highly compact, unambiguous representation of the full metadata, i.e., a distinct set of key-value pairs will always map to the same job id. However, it can also be somewhat cryptic, especially for users who would like to browse the data directly on the file system. Fortunately, you don’t need to worry about this internal representation of the data space while you are actively working with the data. Instead, you can create a linked view with the signac view command:

~/ideal_gas_project $signac view ~/ideal_gas_project$ ls -d view/p/*
view/p/1  view/p/2  view/p/3  view/p/4  view/p/5  view/p/6  view/p/7  view/p/8  view/p/9

The linked view is the most compact representation of the data space in form of a nested directory structure. Most compact means in this case, that signac detected that the values for kT and N are constant across all jobs and are therefore safely omitted. It is designed to provide a human-readable representation of the metadata in the form of a nested directory structure. Each directory contains a job directory, which is a symbolic link to the actual workspace directory.

Note

Make sure to update the view paths by executing the $signac view command (or equivalently with the create_linked_view() method) everytime you add or remove jobs from your data space. ### Interacting with the signac project You interact with the signac project on the command line using the signac command. You can also interact with the project within Python via the signac.Project class. You can obtain an instance of that class within the project root directory and all sub-directories with: >>> import signac >>> project = signac.get_project() Tip You can use the$ signac shell command to launch a Python interpreter with signac already imported as well as depending on the current working directory, with variables project and job set to get_project() and get_job() respectively.

Iterating through all jobs within the data space is then as easy as:

>>> for job in project:
...     print(job)
...
03585df0f87fada67bd0f540c102cce7
22a51374466c4e01ef0e67e65f73c52e
71855b321a04dd9ee27ce6c9cc0436f4
# ...

We can iterate through a select set of jobs with the find_jobs() method in combination with a query expression:

>>> for job in project.find_jobs({"kT": 1.0, "p.$lt": 3.0}): ... print(job, job.sp.p) ... 742c883cbee8e417bbb236d40aea9543 1 ee550647e3f707b251eeb094f43d434c 2 >>> In this example we selected all jobs, where the value for $$kT$$ is equal to 1.0 – which would be all of them – and where the value for $$p$$ is less than 3.0. The equivalent selection on the command line would be achieved with$ signac find kT 1.0 p.\$lt 3.0. See the detailed Query API documentation for more information on how to find and select specific jobs. Note The following expressions are all equivalent: for job in project:, for job in project.find_jobs():, and for job in project.find_jobs(None):. ### Operating on the data space Each job represents a data set associated with specific metadata. The point is to generate data which is a function of that metadata. Within the framework’s language, such a function is called a data space operation. Coming back to our example, we could implement a very simple operation that calculates the volume $$V$$ as a function of our metadata like this: def volume(N, kT, p): return N * kT / p Let’s store the volume within our data space in a file called volume.txt, by implementing this function in a Python script called project.py: # project.py import signac def compute_volume(job): volume = job.sp.N * job.sp.kT / job.sp.p with open(job.fn("volume.txt"), "w") as file: file.write(str(volume) + "\n") project = signac.get_project() for job in project: compute_volume(job) Executing this script will calculate and store the volume for each pressure-temperature combination in a file called volume.txt within each job’s workspace. Note The job.fn('volume.txt') expression is a short-cut for os.path.join(job.workspace(), 'volume.txt'). ## Workflows ### Implementing a simple workflow In many cases, it is desirable to avoid the repeat execution of data space operations, especially if they are not idempotent or are significantly more expensive than our simple example. For this, we will incoporate the compute_volume() function into a workflow using the package signac-flow and its FlowProject class. We slightly modify our project.py script: # project.py from flow import FlowProject @FlowProject.operation def compute_volume(job): volume = job.sp.N * job.sp.kT / job.sp.p with open(job.fn("volume.txt"), "w") as file: file.write(str(volume) + "\n") if __name__ == "__main__": FlowProject().main() The operation() decorator identifies the compute_volume function as an operation function of our project. Furthermore, it is now directly executable from the command line via an interface provided by the main() method. We can then execute all operations defined within the project with: ~/ideal_gas_project$ python project.py run

However, if you execute this in your own terminal, you might have noticed a warning message printed out at the end, that looks like:

WARNING:flow.project:Operation 'compute_volume' has no post-conditions!

That is because by default, the run command will continue to execute all defined operations until they are considered completed. An operation is considered completed when all its post conditions are met, and it is up to the user to define those post conditions. Since we have not defined any post conditions yet, signac would continue to execute the same operation indefinitely.

For this example, a good post condition would be the existence of the volume.txt file. To tell the FlowProject class when an operation is completed, we can modify the above example by adding a function that defines this condition:

# project.py
from flow import FlowProject
import os

def volume_computed(job):
return job.isfile("volume.txt")

@FlowProject.operation
@FlowProject.post(volume_computed)
def compute_volume(job):
volume = job.sp.N * job.sp.kT / job.sp.p
with open(job.fn("volume.txt"), "w") as file:
file.write(str(volume) + "\n")

if __name__ == "__main__":
FlowProject().main()

Tip

Simple conditions can be conveniently defined inline as lambda expressions: @FlowProject.post(lambda job: job.isfile("volume.txt")).

We can check that we implemented the condition correctly by executing $python project.py run again. This should now return without any message because all operations have already been completed. Note To simply, execute a specific operation from the command line ignoring all logic, use the exec command, e.g.:$ python project.py exec compute_volume. This command (as well as the run command) also accepts jobs as arguments, so you can specify that you only want to run operations for a specific set of jobs.

### Extending the workflow

So far we learned how to define and implement data space operations and how to define simple post conditions to control the execution of said operations. In the next step, we will learn how to integrate multiple operations into a cohesive workflow.

First, let’s verify that the volume has actually been computed for all jobs. For this we transform the volume_computed() function into a label function by decorating it with the label() decorator:

# project.py
from flow import FlowProject

@FlowProject.label
def volume_computed(job):
return job.isfile("volume.txt")

# ...

We can then view the project’s status with the status command:

~/ideal_gas_project $python project.py status Generate output... Status project 'ideal-gas-project': Total # of jobs: 10 label progress --------------- -------------------------------------------------- volume_computed |########################################| 100.00% That means that there is a volume.txt file in each and every job workspace directory. Let’s assume that instead of storing the volume in a text file, we wanted to store in it in a JSON file called data.json. Since we are pretending that computing the volume is an expensive operation, we will implement a second operation that copies the result stored in the volume.txt file into the data.json file instead of recomputing it: # project.py from flow import FlowProject import json # ... @FlowProject.operation @FlowProject.pre(volume_computed) @FlowProject.post.isfile("data.json") def store_volume_in_json_file(job): with open(job.fn("volume.txt")) as textfile: data = {"volume": float(textfile.read())} with open(job.fn("data.json"), "w") as jsonfile: json.dump(data, jsonfile) # ... Here we reused the volume_computed condition function as a pre-condition and took advantage of the post.isfile short-cut function to define the post-condition for this operation function. Important An operation function is eligible for execution if all pre-conditions are met, at least one post-condition is not met and the operation is not currently submitted or running. Next, instead of running this new function for all jobs, let’s test it for one job first. ~/ideal_gas_project$ python project.py run -n 1
Execute operation 'store_volume_in_json_file(742c883cbee8e417bbb236d40aea9543)'...

We can verify the output with:

~/ideal_gas_project $cat workspace/742c883cbee8e417bbb236d40aea9543/data.json {"volume": 1000.0} Since that seems right, we can then store all other volumes in the respective data.json files by executing$ python project.py run.

Tip

We could further simplify our workflow definition by replacing the pre(volume_computed) condition with pre.after(compute_volume), which is a short-cut to reuse all of compute_volume()’s post-conditions as pre-conditions for the store_volume_in_json_file() operation.

### Grouping Operations

If we wanted to submit compute_volume and store_volume_in_json_file together to run in series, we currently couldn’t, even though we know that store_volume_in_json_file can run immediately after compute_volume. With the FlowGroup class, we can group the two operations together and submit any job that is ready to run compute_volume. To do this, we create a group and decorate the operations with it.

# project.py
from flow import FlowProject
import json

volume_group = FlowProject.make_group(name="volume")

@FlowProject.label
def volume_computed(job):
return job.isfile("volume.txt")

@volume_group
@FlowProject.operation
@FlowProject.post(volume_computed)
def compute_volume(job):
volume = job.sp.N * job.sp.kT / job.sp.p
with open(job.fn("volume.txt"), "w") as file:
file.write(str(volume) + "\n")

@volume_group
@FlowProject.operation
@FlowProject.pre(volume_computed)
@FlowProject.post.isfile("data.json")
def store_volume_in_json_file(job):
with open(job.fn("volume.txt")) as textfile:
data = {"volume": float(textfile.read())}
with open(job.fn("data.json"), "w") as jsonfile:
json.dump(data, jsonfile)

if __name__ == "__main__":
FlowProject().main()

We can now run python project.py run -o volume or python project.py submit -o volume to run or submit both operations.

### The job document

Storing results in JSON format – as shown in the previous section – is good practice because the JSON format is an open, human-readable format, and parsers are readily available in a wide range of languages. Because of this, signac stores all metadata in JSON files and in addition comes with a built-in JSON-storage container for each job (see: The Job Document).

Let’s add another operation to our project.py script that stores the volume in the job document:

# project.py
# ...

@FlowProject.operation
@FlowProject.pre.after(compute_volume)
@FlowProject.post(lambda job: "volume" in job.document)
def store_volume_in_document(job):
with open(job.fn("volume.txt")) as textfile:
job.document.volume = float(textfile.read())

Besides needing fewer lines of code, storing data in the job document has one more distinct advantage: it is directly searchable. That means that we can find and select jobs based on its content.

Executing the $python project.py run command after adding the above function to the project.py script will store all volume in the job documents. We can then inspect all searchable data with the$ signac find command in combination with the --show option:

~/ideal_gas_project $signac find --show 03585df0f87fada67bd0f540c102cce7 {'N': 1000, 'kT': 1.0, 'p': 3} {'volume': 333.3333333333333} 22a51374466c4e01ef0e67e65f73c52e {'N': 1000, 'kT': 1.0, 'p': 5} {'volume': 200.0} 71855b321a04dd9ee27ce6c9cc0436f4 {'N': 1000, 'kT': 1.0, 'p': 4} {'volume': 250.0} # ... When executed with --show, the find command not only prints the job id, but also the metadata and the document for each job. In addition to selecting by metadata as shown earlier, we can also find and select jobs by their job document content, e.g.: ~/ideal_gas_project$ signac find doc.volume.\$lte 125 --show Interpreted filter arguments as '{"doc.volume.$lte": 125}'.
df1794892c1ec0909e5955079754fb0b
{'N': 1000, 'kT': 1.0, 'p': 10}
{'volume': 100.0}
dbe8094b72da6b3dd7c8f17abdcb7608
{'N': 1000, 'kT': 1.0, 'p': 9}
{'volume': 111.11111111111111}
97ac0114bb2269561556b16aef030d43
{'N': 1000, 'kT': 1.0, 'p': 8}
{'volume': 125.0}

### Job.data and Job.stores

The job data attribute provides a dict-like interface to an HDF5-file, which is designed to store large numerical data, such as numpy arrays.

For example:

with job.data:
job.data.my_array = numpy.zeros(64, 32)

You can use the data-attribute to store both built-in types, numpy arrays, and pandas dataframes. The job.data property is a short-cut for job.stores['signac_data'], you can access many different data stores by providing your own name, e.g., job.stores.my_data.

See Job Data Storage for an in-depth discussion.

## Submit operations to a scheduling system

In addition to executing operations directly on the command line, signac can also submit operations to a scheduler such as SLURM. The submit command will generate and submit a script containing the operations to run and relevant scheduler directives such as the number of processors to request. In addition, signac will also keep track of submitted operations in addition to workflow progress, which almost completely automates the submission process as well as preventing the accidental repeated submission of operations.

To use this feature, make sure that you are on a system with any of the supported schedulers and then run the $python project.py submit command. As an example, we could submit the operation compute_volume to the cluster.$ python project.py submit -o compute_volume -n 1 -w 1.5

This command submits to the cluster for the next available job (because we specified -n 1), which is submitted with a walltime of 1.5 hours. We can use the --pretend option to output the text of the submission document. Here is some sample output used on Stampede2, a SLURM-based queuing system:

$python project.py submit -o compute_volume -n 1 -w 1.5 --pretend Query scheduler... Submitting cluster job 'ideal_gas/ee550647/compute_volu/0000/085edda24ead71794f423e0046744a17': - Operation: compute_volume(ee550647e3f707b251eeb094f43d434c) #!/bin/bash #SBATCH --job-name="ideal_gas/ee550647/compute_volu/0000/085edda24ead71794f423e0046744a17" #SBATCH --partition=skx-normal #SBATCH -t 01:30:00 #SBATCH --nodes=1 #SBATCH --ntasks=1 set -e set -u cd /scratch/05583/tg848827/ideal_gas_project # compute_volume(ee550647e3f707b251eeb094f43d434c) /opt/apps/intel17/python3/3.6.3/bin/python3 project.py exec compute_volume ee550647e3f707b251eeb094f43d434c We can submit 5 jobs simultaneously by changing -n 1 to -n 5. After submitting, if we run$ python project.py status -d, a detailed report is produced that tracks the progress of each job.

\$ python project.py status -d
Query scheduler...
Collect job status info: 100%|██████████████████████████████| 10/10 [00:00<00:00, 2500.48it/s]
# Overview:
Total # of jobs: 10

label    ratio
-------  -------
[no labels to show]

# Detailed View:
job_id                            operation           labels
--------------------------------  ------------------  --------
ee550647e3f707b251eeb094f43d434c  compute_volume [Q]
df1794892c1ec0909e5955079754fb0b  compute_volume [Q]
71855b321a04dd9ee27ce6c9cc0436f4  compute_volume [Q]
dbe8094b72da6b3dd7c8f17abdcb7608  compute_volume [Q]
a2fa2b860d0a1df3f5dbaaa3a7798a59  compute_volume [Q]
22a51374466c4e01ef0e67e65f73c52e  compute_volume [U]
97ac0114bb2269561556b16aef030d43  compute_volume [U]
03585df0f87fada67bd0f540c102cce7  compute_volume [U]
e5613a5439caeb021ce40a2fc0ebe7ed  compute_volume [U]
742c883cbee8e417bbb236d40aea9543  compute_volume [U]
[U]:unknown [R]:registered [Q]:queued [A]:active [I]:inactive [!]:requires_attention

Jobs signified with Q are queued in the cluster; when calling python project.py status -d again, if signac queries the cluster to find those jobs have begun running, their status will be reported A.

See the Cluster Submission section for further details on how to use the submit option and the Manage Environments section for details on submitting to your particular cluster.


text:
# How do you find (dy)/(dx) given 4xy+4x+3=0?

Nov 3, 2016

$\frac{\mathrm{dy}}{\mathrm{dx}} = - \frac{1 + y}{x}$

#### Explanation:

I propose a slightly different approach.

$4 x y = - 3 - 4 x$

$x y = \frac{- 3 - 4 x}{4}$

Now, differentiate with respect to $x$.

$y + x \left(\frac{\mathrm{dy}}{\mathrm{dx}}\right) = \frac{- 4 \times 4 - 0 \times \left(- 3 - 4 x\right)}{4} ^ 2$

$y + x \left(\frac{\mathrm{dy}}{\mathrm{dx}}\right) = - \frac{16}{16}$

$y + x \left(\frac{\mathrm{dy}}{\mathrm{dx}}\right) = - 1$

$x \left(\frac{\mathrm{dy}}{\mathrm{dx}}\right) = - 1 - y$

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{- 1 - y}{x}$

$\frac{\mathrm{dy}}{\mathrm{dx}} = - \frac{1 + y}{x}$

Hopefully this helps!


text:
# Properties

 Label 53130cr Number of curves 8 Conductor 53130 CM no Rank 1 Graph

# Related objects

Show commands for: SageMath
sage: E = EllipticCurve("53130.cs1")
sage: E.isogeny_class()

## Elliptic curves in class 53130cr

sage: E.isogeny_class().curves
LMFDB label Cremona label Weierstrass coefficients Torsion order Modular degree Optimality
53130.cs8 53130cr1 [1, 0, 0, 389490, -79877628] 6 1327104 $$\Gamma_0(N)$$-optimal
53130.cs7 53130cr2 [1, 0, 0, -2088590, -732603900] 12 2654208
53130.cs6 53130cr3 [1, 0, 0, -9421710, -11238222588] 2 3981312
53130.cs5 53130cr4 [1, 0, 0, -13968590, 19556060100] 6 5308416
53130.cs4 53130cr5 [1, 0, 0, -29857870, -62785836988] 6 5308416
53130.cs3 53130cr6 [1, 0, 0, -151146590, -715242391500] 4 7962624
53130.cs2 53130cr7 [1, 0, 0, -151545890, -711273429360] 2 15925248
53130.cs1 53130cr8 [1, 0, 0, -2418345370, -45774911264488] 2 15925248

## Rank

sage: E.rank()

The elliptic curves in class 53130cr have rank $$1$$.

## Modular form None

sage: E.q_eigenform(10)
$$q + q^{2} + q^{3} + q^{4} + q^{5} + q^{6} + q^{7} + q^{8} + q^{9} + q^{10} - q^{11} + q^{12} + 2q^{13} + q^{14} + q^{15} + q^{16} - 6q^{17} + q^{18} - 4q^{19} + O(q^{20})$$

## Isogeny matrix

sage: E.isogeny_class().matrix()

The $$i,j$$ entry is the smallest degree of a cyclic isogeny between the $$i$$-th and $$j$$-th curve in the isogeny class, in the Cremona numbering.

$$\left(\begin{array}{rrrrrrrr} 1 & 2 & 3 & 4 & 4 & 6 & 12 & 12 \\ 2 & 1 & 6 & 2 & 2 & 3 & 6 & 6 \\ 3 & 6 & 1 & 12 & 12 & 2 & 4 & 4 \\ 4 & 2 & 12 & 1 & 4 & 6 & 3 & 12 \\ 4 & 2 & 12 & 4 & 1 & 6 & 12 & 3 \\ 6 & 3 & 2 & 6 & 6 & 1 & 2 & 2 \\ 12 & 6 & 4 & 3 & 12 & 2 & 1 & 4 \\ 12 & 6 & 4 & 12 & 3 & 2 & 4 & 1 \end{array}\right)$$

## Isogeny graph

sage: E.isogeny_graph().plot(edge_labels=True)

The vertices are labelled with Cremona labels.


text:
# A geostationary orbit is chosen for communication satellites because:

This question was previously asked in
ESE Electronics 2011 Paper 2: Official Paper
View all UPSC IES Papers >
1. It is stationary at one point in space
2. With respect to a spot on earth it looks stationary
3. This orbit provides earth's coverage of more than 50% using a single satellite
4. The length of 4700 km is convenient for launching

Option 2 : With respect to a spot on earth it looks stationary
Free
CT 1: Network Theory 1
11207
10 Questions 10 Marks 10 Mins

## Detailed Solution

• A geostationary orbit is a circular orbit approx. 36,000 kilometers above the Earth's equator and following the direction of the Earth's rotation.
• satellite in geostationary orbit lies in the same plane as the equator.
• This implies that an object that is placed in this orbit has an orbital period equal to the Earth's rotational period and therefore stays at the same spot with respect to the Earth.
• Weather satellites are, therefore, placed in the geostationary orbit as the position allows them to observe and monitor weather conditions that vary on a short timescale.

Applications of Geostationary (GEO) satellite includes: