text:
## Planar web geometry through abelian relations and singularities.(English)Zbl 1133.53012

Griffiths, Phillip A. (ed.), Inspired by S. S. Chern. A memorial volume in honor of a great mathematician. Hackensack, NJ: World Scientific (ISBN 978-981-270-061-2/hbk; 978-981-270-062-9/pbk). Nankai Tracts in Mathematics 11, 269-295 (2006).
This paper is the Chapter 10 of a volume in honour of S. S. Chern. The author presents basic and new results on webs consisting of $$d \geq 1$$ complex analytic foliations of curves in general position of the projective plane. To illustrate methods and open problems, introductory examples are given. The paper has three sections. In the first one, one can see an acknowledgement to the work of Chern and Blaschke and the introduction of the main objects treated in the paper. The second section essentially deals with the geometric study of planar webs with the help of certain generically finite morphisms and a not necessarily integrable connection associated to the web where possible horizontal sections are identified with the space of abelian relations, The paper ends with a singular approach for planar webs.
For the entire collection see [Zbl 1105.00006].

### MSC:

 53A60 Differential geometry of webs 14C21 Pencils, nets, webs in algebraic geometry

### Keywords:

planar web; abelian relations; singularities of webs


text:
# Random walks on symmetric groups

Let $$S_n$$ be the symmetric group on $$n$$ elements. Now, we pick a random transpositions to generate random walks on $$S_n$$ (also assume the probability of picking each transposition is equal of course). There are $$n(n-1)/2$$ transpositions. How many does is need on average (expectation) to get back to the identity $$(1)$$? Namely, what is the expectation step of a random walk on $$S_n$$ first hit the identity?

I could compute the case for 2,3, and 4. The expectations are simply 2, 6, 24. So I guess it is $$n!$$.

In general, for an irreducible, aperiodic Markov process on a finite state space, the expected return time to a state $$x$$ is always the reciprocal of the unique steady state probability for $$x$$. To see this, let $$T_0,T_1,T_2,\dots$$ be the return times to $$x$$ when the Markov process starts at $$x$$, where we define $$T_0=0$$. Note that $${T_n\over n}=\frac1n\left[(T_1-T_0)+(T_2-T_1)+\dots+(T_n-T_{n-1})\right]$$ By the strong law of large numbers, $$T_n/n\to E[T_1]$$, the expected return time to $$x$$. On the other hand, $$n/T_n$$ is the proportion of visits to $$x$$ among the first $$T_n$$ steps of the process, since there were exactly $$n$$ visits. Since we assumed the process converges to a unique steady state vector, we must also have $$n/T_n\to p_{\infty}(x)$$.
Your random walk on $$S_n$$ is irreducible and aperiodic. Since symmetry implies the steady state probability for all group elements is equal, it must be $$1/n!$$ for each, so the expected return time for all elements is $$n!$$.

format: plain


text:
# Continuous compounding problem [duplicate]

How long does it take an investment to double if continuously compounded at a 6% rate? Is this right?

\begin{align*} e^{0.06 \cdot t} & = 2\\ 0.06t & = \ln(2)\\ t & = \frac{\ln 2}{0.06}\\ & \approx 11.55 \end{align*}

Why does $e$ equal the $\lim_{n \to \infty} (1+\frac{1}{m})^m$?

I know that if $r$ is the rate and $n$ is the number of compounding periods in $t$ years, then the value of an investment is:

$$A_0\left(1+\frac{r}{n}\right)^{nt}$$

But how do we get from here to the definition with $e$ in continuous compounding?

## marked as duplicate by user296602, N. F. Taussig, Misha Lavrov, Saad, ShaileshFeb 19 '18 at 0:33

• The question of why $e = \lim_{n \to \infty} (1 + 1/n)^n$ has been asked here a very large number of times. – user296602 Feb 12 '18 at 1:31
$lim_{n\rightarrow \infty}(1+\frac{r}{n})^n = e^r$ is proved in calculus. If you don't remember this, you can prove it easily by proving that the logarithm goes to $r$. As to your second question, $(1+\frac{r}{n})^{nt}=((1+\frac{r}{n})^n)^t,$ by the laws of exponents.


text:
## Content

### Lights in the Passage

The passage to our front door is lit by a light that is controlled by two switches, one at either end. When you switch a light on at one end you can switch it off from that same end or from the other end. This has obvious advantages for both human and electrical efficiency. But how would you wire such an arrangement?

Well, it's clearly not in series as we've shown in Figure 1, where the switches x and y are joined in line'.

Figure 1: Two switches in series

Given the series set up you would need both $x$ and $y$ to be on' to get the light to work. Any other positioning of the switches would lead to no light which isn't so good if you've just come home to a dark house and you don't want to fall over the cat. Just to emphasise this, we've drawn up Table 1. By on' for a switch we visualise it as making a connection with the wire' shown in Figure 1.

#### Table 1: The effect of two switches in series

Switch $x$ Switch $y$ Light
on on on
on off off
off on off
off off off

That's obviously not how the electrician wired up the hall light. So the next guess is a wiring that is in parallel (see Figure 2).

Figure 2: Two switches in parallel

All the possible situations are show in Table 2, but this is no good either because, for example, when $x$ is on, the light is always on.

#### Table 2: The effect of two switches in parallel

Switch $x$ Switch $y$ Light
on on on
on off on
off on on
off off off

Now the only ways to wire things together are in series or parallel. So how did the electrician wire up the passage?

Questions

1. Draw up a table of off and on results for the switches in the circuits in Figure 3. Simplify the circuits where possible.

Figure 3: Some switching circuits

Questions

1. Voting for Two: Jamal and John have invented a system for getting a majority vote. If they both vote `yes' by pressing a button a light comes on. Otherwise there is no light. Draw up a table that explains this system. What does this simplify to?
2. Voting for Three: Veronique joins Jamal's and John's committee. Draw up a table for a system that produces a light only when there is a majority vote. What does this simplify to?
3. Passage Problem: Assume that switches $x$ and $y$ both start in the off position and the light is then off too. Draw up a table of the results we want to achieve so that we get the desired effect in the passage.
4. Experiment with circuits that are combinations of two switches used in a variety of series and parallel arrangements. Produce on, off tables for each of them.

As we shall see shortly there are advantages to replacing the on and off of switches by 1 and 0. This means that Table 1 would become Table $1'$.

#### Table $1'$: The effect of two switches in series using ones and zeros

Switch $x$ Switch $y$ Light
1 1 1
1 0 0
0 1 0
0 0 0

Questions

1. In all the tables you have met so far, replace on and off with 1 and 0.
2. Table 1$'$ looks like multiplication. We could replace the whole of the table, and therefore the whole series system, by $x \times y$. What algebraic expression could you replace the parallel arrangement of switches by?
3. But the arithmetic here is a little strange. In particular what is 1 + 1 in the parallel case? Where else in mathematics does this kind of thing happen?
4. Think about the tables in Q6 from an algebraic standpoint. Can you express the results algebraically in terms of $x, y$ and $z$?

One final device that is useful here is the complement $x'$ of a switch $x$. The effect of this is shown in Table 3. The idea here is that when $x$ switch is on, its complement is off and vice versa.

#### Table 3: The complement of a switch

Switch $x$ Switch $x'$
1 0
0 1

Figure 4: Some switching circuits

Questions

1. Draw up 0 and 1 tables for the circuits in Figure 4. Produce algebraic expressions for each of them in terms of the $+$ and $\times$ of parallel and series switches.
2. Now try to algebraicise the Passage Problem of Q4.
3. Continue to experiment as in Q5, but now allow for a switch and/or its complement to be present.

Next page - Content - Boolean Algebra 2


text:
# Motion in 2D and Its Dimensions for JEE

## What is Motion in 2D?

Motion is the change of position of an object or a body. It could be a one-dimensional, two-dimensional, or three-dimensional motion. The motion of an object or particle in a plane is referred to as two-dimensional motion. Motion in two dimensions can further be divided into circular, projectile, and planar motion. Their examples include: a boy throwing a ball towards his friend is an example of projectile motion; rotating ceiling fan is an example of circular motion. Now, how do we simplify motion in two dimensions? We divide it into one dimension, correlating the equations and then calculating the unknowns.

## What is Motion?

The rate of change of position is known as motion. It can be different physical quantities like displacement, acceleration, velocity, speed, and so on. A car accelerating, an apple falling from a tree, water gushing out of a tap, etc. are all examples of motion. Every physical process around us is in some kind of fast or slow motion. Take, for example, distance. It is the change in position of an object with respect to time. Acceleration, on the other hand, is the change in velocity of an object with respect to time. Be it velocity, distance, acceleration, or displacement, all are used to describe motion.

## What are the Types of Motion?

Depending on the type of motion an object goes through, motion can be classified into different types, which include:

• Linear motion of objects or rectilinear motion

• Rotational Motion of an object

• Oscillatory Motion

The rotation of a car wheel, a pendulum swinging to and fro, a ball rolling from an inclined surface, a car accelerating at a constant speed or variable speeds are all examples of the different types of motion listed above. Let us further understand this with a few more examples.

## Explanation of the Types of Motion with Examples

### Linear or Rectilinear Motion

As the name suggests, a linear or rectilinear motion is the motion of an object in a straight line. We witness several examples of linear motion in our day-to-day lives. Some of these include the following:

1. A sliding door

A sliding door is a perfect example of linear motion. The to-and-fro motion of the sliding door allows a person to enter or close the door.

2. A person firing a bullet

A person firing a bullet is another good example of linear motion. When the bullet is fired, it leaves the barrel in a straight line.

Firing a Bullet

3. The motion of a car on a flat road

The forward or backward motion of a car on a flat road is another great example to exhibit linear motion.

## Rotational Motion

Rotational or circular motion is the motion of a rigid body moving with a constant angular velocity about an axis. The rotational motion does not change the shape or size of an object. Let us further understand this with a few examples.

1. Earth Rotating about its Axis

The rotation of the Earth around its axis is a perfect example of rotational motion. The Earth rotates at a very slow and constant speed about its axis.

2. Rotation of a Ceiling Fan

A ceiling fan mounted on the roof of your house rotates in a clockwise direction when it is switched on. The speed of the fan at a time remains the same until it is changed using a regulator.

3. Rotation of the Minute or Hour Hand of the Clock

The rotation of different hands of the clock is another example of rotational motion. The hands of the clock move in a clockwise direction to complete a whole rotation around a fixed point.

## Oscillatory Motion

Oscillatory motion is also called periodic or repetitive motion. It is the to-and-fro motion of an object from its mean position. Some examples of oscillatory motion include the following.

1. A pendulum swinging

The to-and-fro motion of a pendulum from its mean position is an example of oscillatory motion.

Pendulum Swinging

2. Alternating Current

The AC supply that we get in our households is another example of an oscillatory motion as current reverses its direction at regular intervals.

Alternating Current or AC

3. Vibrating string of a guitar or any musical instrument

The strings of the guitar vibrate when a person plucks them using a pick. It is another good example of an oscillatory motion.

## What are the Dimensions of Acceleration?

Acceleration is the rate of change of velocity. To denote the dimensions of acceleration, they are denoted in terms of mass, length, and time. Let us derive this.

Let

Mass = M

Length = L

Time = T

Acceleration = a

Velocity = v

Now the dimensional formula for displacement, time, and velocity are:

Displacement = M0L1T0

Time=M0L0T1

We know, velocity=displacement $\times$ time-1

=(M0L1T0)$\times$(M0L0T1)-1

=(M0L1T0)$\times$(M0L1T-1)

Velocity=M0L1T-1

Now, we know acceleration=velocity $\times$time-1

=(M0L1T-1)$\times$(M0L0T1)

=M0L1T-2

Thus, the dimensions of acceleration are M0L1T-2.

Now that we have discussed types of motion with examples, we will look at some of the solved examples related to the same concept.

## Visualisation of Vector in 2D

2D objects or two-dimensional objects are nothing but the objects that have a length and a breadth. For a vector to be denoted in 2D, its components are represented on the a-axis and y-axis, respectively.  Mathematically, these will be denoted as VX and VY. $\theta$ is the angle that the vector $\vec V$ with the x-axis.

2D Vector

## Relative Velocity

Relative velocity is the velocity of an object with another object. To understand how two objects are moving with respect to another, we use the concept of relative velocity. The two objects in this case might move in the same direction or in the opposite direction. Suppose that one object has velocity v1 and another has velocity v2, then the relative velocity of one with respect to the second is

\begin{align}&\vec{V}_{12}=\vec{V}_{2}-\vec{V}_{1}\\&\vec{V}_{12}=\vec{V}_{2}+\vec{V}_{1} \end{align}

First expression is valid when both objects have velocities in opposite directions and the second is valid when both objects have velocities in the same direction.

## Projectile Motion

The motion of an object in a curved path with constant acceleration is known as projectile motion. The motion in this case is along the x-axis and the y-axis.

Projectile Motion

The acceleration component along the x-axis is 0, whereas in the vertical direction it is -g. However, the component of velocity along the x-axis is  $u \cos (\theta)$ and $u \sin (\theta)$, respectively.

The equation of a projectile or the trajectory formula as it is known is given as

$y=x \tan \theta-\dfrac{g x^{2}}{2 u^{2} \cos ^{2} \theta}$

Here, x and y are the horizontal and vertical components, respectively, and u is the initial velocity and g is the acceleration due to gravity. There are other important equations related to the projectile motion which include the time of flight (T), maximum height (H), and the horizontal range of the projectile (R). These equations are

\begin{align} &T=\dfrac{2 u \sin \theta}{g} \\ &H=\dfrac{u^{2} \sin ^{2} \theta}{2 g} \\ &R=\dfrac{u^{2} \sin 2 \theta}{g} \end{align}

Here, u is the initial velocity, g is the acceleration due to gravity, and θ at which the projectile was thrown with respect to the horizontal.

These are the equations of motion of the projectile.

## Equation of Motions in Two Dimensions

The three equations of motion in two dimensions x and y are given as:

\begin{align} &v_{x}=u_{x 0}+a_{x} t \\ &\Delta x=u_{x 0} t+\dfrac{1}{2} a_{x} t^{2} \\ &v_{x}^{2}-u_{x 0}^{2}=2 a_{x} \Delta x \end{align}

Similarly, the equations can be written in y directions.

\begin{align} &v_{y}=u_{y 0}+a_{y} t \\ &\Delta y=u_{y 0} t+\dfrac{1}{2} a_{y} t^{2} \\ &v_{y}^{2}-u_{y 0}^{2}=2 a_{y} \Delta y \end{align}

## Solved Examples for Two-Dimensional Motion

Example 1: A particle is moving with an initial velocity (2i + 4j) $\dfrac{m}{s}$ and has constant acceleration of  (10i + 2j) $\dfrac{m}{s^2}$. Calculate the final velocity and displacement after 6 seconds.

Solution: The above problem can be solved by dividing velocity and acceleration into one dimension. Thus, along the x-axis, we have initial velocity as 2 $\dfrac{m}{s}$, acceleration as 4 $\dfrac{m}{s^2}$. Using the first equation of motion, we have v=u+at. Substituting the values above in this, we get

\begin{align} &v=2+10 \times 6 \\ &v=62 m s^{-1} \end{align}

Now, using the second equation of motion, we have $s=u t+\dfrac{1}{2} a t^{2}$. Substituting the above values we get,

\begin{align} &s=2 \times 6+\dfrac{1}{2}(10) \times 6^{2} \\ &s=12+180 \\ &s=192 \mathrm{~m} \end{align}

Now, we will calculate the same along the y-direction.

We get the value of velocity as

\begin{align} &v=4+2 \times 6 \\ &v=16 \mathrm{~ms}^{-1} \end{align}

Similarly, the displacement will be

\begin{align} &s=4 \times 6+\dfrac{1}{2} \times 2 \times 6^{2} \\ &s=24+36 \\ &s=60 \mathrm{~m} \end{align}

Thus, final velocity = $v=v_{x} \hat{i}+v_{y} \hat{j}=62 \hat{i}+16 \hat{j}$

or

\begin{align} v &=\sqrt{62^{2}+16^{2}} \\ =v &=64 ms^{-1} \end{align}

The final displacement is

\begin{align} &s=s_{x} \hat{i}+s_{y} \hat{j} \\ &s=192 \hat{i}+60 \hat{j} \\ &\text { or } \\ &s=\sqrt{192^{2}+60^{2}} \\ &s=201.15 \mathrm{~m} \end{align}

Hence, the final velocity and displacement after 6 seconds are $62 \hat{i}+16 \hat{j}$ and $201.15 \mathrm{~m}$.

Example 2: An object is moving in a plane with a velocity $v=4 t \hat{i}+6 t^{3} \hat{j}$. Find the acceleration of the object between time intervals (0,2).

Solution: Acceleration is denoted as $a=\dfrac{\Delta v}{\Delta t}$

At 0 time interval, velocity will be zero, whereas at t=2 seconds, velocity will be

\begin{align} &v=4 \times 2 \hat{i}+6 \times 2^{3} \hat{j} \\ &v=8 \hat{i}+48 \hat{j} \end{align}

Therefore, acceleration will be

\begin{align} &\Rightarrow \dfrac{8 \hat{i}+48 \hat{j}}{2} \\ &\Rightarrow 4 \hat{i}+24 \hat{j} \end{align}

Hence, the acceleration of the object between time intervals (0,2) is $4 \hat{i}+24 \hat{j}$.

## Conclusion

Two-dimensional motion is an important concept that is used to describe displacement, acceleration, speed, etc. It is the change in motion of an object with time. In our day-to-day life, we experience different kinds of motion, be it one-dimensional, two-dimensional, or even three-dimensional. The difference of an object gives rise to the concepts of the frame of reference and relative motion. These are extremely fundamental concepts when dealing with two-dimensional motion problems.

## FAQs on Motion in 2D and Its Dimensions for JEE

1. What is a frame of reference?

A frame of reference is an important concept in Physics. It is especially helpful when we are trying to calculate a value based on set values or criteria. It usually consists of a coordinate system or setting up coordinates in relation to the motion of an observer.

For example, if a person is looking at a moving train, and another person sitting inside the train is waving his hand towards him. In such a case, we take two frames of reference, one of the person standing at the platform watching the moving train, and the other one is of the person sitting inside the train. To the person standing on the platform, the person sitting inside the train seems to be moving. But from his/her frame of reference, the person sitting inside is at rest.

2. What is relative motion?

The motion of one body with respect to another, which could be at rest or in motion, is known as relative motion. The concept of a frame of reference was introduced to understand relative motion in-depth. The motion in case of a relative motion depends on the frame of reference or location of the observer. Motion can also be viewed from a fixed point of view. This type of motion is known as absolute motion.

Comment


text:
# Q7.20     The oxygen molecule has a mass of $5.30\times 10^{-26}kg$  and a moment of inertia of               $1.94\times 10^{-46}kg\: m^{2}$about an axis through its centre perpendicular to the lines joining              the two atoms. Suppose the mean speed of such a molecule in a gas is $500m/s$ and              that its kinetic energy of rotation is two thirds of its kinetic energy of translation.             Find the average angular velocity of the molecule.

D Devendra Khairwa

We are given the moment of inertia and the velocity of the molecule.

Let the mass of oxygen molecule be m.

So the mass of each oxygen atom is given by :      $\frac{m}{2}$

Moment of inertia is :

$I\ =\ \frac{m}{2}r^2\ +\ \frac{m}{2}r^2\ =\ mr^2$

or                                   $r\ =\ \sqrt{\frac{I}{m}}$

or                                  $r\ =\ \sqrt{\frac{1.94\times 10^{-46}}{5.36\times 10^{-26}}}\ =\ 0.60\times 10^{-10}\ m$

We are given that :

$E_{rot}\ =\ \frac{2}{3}E_{tra}$

or                                  $\frac{1}{2}I\omega ^2\ =\ \frac{2}{3}\times \frac{1}{2}mv^2$

or                                 $\omega \ =\ \sqrt{\frac{2}{3}}\times \frac{v}{r}$

or                                        $=\ 6.80\times 10^{12}\ rad/s$

Exams
Articles
Questions


text:
n2_o2.hh 3.42 KB
 Vishal Jambhekar committed Aug 13, 2015 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: /***************************************************************************** * See the file COPYING for full copying permissions. * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *****************************************************************************/ /*! * \file * * \brief Binary coefficients for nitrogen and oxygen. */ #ifndef DUMUX_BINARY_COEFF_N2_O2_HH #define DUMUX_BINARY_COEFF_N2_O2_HH #include #include #include #include namespace Dumux { namespace BinaryCoeff { /*! * \ingroup Binarycoefficients * \brief Binary coefficients for nitrogen and oxygen. */ class N2_O2 { public: /*!  Alexander Kissinger committed Sep 08, 2015 46  * \brief Henry coefficent \f$\mathrm{[Pa]}\f$ for molecular oxygen in liquid nitrogen.  Vishal Jambhekar committed Aug 13, 2015 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90  * \param temperature the temperature \f$\mathrm{[K]}\f$ */ template static Scalar henry(Scalar temperature) { DUNE_THROW(Dune::NotImplemented, "henry coefficient for oxygen in liquid nitrogen"); }; /*! * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular oxygen in liquid nitrogen. * * Uses fullerMethod to determine the diffusion of water in nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the phase pressure \f$\mathrm{[Pa]}\f$ */ template static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure) { typedef Dumux::N2 N2; typedef Dumux::O2 O2; // atomic diffusion volumes const Scalar SigmaNu[2] = { 18.1 /* N2 */, 16.3 /* O2 */ }; // molar masses [g/mol] const Scalar M[2] = { N2::molarMass()*1e3, O2::molarMass()*1e3 }; return fullerMethod(M, SigmaNu, temperature, pressure); }; /*! * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular oxygen in liquid nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the phase pressure \f$\mathrm{[Pa]}\f$ */ template static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure) { DUNE_THROW(Dune::NotImplemented, "diffusion coefficient for liquid oxygen and nitrogen"); }; }; } } // end namespace #endif


text:
# Capacitances in a PMOS transistor: what about the n-well?

So I'm studying MOS transistors and came across the topic of capacitances between various terminals/contacts, including the bulk terminal. These capacitances are due to lateral diffusion as a consequence of the self-aligned process of the MOS transistors, the channel charge and the PN junctions formed in the MOS. Anyway, a capacitance value that is never defined is the capacitance between the nwell and the p-substrate in a PMOS transistor. These capacitance is never modelled in the schematic, unless we can extract it from the layout of the transistor. Can someone explain me why?


text:
# TRC Signing Ceremony Phases - Base TRC¶

This documents outlines the steps each participant must go through when participating in a TRC Signing Ceremony for establishing a new base TRC.

This document is organized by role. Please only refer to the section pertaining to your role.

This document assumes that the basic devices required by the ceremony are present:

• Formatted USB Flash Drive (FAT)
• Voting representative’s device

The script for each role is described in the following sections:

Prior to the start, the ceremony administrator assigns a short identifier to each voting representative. This identifier will later be used in the naming of certain files. For the purpose of this document, the names are assumed to be zürich, bern, and geneva. Also for the purpose of this document, bern is assumed to be a Certificate Authority for the ISD.

The ceremony administrator brings their own ceremony representative’s device to the ceremony. For readability, in this section we refer to this device simply as the device.

### Phase 1 - Exchange of Certificates¶

As the first step, the ceremony administrator announces the TRCID that is used for the rest of the signing ceremony. Because a base TRC is signed in this ceremony, the value should be chosen to be ISD<isd-id>-B1-S1, where <isd-id> is replaced with the ISD identifier.

The ceremony administrator shares the USB flash drive with each voting representative, and waits for each voting representative to copy the needed certificates.

The ceremony administrator reminds participants that they need to copy all certificates needed for the role of the entity they represent. For those who are only voters, this means the CP sensitive voting certificate and the CP regular voting certificate. For those who are also Certificate Authorities in the ISD, the list of certificates includes the CP root certificate.

When the ceremony administrator gets the back the USB flash drive, they connect it to their device. They must first check that all required certificates are contained on the drive.

For each certificate, the ceremony administrator displays the validity period and checks that they cover the previously agreed upon TRC validity.

Further, checks that the signature algorithms are correct:

And finally, checks that the certificates are of valid type:

If the results of these checks are as expected, the ceremony administrator computes the SHA256 sum for each certificate:

Disconnect the USB flash drive, and give it back to the voting representatives. Wait for each voting representative to download the certificates of the other voting representatives.

Finally, show the SHA256 sums on the screen for the voting representatives to see, and wait for them to confirm that the SHA256 sum is correct for every certificate.

After every voting representative has confirmed that the SHA256 sums are correct, announce that Phase 1 has concluded. If there is a mismatch in any of the sums, Phase 1 needs to be repeated.

### Phase 2 - Creation of TRC Payload¶

Once all the certificates have been accounted for, the ceremony administrator must create a TRC payload.

First, ask the voting representatives for the ISD number of the new ISD. The value will be used to fill in the {{.ISD}} variable below.

Second, ask the voting representatives for the description of the TRC. This will be used to fill in the {{.Description}} variable below.

Third, ask the voting representatives for the AS numbers of the ASes that will be core (these will be used to populate the {{.CoreASes}} variable in the file below), and the AS numbers of the ASes that will be authoritative (these will be used to populate the {{.AuthoritativeASes}} variable in the file below).

Fourth, ask the voting representatives for the voting quorum of the next TRC update. The value will be used to fill in the {{.VotingQuorum}} variable below.

Last, ask the voting representatives for the validity period of the new TRC. The value will be used to fill in the {{.NotBefore}} and {{.Validity}} variable below. The {{.NotBefore}} variable is represented as a UNIX timestamp (seconds since Epoch January 1st, 1970 UTC, e.g. 1593000000 equals June 24th, 2020 UTC at noon).

To highlight variable types, we include some examples. The format must include the part after the = sign exactly as it is written (i.e., with the exact same quoting, parentheses, etc.).

Note

The UNIX timestamp can be displayed in human readable form using the date command:

date -d @1593000000 --utc

To compute the UNIX timestamp for a given date in UTC, use:

date -d 'YYYY-MM-DD HH:MM:SSZ' +"%s"

Display the payload template file with the variables filled-in on the device monitor. The voting representatives should compare the contents of the file with their answers to the previous questions, to ensure that all the data is correct.

Once the data has been verified, compute the DER encoding of the TRC data:

Compute the SHA256 sum of the TRC payload file using:

Connect the USB flash drive to your device, and copy the TRC payload file to the root directory, then disconnect the USB flash drive. Hand out the USB flash drive to the voting representatives.

The voting representatives proceed to check the contents of the TRC payload file by computing the SHA256 sum. Over the duration of the checks, keep the SHA256 sum of the file available on the monitor for inspection.

This phase concludes once every voting representative confirms that the contents of the TRC payload are correct. Once that happens, announce that Phase 2 has successfully concluded.

### Phase 3 - Signing of the TRC Payload¶

This phase consists of the voting representatives casting votes on the TRC payload file. The phase concludes after all voting representatives have cast their votes and copied the signatures onto the USB flash drive.

As part of this phase, the voting representatives inspect the TRC payload. Display the TRC payload using:

Walk the voting representatives through the output and describe the meaning and implications of each part.

Once every voting representative has finished the signing process, announce that Phase 3 has successfully concluded.

### Phase 4 - Assembly of the TRC¶

This phase consists of assembling the final TRC by aggregating the payload data with the votes (signatures) cast by the voting representatives.

Connect the USB flash drive to the device. Given the example data, the votes should be available at the following locations on the USB flash drive:

• /bern/isd.sensitive.trc
• /bern/isd.regular.trc
• /geneva/isd.sensitive.trc
• /geneva/isd.regular.trc
• /zürich/isd.sensitive.trc
• /zürich/isd.regular.trc

To assemble the final TRC in a file, run the following command:

To check that the resulting TRC is correct, run:

Copy the signed TRC to the USB flash drive in the root directory. Disconnect the USB flash drive.

Finally, compute the SHA256 sum of the final TRC:

and keep it for reference on the monitor of the device.

Each voting representative now checks that the final TRC contains the correct data, and that it can be verified. Wait for each voting representative to confirm that verification has finished successfully. If any verification fails, Phase 3 and Phase 4 need to be repeated.

Furthermore, the voting representatives inspect that all signatures are present. Display the signed TRC with this command:

Walk the voting representatives through the output and describe the meaning and implications of each part.

If each voting representative confirms they have successfully verified the TRC, announce that Phase 4 has finished successfully. Then, announce that the key signing ceremony has concluded successfully.

## Voting AS representative role¶

Each voting representative brings their own voting representative’s device to the ceremony. Each voting representative performs actions only on their own device. For readability, in this section we refer to this device simply as the device.

### Preparation¶

To follow the commands described in the following sections, three environment variables need to be set up:

The TRCID variable that is used is announced by the ceremony administrator in the beginning of the signing ceremony.

Furthermore, everything that is copied from the USB Flash Drive should be put in the current working directory.

Important

It is required that the machine used to execute the commands has openssl version 1.1.1d or higher installed.

### Phase 1 - Exchange of Certificates¶

Phase 1 consists of sharing the self-signed voting and root certificates.

Plug the USB Flash Drive into the device.

Create a new folder; use the identifier you received from the ceremony administrator as the name of the folder (e.g., if the identifier is zürich, the folder will have the same name).

Copy the CP Sensitive Voting Certificate and the CP Regular Voting Certificate onto the USB Flash Drive into the newly created folder. The sensitive voting certificate should be named sensitive-voting.crt, and the regular voting certificate should be named regular-voting.crt.

Warning

Note that only the certificates must be shared during the step, not the private keys. Copying a private key by mistake invalidates the security of the ceremony.

If the entity you represent will also act as a CA in the new ISD, also copy the CP Root Certificate to the USB flash drive. The file should be named cp-root.crt.

Disconnect the USB flash drive from the device, and pass it to the next voting representative or, if certificate copying has concluded, to the ceremony administrator.

Wait for the ceremony administrator to pass back the USB flash drive. Connect the USB flash drive to the device, and copy the folders with the certificates of the other voting representatives. Disconnect the USB flash drive.

Wait for the ceremony administrator to announce the SHA256 sums for each certificate. For each certificate, check carefully that the SHA256 sum announced by the administrator matches the value computed on your copy of the certificate.

To compute the SHA256 on a Linux host, run the following commands from the folder that contains the copied files.

Furthermore, check that the certificate that is on the USB flash drive does not differ from your own. For example, for identifier bern, the command that should be executed in the same folder as above is:

Phase 1 concludes once every participant confirms that the ceremony administrator has the correct version of each certificate (that is, every SHA256 sum matches).

### Phase 2 - Creation of TRC Payload¶

• What is the ISD number?
• What text description should the TRC contain? (e.g., “Swiss Medical ISD”)
• Who will be the core ASes of the new ISD?
• Who will be the authoritative ASes of the new ISD?

If the answers from all voting representatives do not exactly match, discussions are allowed to reach a common answer. If consensus cannot be reached for a question, the ceremony is voided and no TRC is created.

After the ceremony administrator has collected all answers, they will produce a file detailing TRC contents. Inspect the contents of the file carefully on the ceremony administrator’s monitor, and point out any mistakes. If this verification succeeds, the ceremony administrator will hand out the USB flash drive, which now contains the TRC data.

Plug the USB flash drive into your device, copy the TRC file (it should be in the root directory, called $TRCID.pld.der) to your device, and disconnect the USB flash drive. Compute the SHA256 sum on the file by executing the following command from the folder that contains the copied file: Compare the result of the command with the SHA256 sum displayed on the monitor of the ceremony administrator. If there are any differences, this phase needs to be restarted. This phase concludes once all voting representatives confirm that the $TRCID.pld.der file has the correct digest.

### Phase 3 - Signing of the TRC Payload¶

This phase consists of signing the TRC file. Two signatures need to be computed, one using the regular voting certificate and one using the sensitive voting certificate.

Before signing, check that the TRC payload is sound:

To compute the signatures, run:

Warning

The above operation requires access to the private key. If this key gets leaked, it may compromise the security of the ISD. Make sure no other operations read this key.

To sanity check that the signatures were created correctly, run:

Connect the USB flash drive to the device, and copy $TRCID.regular.trc and $TRCID.sensitive.trc to the folder named after your identifier.

Disconnect the USB flash drive, and hand it to the other voting representatives.

### Phase 4 - Assembly of the TRC¶

Once the aggregation is finished, the USB flash drive will contain the final TRC.

Connect the USB flash drive to the device, and copy the \$TRCID.trc file located in the root of the USB flash drive.

Compute the SHA256 sum by navigating to the folder that contains the TRC file and executing the following command:

Compare the result with what is displayed on the monitor of the ceremony administrator. If the sum differs, then Phase 3 and Phase 4 need to be repeated.

Next, check that all the fields are consistent with earlier choices. To print the fields that are present in the TRC, run:

If there is a mismatch between any of the fields and the desired policy, then Phase 3 and Phase 4 need to be repeated.

Note

The -no_check_time flag is needed when the validity time of the TRC is in the future.

As a final check, run:

and check that the signature information of each signature is present; there should be 2 signatures for each voting representative. If a signature is missing, then Phase 3 and Phase 4 need to be repeated.

Inform the ceremony administrator of the outcome of the verification.

Tip

To make the TRC file more ergonomic to work with, you can change it to PEM format instead of the raw ASN.1 DER encoding. You can do so by running the following command:

## Witness role¶

The role of the witness is to examine that the rules in this document are followed by the participants. While not strictly required, it is useful if a witness is familiar with the steps that both the ceremony administrator and voting representatives must perform.

The witness has no active role in any of the steps of the ceremony, but can stop the process and inquire for more information if they feel the integrity of the process might have been compromised.

The witness should also be aware of what phase the ceremony is in, and take notes on which phases completed successfully.


text:
Aapeli Vuorinen

# Modeling NYC Taxi Profitability using a Leontief-style Model

This blog post is joint work with Alex Huang.

Here's a quick peek at the output of the model. The areas are shaded on a logarithmic scale according to their profitability. Hover over an area to see information about it.

It's interesting to see what one would expect: Manhattan is profitable and so are the areas around airports: JFK (the large area in the bottom right hand corner) and LaGuardia. Note that the profitability does not really translate to a real dollar amount, it's more an arbitrary metric.

## Background

A friend of mine recently brought to my attention the cool open data available from the NYC Taxi & Limousine Commission's site. There is some quite interesting data there, and I ended up thinking about good ways to model the profitability of certain areas in NYC, trying to figure out what kind of model would capture this well. This post is a quick overview of the model I came up with and how I went about solving it.

The data available on the TLC site consists of rows of data per-ride with fields including the dropoff and pickup date/location, the trip distance/duration/number of passengers, and the charge, fees, tip, etc. The dropoff and pickup locations are encoded as custom polygons that you can also download as a shapefile from their site.

A somewhat natural question to ask given this per-trip data, is: what's the profitability of some location?

There's quite a few ways of looking at this and trying to answer such an open ended question. For example, one may look at the time-series of how often a driver gets rides from different areas, and so on. However, the model I decided to go for was based rather on trying to understand how the destination area influenced the profitability of the current area. For example, suppose a taxi takes a passenger from Downtown Manhattan to somewhere in Brooklyn, but — for the sake of argument — riders in Downtown Manhattan tip a lot more than those in Brooklyn; then obviously this one-time trip may lead the driver to an area with low profitability. We want to capture this kind of dynamic and so chose a model where the profitability of a given area is influenced by the profitability of probable future locations.

To get some rough metric for profitability, we let the profitability of a ride be the total fare divided by the duration in minutes. I had to do some cleaning to get rid of data with very low durations (due to inaccuracy in timing).

## Our model

Let $$\mathcal{S}$$ be the set of (pickup/dropoff) areas, and let $$\mathcal{T}$$ be the set of all trips. For $$i,j\in\mathcal{S}$$, $$\mathcal{T}_{i,j}$$ to be the set of trips from $$i$$ to $$j$$ and $$\mathcal{T}_i$$ to be the set of trips originating from $$i\in\mathcal{S}$$. For a trip $$e\in\mathcal{T}$$, let $$p_e$$ be its profitability.

We now define

$q_{i,j}=\frac{1}{|T_{i,j}|}\sum_{e\in\mathcal{T}_{i,j}}p_e,$

the (empirical) expected profitability of a trip from $$i$$ to $$j$$. Similarly we define

$q_i=\frac{1}{|\mathcal{T}_i|}\sum_{e\in\mathcal{T}_i}p_e,$

the expected profitability of a trip originating from $$i$$.

Finally define

$w_{i,j}=\frac{|\mathcal{T}_{i,j}|}{|\mathcal{T}_i|},$

the expectation of the proportion of trips originating from $$i$$ that go to $$j$$.

Now let $$p_i$$ for $$i\in\mathcal{S}$$ be the (expected) profitability of an area. We wish for the vector of profitabilities to satisfy

$p_i=\sum_{j\in\mathcal{S}}w_{i,j}(q_{i,j}+\gamma p_j),$

for some discounting factor $$\gamma\in(0,1)$$. This says that the profitability of an area is the weighted average (by proportion of trips) profitability of destination areas plus some discounting factor times the profitability of that area. So if an area is average but often leads to a very profitable area, then the first area is also pretty good in the scheme of things.

Simplifying this, we can also write

$p_i=q_i+\gamma\sum_{j\in S}w_{i,j}p_j,$

so the profitability of an area is the average profitability of outgoing trips plus the discounted weighted average profitability of destination areas.

Writing $$\mathbf{W}$$ as the matrix of $$w_{i,j}$$, and similarly $$\mathbf{p}$$ and $$\mathbf{q}$$ for the column vectors of $$p_i$$ and $$q_i$$, we get the matrix equation

$\mathbf{p}=\mathbf{q}+\gamma\mathbf{W}\mathbf{p},$

and rearranging, we have

$\mathbf{p}=(\mathbf{I}-\gamma\mathbf{W})^{-1}\mathbf{q},$

where $$\mathbf{I}$$ is the identity matrix of appropriate size and the inverse is the matrix inverse.

Note that we need $$\gamma<1$$ here (instead of having $$\gamma=1$$) because by construction, $$\mathbf{W}$$ is a stochastic matrix, so $$\mathbf{I}-\mathbf{W}$$ has vanishing row sums, so the rows are linearly dependent and $$\mathbf{I}-\mathbf{W}$$ is singular. One can also see this intuitively from the model: in the presence of cycles — ways of starting from one area and then getting back there — the the weighted sum for $$p_i$$ gives an infinite recursion, and one can see that having no discounting would be problematic.

This kind of model is called a Leontief Input-Output model.

## The nitty gritty

I loaded the data into a Jupyter notebook and created a Pandas dataframe to hold the taxi data. After a few simple groupbys and aggs, I got the data I needed, put those in a Numpy matrix, and did a quick matrix inverse with numpy.linalg.inv to get the results.

import pandas as pd
import numpy as np

# import and cleaning
df_raw["p"] = df_raw.total_amount / ((pd.to_datetime(df_raw.lpep_dropoff_datetime) - pd.to_datetime(df_raw.lpep_pickup_datetime)) / np.timedelta64(60, "s"))
df = df_raw[["PULocationID", "DOLocationID", "p"]].rename(columns={"PULocationID": "pickup", "p": "p_e", "DOLocationID": "dropoff"})
df = df[(df.p_e > 0) & ~df.p_e.isna() & (df.p_e < 10)]

# list of all locations/areas, having dropoff areas with no pickups causes issues with the weight matrix
areas = df.pickup.unique()
df = df[df.pickup.isin(areas) & df.dropoff.isin(areas)]
ix_lookup = {val: ix for ix, val in enumerate(areas)}
n = len(areas)

# creating the T_{i,j} matrix
Tij = np.zeros([n, n])
for (i, j), val in df.groupby(["pickup", "dropoff"]).agg("count").p_e.items():
Tij[ix_lookup[i], ix_lookup[j]] = val

# computing the W matrix...
W = (Tij / Tij.sum(axis=1)).T

# ...and q vector
q = np.zeros([n])
for i, val in df[["pickup", "p_e"]].groupby("pickup").agg("mean").p_e.items():
q[ix_lookup[i]] = val

# set it pretty high
gamma = 0.6

# compute p
p = np.linalg.inv(np.eye(n) - gamma * W) @ q

# save to csv
with open("p.csv", "w") as f:
f.writelines(f"{areas[i]},{val}\n" for i, val in enumerate(p))

I then imported the shapefile taxi zone areas into PostGIS with ogr2ogr:

ogr2ogr -overwrite \
-nln areas \
-nlt PROMOTE_TO_MULTI \
-nlt MULTIPOLYGON \
-lco CREATE_TABLE=YES \
-lco GEOMETRY_NAME=geom \
out.sql \
taxi_zones.shp
cat out.sql | psql

Finally I exported the $$\textbf{p}$$ vector into PostGIS and did a spatial join against the shapefiles from T&LC's site to get the following dataset.

create table values(
locationId int not null,
p real not null
);
-- \copy is a psql built in command that allows access to the local fs
\copy values(locationId, p) from 'p.csv' with csv;
select * into taxi_profitability from (
select geom, shape_area, zone, values.locationid, borough, p
from areas
inner join values
on values.locationId = areas.locationid
) t;

Then export it into GeoJSON (we need to reproject to EPSG4326, I'm not sure what the original SRS is, something NYC specific, it seems)

ogr2ogr -t_srs "EPSG:4326" taxi_profitability.geojson PG:"tables=taxi_profitability"

And that's it, now just load it into a map or into QGIS and you can look at the pretty colors!


text:
## Train Tracks

Consider a segment of train tracks is secured via fasteners to the ground/wooden boards every 2 m. The ambient temperature is 40°C during the summer, and drops to 0°C during the winter. If the axial stress on the rails is 100 MPa due to temperature fluctuations and the Young’s Modulus is 210 GPa, what is the rail’s coefficient of thermal expansion?

Hint
The thermal expansion coefficient is the ratio of engineering strain to the temperature change.
$$\alpha=\frac{\varepsilon }{\Delta T}$$$where $$\alpha$$ is the thermal expansion coefficient, $$\varepsilon$$ is the engineering strain, and $$\Delta T$$ is the temperature change. Hint 2 The axial stress due to temperature deformation: $$\sigma=E \times \varepsilon$$$
where $$E$$ is the Young's Modulus and $$\varepsilon$$ is the engineering strain.
First, let’s solve for engineering strain. The axial stress due to temperature deformation:
$$\sigma=E \times \varepsilon$$$where $$E$$ is the Young's Modulus and $$\varepsilon$$ is the engineering strain. $$\varepsilon=\frac{\sigma}{E}=\frac{100MPa}{210,000MPa}=0.000476$$$
The thermal expansion coefficient is the ratio of engineering strain to the temperature change.
$$\alpha=\frac{\varepsilon }{\Delta T}$$$where $$\alpha$$ is the thermal expansion coefficient, $$\varepsilon$$ is the engineering strain, and $$\Delta T$$ is the temperature change. Thus, $$\alpha=\frac{0.000476}{(40^{\circ}C-0^{\circ}C)}=\frac{0.000476}{40^{\circ}C}=1.2\cdot 10^{-5}/^{\circ}C$$$
$$1.2\cdot 10^{-5}/^{\circ}C$$\$


text:
Article Contents
Article Contents

Topological remarks and new examples of persistence of diversity in biological dynamics

• There are several definitions of persistence of species, which amount to define interactions between them ensuring the survival of all the species initially present in the system. The aim of this paper is to present a wide family of examples in dimension $n>2$ (very natural in biological dynamics) exhibiting convergence towards a cycle when starting from anywhere with the exception of a zero-measure set of "forbidden" initial positions. The forbidden set is a heteroclinic orbit linking two equilibria on the boundary of the domain. Moreover, such systems have no equilibrium point interior to the domain (which is necessary for classical persistence for topological reasons). Such systems do not enjoy persistence in a strict sense, whereas in practice they do. The forbidden initial set does not matter in practice, but it modifies drastically the topological properties.

Mathematics Subject Classification: Primary: 34A34, 34C15, 34C37; Secondary: 92B05.

 Citation:

• Figure 1.  Plot of orbits on the coordinate planes and of the heteroclinic orbit of system (1)

Figure 2.  Plot of the attractor of system (1)

Figure 3.  Plot of a solution of system (1) on the attractor (i.e. longtime after the initial instant

Figure 10.  Artist view of of an orbit approaching a limit cycle turning around in the case when the period of the "turning around" is smaller than the period of the limit cycle

Figure 11.  Artist view of of an orbit approaching a limit cycle turning around in the case when the period of the "turning around" is larger than the period of the limit cycle

Figure 12.  The same orbit of Fig 11 after a diffeomorphism

Figure 4.  Plot of $z_{2}(t)$ of a solution of system (1) starting with small $z_{2}(0)$ showing a double periodicity (the small period is the attractor, whereas the long period one is the transient, which vanishes slowly)

Figure 5.  Plot of a solution of system (6) with the parameters (7)

Figure 6.  Plot of the solution of system (6) with the parameters (6) starting from the point $(1.5,1,0.7,1.5)$: four-dimensional cycle

Figure 7.  Plot of the solution of system (6) with the parameters (6) starting from the point $(1.5,0.6,0.6,0.8)$: there is a stable equilibrium with extinction of $x_2$ and $z_1$

Figure 8.  Plot of the limit cycle of system (10) (see text for the values of the parameters)

Figure 9.  Plot of the periodic solution of system (10) (see text for the values of the parameters) with the parameters)

•  R. Arditi and J. Michalski, Nonlinear food web models and their response to increased basal productivity, in food webs; integration of patterns and dynamics, G.A. Polis and K.O. Winemiller eds. Chapman and Hall, New York, (1996), 122-133. J. Hofbauer and K. Sigmund, The Theory of Evolution and Dynamical Systems, London Math. Soc. Student Texts, 7, Cambridge University Press, 1988. V. Hutson  and  K. Schmitt , Permanence and the dynamics of biological systems, Mathematical Biosciences, 111 (1992) , 1-71.  doi: 10.1016/0025-5564(92)90078-B. G. Kirlinger , Permanence of some ecological systems with several predators and one prey species, Jour Mathematical Biol, 26 (1988) , 217-232.  doi: 10.1007/BF00277734. Ph. Lherminier  and  E. Sanchez-Palencia , Remarks and examples on transient processes and attractors in biological evolution, Elec. Jour. Diff. Equat. Conference, 22 (2015) , 63-77. C. Lobry, Modèles Déterministes en Dynamique des Populations, Ecole CIMPA Saint Louis du Sénégal, 2001. K. S. McCann , The diversity - stability debate, Nature, 405 (2000) , 228-230. R. McGehee  and  R. A. Armstrong , Some mathematical problems concerning the ecological principle of competetive exclusion, Jour Diff Equations, 23 (1977) , 30-52.  doi: 10.1016/0022-0396(77)90135-8. J. Milnor, Topology from the Differential Viewpoint, The University Press of Virginia, Charlottesville, 1965. V. A. Pliss,  Nonlocal Problems in the Theory of Oscillations, Academic Press, 1966. A. Rapaport , D. Dochain  and  J. Harmand , Practical coexistence in the chemostat with arbitrarily close growth functions, Revue Africaine de la Recherche en Informatique et Mathématiques Appliquées, 9 (2008) , 231-243. E. Sanchez-Palencia  and  J.-P. Françoise , Structural stability and emergence of biodiversity, Acta Biotheoretica, 61 (2013) , 397-412. E. Sanchez-Palencia  and  J.-P. Françoise , Constrained evolution processes and emergence of organized diversity, Math Meth Applied Sci., 39 (2016) , 104-133.  doi: 10.1002/mma.3463. S. J. Schreiber , Criteria for Cr robust permanence, Jour Diff Equations, 162 (2000) , 400-426.  doi: 10.1006/jdeq.1999.3719. Hal. L. Smith and H. R. Thieme, Dynamical Systems and Population Persistence, Graduate Studies in Mathematics, vol 111, Amer. Math. Soc., 2011.

Figures(12)


text:
# ROC curves in PERL project

In an existing PERL project, I need a ROC curve generated, using the output of an algorithm and a user-uploaded file. PM me for more deatails.

Skills: Biotechnology, Perl

( 11 reviews ) P?tra, Greece

Project ID: #2551594

## 3 freelancers are bidding on average $46 for this job mlambrichs Use of cpan Statistics-ROC module should do the job.$40 USD in 2 days
(12 Reviews)
4.0
PerlIsFun

I have done lots of Perl things till now, but never a ROC curve - so I'm curious about it :) I'd be glad to help. Thank you.

$49 USD in 1 day (9 Reviews) 3.6 sofina2006 Hello, I can do \it for you. In perl, a ROC Statistic algorithm is already included (Statistics-ROC-0.04 Statistics::ROC). If this algorith is good for you it could be an easy task. Otherway provide the algorithm a More$50 USD in 2 days
(7 Reviews)
3.3


text:
# Inserting graphics into asymptote or pgfplots

How another graphics can be inserted into Asymptote or pgfplots? The following is a MWE in pgfplots that creates three figures in the document. The main figure which I want to insert graphics in is a pgfplot graphics and the other two are a vector or a raster graphics.

\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}

\begin{document}
Figure 1 is the main figure that will be used for the insertion of a vector or a raster graphics.
\begin{figure}
\begin{tikzpicture}
\begin{axis}[
colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)}]
domain=0:8,samples=100]
{exp(x)};
\end{axis}
\end{tikzpicture}
\caption{This is the main figure.}
\end{figure}

Figure 2 is a graphics which I want to be inside figure 1, which is a vector graphics. I want to place it in the upper left corner position.
\begin{figure}
\begin{tikzpicture}
\begin{axis}[colormap/bluered]
scatter src=x,samples=50]
{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\caption{This figure needs to be inside figure 1.}
\end{figure}

Figure 3 is another graphics which I want to be placed inside figure 1 in the upper left corner.
\begin{figure}
\includegraphics[width=\linewidth]{piv.jpg}
\caption{This figure needs to be inside figure 1}.
\end{figure}

\end{document}

This is figure 1, which is a pgfplots graphics.

This is figure 2, which is a pgfplots graphics.

This is figure 3, which is a jpg image.

This is combined figure 1 and figure 2. Figure 2 is placed inside figure 1 in the upper left corner. I would like this figure to be a vector graphics

This is combined figure 1 and figure 3. Figure 3 is placed inside figure 1 in the upper left corner. I would like figure 1 to be still a vector graphics.

I would be thankful if someone could help me how I can insert other vector graphics as well as raster graphics in Asymptote and pgfplots.

• Both Yes but insert where in the axis? Mar 23, 2014 at 4:27
• @percusse: thanks for your comment. Both in and outside the axis. Mar 23, 2014 at 8:51
• @Ahm: At the moment, your question is really to vague to be answered in a meaningful way. Could you please edit it to include more information on what exactly you're trying to achieve, ideally including a mockup of what you want the final result to look like?
– Jake
Mar 23, 2014 at 10:58
• @Jake: I made some modifications in the question for better clarification and illustrated a MWE. Mar 23, 2014 at 19:54

For the pgfplots within pgfplots you could combine the two plots in the code, as seen in How the plot in \groupplot could be moved horizontally and vertically?

For the image, add the following inside the axis environment of figure 1:

\node [above right] at (rel axis cs:0.2,0.4) {\includegraphics[width=2.5cm]{piv}};

The exact coordinates, which specify the location of lower left corner of the image, and the width should probably be modified. rel axis cs is a a coordinate system that has (0,0) in the lower left corner of the axis, and (1,1) in the upper right.

Note that if you have for example the pgfplots plot as a vectorised PDF, then including it this way will not rasterise it, so you can use this method for both.

\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)}]
domain=0:8,samples=100]
{exp(x)};

\coordinate (otheraxis) at (rel axis cs:0.2,0.4);
\end{axis}
\begin{axis}[colormap/bluered,at={(otheraxis)},width=5cm]
scatter src=x,samples=50]
{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\caption{This is the main figure.}
\end{figure}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)}]
domain=0:8,samples=100]
{exp(x)};

\node [above right] at (rel axis cs:0.1,0.25) {\includegraphics[width=3cm]{piv}};
\end{axis}
\end{tikzpicture}

\caption{This is the main figure.}
\end{figure}

\end{document}

As for Asymptote, you can use the label command to include external EPS graphics, as explained in the manual (version 2.24, p. 19):

The function string graphic(string name, string options="") returns a string that can be used to include an encapsulated PostScript (EPS) file. Here, name is the name of the file to include and options is a string containing a comma-separated list of optional bounding box (bb=llx lly urx ury), width (width=value), height (height=value), rotation (angle=value), scaling (scale=factor), clipping (clip=bool), and draft mode (draft=bool) parameters. The layer() function can be used to force future objects to be drawn on top of the included image:

label(graphic("file.eps","width=1cm"),(0,0),NE);
layer();
• Thanks. It seems it is not possible to put a raster image into Asymptote. Would it be possible to put the image into the EPS file and then use the label function to insert it in Asymptote? Mar 24, 2014 at 17:23
• What do you mean by "putting the image into the EPS file"? What I would do is simply to convert this image to the EPS format and then include it via Asymptote in your picture. Mar 25, 2014 at 18:19
• what would you use to convert the image to an EPS format? Mar 26, 2014 at 2:37
• Converting to eps format is unnecessary if you use settings.tex = pdflatex;. Mar 28, 2014 at 23:39
• @CharlesStaats, it is settings.tex = "pdflatex";
– alfC
Oct 17, 2014 at 22:00

Asymptote supports importing the external image directly, you can see its sample code in its GitHub source repo orthocenter.asy, the png file is located here piicon.png for a reference.

import geometry;
import math;

size(7cm,0);

if(!settings.xasy && settings.outformat != "svg") settings.tex="pdflatex";

real theta=degrees(asin(0.5/sqrt(7)));

pair B=(0,sqrt(7));
pair A=B+2sqrt(3)*dir(270-theta);
pair C=A+sqrt(21);
pair O=0;

pair Ap=extension(A,O,B,C);
pair Bp=extension(B,O,C,A);
pair Cp=extension(C,O,A,B);

perpendicular(Ap,NE,Ap--O,blue);
perpendicular(Bp,NE,Bp--C,blue);
perpendicular(Cp,NE,Cp--O,blue);

draw(A--B--C--cycle);

draw("1",A--O,-0.25*I*dir(A--O));
draw(O--Ap);
draw("$\sqrt{7}$",B--O,LeftSide);
draw(O--Bp);
draw("4",C--O);
draw(O--Cp);

dot("$O$",O,dir(B--Bp,Cp--C),red);
dot("$A$",A,dir(C--A,B--A),red);
dot("$B$",B,NW,red);
dot("$C$",C,dir(A--C,B--C),red);
dot("$A'$",Ap,dir(A--Ap),red);
dot("$B'$",Bp,dir(B--Bp),red);
dot("$C'$",Cp,dir(C--Cp),red);

label(graphic("piicon.png","width=2.5cm, bb=0 0 147 144"),Ap,5ENE);

Note the last statement of the code. Here is the result screen shot of the pdf.

• Note that this works only with pdflatex, i.e. thanks to settings.tex="pdflatex" at the top. Apr 13 at 7:16


text:
# tcbtheorem: Multiline centered title

I'm using the tcolorbox package for creating an algoritm environment. Now, in one algorithm, my title text spans two lines, and I'd like to have it centered. However, the second line is only centered under the title, but not the part "Algorithm 1:". I'd like to have this centered as if "Algorithm 1" was part of the text, but I don't see how I could achieve this.

A MWE:

\documentclass{standalone}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{algorithm}{Algorithm}%
{
colback = white,
colbacktitle = white,
coltitle = black,
center title,
fonttitle = \bfseries,
sharp corners,
boxrule = 1pt,
titlerule = 1pt,
width = 0.8\linewidth,
center
}{}
\begin{document}
\begin{algorithm}{This is a very long title that causes a break}{}
\begin{center}
\textbf{Algorithm 1: This is the optics that I'd like to have, with the second line centered. }
\end{center}
\end{algorithm}
\end{document}

• I think you should not use newtcbtheorem for this but \newtcolorbox rather. The name for a theorem is set left (Algorithm) and is not part of the title here – user31729 Mar 2 '17 at 22:47
• Hmm...but this means that I can't keep the automatic numbering, does it? I'm using a numbering within chapters, so that I get Algorithm 1.1, Algorithm 1.2,... including the options for safely referencing the numbers. – proMath Mar 2 '17 at 22:56
• \newtcolorbox allows for autonumbering – user31729 Mar 2 '17 at 22:57
• Ah, okay, then I'll go to the manual and check it! Thanks! – proMath Mar 2 '17 at 22:59
• In fact, I think you're misusing the bundle of theorem name, number and description like a caption. – user31729 Mar 2 '17 at 23:16

The tcolorbox library for theorems does use the theorem title (Algorithm here) and fixes it to the left margin of the title. The real title (called 'description' is independent of this, so center title will only center the description but not the number and name of the environment.

Using a \newtcolorbox this can be fixed and almost the same features of the \newtcbtheorem command can be achieved.

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{hyperref}
\tcbuselibrary{theorems}

\newtcolorbox[auto counter]{algorithm}[3][]{%
colback = white,
colbacktitle = white,
coltitle = black,
center title,
fonttitle = \bfseries,
sharp corners,
boxrule = 1pt,
titlerule = 1pt,
width = 0.8\linewidth,
center,
title={Algorithm \thetcbcounter: #2},
label={#3},
#1
}

\begin{document}

See the nice Algorithm \ref{firstalgo}

\begin{algorithm}{This is a very long title that causes a break}{firstalgo}
\begin{center}
\textbf{Algorithm 1: This is the optics that I'd like to have, with the second line centered. }
\end{center}
\end{algorithm}
\end{document}

• I'll try to find a cleaner way later on – user31729 Mar 2 '17 at 23:24


text:
# Theoretical Calculation of Lattice Parameter from Space Group

If I am given a compound which belongs to, say the cubic $\text{Ia}\bar 3\text{d}$ space group, is there a known way to calculate the lattice parameter of the compound? In general, can lattice parameters be calculate from knowing what space group the compound belongs to?

• On the other hand, lattice parameters and crystal system can be known independent of space group and atoms by indexing a diffraction pattern. – wismuthaft Nov 15 '15 at 10:52


text:
# How to disable minted highlighting in tcolorbox's dispExample environment?

I'm now making a documentation of a small LaTeX package with documentation library from the tcolorbox package, and having difficulty in printing sample codes without any syntax highlighting.

According to G. Poore's answer, we can set the language as text to turn off the coloring, which can be specified via /tcb/minted language key. Thus, I tried to redefine the corresponding value like the following MWE (the first two are just for comparison).

\documentclass{article}
\usepackage[all]{tcolorbox}
\tcbset{listing engine=minted}
\begin{document}
\begin{tcblisting}{minted language=text}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{tcblisting}
\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}
\tcbset{
fontlower=\normalsize,
minted language=text,
documentation minted options={
autogobble=true,
fontsize=\small
}
}
}
\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}
\end{document}

Typesetting this with pdflatex -shell-escape gave me

As you can see, the option minted language=text seems to be invalid in the third box while other key-value settings (e.g., fontlower=\normalsize) works. Also, minted language=text is valid in the normal tcblisting environment.

How can I .add style the minted language key to the docexample style? What am I doing wrong?

I could have directly asked this question at Prof. Thomas F. Sturm's GitHub repository, but I use TeX.SX expecting more people will have a look.

Update:

Thanks to @egreg's answer, I found that my issue lies in the combination of tcolorbox and newtxtt (after some investigation, the same behaviour was confirmed with other monospaced fonts). Consider this MWE:

\documentclass{article}
\usepackage[all]{tcolorbox}
\usepackage{newtxtt}
\tcbset{
listing engine=minted,
fontlower=\normalsize,
minted language=latex,
documentation minted options={
autogobble=true,
fontsize=\small,
style=bw,
}
}
}
\begin{document}
\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}
\end{document}

This gives control sequences in boldface, which I don't like, although style=bw is specified.

Monospaced fonts that reproduce this problem include

• Courier (\usepackage{courier}),
• DejaVu (\usepackage{dejavu}),
• Fira (\usepackage{firamono}),
• Incondolata (\usepackage{zi4}), and
• Source Code Pro (\usepackage{sourcecodepro}),

while Latin Modern and Droid don't trigger the problem.

Yet Another Update:

The second part of this question now has its own thread.

Currently, the documentation library assumes all (minted) texts to be of latex language. Therefore, minted language has deliberately no effect on dispExample environments.

Nevertheless, I take it as a feature request to make this configurable in the same way as documentation minted options.

The following patch introduces a new option documentation minted language which will be integrated into tcolorbox version 4.03 and higher:

\documentclass{article}
\usepackage[all]{tcolorbox}
\begin{document}

\makeatletter

\tcbset{
documentation minted language/.store in=\kvtcb@docminted@language,
documentation minted language=latex,
}

\def\tcb@minted@doc@usetemplisting{%
\tcb@minted@input@listing{\kvtcb@docmintoptions}{\kvtcb@docminted@language}{\kvtcb@tempfile}{\kvtcb@docmintstyle}%
}

\tcbset{listing engine=minted}

\makeatother

\begin{tcblisting}{minted language=text}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{tcblisting}

\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}

\tcbset{
fontlower=\normalsize,
documentation minted language=text,
documentation minted options={
autogobble=true,
fontsize=\small
}
}
}

\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}

\end{document}

• Thank you for your explanation and the patch works well also. Regarding the font weight problem, which still remains, I'll open another question with a reduced MWE later. – yudai-nkt Apr 24 '17 at 17:20

You want to pass style=bw to pygmentize:

\documentclass{article}
\usepackage[all]{tcolorbox}
\tcbset{
listing engine=minted,
fontlower=\normalsize,
minted language=latex, % <--------
documentation minted options={
autogobble=true,
fontsize=\small,
style=bw, % <-------
}
}
}
\begin{document}

\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}

\end{document}

• I know the style key but it didn't give me a desired result neither. My actual case is like this, where some control sequences are in boldface. This is why I next tried the minted language. That being said, your code works on my end as well. I'll update the question after investigating a true cause and making a new MWE. – yudai-nkt Dec 28 '16 at 12:59
• I updated the question. – yudai-nkt Dec 28 '16 at 13:20


text:
# Simple Limit Proof/Reasoning

• Sep 28th 2010, 03:50 PM
mscbuck
Simple Limit Proof/Reasoning
Hey all, thanks again for all help in the past! Here's a limit question that I am unsure if I am overthinking, or if it's as simple as it looks.

It states:

Prove:
lim f(x) as x-->a is equal to lim f(a+h) as h-->0 (this is really just an exercise in understanding what the terms are)

Now the easiest way would just to pop in the values and boom, lim f(a) = lim f(a). But I think he is looking for a different reasoning. My attempt was to kind of define the statements like so:

_______

LHS: f can be made to be as close to a limit L as desired by making x sufficiently close to a.

RHS: f can be made to be as close to a limit L as desired by making h sufficiently close to zero.

And in this example, it just so happens when h is made to go to zero we are left with the respective equations L's equal to each other.
______

I don't think I've really "proved" anything though, have I?

Thanks again!
• Sep 28th 2010, 08:51 PM
Prove It
It depends on whether $f(x)$ and $f(a + h)$ are continuous at $x = a$ and $h = 0$ respectively, and if you are allowed to use the result that $\lim_{x \to n}f(x) = f(n)$ if $f(x)$ is continuous at $x = n$.

If so, your reasoning is fine.

If not, you will need to use an $\epsilon -\delta$ proof.


text:
# Paradox in evaluating the Lorentz field in a dielectric

1. Jun 21, 2013

### Order

Can someone help me in understanding where I am wrong when thinking about the derivation of the Lorentz field in a dielectric. I give the derivation in italics (although the familiar reader should not need to read it) and after that I present the paradox.

The basic idea is to consider a spherical zone containing the dipole under study, immersed in the dielectric.

The sphere is small in comparison with the dimension of the condenser, but large compared with the molecular dimensions.

We treat the properties of the sphere at the microscopic level as containing many molecules, but the material outside of the sphere is considered a continuum.

The field acting at the center of the sphere where the dipole is placed arises from the field due to
 (1) the charges on the condenser plates
 (2) the polarization charges on the spherical surface, and
 (3) the molecular dipoles in the spherical region.

 The field due to the polarization charges on the spherical surface, $E_{sp}$, can be calculated by considering an element of the spherical surface defined by the angles $\theta$ and $\theta + d \theta$.

 The area of this elementary surface is: $2 \pi r^2 \sin \theta d \theta$.

 The density of charge on this element is given by $P \cos \theta$, and the angles between this polarization and the elementary surface is $\theta$. Integrating over all values of angle formed by the direction of the field with the normal vector to spherical surface at each point and dividing by the surface of the sphere we obtain

$$E_{sp}=\frac{1}{r^2}\int_0^{\pi} 2 \pi r^2 P \sin \theta \cos^2 \theta d \theta = \frac{4 \pi P}{3}$$

Now suppose the dielectric is a sphere of radius R and that the smaller sphere of radius r is in the middle of this bigger sphere. Since the Surface charges are reversed compared to the smaller sphere one can then evaluate the field in a similar way from the bigger sphere as
$$E_{SP}=-\frac{1}{R^2}\int_0^{\pi} 2 \pi R^2 P \sin \theta \cos^2 \theta d \theta = -\frac{4 \pi P}{3}$$
The field acting at the centre of the sphere then is
$$E_{tot}=E_{sp}+E_{SP}+E_{external}=\frac{4 \pi P}{3}-\frac{4 \pi P}{3}+E_{external}=E_{external}$$
This is, by the way also, in line with that the displacement field is constant everywhere but that there is no polarization inside the region inside the smaller sphere so that the field there should be the external field.

Now did Lorentz totally miss this?

(The Picture did not appear good against a White background.)

#### Attached Files:

• ###### Lorentz field.png
File size:
10.1 KB
Views:
149
2. Jun 22, 2013

### Meir Achuz

The molecules inside do not have surface charge producing an E field.
The field due to the inside molecules vanishes for a regular distribution.

3. Jun 23, 2013

### Order

Vielen dank for giving my problem attention Meir Achurz. I thought it would engage more phycisists when I am saying something is wrong. I Think it should be easy to correct a misstake. But I dont know if you have really understood my problem. (If you cannot imagine Surface charges inside the dielectric then how do you appreciate the local field in a non-polar ditto?)

What is the problem then? The problem is to understand the subtleties in working out the Lorentz field and eventually the Clausius-Mossotti formula. Let me clarify.

Suppose it is a correct assumptions to imagine a spherical cavity in the dielectric. (Obviously Lorentz was kinda right.) And let me also assume that the macroscopic Surface charges on the Surface of the dielectric itself does not contribute to the local field. (This is obviously so, although I cant understand it, and this is what my question is all about: how can you ignore this?!) Then the total local field Ei will be
$$E_i = E_{sp} + E_{0}$$ where E0 is the original field applied to the dielectric. Now using the definition of polarization (in Gaussian units I Think)
$$P=\frac{1}{4 \pi}(\varepsilon - 1) E_{0}$$
and using the expression for Esp given in my original post this leads to the Lorentz field$$E_i = E_0 + \frac{\varepsilon - 1}{3}E_0=\frac{\varepsilon + 2}{3}E_0$$
And with a Little more work you can derive the Claussius-Mossotti formula. This is obviously correct, so in what way am I wrong?


text:
# EXERCISE 14–5 Prepare a Statement of Cash Flows [LO1, LO2] The following changes took place last...

EXERCISE 14–5 Prepare a Statement of Cash Flows [LO1, LO2]

The following changes took place last year in Herald Company’s balance sheet accounts:

Long-term investments that had cost the company $50 were sold during the year for$45, and land that had cost $30 was sold for$70. In addition, the company declared and paid $35 in cash dividends during the year. Besides the sale of land, no other sales or retirements of plant and equip- ment took place during the year. Herald did not issue any bonds during the year or repurchase any of its own stock. The company’s income statement for the year follows:  Sales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .$600 Cost of goods sold . . . . . . . . . . . . . . . . . . . . 250 Gross margin . . . . . . . . . . . . . . . . . . . . . . . . 350 Selling and administrative expenses . . . . . . 280 Net operating income . . . . . . . . . . . . . . . . . . Nonoperating items: Loss on sale of investments . . . . . . . . . . . $(5) 70 Gain on sale of land . . . . . . . . . . . . . . . . . 40 35 Income before taxes . . . . . . . . . . . . . . . . . . . 105 Income taxes . . . . . . . . . . . . . . . . . . . . . . . . 30 Net income . . . . . . . . . . . . . . . . . . . . . . . . . .$  75

The company’s beginning cash balance was $100 and its ending balance was$120.

Required:

1.       Use the indirect method to determine the net cash provided by operating activities for the year.

2.       Prepare a statement of cash flows for the year.


text:
Disclaimer: I originally wrote and planned to release this post on January 6, 2021, to celebrate Congress officially certifying Joe Biden’s win. But then there was an insurrection, and it didn’t really feel appropriate. So instead I’m releasing the one year anniversary of the race being called by the AP.

To celebrate, I thought I’d look back at the many election forecasts we had in 2020 to see which forecast performed the best, given the final results. To do this, we’ll look at two outcomes: prediction accuracy and model accuracy. But first, the data!

## The Forecasts

There were so. many. forecasts. I tried my best to gather as many as I could prior to election day. Ultimately, here are the forecasts I was able to pull probabilities of each candidate winning from for each state.

I also pulled the 2016 map to use as a baseline measure. All of the data is available in a Google sheet here. In the Google sheet, the probabilities indicate the probability that Joe Biden would win each state.

A few of the forecasts (including notably, the Economist) did not forecast the congressional districts in Nebraska and Maine separately from the whole state. Thus, for those forecasts, I used the statewide probability for each of the individual congressional districts as well, as that was the probability those forecasts assigned to each candidate for winning all electoral college votes from the state.

## Prediction Accuracy

We’re defining prediction accuracy as how close the estimated probabilities were to the observed outcome. We can assess this through three measures: log-loss, Brier Score, and a weighted Brier Score. All of these measures evaluate how close the probability was to the observed event. The log-loss is very common classification metric and is defined as

$$\text{Log-Loss}=-\frac{1}{P}\sum_{i=1}^Py_i\log(\hat{y}_i) + (1 - y_i)\log(1-\hat{y}_i)$$

In this equation, P is the total number of predictions, yi is the observed outcome (i.e., 0 or 1), and ŷi is the estimated probability of the event occurring. When the event occurs (i.e., yi = 1), we add the log of the probability of the event in our sum. Conversely, when the event doesn’t occur (i.e., yi = 0) we add the log of the probability of the event not occurring, that is, 1 - ŷi. The lower the probability of the observed outcome, the larger the term will be that gets included in the. We then take the average to get the average log probability of the observed events. Finally, because all the log probabilities are negative, we multiply by -1 so that everything is positive and smaller scores relate to smaller prediction errors.

The second measure is the Brier score. This measure is a little easier to calculate. Essentially, the Brier score is the mean squared error of predictions.

$$\text{Brier Score} = \frac{1}{P}\sum_{i=1}^P(\hat{y}_i - y_i)^2$$

Unlike, the log-loss, the penalty for the Brier score is almost linear. Below we can see that the log-loss penalty increases exponentially for observed events with a low probability, whereas the Brier penalty increases much more slowly. Therefore, the Brier Score is more forgiving of a forecast that estimated low probabilities for events that ended up happening.

Code to reproduce
tibble(prob = seq(0, 1, by = 0.01)) %>%
mutate(log_loss = -1 * log(prob),
brier = (prob - 1) ^ 2,
log_loss = case_when(is.infinite(log_loss) ~ NA_real_,
TRUE ~ log_loss)) %>%
pivot_longer(cols = c(log_loss, brier), names_to = "measure",
values_to = "penalty") %>%
ggplot(aes(x = prob, y = penalty)) +
geom_line(aes(color = measure), na.rm = TRUE, size = 2) +
scale_color_wjake(labels = c("Brier Score", "Log-Loss")) +
labs(x = "Event Probability", y = "Penalty", color = NULL,
title = "Penalty Score for Observed Event",
subtitle = "Log-loss penalty increases more dramatically",
caption = "Plot: @wjakethompson") +
theme(plot.caption = element_text(face = "plain")) -> p

ggsave2(p, knitr::fig_path(".png"), width = 6, height = 6)

A perfect prediction (e.g., a probability of 1.0 and the event actually occurring) would result in a Brier score of 0, as yi and ŷi are the same. Conversely, is 1 when the probability of an event is 1.0 and the even doesn’t occur, or the reverse where the probability is 0.0 and the event does occur. As with the log-loss, we take the average of all the error terms to get the overall Brier score.

The final measure is a weighted Brier score. The idea here is that not all predictions are created equal. In the United States’ election system, states have different numbers of electoral votes. Therefore, we should weight our predictions based on their influence on the overall outcome. For example, suppose a forecast gave Donald Trump a 70% chance of winning both Vermont and California (purposefully choosing outrageous examples). In reality, Trump won neither. Should an equal penalty be applied for each state? Vermont has only 3 electoral votes, whereas California has 55, more than any other state. Therefore, getting California wrong has a much larger impact on determining the winner of the presidential race. To account for this, we can weight the Brier score by the number of electoral votes for each state.

$$\text{Weighted Brier Score} = \frac{1}{\sum_{i=1}^PEV_i}\sum_{i = 1}^PEV_i(\hat{y}_i - y_i)^2$$

Here, EVi is the number of electoral votes for the given prediction. Thus, instead of taking a pure average of the squared errors, we are taking a weighted average. We multiply each squared error by the number of electoral votes associated with the prediction, and then divide to sum of the weighted errors by the total weight, or the total number of electoral college votes.

Using this formulas, we can calculate the prediction accuracy measures for each forecast. These results are summarized in the table below.

Code to reproduce
library(tidyverse)
library(here)
library(fs)

results_2020 <-
here("content", "blog", "2021-11-07-2020-election-forecasts",
"data", "results.csv") %>%

ev_2020 <-
here("content", "blog", "2021-11-07-2020-election-forecasts",

raw_data <-
dir_ls(here("content", "blog", "2021-11-07-2020-election-forecasts",
"data", "forecasts")) %>%
full_join(ev_2020, by = c("state_name", "state_abbr")) %>%
full_join(results_2020, by = c("state_name", "state_abbr"))

pred_acc_results <- raw_data %>%
mutate(biden = case_when(biden == 0 ~ 0.00001,
biden == 1 ~ 0.99999,
TRUE ~ biden)) %>%
group_by(model) %>%
summarize(log_loss = (-1 / n()) *
sum((biden_win * log(biden)) + (1 - biden_win) * log(1 - biden)),
brier = (1 / n()) * sum((biden - biden_win) ^ 2),
w_brier = (1 / sum(ec_votes)) * sum(ec_votes * ((biden - biden_win) ^ 2)),
.groups = "drop")

pred_acc_results
#> # A tibble: 16 × 4
#>    model                   log_loss  brier w_brier
#>    <chr>                      <dbl>  <dbl>   <dbl>
#>  1 2016 Map                   1.23  0.107   0.138
#>  2 Decision Desk HQ           0.160 0.0456  0.0701
#>  3 Drord Mapmaking            0.137 0.0461  0.0789
#>  4 Economist                  0.385 0.0692  0.0739
#>  5 Electoral Polls            0.116 0.0390  0.0600
#>  6 FiveThirtyEight            0.137 0.0400  0.0663
#>  7 JHK                        0.118 0.0394  0.0661
#>  8 Lean Tossup                0.170 0.0606  0.117
#>  9 New Statesman              0.236 0.0679  0.0724
#> 10 Plural Vote                0.133 0.0417  0.0616
#> 11 PredictIt                  0.158 0.0385  0.0549
#> 12 Princeton                  0.123 0.0407  0.0636
#> 13 Progress Campaign          0.149 0.0449  0.0727
#> 14 Race to the White House    0.132 0.0456  0.0785
#> 15 Reed                       0.189 0.0555  0.0731
#> 16 The Cycle                  0.134 0.0410  0.0816

library(gt)

pred_acc_results %>%
mutate(log_loss_rank = rank(log_loss),
brier_rank = rank(brier),
w_brier_rank = rank(w_brier),
avg_rank = (log_loss_rank + brier_rank + w_brier_rank) / 3,
across(c(log_loss, brier, w_brier), ratlas::fmt_digits, digits = 3),
across(c(log_loss, brier, w_brier), as.factor),
log_loss = fct_reorder(log_loss, log_loss_rank),
brier = fct_reorder(brier, brier_rank),
w_brier = fct_reorder(w_brier, w_brier_rank)) %>%
arrange(avg_rank) %>%
select(-avg_rank) %>%
mutate(across(ends_with("_rank"), ~case_when(.x < 10 ~ paste0(" ", .x),
TRUE ~ paste0(.x)))) %>%
gt() %>%
gt_theme_wjake() %>%
tab_options(table.align = "center") %>%
cols_label(model = "Forecast", log_loss = "Log Loss", brier = "Brier Score",
w_brier = "Weighted Brier") %>%
title = md("**Prediction Accuracy for 2020 Election Forecasts**")
) %>%
tab_source_note(source_note = "TABLE: @WJAKETHOMPSON") %>%
cols_merge(columns = c(log_loss, log_loss_rank),
pattern = "{1} {2}") %>%
cols_merge(columns = c(brier, brier_rank),
pattern = "{1} {2}") %>%
cols_merge(columns = c(w_brier, w_brier_rank),
pattern = "{1} {2}") %>%
tab_style(style = cell_text(font = "Source Code Pro"),
locations = cells_body(
columns = c(log_loss, brier, w_brier)
)) %>%
tab_style(style = cell_borders(sides = "bottom",
color = "black",
weight = px(1)),
locations = cells_body(columns = everything(),
rows = 16)) %>%
cols_width(c(model) ~ px(200),
c(log_loss, brier, w_brier) ~ px(100)) %>%
data_color(
columns = c(log_loss, brier, w_brier),
colors = scales::col_factor(
palette = ramp_blue(seq(0.1, 0.9, length.out = 16)),
domain = NULL
)
) -> gt_pred_acc

Prediction Accuracy for 2020 Election Forecasts
Forecast Log Loss Brier Score Weighted Brier
Electoral Polls 0.116  1 0.039  2 0.060  2
JHK 0.118  2 0.039  3 0.066  5
PredictIt 0.158 10 0.038  1 0.055  1
Princeton 0.123  3 0.041  5 0.064  4
Plural Vote 0.133  5 0.042  7 0.062  3
FiveThirtyEight 0.137  8 0.040  4 0.066  6
Race to the White House 0.132  4 0.046  9 0.078 12
Progress Campaign 0.149  9 0.045  8 0.073  9
The Cycle 0.134  6 0.041  6 0.082 14
Decision Desk HQ 0.160 11 0.046 10 0.070  7
Drord Mapmaking 0.137  7 0.046 11 0.079 13
Reed 0.189 13 0.055 12 0.073 10
New Statesman 0.236 14 0.068 14 0.072  8
Lean Tossup 0.170 12 0.061 13 0.117 15
Economist 0.385 15 0.069 15 0.074 11
2016 Map 1.234 16 0.107 16 0.138 16
TABLE: @WJAKETHOMPSON

Overall, the Electoral Polls forecast had the best accuracy. The biggest surprise to me was that the Economist forecast came in last, only beating the baseline 2016 map. What what gives? Let’s compare the Economist forecast to the FiveThirtyEight forecast, which came in close the the middle of the road. The two biggest misses for the Economist were the congressional districts from Nebraska and Maine that went in the opposite direction of the overall state. Maybe this isn’t fair since the Economist didn’t actually forecast the individual congressional districts, but on the other hand, the statewide forecast from the Economist included all of the electoral votes from that state, including the congressional district votes. The other two largest penalties came from North Carolina and Florida. In North Carolina, the Economist forecast gave Trump a 30% chance of winning, compared to 36% in the FiveThirtyEight model. Similarly in Florida, the Economist model gave Trump only a 20% chance of winning, compared to 31% in the FiveThirtyEight model. Trump ended up winning both states, so there were smaller penalties for FiveThirtyEight since that model gave Trump a greater chance of winning.

Code to reproduce
library(gghighlight)
library(ggrepel)

raw_data %>%
filter(model %in% c("Economist", "FiveThirtyEight")) %>%
mutate(biden = case_when(biden == 0 ~ 0.00001,
biden == 1 ~ 0.99999,
TRUE ~ biden)) %>%
group_by(model) %>%
mutate(log_loss_penalty = -1 *
((biden_win * log(biden)) + ((1 - biden_win) * log(1 - biden))),
brier_penalty = (biden - biden_win) ^ 2) %>%
pivot_wider(names_from = model,
values_from = c(trump, biden, log_loss_penalty, brier_penalty)) %>%
ggplot(aes(x = brier_penalty_Economist, y = brier_penalty_FiveThirtyEight)) +
geom_point(aes(size = ec_votes, color = factor(biden_win)), alpha = 0.6) +
gghighlight(brier_penalty_Economist > 0.25, label_key = state_abbr,
label_params = list(size = 3), use_group_by = FALSE,
use_direct_label = FALSE) +
geom_label_repel(aes(label = state_abbr, color = factor(biden_win)),
size = 3, show.legend = FALSE) +
scale_color_manual(values = c("red", "blue"),
labels = c("Trump", "Biden"),
name = "Winner") +
limits = c(1, 55),
breaks = c(1, 10, 20, 40)) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
expand_limits(x = c(0, 1), y = c(0, 1)) +
labs(x = "Economist Penalty", y = "FiveThirtyEight Penalty",
title = "Brier Penalties for Each Prediction",
subtitle = "Economist predictions hurt by un-forecasted congressional districts",
caption = "Plot: @wjakethompson") +
guides(color = guide_legend(override.aes = list(alpha = 1, size = 2),
order = 1),
size = guide_legend(order = 2)) +
theme(plot.caption = element_text(face = "plain"),
plot.title.position = "plot",
legend.box = "horizontal") -> p

ggsave2(p, knitr::fig_path(".png"), width = 6, height = 6)

## Model Accuracy

For an evaluation of model accuracy, we assume that the estimated probabilities from each forecast are true. Using these probabilities, we then simulate the election hundreds or thousands of times. From each simulation, we can then calculate the number of electoral votes won by each candidate. Across all simulations, we can then compare the distributions of the expected electoral college votes to the observed outcome.

Simulation code
# Observed results -------------------------------------------------------------
real_election <- raw_data %>%
filter(model != "2016 Map") %>%
mutate(biden_pick = case_when(biden >= 0.5 ~ 1L,
TRUE ~ 0L)) %>%
group_by(model) %>%
incorrect_picks = sum(biden_pick != biden_win))

# Calculate correlations between states/CDs ------------------------------------
library(politicaldata)

states <- distinct(raw_data, state_name, state_abbr)

"2016-11-08-election-forecast-performance",
"data", "election_dem_history.csv"),
col_types = cols()) %>%
arrange(Year) %>%
filter(Year < 1976) %>%
rename(District of Columbia = Washington DC)

new_states <- pres_results %>%
as_tibble() %>%
distinct(state_abbr = state, Year = year, dem) %>%
left_join(states, by = "state_abbr") %>%
select(-state_abbr) %>%
pivot_wider(names_from = state_name, values_from = dem)

new_cd <- pres_results_by_cd %>%
as_tibble() %>%
filter(state_abb %in% c("ME", "NE")) %>%
mutate(state_abbr = paste0(state_abb, "-", district)) %>%
distinct(Year = year, state_abbr, dem) %>%
pivot_wider(names_from = state_abbr, values_from = dem,
values_fn = mean)

new_results <- full_join(new_states, new_cd, by = "Year")

state_order <- sort(states$state_name) dem_history <- bind_rows(historical_results, new_results) %>% select(Year, !!!state_order) rho <- cov(select(dem_history, -Year), use = "complete.obs") # Simulation elections --------------------------------------------------------- library(mvtnorm) set.seed(306) sim_election <- raw_data %>% arrange(model, state_name) %>% nest(forecast = -model) %>% mutate( sim_elections = map(forecast, function(f, mat) { f <- f %>% mutate(var = biden * (1 - biden)) cur_prob <- pull(f, biden) cur_var <- pull(f, var) diag(mat) <- cur_var sim <- rmvnorm(n = 1000, mean = cur_prob, sigma = mat) colnames(sim) <- f$state_name
sim %>%
as_tibble() %>%
rowid_to_column(var = "sim") %>%
pivot_longer(cols = -sim, names_to = "state_name",
values_to = "sim_val") %>%
mutate(biden_win = case_when(sim_val >= 0.5 ~ 1L,
TRUE ~ 0L)) %>%
select(-sim_val)
},
mat = rho),
sim_summary = map2(forecast, sim_elections,
function(f, s) {
sim_info <- s %>%
rename(biden_sim = biden_win) %>%
by = "state_name")

sim_info %>%
group_by(sim) %>%
incorrect = biden_sim != biden_win) %>%
summarize(biden_ec = sum(won_vote),
incorrect_picks = sum(incorrect),
.groups = "drop")
}),
ppp = map2(model, sim_summary,
function(m, s, real) {
obs_ec <- real %>%
filter(model == m) %>%
pull(biden_ec)
obs_incorrect <- real %>%
filter(model == m) %>%
pull(incorrect_picks)

tibble(ec_ppp = mean(s$biden_ec > obs_ec), ip_ppp = mean(s$incorrect_picks > obs_incorrect))
},
real = real_election))

In the figure below, the histograms show the expected number of electoral votes for Biden under each model, with the blue line representing the 306 he actually received. One way to assess the model accuracy is to evaluate the proportion of simulations where the number of electoral votes received by Biden is greater than the observed electoral votes. Numbers very close to 0 or 1 indicate poor fit (i.e., the observed number is well outside the expected distribution).

Code to reproduce
library(ggtext)

sim_election %>%
filter(model != "2016 Map") %>%
select(model, sim_summary, ppp) %>%
unnest(ppp) %>%
mutate(label = glue::glue("{model}
*p* = {ratlas::fmt_digits(ec_ppp, 3)}")) %>%
select(label, sim_summary) %>%
unnest(sim_summary) %>%
ggplot(aes(x = biden_ec)) +
facet_wrap(~label, ncol = 4) +
geom_histogram(binwidth = 10, alpha = 0.9) +
geom_vline(data = real_election,
aes(xintercept = biden_ec),
color = palette_wjake[1], linetype = "solid", size = 1) +
geom_point(aes(x = 300, y = 0, color = "Observed Electoral Votes"),
alpha = 0) +
labs(x = "Biden's Electoral Votes", y = "Simulations", color = NULL,
title = "Expected Electoral College Votes for Biden",
subtitle = "Most forecasts overestimated Biden's electoral votes",
caption = "Plot: @wjakethompson") +
theme(strip.text = element_markdown(size = rel(0.7)),
plot.caption = element_text(face = "plain"),
plot.subtitle = element_text(margin = margin(0, 0, 5, 0)),
axis.text.x = element_text(size = rel(0.7)),
axis.text.y = element_text(size = rel(0.7)),
panel.spacing.y = unit(1, "lines"),
panel.spacing.x = unit(1, "lines")) +
guides(color = guide_legend(override.aes = list(shape = 15, size = 3,
alpha = 1))) -> p

ggsave2(p, knitr::fig_path(".png"), width = 6, height = 6)

Most models over estimated the number of electoral votes Biden would receive, with the bulk of the distribution shifted to the right of the blue line. Only the forecasts from Plural Vote and PredictIt got had an expected distribution close to centered on the observed outcome. However, the observed 306 was within the middle 80% of the Electoral Polls, New Statesman, Progress Campaign, and Reed forecasts as well, indicating that those models also did an okay job.

## Final Thoughts

Taken all together, the Electoral Polls forecast and the market derived probabilities from PredictIt showed the best performance for both prediction and model accuracy. I’m still unsure how useful these forecasts are in practice, but I don’t think they’re going anywhere anytime soon. And with the mid-term elections coming up in in 2022, it’s good to be thinking about how accurate different forecasts might be!

Posted on:
November 7, 2021
Length:


text:
Lemma 18.11.4. Let $\mathcal{C}$ be a site. Let $\mathcal{O} \to \mathcal{O}'$ be an epimorphism of sheaves of rings. Let $\mathcal{G}_1, \mathcal{G}_2$ be $\mathcal{O}'$-modules. Then

$\mathop{\mathrm{Hom}}\nolimits _{\mathcal{O}'}(\mathcal{G}_1, \mathcal{G}_2) = \mathop{\mathrm{Hom}}\nolimits _\mathcal {O}(\mathcal{G}_1, \mathcal{G}_2).$

In other words, the restriction functor $\textit{Mod}(\mathcal{O}') \to \textit{Mod}(\mathcal{O})$ is fully faithful.

Proof. This is the sheaf version of Algebra, Lemma 10.107.14 and is proved in exactly the same way. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text:
# Is there an explanation for this unexpected similarity between binomial coefficients and waves?

Background

Binomial coefficients appeal mostly in probability, combinatorics number theory etc so were were surprised when we observed something that appeared to belong more to physics than pure mathematics. This question arose out of a problem that we were working on Mathematics Stack Exchange and we observed things that looked like propagation of a wave with fixed amplitude and decreasing frequency. So we are posting this question in Physics community asking if there is something similar to this in Physics.

Theory

Let $$s_{n,a}$$ be the sum of the squares of the multiple of the squares of binomial coefficients as defined below. $$s_{n,a} = \sum_{1\leq \lfloor ak^2 \rfloor\leq n}{n\choose \lfloor ak^2 \rfloor}= {n\choose \lfloor 1^2 a \rfloor} + {n\choose \lfloor 2^2 a \rfloor} + \cdots + {n\choose \lfloor r^2 a \rfloor}.$$

We obtained series expansion $$\frac{S_{n,a}\sqrt{2an}}{2^n}=1+\sum_{k=1}^{\infty}2 e^{-\frac{\pi^2}{4a} k^2} \cos2\pi k x_n+O\left(\frac{\log^3 n}{\sqrt n}\right),$$ where $$x_n$$ is defined in the above link.

Observation

The graph of $$\dfrac{S_{n,a}\sqrt{n}}{2^n}$$ has the shape as shown below

Questions

The graph looks like a wave with fixed amplitude and decreasing frequency, somewhat like frequency modulation where you are only allowed to decrease the frequency but never increase it back. Mathematically, this is due to the $$\cos$$ term in the series expansion.

1. Where in physics do we observe something like this with fixed amplitude and decreasing frequency? May be something like Doppler shift?
2. What is the equation of a wave with such characteristics?
• Consider to make post self-contained and define $x_n$ directly. Jul 25 '19 at 7:39

## 1 Answer

first, it is not a wave, wich implies Space and time, it is an oscillation, and you are right, it would come from Doppelereffekt. The frequency yo would hier from a sound source moving away from you and acellarating, would give something like your picture, or a little different if you move accelerating away from a surge with a single frequency. the frequency you hear in the first case ist f=f_0/(1-c/v) c=velocity of sound, v=velocity of car, if now v=at with a acceleration the frequency decreases in time, if v is negativ. the curve would be Asin(f_0*t/(1-at/c)) in the second case f=f_o(1+v/c) again with v=-at but with at

• I am aware of the math and the physics of Dopper Shift but I can't see how your answer addresses the two questions asked in the post? Jul 25 '19 at 12:25