text:
## Binomial logistic regression models in R

In this post, we will look at a simple logistic binomial regression model in R. First, let's take a look at the following hypothetical data taken from [1]:

 C = Yes C = No Disease Disease Yes No Yes No Exposure Yes 1200 600 300 400 No 400 100 600 400

It is a contingency table. With this data we want to predict the probability of getting a disease based on exposure. We assume that some people are exposed to something (not necessarily the disease itself), and we count the number of people that get the disease. The exposure could be something good like an experimental treatment of "exercises at least twenty minutes a week on a treadmill" and the disease could be "heart disease". Notice that there is a second variable, "C" that we could also incorporate into our model. To get this data into R it is easiest to have it in a comma separate file like this:…read the rest of this post!

## Chytrid fungus and logistic regression against temperature

Chytrid fungus refers to the fungus Batrachochytrium dendrobatidis (Bd). In amphibians, it causes a disease known as Chytridiomycosis. It is one of the worst diseases to strike out at multiple species of animals on the planet. This horrible disease degrades the skin, which in amphibians is a sensitive, permeable organ that is part of the respiratory system. Chytridiomycosis eventually leads to death and is a serious threat to many amphibian species in areas such as North America, Central America, Asia, Africa, and even in Australia.

While not necessarily threatened with extinction by Chytrid fungus, even Northern Leopard Frogs may be affected by the widespread organism. Photo by Jason Polak.

As humans, we have contributed to the spread of Chytrid. For example, the bullfrog Lithobates catesbeianus is an excellent reservoir of Bd and has been associated with increased presence of the bacteria in areas where it has become an invasive species due to imports for food. Chytrid fungus has also been responsible for huge losses and declines of frog species in Panama.

Bd grows between 4-25 C°. Therefore, we expect to see a decrease in prevalence in Bd infections in species in the wild as the temperature of the water rises. Matthew Forrest and Martin Schlaepfer tested this and modeled the presence or absence of a Bd infection against water temperature using binomial logistic regression. In their sample of 201 Lowland Leopard frogs, they grouped 10-12 individuals and plotted the proportion of individuals with Bd to illustrate their model:

Logistic equation model reproduced from Forrest and Schlaepfer.

The curve is their logistic regression equation, which is
$$p = \frac{1}{1+e^{4.56-0.226t}}$$ where $t$ is the temperature in Celsius, and $p$ is the proportion of individuals with Bd. This is just one example of the steps we need to take towards better understanding the ecology of the Bd organism so that we can better prevent it from eradicating beautiful species of amphibians that are integral parts of our biosphere.

## Book review: Richard Fortey's "Life"

As far as the telling of history goes, there can be little more ambitious than the entire history of life from the dawn of the Precambrian to the present day. That is just what paleontologist Richard Fortey attempts in his book Life: A Natural History of the First Four Billion Years of Life on Earth published by Vintage.

Life is a tour of the development of our planet, and puts our current state of the world in its humble place. The land biodiversity that we are so accustomed to as well as the existence of anything remotely resembling ourselves, is a relatively recent occurrence, and Fortey shows us the huge changes that the earth went through to get to the present day.

Many readers will be excited to read the chapters on dinosaurs and their extinction. The author did a great job here of portraying the controversies and ideas surrounding the exact nature of this cataclysm. Personally, I really enjoyed the earlier chapters on the little creatures that inhabited the ancient oceans. They were small, often delicate things that give the impression of a gentler time with gentle creatures. What I wouldn't give to view the planet at that time, though through much of it the atmosphere would not even be suitable for human breathing!

From plants to reptiles to birds to mammals, this book touches upon all aspects of life and its evolution. The narratives are imbued with the personal journey of the author to discover many of the facts in this book. Although at times I found his tangents into literature and human history a distracting, I found his choice of style and witty language to give the perfect grandeur to such an epic story. In fact, the story is so epic that I suggest to readers of this book that they create their own timeline of geologic history based on this chart, and have it handy when reading the book.

Although the story in Life was partially presented in minute and dim fragments to me in school, until now I had never be exposed to such cohesiveness, and I believe this knowledge should be known by everyone. Highly recommended!

## Book review: Dunn's "The Wild Life of Our Bodies"

For the past few years, I have been increasingly aware of the unusual aspects of modern society with regard to technological and cultural development. Compared to thousands of years ago, these developments have led to vast changes in the food we eat and how we spend our time. More of our lives are indoors, away from nature. The more I think about it, the more alarmed I get.

When sentiments like this were echoed in the introduction of the book The Wild Life of Our Bodies by Rob Dunn, I jumped into reading until the end!

Dunn's book is a look at some aspects of our species evolution through interactions with parasites, predators, and diet. More specifically, through the lens of evolution, he examines some of our current problems and what we lack compared to our past that may actually be causing problems for us. The opening part is about parasites such as intestinal worms. He argues that certain intestinal worms may actually have been beneficial and that the chances of getting digestive problems such as inflammatory bowel disease may actually be exacerbated in those that do not have the intestinal whipworms.

The author takes us through other topics such as obesity and anxiety, and how traits that led to these were once adaptive, and colour vision, which is still useful to us (but not to the snakes which possibly led to colour vision). This idiosyncratic tour through our evolution makes the point that to understand ourselves and our modern problems, we should look in the past and discover what we have changed. The book finishes by examining our move away from living where we farm our food, and the growing needs of our increasing population.

Although each of the topics examined by Dunn could be a topic of a book by themselves, Dunn manages to continually entertain the reader through clear scientific exposition combined with the witty writing of a seasoned biologist. The book is consistently enjoyable and I highly recommend it to anyone interested in science or the natural history of humanity.

## Forthcoming book review: Algorithms by Louridas

An algorithm is a set of well-defined instructions for data transformation. An algorithm typically is given input, and then gives some sort of output. It is the computing version of a function in mathematics. Examples of algorithms range from the very simple such as long division or multiplication that we are taught in grade school to S. Landau's polynomial time algorithm to factor polynomials over algebraic number fields.

For most people, the influence of algorithms on their life come from more practical examples, such as recommendations on Amazon or optimizing the amount of food delivered to the local grocery store. For this reason, it might be useful to have an introductory book on algorithms aimed at a general audience. Panos Louridas has written just such a book, entitled Algorithms, set to be released by MIT press on August 18, 2020. The publisher was kind enough to send me an advance copy, which I will now review.

Algorithms has the difficult task of introducing the concept of algorithm in just 244 pages. To do this, the author has chosen the greatest common divisor (GCD) algorithm to start with, also aptly illustrated by a flowchart on the front cover of the book. This algorithm, known as Euclid's algorithm, is introduced in the first chapter through a similar problem of distributing as evenly as possible two types of objects arranged in a row. By using Euclid's algorithm graphically, the author shows us how to create one possible distribution of the two types of objects. It is also quite interesting how he related these patterns to drumming rhythms in ancient music.
…read the rest of this post!

## Check out my Sudoku solver

A couple days ago I started solving a few Sudokus. I would say I am average at solving them. I certainly don't use any advanced techniques and I don't really find the difficult ones very entertaining. By difficult here I mean where you have to think several moves ahead to rule out possibilities. So I thought I would write a Sudoku solver. You can try it out. Yeah, I named it 'Jasudoku' after myself. There are some test cases in it, and you can actually play them by entering some numbers and clicking 'Solve' as the program won't let you go to solve mode unless the puzzle is correct at the end.
…read the rest of this post!

## Preprint: group theory and chords

A while ago I wrote a paper called A Group-theoretical Classification of Three-tone and Four-tone Harmonic Chords (arXiv link). The main contribution is an analysis of four-tone harmonic chords in music theory. These are: major-major, minor-major, augmented-major, major-minor, diminished-minor, minor-minor, and diminished-diminished. X-Y in this scheme means X is the basic triad (so major, minor, augmented, or diminished), and Y is the quality of the seventh factor. These four-tone chords can be represented as a quadruple $(0,a,b,c)$ where the numbers $a,b,c$ are the distance from the root $0$ in semitones. I define three fundamental operations on these chords: inversion (usual inversion on a keyboard instrument) denoted $i$, major-minor duality denoted $d$, and augmented-diminished duality denoted $a$. These three operators are elements of the symmetric group on four letters.

I show how all the harmonic chords are related under these operators, and each of these relations reveals the harmonic relations between these chords as we hear them in music. The highlight of the paper is this diagram, which shows all these relations (M=major, m=minor, A=augmented, d=diminished):

Unfortunately, I recently found out that it was rejected :( It was suggested that I could resubmit on the condition that I significantly expand its relation to the rest of the literature and make the notation more consistent with some other parts of the literature. I am going to have to figure out what to do about that because I think too much notational change might actually make this paper more confusing and hard to read. So, I am sharing it with you so you can see this cool diagram. I am not sure if I can really satisfy the requirements of the field of mathematics of music so I might have to leave this one as a preprint, especially since I would like to keep working on ecology.

## Some misuses of science

Ever since I was a child, I was fascinated by science. Back then, science was reading about astronomy, physics, chemistry, and biology and the wonderful facts and theories proposed to explain those facts. The method that is used by scientists in their journey is the scientific method. Although the exact nature of the scientific method has been examined by philosophers for hundreds of years, its core nature of falsifiable hypotheses and experimentation holds a great beauty of thought.

However, science is carried out by individuals and societies and in turn that knowledge affects those individuals and societies. Thus, the actual discoveries and processes of science in the short term can be far more tumultuous than the overarching successes presented in history. As intelligent beings, we need to be aware of the dangers in science, so that we can more quickly discover the truth. We need to be wary of the misuse of science for means other than discovering the truth via genuine curiosity about the world.
…read the rest of this post!

## Is math art? Part 1

Is mathematics an art? In this series of posts I will attempt to explore and answer this question. I encourage readers to also contribute their ideas in the comments.

The term art itself has undergone a metamorphoses over the centuries, so we should start by examining what humanity has meant by art and see if mathematics might fall under any of the definitions used over time. But beyond these definitions, we should examine whether we feel that mathematics is an art. Whether it is or not, what definition should art have in order to be consistent with the existence of mathematics? Only be examining these two angles will we gain insight into both art and mathematics, and how we as humans fit into both.

One of the earliest descriptions of art is the Platonic one, which says that art is imitation [1]. This view is echoed by Leon Battista Alberti (1404-1472), who thought that painting should be as faithful a reproduction or imitation of the real scene being constructed. Obviously this is a very limited definition by today's standards, but nonetheless worth looking at, as the germ of creating a reproduction of a scene using any media is still alive today, at least as a motivating factor to create art.
…read the rest of this post!

## Summing the first $n$ powers and generating functions

One of the classic and most used sums in all of mathematics is the sum of the first $n$ natural numbers
$$1 + 2 + \cdots + n = \frac{n(n+1)}{2}.$$ Gauss's classic derivation of this formula involves observing that if we duplicate this sum, write it backwards under the first sum, and add termwise, we get $(n+1) + (n+1) + \cdots (n+1)$, whence the original sum is half $n(n+1)$.

Similar formulas work for higher powers. For example,
$$1^2 + 2^2 + \cdots + n^2 = \frac{n(n+1)(2n+1)}{6}.$$ But is it a priori clear that the sum of the $a$-powers of the first $n$ natural numbers is a polynomial in $n$ with degree $a+1$? The sum of the first $n$ natural numbers is a quadratic polynomial in $n$, and the sum of the first $n$ squares is a cubic polynomial in $n$.

It is actually true that for any natural number $a$,
$$\sum_{k=0}^n k^a$$ can be written as a polynomial function of $n$ of degree $a+1$. Of course, one way to see this is to derive in a brute force manner a formula that actually works for all powers $a$. That train of thought was actually carried out by Johann Faulhaber (1580-1635) and completed by Jacobi. The resulting formula is now known as Faulhaber's formula.
…read the rest of this post!


text:
20 Oct 2006 05:25

### Texmode does not reconize math mode automatically

I am using Winedit 5.5b2. I have installed the TeXmode macro but for some reason it does not automatically recognize the Mathmode and switch to it. I have to do it myself. I remember that an earlier version of Texmode was able to do it automatically but after I "updated" to the latest version it cannot do it anymore.

Any suggestions?

Thansk

20 Oct 2006 17:22

### Re: Texmode does not reconize math mode automatically

On 20.10.2006 05:25, Per Ting wrote:
> I am using Winedit 5.5b2. I have installed the TeXmode macro but for
> some reason it does not automatically recognize the Mathmode and
> switch to it. I have to do it myself. I remember that an earlier
> version of Texmode was able to do it automatically but after I

Actually, it's the other way round: With old versions, you had to toggle
the mode manually, since version 1.5 from 21 August, math mode will be
recognized automatically (with WinEdt 5.5).

Maybe you are using a math environment that isn't defined in the
highlighting settings and in _TeXmode.edt?

Note that with WinEdt 5.5, the information in the status line does not
necessarily reflect the current mode.

Regards,
Robert.

20 Oct 2006 17:47

### Re: Texmode does not reconize math mode automatically

Robert,

As I stated in my original posting, it worked fine in Aug. 21 release. When I upgraded to the latest version (Sept. 14 version) it stopped working. I have tried many enviornments, including $..$ and $...$. It has not worked with any environment I have tried.

Can you tell me what is the difference between 8/21 and 9/14 releases of Texmode? Is there a way that I can get a copy of the 8/21 release since it worked for me beautifully.

Thanks

Per

On 10/20/06, RS <w.m.l <at> gmx.net> wrote:
On 20.10.2006 05:25, Per Ting wrote:
> I am using Winedit 5.5b2. I have installed the TeXmode macro but for
> some reason it does not automatically recognize the Mathmode and
> switch to it. I have to do it myself. I remember that an earlier
> version of Texmode was able to do it automatically but after I

Actually, it's the other way round: With old versions, you had to toggle
the mode manually, since version 1.5 from 21 August, math mode will be
recognized automatically (with WinEdt 5.5).

Maybe you are using a math environment that isn't defined in the
highlighting settings and in _TeXmode.edt?

Note that with WinEdt 5.5, the information in the status line does not
necessarily reflect the current mode.

Regards,
Robert.

20 Oct 2006 18:28

### Re: Texmode does not reconize math mode automatically

On 20.10.2006 17:47, Per Ting wrote:
> Robert,
>
> As I stated in my original posting, it worked fine in Aug. 21 release. When
> have tried many enviornments, including $..$ and $...$. It has not worked
> with any environment I have tried.
>
> Can you tell me what is the difference between 8/21 and 9/14 releases of
> Texmode? Is there a way that I can get a copy of the 8/21 release since it
> worked for me beautifully.

The *only* difference between these releases is in line 48 of _TeXmode.edt:

IfOK(''Goto(9);CMD(|Next Bullet|);'');',>

IfOK(''Goto(9);CMD(""Next Bullet"");'');',>

That shouldn't make a difference, though.

Could you send the _Installation.log, please?

To find out what goes wrong, you can temporarily replace the lines 24+
in _TeXmode.edt with:

:checkmath::
FindInString("%%%!0%%","%%%!1%%",2,3);
IfOK(!"Prompt('""%!1"" IN switch stack:%\%!0');JMP('math');",>
!"Prompt('""%!1"" NOT in switch stack:%\%!0');");
Return;

For each of the defined switches, this will tell you whether it's in the
stack of highlighting switches (a list separated with "%"). What does it
say when you type "\(a" (with the correct prefix)?

Regards,
Robert.

20 Oct 2006 21:35

### Re: Texmode does not reconize math mode automatically

Robert

Here is my _installation.log (after another removal and reinstallation today, problem still persisting!):

-*- ASCII -*-

+===================================+
=   TeX Math Mode Macro Package'   =
=       ( $Revision: 1.6$ )        =
+===================================+

Successfully Installed on: 20. October 2006, 15:28

Package directory is: %b\Macros\LaTeX

Options:
=========

* Prefix:
* Use Status Line to toggle TeX mode: No

No Active String Clashes

To uninstall the TeX math mode macro package',
execute the macro  "TeXmode_uninstall.edt".

Thanks

Per

On 10/20/06, RS <w.m.l <at> gmx.net> wrote:
On 20.10.2006 17:47, Per Ting wrote:
> Robert,
>
> As I stated in my original posting, it worked fine in Aug. 21 release. When
> have tried many enviornments, including $..$ and $...$. It has not worked
> with any environment I have tried.
>
> Can you tell me what is the difference between 8/21 and 9/14 releases of
> Texmode? Is there a way that I can get a copy of the 8/21 release since it
> worked for me beautifully.

The *only* difference between these releases is in line 48 of _TeXmode.edt:

IfOK(''Goto(9);CMD(|Next Bullet|);'');',>

IfOK(''Goto(9);CMD(""Next Bullet"");'');',>

That shouldn't make a difference, though.

Could you send the _Installation.log, please?

To find out what goes wrong, you can temporarily replace the lines 24+
in _TeXmode.edt with:

:checkmath::
FindInString("%%%!0%%","%%%!1%%",2,3);
IfOK(!"Prompt('""%!1"" IN switch stack:%\%!0');JMP('math');",>
!"Prompt('""%!1"" NOT in switch stack:%\%!0');");
Return;

For each of the defined switches, this will tell you whether it's in the
stack of highlighting switches (a list separated with "%"). What does it
say when you type "\(a" (with the correct prefix)?

Regards,
Robert.

20 Oct 2006 21:49

### Re: Texmode does not reconize math mode automatically

Robert;

I tried your suggestion given below, the response to \(a is: *$?$* NOT in switch stack:info

That is all it says. In all other environments, , ..., etc, it gives me the same error message: *$?$* NOT in ...

Thanks

Per

To find out what goes wrong, you can temporarily replace the lines 24+
in _TeXmode.edt with:

:checkmath::
FindInString("%%%!0%%","%%%!1%%",2,3);
IfOK(!"Prompt('""%!1"" IN switch stack:%\%!0');JMP('math');",>
!"Prompt('""%!1"" NOT in switch stack:%\%!0');");
Return;

For each of the defined switches, this will tell you whether it's in the
stack of highlighting switches (a list separated with "%"). What does it
say when you type "\(`a" (with the correct prefix)?

Regards,
Robert.

Gmane

format: plain


text:
Getting Started

This page is to introduce you to the syntax and features on the new CS wiki. There are some intricacies because of plugins that we use to make mediawiki migration easier.

Images

In order to add an image to a page, you must first add the image to the file system using the Media Manager located in the toolbox on the left side of your screen.

Make sure you place the pictures under :media:[your class name], not the root directory, or they will be unavailable.

Once the image has been added under the media manager, you may add the image to your page using this syntax:

 [[media:YOURCLASS:IMAGENAME.PNG]]

Resize Image

Currently, formatting options for images are limited. To resize the image, specify how many pixels the image should be resized. For example, to make the previous image 400 pixels:

 [[media:YOURCLASS:IMAGENAME.PNG|400px]]

Center Image

To center an image, prefix and suffix the image tag with html center tags, without the whitespace:

 < html>< center>< /html>[[media:YOURCLASS:IMAGENAME.PNG]]< html>< /center>< /html>

Text Formatting

Text formatting follows the mediawiki syntax. A good guide on mediawiki text syntax can be found here

Tables

Table formatting follows the dokuwiki syntax. The official dokuwiki documentation for tables can be found here

Code Tags

Code tags are easily created by placing two spaces before the text that you would like to be in code.

 This just has two spaces in front of it


text:
# What Can You Do To Get Rid Of Flies Image Titled Get Rid Of Flies In The House Step 1 What Can You Do To Get Rid Of Flies

what can you do to get rid of flies image titled get rid of flies in the house step 1 what can you do to get rid of flies.

what can i do to get rid of flies in my house,what can i do to get rid of flies on my porch,what can you do to get rid of flies in your house,what can i do to get rid of flies in my home,what can you use to get rid of flies outside,what can you do to get rid of flies outside,what can you use to get rid of fruit flies,what can you do to get rid of flies,what can i do to get rid of flies,what can you use to get rid of flies,what can i do to get rid of flies outside.


text:
INFINITESIMAL

# INFINITESIMAL MODALITY

(Infinitesimal Shape Modality or de Rham stack). The two maps and are called shape modality if i) is an equivalence, the type is then called coreduced.; ii) identity types of coreduced types are coreduced; iii) if is a dependent type such that for all the type is coreduced, then we can define a section of by induction. The is called de Rham space.

def ι (A : U) (a : A) : ℑ A := ℑ-unit a def is-coreduced (A : U) : U := isEquiv A (ℑ A) (ι A) def ℑ-coreduced (A : U) : is-coreduced (ℑ A) := isoToEquiv (ℑ A) (ℑ (ℑ A)) (ι (ℑ A)) (μ A) (λ (x : ℑ (ℑ A)), <_> x) (λ (y : ℑ A), <_> y) def ℑ-rec (A B : U) (c : is-coreduced B) (f : A → B) : ℑ A → B := ℑ-ind A (λ (_ : ℑ A), B) (λ (_ : ℑ A), c) f def ℑ-ind (A : U) (B : ℑ A → U) (c : Π (a : ℑ A), is-coreduced (B a)) (f : Π (a : A), B (ι A a)) (a : ℑ A) : B a := (c a (ind-ℑ A B (λ (x : A), ι (B (ι A x)) (f x)) a)).1.1

# ÉTALE MAP

(Étale map). A map is formally étale if its naturality square is a pullback: with induced naturality equation:

def ℑ-app (A B : U) (f : A → B) : ℑ A → ℑ B := ℑ-rec A (ℑ B) (ℑ-coreduced B) (∘ A B (ℑ B) (ι B) f) def ℑ-naturality (A B : U) (f : A → B) (a : A) : Path (ℑ B) ((ι B) (f a)) ((ℑ-app A B f) (ι A a)) := <_> ℑ-unit (f a)
def isÉtaleMap (A B : U) (f : A → B) : U := isPullbackSq A (ℑ A) B (ℑ B) (ℑ-app A B f) (ι B) (ι A) f (λ (a : A), <_> ℑ-unit (f a))
def ÉtaleMap (A B : U) : U := Σ (f : A → B), isÉtaleMap A B f

(Infinitesimal Close). Let , then we have a type which could be read x is infinitesimally close to y and is given as:

def ~ (X : U) (a x′ : X) : U := Path (ℑ X) (ι X a) (ι X x′)

# FORMAL DISK BUNDLE

(Formal Disk). Let be a type and . The type defined below in three equivalent ways is called the formal disk at a: i) is the sum of all point infinitesimal close to a; ii) is a fiber of at ; iii) is defined as a pullback square:

def 𝔻 (X : U) (a : X) : U := Σ (x′ : X), ~ X a x′

(Differential). If is a type, there is a dependent function defined as

def inf-prox-ap (X Y : U) (f : X → Y) (x x′ : X) (p : ~ X x x′) : ~ Y (f x) (f x′) := <i> ℑ-app X Y f (p @ i) def d (X Y : U) (f : X → Y) (x : X) (ε : 𝔻 X x) : 𝔻 Y (f x) := (f ε.1, inf-prox-ap X Y f x ε.1 ε.2)

(Formal Disk Bundle). Let be a type. The type defined in one of the equivalent ways below is called the formal disk bundle of : i) is the sum over all formal disks in A: ii) is defined by pullback square:

def T∞ (A : U) : U := Σ (a : A), 𝔻 A a

(Hennion). The tangent complex of a derived algebraic stack is equivalently the (sheaf of modules of) sections of the formal neighbourhood of the diagonal of . We may think of as being the tangent complex of .

(Kock). The infinitesimal disk bundle construction is left adjoint to the jet comonad:

(Induced map). For a map there is an induced map on the formal disk bundles, given as

# MANIFOLDS

(Homogeneous structure). A type is homogeneous, if there are terms of the following types: i) ; ii) ; iii) .

def is-homogeneous (A : U) := Σ (e : A) (t : A → equiv A A), Π (x : A), Path A ((t x).1 e) x

# LITERATURE

[1]. Felix Cherubini Formalizing Cartan Geometry in Modal Homotopy Type Theory.


text:
## A Derivation of Centripetal Force

### Introduction

I love talking with undergraduate students. When you get to a certain level of study, you take most of the elementary material for granted. But then every once in awhile, a young student asks you a seemingly simple question that completely takes you by surprise.

That happened to me this past week. Twice!

Two undergraduate students came to me on two separate occasions and mentioned that most graduate students and professors could not explain the origin of the equation for centripetal force. And to my horror, I realized that I could not derive the equation for centripetal force during the conversations! I guess the universe really wanted me to look into it this week.

After a good night’s sleep, I realized that this derivation is actually really straightforward. The key is to identify a few simple concepts and then mush them all together.

Brian and Chaitanya, thanks for throwing down the gauntlet! This post is for you!

### Angles and Arcs

We are analyzing a particle moving around a circle with a constant speed, so it might be helpful to identify some relationships between arc length ($$s$$), radius ($$r$$), central angle ($$\theta$$), and speed ($$v$$). From introductory geometry:

$$$\Delta s = r \Delta \theta$$$

I am going to rearrange the expression above so that we can use it in the final derivation:

$$$\frac{1}{r} = \frac{\Delta \theta}{\Delta s}$$$

Additionally, we know that the particle covers a certain arc length ($$\Delta s$$) per unit time ($$\Delta t$$):

$$$v = \frac{\Delta s}{\Delta t}$$$

Multiplying the two expressions above yields:

$$$\frac{\Delta \theta}{\Delta t} = \frac{\Delta \theta}{\Delta s}\frac{\Delta s}{\Delta t} = \frac{v}{r}$$$

### Changing Momentum

Let’s draw a diagram of the particle moving along the circle. At some initial time, suppose that it has a momentum directed in some initial direction ($$\vec{p}_i$$). At some time $$\Delta t$$ in the future, the momentum has the same magnitude but a different direction ($$\vec{p}_f$$). This is because the particle has the same mass and speed, but it has moved along the circle.

In the image above on the right, we let the magnitudes of $$\vec{p}_i$$ and $$\vec{p}_f$$ equal $$p$$. We can find the difference in momentum by subtracting the two vectors and doing some trig:

$$$sin \left ( \frac{\Delta \theta}{2} \right) = \frac{\Delta p/2}{p}$$$ $$$\Delta p = 2 p sin \left ( \frac{\Delta \theta}{2} \right)$$$

Dividing each side by $$\Delta \theta$$ yields:

\begin{align} \frac{\Delta p}{\Delta \theta} &= \frac{2 p sin \left ( \frac{\Delta \theta}{2} \right)}{\Delta \theta}\\[0.1cm] &= p \frac{sin \left ( \frac{\Delta \theta}{2} \right)}{\frac{\Delta \theta}{2}}\\[0.1cm] &= p \hspace{1mm} {\rm sinc} \left ( \frac{\Delta \theta}{2} \right)\\[0.1cm] &= mv \hspace{1mm} {\rm sinc} \left ( \frac{\Delta \theta}{2} \right) \end{align}

Where the $$sinc$$ function is $$sinx/x$$.

### The Derivation

Now that we have all of the pieces of the problem, the derivation is really straightforward.

\begin{align} F &= \frac{\Delta p}{\Delta t}\\[0.1cm] &= \left ( \frac{\Delta p}{\Delta \theta} \right ) \left ( \frac{\Delta \theta}{\Delta t} \right )\\[0.1cm] &= \left [ mv \hspace{1mm} {\rm sinc} \left ( \frac{\Delta \theta}{2} \right) \right ] \left ( \frac{v}{r} \right )\\[0.1cm] &= \frac{mv^2}{r} {\rm sinc} \left ( \frac{\Delta \theta}{2} \right) \end{align}

Finally, if we take the limit as $$\Delta \theta \rightarrow 0$$, we get the instantaneous centripetal force at some point on the circular path. The limit can be found using L’Hospital’s Rule:

\begin{align} \lim_{\Delta \theta \rightarrow 0} {\rm sinc} \left ( \frac{\Delta \theta}{2} \right ) &= \lim_{\Delta \theta \rightarrow 0} \frac{sin \left ( \frac{\Delta \theta}{2} \right )}{\frac{\Delta \theta}{2}}\\[0.1cm] &= \lim_{\Delta \theta \rightarrow 0} \frac{\frac{1}{2}cos \left ( \frac{\Delta \theta}{2} \right )}{\frac{1}{2}}\\[0.1cm] &= cos(0)\\[0.1cm] &= 1 \end{align}

Thus, we get the final expression for centripetal force:

$$$F = \frac{mv^2}{r}$$$


text:
# Alternating/looping section dividers

I would like to create a section dividers that alternate/loop around several possibilities.

Code I have now:

\documentclass{article}

\usepackage{halloweenmath}
\def\SectionDivider{$$\mathwitch \mathwitch \mathwitch$$}

\begin{document}

1
\SectionDivider
2
\SectionDivider
3
\SectionDivider
4
\SectionDivider
5
\SectionDivider
6
\SectionDivider
7

\end{document}

Output PDF I have now:

Output PDF I want:

The above desired PDF was accomplished with the following code, but I want \SectionDivider to do this automatically for me, looping through (i) witches; (ii) pumpkins; and (iii) ghosts.

\documentclass{article}

\usepackage{halloweenmath}
\def\SectionDivider{$$\mathwitch \mathwitch \mathwitch$$}

\begin{document}

1
\SectionDivider
2
$$\pumpkin \pumpkin \pumpkin$$
3
$$\mathrightghost \mathrightghost \mathrightghost$$
4
\SectionDivider
5
$$\pumpkin \pumpkin \pumpkin$$
6
$$\mathrightghost \mathrightghost \mathrightghost$$
7

\end{document}

• – Werner Mar 29 '18 at 3:31

\documentclass{article}
\newcounter{SecDiv}\setcounter{SecDiv}{-1}
\usepackage{halloweenmath}
\newcommand{\SectionDivider}{\stepcounter{SecDiv}
\ifnum\theSecDiv=3
\setcounter{SecDiv}{0}
\fi
\typeout{\theSecDiv}
\ifcase\theSecDiv
$$\mathwitch \mathwitch \mathwitch$$
\or
$$\pumpkin \pumpkin \pumpkin$$
\or
$$\mathrightghost \mathrightghost \mathrightghost$$
\fi
}

\begin{document}

1
\SectionDivider
2
\SectionDivider
3
\SectionDivider
4
\SectionDivider
5
\SectionDivider
6
\SectionDivider
7

\end{document}


text:
Author:
All :: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
All :: Kaad, ... , Koehl, Koepke, Koerwien, ... , KÃ¼mmel
References
 57 Dominik Adolf, Arthur W. Apter and Peter Koepke Singularizing successor cardinals by forcing Proc. Amer. Math. Soc., 146(3):773--783 2018 56 Dominik Adolf, Arthur W. Apter and Peter Koepke Singularizing successor cardinals by forcing Proc. Amer. Math. Soc., 146(2):773--783 2018 55 Peter Koepke and Andrei S. Morozov The computational power of infinite time Blum-Shub-Smale machines Algebra and Logic, 56(1):37--62 2017 54 Arthur W. Apter, Ioanna M. Dimitriou and Peter Koepke All uncountable cardinals in the Gitik model are almost Ramsey and carry Rowbottom filters MLQ Math. Log. Q., 62(3):225--231 2016 53 Arthur W. Apter, Ioanna M. Dimitriou and Peter Koepke The first measurable cardinal can be the first uncountable regular cardinal at any successor height MLQ Math. Log. Q., 60(6):471--486 2014 52 Peter Koepke Logic, Methodology and Philosophy of Science - Proceedings of the 14th InternationalCongress In Pierre Edouard Bour, Gerhard Heinzmann and Wilfriedand SchrÃ¶der-Heister Hodges, editor, Chapter Computer-Assisted Formal Mathematics and Mathematical Practice, page 409--426. Publisher: College Publications, 2014 51 Peter Koepke Mathematics and the new technologies part II: computer-assisted formal mathematics and mathematical practice Logic, methodology and philosophy of science---logic and science facing the new technologies page 409--426. Publisher: Coll. Publ., [London], 2014 50 Peter Koepke, Karen RÃ¤sch and Philipp Schlicht A minimal Prikry-type forcing for singularizing a measurable cardinal J. Symbolic Logic, 78(1):85--100 2013 49 Peter Koepke and Julian J. SchlÃ¶der The GÃ¶del completeness theorem for uncountable languages Formalized Mathematics, 20:199--203 2012 48 Peter Koepke and Julian J. SchlÃ¶der Transition of consistency and satisfiability under language extensions Formalized Mathematics, 20:193--197 2012 47 Moti Gitik and Peter Koepke Violating the singular cardinals hypothesis without large cardinals Israel J. Math., 191(2):901--922 2012 46 Peter Koepke and Benjamin Seyfferth Towards a theory of infinite time Blum-Shub-Smale machines How the world computes Volume 7318 of Lecture Notes in Comput. Sci. page 405--415. Publisher: Springer, Heidelberg, 2012
Page:
Previous | 1, 2, 3, 4, 5 | Next
Export as:
BibTeX, XML


text:
OculusVR SDK and simple oculus rift DK2 / OpenGL test program

I’ve been hacking with my new Oculus Rift DK2 on and off for the past couple of weeks now. I won’t go into how awesome it is, or how VR is going to change the world, and save the universe or whatever; everybody who cares, knows everything about it by now. I’ll just share my experiences so far in programming the damn thing, and post a very simple OpenGL test program I wrote last week to try it out, that might serve as a baseline.

Calculating hierarchical animation transformation matrices

This is a short post with my thoughts on what’s the best way to design a transformation hierarchy for animation, and how the “ideal design” changes over time.

Bottom-up lazy evaluation magic

For a long time, I was a big fan of backwards (bottom-up) lazy evaluation of transformation hierarchies. Essentially having an `XFormNode` class for each node in the hierarchy with a `get_matrix(long msec)` function which calculates the current node’s transformation matrix for the current time, then calls `parent->get_matrix(msec)` and returns the concatenated matrix.

``` ```

``````Matrix4x4 XFormNode::get_matrix(long msec) const
{
Matrix4x4 xform;
calc_matrix(&xform, msec);

if(parent) {
xform = parent->get_xform(msec) * xform;
}
return xform;
}
``````
``` ```

Of course, such a scheme would be wasteful if these matrices where calculated every time `get_matrix` functions are called. For instance if a node is part of a hierarchy, then its `get_matrix` will be called when we need to draw the object corresponding to this node, and also every time the `get_matrix` of any one of its descendants is called, due to the recursive bottom-up evaluation of matrices outlined previously. If one considers the posibility of drawing an object multiple times for various multi-pass algorithms the problem gets worse, with the limiting worse case scenario being if we’re doing ray-tracing which would require these functions to be called at the very least once per ray cast.

It follows then, that such a design goes hand in hand with lazy evaulation and caching of calculated node matrices. The XFormNode class would hold the last requested time and corresponding matrix, and when `get_matrix` is called, if the requested time matches the last one, we just return the cached matrix instead of recalculating it.

``` ```

``````const Matrix4x4 &XFormNode::get_matrix(long msec) const
{
if(msec == cached_msec) {
return cached_matrix;
}

calc_matrix(&cached_matrix, msec);
cached_msec = msec;

if(parent) {
cached_matrix = parent->get_xform(msec) * cached_matrix;
}
return cached_matrix;
}
``````
``` ```

This worked nicely for a long time, and it worked like magic. At any point I could just ask for the transform at time X and would get the matrix automatically, including any effects of hierarchy, keyframe interpolations, etc. It’s all good… until suddenly processors stopped getting faster any more, moore’s law went belly up, and after the shock passed we all sooner or later realised that single-threaded graphics programs are a thing of the past.

In the brave new multithreaded world, lazy evaluation becomes a pain in the ass. The first knee-jerk reaction is to add a mutex in XFormNode, and lock the hell out of the cached matrices. And while that might be ok for an OpenGL program which won’t have more than a couple of threads working with the scene database at any point (since rendering itself can only be done safely from a single thread), it throws out of the window a lot of concurrency that can take place in a raytracer where at any point there could be 8 or more threads asking for the matrix of any arbitrary node.

A second way to deal with this issue is to have each thread keep its own copy of the matrix cache, keeping it in thread-specific memory. I’m shamed to admit I never got around to doing any actual performance comparisons on this, though I’ve used it for quite some time in my programs. In theory it avoids having to wait for any other thread to access the cache, so it should be faster in theory, but it needs a `pthread_getspecific` call in every `get_matrix` invocation which comes with its own overhead.

``` ```

``````const Matrix4x4 &XFormNode::get_matrix(long msec) const
{
MatrixCache *cache = pthread_getspecific(cache_key); // cache_key created in the constructor for each node
if(!cache) {
// first time we need a cache for this thread we'll have to create it
cache = new MatrixCache;
cache_list.push_back(cache);
}

if(msec == cache->msec) {
return cache->matrix;
}

calc_matrix(&cache->matrix, msec);
cache->msec = msec;

if(parent) {
cache->matrix = parent->get_xform(msec) * cache->matrix;
}
return cache->matrix;
}
``````
``` ```

This works fine, and although we managed to avoid blocking concurrent use of `get_matrix`, we had to add some amount of overhead for thread-specific storage calls, and the code became much more complex all over the place: invalidations must also access this thread-specific storage, we need cleanup for the per-thread MatrixCache objects, etc.

Return of the top-down evaluation

So nowadays I’m starting to lean more towards the simpler, less automagic design of top-down evaluation. It boils down to just going through the hierarchy once to calculate all the matrices recursively, then at any point we can just grab the previously calculated matrix of any node and use it.

``` ```

``````void XFormNode::eval(long msec)
{
calc_matrix(&matrix, msec);

if(parent) {
matrix = parent->matrix * matrix;
}

for(size_t i=0; i<children.size(); i++) {
children[i]->eval(msec);
}
}
``````
``` ```

The simplicity of this two-pass approach is hard to overlook, however it’s just not as good for some things as my original ideal method. It works fine for OpenGL programs where it suffices to calculate transformations once per frame, it even works fine for simple raytracers where we have again a single time value for any given frame. However it breaks down for ray-tracers doing distribution ray tracing for motion blur.

No rest for the wicked

The best way to add motion blur to a ray tracer is through a monte-carlo method invented by Cook, Porter and Carpenter, called “distribution ray tracing“. In short, when spawining primary rays we have to choose a random time in the interval centered around the frame time and extending to the past and future, as far as dictated by the shutter speed of the camera. This time is then used both to calculate the position and direction of the ray, which thus might differ between sub-pixels if the camera is moving, and to calculate the positions of the objects we’re testing for intersections against. Then if we cast many rays per pixel and average the results, we’ll get motion blur on anything that moves significantly while the virtual shutter is open (example from my old s-ray renderer).

It’s obvious that calculating matrices once per frame won’t cut it with advanced ray-tracers, so there’s no getting rid of the complexity of the lazy bottom-up scheme in that case. Admittedly, however, caching won’t do much for us either because every sub-pixel will request the matrix at a different time anyway, so we might as well just calculate matrices from scratch all the time, and skip the thread-specific access overhead. The jury is still out on that one.

Do you have a favourite design for hierarchical animation code? Feel free to share it by leaving a comment below!

OpenGL stereoscopic anaglyphs and patents

An anaglyph is a combination of two images into one, in such a way that they can later be separated by viewing the image through appropriately colored transparent filters. The objective is to present slightly shifted views of the same 3D environment to each eye, in order to achieve depth perception (i.e. really perceive the 3rd dimension).

I’ve never dealt with anaglyphs in the past, but during my recent week-old obsession with stereoscopy, I’ve stumbled upon a pair of free anaglyph viewing glasses (made out of cardboard and cellophane of course). So I couldn’t help but try to find out how I can use them with my own programs.
Read the rest of this entry »

Raytracing Anamorphic Images

A long time ago, I stumbled upon a couple of strikingly odd images on Jim Arvo’s web site, which are apparently called “anamorphic”. The idea behind an anamorphic image, is that it’s distorted in such a way, that its true shape can be seen only when viewed in a particular manner. In the case of these images, you’re supposed to print the image and place a highly reflective cylindrical object, such as a chrome pipe, at a specific marked location in order to see the geometric shapes correctly.

I kept the images back then, with the purpose of either finding an appropriate cylindrical object, or raytracing them to see what they look like, but for some reason I’ve forgotten all about them until I accidentally found them again yesterday, in a dusty corner of my filesystem.

So I decided to hack some code to add perfect ($x^2 + y^2 = r^2$) cylinder primitives to my raytracer and do a couple of renderings with those images texture-mapped onto a ground quad (I could just do the same thing with another raytracer such as pov-ray but where’s the fun in that?).

So anyway here are the anamorphic images along with the renderings (click on the images for the full rendering):

Introductory OpenGL tutorials continued

Just a short notice, the second part of my “introduction to 3D graphics with OpenGL” series should be available as we speak. This time, we’ll perform the full set of transformations that we described while discussing the rendering pipeline in the previous issue. We’ll use the matrix stack to separate the model from the view parts of the modelview matrix, and render multiple objects properly. And finally we’re going to explain the mathematical model of shading and illumination, and we’ll apply lighting to our object in order to increase the realism of our simple 3D environment tremendously.

So, go and grab a copy of the november-december issue of the greek linux format magazine, and let me know what you think. As always I look forward to your comments, suggestions, corrections, etc.

By the way, due to popular demand, I will upload the first tutorial of the series in a couple of weeks, after the previous issue of linux format goes out of circulation.

Introductory OpenGL tutorials

I recently started writing a series of introductory tutorials about graphics programming with OpenGL, for the greek linux format magazine.

The articles are written for the complete begginer, who hasn’t had any previous exposure to graphics programming. However, familiarity with the C programming language is definitely required.

What I’m aiming for, is to thoroughly explain the underlying theory, in order to provide a stepping stone for someone who would like to eventually delve deeper into graphics algorithms, rather than just present raw examples for doing this and that with OpenGL.

In any case, the first article of the series will be published in the september-october issue of the greek linux format magazine, which should be available during the next few days. Any feedback, is greatly appreciated.


text:
# Introduction

Arrows come in many shapes and sizes and diagrams provides a wide variety of flexible and extensible tools for creating and using arrows. The diagram below gives a small taste of some of the different arrows that can be created easily with diagrams. The Diagrams.TwoD.Arrow module, along with Diagrams.TwD.Arrowheads, provides a collection of functions and options used to make arrows.

## Optional and named parameters

Most of the arrow functions take an opts parameter (see Faking optional named parameters) of type ArrowOpts, these functions typically have companion functions that use a default set of ArrowOpts. For example the functions arrow' and arrow. The former takes an opts parameter and the latter does not. In this tutorial whenever we mention a function with a single quote (') at the end, there is a sister function without the quote that uses a default set of options.

## Scale invariance

Arrowheads and -tails are the canonical example of scale invariant objects: they are not affected by scaling (though they are affected by other transformations such as rotation and translation). The scale-invariance section of the user manual has a good example showing why scale-invariance is necessary for the creation of arrowheads; detailed documentation explaining scale invariant objects is in Diagrams.TwoD.Transform.ScaleInv. The most important consequence for day-to-day diagramming with arrows is that arrowheads and -tails do not contribute to the envelope of an arrow (arrow shafts, on the other hand, do).

Arrowheads and tails do not contribute to the envelope of an arrow!

# Connecting Points

The default length of an arrow head is Normalized 0.035 which scales with the size of the diagram. Since the diagrams in this tutorial are relatively small and we want to highlight the arrows, we often set the head length and tail length to a larger size. This is accomplished using the options headLength and tailLength and the lengths traversal which will be explained in the Lengths and Gaps section.

A typical use case for an arrow is to connect two points, having an arrow pointing from one to the other. The function arrowBetween (and its cousin arrowBetween') connects two points.

> sPt = p2 (0.20, 0.20)
> ePt = p2 (2.85, 0.85)
>
> -- We use small blue and red circles to mark the start and end points.
> dot  = circle 0.02 # lw none
> sDot = dot # fc blue # moveTo sPt
> eDot = dot # fc red  # moveTo ePt
>
> example = ( sDot <> eDot <> arrowBetween' (with & headLength .~ veryLarge) sPt ePt)
>           # centerXY # pad 1.1

1. Create a diagram which contains a circle of radius 1 with an arrow connecting the points on the circumference at 45 degrees and 180 degrees.

# ArrowOpts

All of the arrow creation functions have a primed variant (e.g. arrowBetween and arrowBetween') which takes an additional opts parameter of type ArrowOpts. The opts record is the primary means of customizing the look of the arrow. It contains a substantial collection of options to control all of the aspects of an arrow. Here is the definition for reference:

> data ArrowOpts = ArrowOpts
>   , _arrowTail  :: ArrowHT
>   , _arrowShaft :: Trail R2
>   , _headGap    :: Measure R2
>   , _tailGap    :: Measure R2
>   , _headStyle  :: Style R2
>   , _headLength :: Measure R2
>   , _tailStyle  :: Style R2
>   , _tailLength :: Measure R2
>   , _shaftStyle :: Style R2
>   }

Don't worry if some of the field types in this record are not yet clear, we will walk through each field and occasionally point to the API reference for material that we don't cover in this tutorial.

## The head and tail shape

The arrowHead and arrowTail fields contain information needed to construct the head and tail of the arrow, the most important aspect being the shape. So, for example, if we set arrowHead=spike and arrowTail=quill,

> arrowBetween' (with & arrowHead .~ spike & arrowTail .~ quill
>                     & lengths  .~ veryLarge)
>   sPt ePt

then the arrow from the previous example looks like this:

The Arrowheads package exports a number of standard arrowheads including, tri, dart, spike, thorn, dart, lineHead, and noHead, with dart being the default. Also available are companion functions like arrowheadDart that allow finer control over the shape of a dart style head. For tails, in addition to quill are block, lineTail, and noTail. Again for more control are functions like, arrowtailQuill. Finally, any of the standard arrowheads can be used as tails by appending a single quote, so for example:

> arrowBetween' (with & arrowHead .~ thorn & arrowTail .~ thorn'
>                     & lengths  .~ veryLarge) sPt ePt

yields:

## The shaft

The shaft of an arrow can be any arbitrary Trail R2 in addition to a simple straight line. For example, an arc makes a perfectly good shaft. The length of the trail is irrelevant, as the arrow is scaled to connect the starting point and ending point regardless of the length of the shaft. Modifying our example with the following code will make the arrow shaft into an arc:

> shaft = arc (0 @@ turn) (1/2 @@ turn)
>
> example = ( sDot <> eDot
>          <> arrowBetween' (with & arrowHead .~ spike & arrowTail .~ spike'
>                                 & arrowShaft .~ shaft
>                                 & lengths .~ veryLarge) sPt ePt
>           # frame 0.25

Arrows with curved shafts don't always render the way our intuition may lead us to expect. One could reasonably expect that the arc in the above example would produce an arrow curving upwards, not the downwards-curving one we see. To understand what's going on, imagine that the arc is Located. Suppose the arc goes from the point $$(0,0)$$ to $$(-1,0)$$. This is indeed an upwards curving arc with origin at $$(0,0)$$. Now suppose we want to connect points $$(0,0)$$ and $$(1,0)$$. We attach the arrow head and tail and rotate the arrow about its origin at $$(0,0)$$ until the tip of the head is touching $$(1,0)$$. This rotation flips the arrow vertically.

In order to get the arrow to curve upwards we might initially think we could create the shaft reversing the order of the angles, using arc (1/2 @@ turn) 0, but this won't work either, as it creates a downwards curving arc from, say, $$(0,0)$$ to $$(1,0)$$ that does not need to be rotated. The only way to achieve the desired result of making the arrow pointing from $$(0,0)$$ to $$(1,0)$$ curve upwards is to reverse the trail:

> shaft = arc (0 @@ turn) (1/2 @@ turn) # reverseTrail

If an arrow shaft does not appear as you expect, then try using reverseTrail.

Here are some exercises to try.

Construct each of the following arrows pointing from $$(1,1)$$ to $$(3,3)$$ inside a square with side $$4$$.

1. A straight arrow with no head and a spike shaped tail.

2. An arrow with a $$45$$ degree arc for a shaft, triangles for both head and tail, curving downwards.

3. The same as above, only now make it curve upwards.

## Lengths and Gaps

The fields headLength and tailLength are for setting the length of the head and tail. The head length is measured from the tip of the head to the start of the joint connecting the head to the shaft. And the tail length in an analagous manner. They have type Measure R2 and the default is normal. headGap and tailGap options are fairly self explanatory: they leave space at the end or beginning of the arrow and are also type Measure R2. Take a look at their effect in the following example. The default gaps are none.

> sPt = p2 (0.20, 0.50)
> mPt = p2 (1.50, 0.50)
> ePt = p2 (2.80, 0.50)
>
> dot  = circle 0.02 # lw none
> sDot = dot # fc blue  # moveTo sPt
> mDot = dot # fc green # moveTo mPt
> eDot = dot # fc red   # moveTo ePt
>
>
> leftArrow  = arrowBetween' (with & arrowHead .~ dart & arrowTail .~ tri'
>                                  & headLength .~ large & tailLength .~ normal
>                                  & headGap .~ large) sPt mPt
> rightArrow = arrowBetween' (with & arrowHead .~ spike & arrowTail .~ dart'
>                                  & shaftStyle %~ lw ultraThick
>                                  & tailLength .~ veryLarge & headLength .~ huge
>                                  & tailGap .~ veryLarge) mPt ePt
>
> example = ( sDot <> mDot <> eDot <> leftArrow <> rightArrow)
>           # frame 0.25

Our use of the lens package allows us to create other lenses to modify ArrowOpts using the same syntax as the record field lenses. lengths is useful for setting the headLength and tailLength simultaneously and gaps can be used to simultaneously set the headGap / tailGap.

A useful pattern is to use lineTail together with lengths as in the following example:

> dia = (rect 5 2 # fc lavender # alignX (-1) # showOrigin # named "A")
>        === strutY 2 ===
>       (rect 5 2 # fc pink # alignX (-1) # showOrigin # named "B")
>
> ushaft = trailFromVertices (map p2 [(0, 0), (-0.5, 0), (-0.5, 1), (0, 1)])
>
> uconnect tl setWd =
>   connect' (with
>           & arrowShaft .~ ushaft
>           & arrowTail .~ tl
>           & setWd)
>
> example =
>   hcat' (with & sep .~ 1.5)
>   [ dia # uconnect noTail   (headLength .~ veryLarge) "B" "A"  -- looks bad
>   , dia # uconnect lineTail (lengths    .~ veryLarge) "B" "A"  -- looks good!
>   ]
>   # frame 0.25

## The style options

By default, arrows are drawn using the current line color (including the head and tail). In addition, the shaft styling is taken from the current line styling attributes. For example:

> example = mconcat
>   [ square 2
>   , arrowAt' (with & headLength .~ veryLarge) origin unitX
>     # lc blue # lw thick
>   ]
>   # dashingG [0.05, 0.05] 0

The colors (or more gnerally textues of the head, tail, and shaft may be individually overridden using headTexture, tailTexture, and shaftTexture in conjunction with the solid function. More generally, the styles are controlled using headStyle, tailStyle, and shaftStyle. For example:

> dashedArrow = arrowBetween' (with & arrowHead .~ dart & arrowTail .~ spike' & lengths .~ veryLarge
>                                   & headTexture .~ solid blue & tailTexture .~ solid orange
>                                   & shaftStyle %~ dashingG [0.04, 0.02] 0
>                                   . lw thick) sPt ePt
>

Note that when setting a style, one must generally use the %~ operator in order to apply something like dashingG [0.04, 0.02] 0 which is a function that changes the style.

By default, the ambient line color is used for the head, tail, and shaft of an arrow. However, when setting the styles individually, the fill color should be used for the head and tail, and line color for the shaft. This issue can be avoided entirely by using, for example, headStyle %~ fc blue to set the color instead of headStyle %~ fc blue.

# Placing an arrow at a point

Sometimes we prefer to specify a starting point and vector from which the arrow takes its magnitude and direction. The arrowAt' and arrowAt functions are useful in this regard. The example below demonstrates how we might create a vector field using the arrowAt' function.

> locs   = [(x, y) | x <- [0.1, 0.3 .. 3.25], y <- [0.1, 0.3 .. 3.25]]
>
> -- create a list of points where the vectors will be place.
> points = map p2 locs
>
> -- The function to use to create the vector field.
> vectorField (x, y) = r2 (sin (y + 1), sin (x + 1))
>
> arrows = map arrowAtPoint locs
>
> arrowAtPoint (x, y) = arrowAt' opts (p2 (x, y)) (sL *^ vf) # alignTL
>   where
>     vf   = vectorField (x, y)
>     m    = magnitude $vectorField (x, y) > > -- Head size is a function of the length of the vector > -- as are tail size and shaft length. > hs = 0.08 * m > sW = 0.015 * m > sL = 0.01 + 0.1 * m > opts = (with & arrowHead .~ tri & headLength .~ Global hs & shaftStyle %~ lwG sW) > > field = position$ zip points arrows
> example = ( field # translateY 0.05
>        <> ( square 3.5 # fc whitesmoke # lwG 0.02 # alignBL))
>         # scaleX 2

Try using the above code to plot some other interesting vector fields.

# Connecting diagrams with arrows

The workhorse of the Arrow package is the connect' function. connect' takes an opts record and the names of two diagrams, and places an arrow starting at the origin of the first diagram and ending at the origin of the second (unless gaps are specified).

> s  = square 2 # showOrigin # lw thick
> ds = (s # named "1") ||| strutX 3 ||| (s # named "2")
> t  = cubicSpline False (map p2 [(0, 0), (1, 0), (1, 0.2), (2, 0.2)])
>
> example = ds # connect' (with & arrowHead .~ dart & lengths .~ veryLarge
>                               & arrowTail .~ dart'
>                               & shaftStyle %~ lw thick & arrowShaft .~ t) "1" "2"

# Connecting points on the trace of diagrams

It is often convenient to be able to connect the points on the Trace of diagrams with arrows. The connectPerim' and connectOutside' functions are used for this purpose. We pass connectPerim two names and two angles. The angles are used to determine points on the traces of the two diagrams, determined by shooting a ray from the local origin of each diagram in the direction of the given angle. The generated arrow stretches between these two points. Note that if the names are the same then the arrow connects two points on the same diagram.

In the case of connectOutside The arrow lies on the line between the centers of the diagrams, but is drawn so that it stops at the boundaries of the diagrams, using traces to find the intersection points.

> connectOutside "diagram1" "diagram2"
> connectPerim "diagram" "diagram" (2/12 @@ turn) (4/12 @@ turn)

Here is an example of a finite state automata that accepts real numbers. The code is a bit longer than what we have seen so far, but still very straightforward.

> import Data.Maybe (fromMaybe)
>
> state = circle 1 # fc silver
> fState = circle 0.85 # fc lightblue <> state
>
> points = map p2 [ (0, 3), (3, 4), (6, 3), (6, 6.25), (9, 4), (12, 3)
>                 , (12, 6.25), (3, 0), (1.75, 1.75), (6, 1), (9, 0), (12.5, 0)]
>
> ds = [ (text "1" <> state)  # named "1"
>        , label "0-9" large
>        , (text "2" <> state)  # named "2"
>        , label "0-9" large
>        , label "." huge
>        , (text "3" <> fState) # named "3"
>        , label "0-9" large
>        , (text "4" <> state)  # named "4"
>        , label "." huge
>        , label "0-9" large
>        , (text "5" <> fState) # named "5"
>        , label "0-9" large]
>
> label txt size = text txt # fontSize size
>
> states = position (zip points ds)
>
> shaft = reverseTrail $arc (0 @@ turn) (1/6 @@ turn) > shaft' = reverseTrail$ arc (1/2 @@ turn) (0 @@ turn) # scaleX 0.33
> line = trailFromOffsets [unitX]
>
> arrowStyle1 = (with  & arrowHead  .~ spike & headLength .~ large
>                      & arrowShaft .~ shaft)
> arrowStyle2  = (with  & arrowHead  .~ spike
>                       & arrowShaft .~ shaft' & arrowTail .~ lineTail
>                       & tailTexture .~ solid black & lengths .~ large)
> arrowStyle3  = (with  & arrowHead  .~ spike  & headLength .~ large
>                       & arrowShaft .~ line)
>
> example = states # connectOutside' arrowStyle1 "1" "2"
>                  # connectOutside' arrowStyle3 "1" "4"
>                  # connectPerim' arrowStyle2 "2" "2"
>                     (4/12 @@ turn) (2/12 @@ turn)
>                  # connectOutside' arrowStyle1 "2" "3"
>                  # connectPerim' arrowStyle2 "3" "3"
>                     (4/12 @@ turn) (2/12 @@ turn)
>                  # connectOutside' arrowStyle1 "4" "5"
>                  # connectPerim' arrowStyle2 "5" "5"
>                     (1/12 @@ turn) (-1/12 @@ turn)

In the following exercise you can try connectPerim' for yourself.

Create a torus (donut) with $$16$$ curved arrows pointing from the outer ring to the inner ring at the same angle every 1/16 @@ turn.


text:
# What is the domain and range of y = tan(2x)?

Dec 16, 2017

Domain: $\left\{x | x \ne \frac{\pi}{4} + \frac{\pi}{2} k , k \in \mathbb{Z}\right\}$
Range: $y \in \mathbb{R}$

#### Explanation:

Let us first look at the graph of $y = \tan \left(2 x\right)$:
graph{tan(2x) [-8.41, 9.37, -3.74, 5.146]}
We can see that it has recurring vertical asymptotes, which means that the function is undefined at all these points.

To find the asymptotes, we will look at the following identity:
$\tan \left(\theta\right) = \sin \frac{\theta}{\cos} \left(\theta\right)$
$\tan \left(2 x\right) = \sin \frac{2 x}{\cos} \left(2 x\right)$
This equation tells us that the vertical asymptotes occur when $\cos \left(2 x\right) = 0$, and this happens when $x = \frac{\pi}{4} + \frac{\pi}{2} k$ where $k \in \mathbb{Z}$

Since the function is defined for all but those $x$ values, we just need to exclude them from our domain, so we have:
$\left\{x | x \ne \frac{\pi}{4} + \frac{\pi}{2} k , k \in \mathbb{Z}\right\}$

Next we want to look at the range, and we see on the graph that it goes from $- \infty$ to $\infty$ (since each "section" is bounded by two vertical asymptotes), and since the function is continuous on that interval, we know that the domain is all real numbers:
$\left\{y \in \mathbb{R}\right\}$


text:
# If the roots of 2x^2+4x-1=0 are a and b, find a^2+b^2?

Dec 11, 2016

${a}^{2} + {b}^{2} = 5$

#### Explanation:

Sum of roots in a qudratic equation $p {x}^{2} + q x + r = 0$ is $- \frac{q}{p}$ and product of roots is given by $\frac{r}{p}$.

If roots of $2 {x}^{2} + 4 x - 1 = 0$ are $a$ and $b$, we have

we have $\left(a + b\right) = - \frac{4}{2} = - 2$ and

$a b = - \frac{1}{2}$

Hence ${a}^{2} + {b}^{2} = {a}^{2} + 2 a b + {b}^{2} - 2 a b$

= ${\left(a + b\right)}^{2} - 2 a b$

= (-2)^2-2×(-1/2)

= $4 + 1$

= $5$


text:
# Geometry for Elementary School/The Side-Angle-Angle congruence theorem

 Geometry for Elementary School The Angle-Side-Angle congruence theorem The Side-Angle-Angle congruence theorem The Right angle-Hypotenuse-Side congruence theorem

In this chapter, we will discuss yet another congruence theorem, the Side-Angle-Angle congruence theorem, usually abbreviated as SAA.

## The Angle-Side-Angle congruence theorem

Given two triangles $\triangle ABC$ and $\triangle DEF$ such that their sides are equal, hence:

1. The angle $\angle BAC$ equals $\angle EDF$.
2. The angle $\angle ABC$ equals $\angle DEF$.
3. The side $\overline {BC}$ equals $\overline {EF}$.

Then the triangles are congruent and their other angles and sides are equal too. Note that the side must be the included side of the two angles.


text:
# [Update] CubeStation Update to UI 4.0

#### qwr

##### Member
The K'un limited edition sold out quickly so I expect these to sell too. Obviously these are targeted at collectors and not regular cubers.

#### Kedin drysdale

##### Member
GAN12 Maglev Limited Edition is coming soon! Any thoughts?

View attachment 17899

9th Nov 2021
Hello everyone! Thanks for your watch this thread. In this thread, welcome anyone to share their thoughts, suggestions and crits, but friendly and kind is needed. We're eager to see more and more people to join this thread, discuss or share their thoughts about GANcube.Each comment would be will be valued.
Thanks again!

12th May 2021
Dear fans, we have some GAN speed cube descriptions that need to be translated into the following languages (German/Italian/French/Swedish/Polish/Dutch/Spanish).
[email protected]
with the information below:
1. Your name, country, and how long have been cubing
4. Experience in translating (if you have)

We will offer some free cubes as a reward to you. Don't hesitate, we are waiting for you!

View attachment 15035
*Gan Timer, GAN 356 iCarry, CubeStation v3, GAN 330 Easter Egg(Find it on GAN Amazon!)
I have sent a emailed out to you

#### SH03L4C3

##### Member
I have sent a emailed out to you
Hi Guys! Thanks for all your information and emails. We will check and reply. Our translation quota is enough and we closed the application.

Thanks again!

We would email your guys as soon as possible.

#### EngiNerdBrian

If I was going to spend $100 on puzzles this ridiculously overpriced 3x3 is in the bottom of my list. There are so many other puzzles I’d rather have than this GAN at the$100 price point.

#### EngiNerdBrian

The same way people will pay \$1000 for a Dogic, a relatively unremarkable puzzle
Lol...and true! I won't make this another gan debate thread. On the plus side, the plastic color is pretty neat looking.

#### OreKehStrah

##### Member
I wish Gan would sell add-on kits to customize color schemes. Black op white is OO for example, in terms of contrast. And having the option to change shades of colors, replace colors, etc would be very cool

#### qwr

##### Member
According to speedcubeshop apparently there is "less than 50% left". I guess they do sell.
I'm pretty sure the GAN K'un also sold out quickly from preorders. So for SCS and GAN, there is basically no downside to releasing these. People who thought GAN was overpriced weren't going to get it anyway.


text:
Poster
Discovering Context Effects from Raw Choice Data
Arjun Seshadri · Alexander Peysakhovich · Johan Ugander

Thu Jun 13th 06:30 -- 09:00 PM @ Pacific Ballroom #234

Many applications in preference learning assume that decisions come from the maximization of a stable utility function. Yet a large experimental literature shows that individual choices and judgements can be affected by irrelevant'' aspects of the context in which they are made. An important class of such contexts is the composition of the choice set. In this work, our goal is to discover such choice set effects from raw choice data. We introduce an extension of the Multinomial Logit (MNL) model, called the context dependent random utility model (CDM), which allows for a particular class of choice set effects. We show that the CDM can be thought of as a second-order approximation to a general choice system, can be inferred optimally using maximum likelihood and, importantly, is easily interpretable. We apply the CDM to both real and simulated choice data to perform principled exploratory analyses for the presence of choice set effects.


text:
The Peirce quincuncial projection[1] is a conformal map projection developed by Charles Sanders Peirce in 1879. The projection has the distinctive property that it can be tiled ad infinitum on the plane, with edge-crossings being completely smooth except for four singular points per tile. The projection has seen use in digital photography for portraying 360° views.

en.m.wikipedia.org/wiki/Peirce

Non-concentration of the chromatic number of a random graph, arxiv.org/abs/1906.11808, via gilkalai.wordpress.com/2019/06

Shamir & Spencer '87 (doi.org/10.1007/BF02579208) and Alon & Krivelevich '97 (doi.org/10.1007/10.1007/BF0121) proved that random graphs $$G(n,p)$$ with $$p=n^{1/2-\epsilon}$$ have almost surely only two possible chromatic numbers. But now Annika Heckel has shown that dense random graphs have a significantly wider spread in colors.

I find fascinating how these two products differ:

x+iy

numbers x+εy

A nice context to think about the Laplace transform:

Eugene Khutoryansky — Convolution and Unit Impulse Response youtube.com/watch?v=acAw5WGtzu

it clearly adds to a more planar presentation of the material in that it elegantly exploits the third dimension to put the dual aspects in plain sight.

Eugene Khutoryansky has been producing quite a few of these for a large variety of concepts! Watch them all!

Oh, and if you haven't read what Mike Shulman has to say about it here:

golem.ph.utexas.edu/category/2

Les Éléments de l'Art Arabe, archive.org/details/LesElement

Lots of plates of pretty geometric girih patterns, from an 1879 book by Jules Bourgoin. Via a comment at metafilter.com/181967/geometry

ε² = 0

It makes sense to think of ε as a first approximation for infinitesimals: smaller than any non-infinitesimal, but still greater than zero.

You might also notice that Grassmann's exterior algebra works in a similar way.

en.wikipedia.org/wiki/Exterior

Grassmann's exterior algebra also appears as the wedge product in differential algebra. That smells like a kind of unification of the two interpretations above, but I don't know how to make that precise...

Recall that quarternions are like complex numbers on steroids. They have three imaginary units i, j, k each of which squares to minus one, just like the complex unit:

i² = -1

To get dual quarternions, take two quarternions A and B and think of one of them as carrying a new kind of symbol ε:

A+εB

ε also reacts in a funny way when squared:

ε² = 0

2/

Dual quarternions are an 8-dimensional algebra that can be used to represent not only rotation and scaling, but also translations in R³.

en.wikipedia.org/wiki/Dual_qua

Using mere quarternions for rotations in R³ is a well-known trick. But translations work differently, so we need a new kind of , octonions simply won't work here.

1/

How many years until General Direct Dialed telephony dies?

Discuss.

Archimedes came up with a number system that could count up to 10^(8*10^16), and after summarizing the history of measuring the size of our cosmos, Parallax Nick asks "what was he hoping to count with that number?"

The Planck Reckoner

One or two bugs aside, I really like Nick's style, and the format, too! Go and click through to his channel, and watch all of his series about water in the solar system!

@11011110 Things get particularly weird (and wonderful) when your fractional base is smaller than 1. You can see a problem about inserting things into a rotating queue that leads to these kinds of expansions in these slides:
homepages.gac.edu/~jsiehler/Sl

An excerpt from the parameter plane of this formula iterated in a loop (p = 2):

z := z^p + c
z := (|x| - i y)^p + c
z := (x - i |y|)^p + c
`

Apparently some people are only just discovering that AI is interdisciplinary. When I first got interested in it it was grouped in with philosophy and psychology.

req is a text snippet router: given a string, say from your X11 cut buffer, it will classify and extract information contents, and merge that with context information. You write rule files ("ports") in awk to match against this data and to generate a menu of available shell commands.

github.com/robert-figura/req

For @dredmorbius . Feel free to bug me about anything.

I'm indebted to @johncarlosbaez for his talk about the relation of G2 to the octonions, from which I learned all I know about G2. Find out more here:

math.ucr.edu/home/baez/ball/in

Thanks, John!

Also funny: since the big ball isn't really a ball, but a projective plane, that that also played a role in my construction of SO(3) above. No rotation group corresponds to RP² it somehow seems to sit between SO(2) and SO(3)!

Fun fact about G2: it's 5-dimensional, but the little ball has only two dimensions of infinitesimal freedom! You could get to any 5d point by navigating as if you were walking on a 2d surface! Orienting a ball by rolling it on the ground is similar...

This spinor rolling on a projective plane, where the latter has three times the spinor's radius, models the real valued lie algebra g2. However, this also works for complex values. This is what Cartan originally described.

So, let's solve the puzzle: Start at the center s of our, say, white hemiball. After a quarter turn we get to -s the center of the black hemiball. Now all directions point back at s! Any other quarter turn leads back!

Take another copy of SO(3) also looking like the inside of a ball, and glue that onto our original along their spherical boundaries. Leaving a ball turns you over, but reentering turns you upright again!

No matter how you cross Spin(3) you never get back to your starting point turned upside down. The twist is gone! This pair of hemiballs is called 3-sphere or S³. Psst, this object actually lives in ! Now you know a bit more about how that works!


text:
# A few questions about integrating AudioKinetic Wwise and Unity

I'm new to Wwise and to using it with Unity, and though I have gotten the integration to work, I'm still dealing with some loose ends and have a few questions: (I'm on Unity 4.3 as of now but I think it shouldn't make any difference)

1. The base path: The Wwise documentation implies you set this in the AkGlobalSoundEngineInitializer basePath public ivar, which is exposed to the editor. However, I found that this variable is not really used. Instead, the path is hardcoded to /Audio/GeneratedSoundBanks in AkBankPath. I had to modify both scripts to actually look in the path that I set in the editor property. What's the deal with this? Just sloppyness or am I missing something?
2. Also about paths: since I'm on Mac, I'm using Unity natively under OS X and in tadem, the Wwise authoring tool via VMWare and I share the OS X Unity project folder so I can generate the soundbanks into the assets folder. However, the authoring tool (downloaded the latest one for Windows) doesn't automatically generate any "platform-specific" subfolders for my wwise files. That is, again, the Unity integration scripts assume the path to be /Audio/GeneratedSoundBanks/<my-platform>/ which in my case would be Mac (I set the authoring tool to generate for Mac). The documentation says wwise will automatically generate the platform-specific folders but it just dumps all the stuff in GeneratedSoundBanks. Am I missing some setting? cause right now I just manually create the /Mac folder.
3. The C# methods AkSoundEngine.PostEvent and AkSoundEngine.LoadBank for instance, have a few overloads, including ones where I can refer to the soundbanks or events by their ID. However, if I try to use these, for instance:

where the int I got from the .h header, I get Ak_Fail. If I use the overloads that reference the objects by string name then it works. What gives?

4. Converting the ID header to C#: The integration comes with a C# script that seems to fork a process to call Python in turn to covert the C++ header into a C# script. This always fails unless I manually execute the Python script myself from outside Unity. Might be a permissions thing, but has anyone experienced this?
5. The Profiler: I set up the Unity player to run in the background and am using the "Profile" version of the plugin. However, when I start the Unity OS X standalone app, the profiler in VMWare does not see it. This I'm thinking might just be that I'm trying to see a running instance of the sound engine inside an OS X binary from a Windows virtual machine. But I'm just wondering if anyone has gotten the Windows profiler to see an OS X Unity binary.
6. Different versions of the integration plugin: It's not clear to me from the documentation whether I have to manually (or write a script to do it) remove the "Profile" version and install the "Release" version when I'm going to do a Release build or if I should install both version in Unity and it'll select the right one.

Thanks!

• It might be best to ask questions like this on the forum for the product. – MichaelHouse Nov 18 '13 at 21:53
• I did, but no one even looked at the question. If their site had the tumble weed badge I would have gotten it :/ – SaldaVonSchwartz Nov 19 '13 at 6:51

So I just ran into this issue myself and it seems that all that's missing is setting up your Environment Variables to recognize the python path so that python can be run from anywhere.

In case you or anyone else reading this doesn't know how to modify environment variables here's a step by step.


text:
# Assess whether differences in Brighter-Fatter implementations are contributing to the trace radii differences: LSST vs. HSC

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Story Points:
5
• Sprint:
DRP S17-4
• Team:
Data Release Production

#### Description

As noted in DM-6817 and highlighted/further explored in DM-9411, there is a trend of increasing difference in trace radii with increasing magnitude when directly comparing outputs from the HSC vs. LSST stacks. A likely culprit is slight differences in the implementations of the Brighter-Fatter corrections between the stacks. This ticket is to assess whether this is contributing to the trace radii differences.

#### Activity

Hide
Lauren MacArthur added a comment - - edited

The speculation in this ticket is officially confirmed. The difference in the implementations is largely in the computation of the second derivatives. The original HSC method tries to avoid edge effects by explicitly omiting the outer ring of pixels as follows:

 # Second derivative term diffOut20 = numpy.diff(outArray,2,0)[startY:endY, startX+1:endX-1] diffOut21 = numpy.diff(outArray,2,1)[startY+1:endY-1, startX:endX] second = tmpArray[startY+1:endY-1, startX+1:endX-1]*(diffOut20 + diffOut21)

The LSST approach was to use numpy.gradient and trust it to handle the edges elegantly:

 diffOut20 = numpy.gradient(gradOut[0]) diffOut21 = numpy.gradient(gradOut[1]) second = tmpArray[startY:endY, startX:endX]*(diffOut20[0] + diffOut21[1])

To test the hypothesis that this difference was causing the difference in trace radii of PSF model stars I ran the LSST stack using both versions (with all other settings being equal) and compared the trace radii between them:

Indeed, the above difference is causing the difference in trace radii.

To further confirm, the following is the same comparison but between and LSST stack run using the HSC second derivative algorithm vs the HSC stack run of DM-9028:

and they are in agreement.

This concludes this investigation, but it begs the question of how we should be computing the derivatives. This issue will be the subject of another ticket (see DM-9553), but for the time being, we must select one to use for consistent stack run comparisons. The following diagnostic plots show the difference between the source trace radii and the PSF model trace radii (at the position of the source) for stars used in the PSF modeling (calib_psfUsed=True):
LSST's implementation:

HSC's implementation:

It seems the HSC method is doing a slightly better job (there appears to be a mild upturn in the differences toward brighter magnitudes in the LSST version) , so this one will be adopted for another run of the HSC RC dataset with the LSST stack.

Show
Hide
Lauren MacArthur added a comment -

Bob Armstrong, would you mind having a look and seeing if you agree with my assessment?

Show
Lauren MacArthur added a comment - Bob Armstrong , would you mind having a look and seeing if you agree with my assessment?
Hide
Lauren MacArthur added a comment -

Ping Bob Armstrong. Your review of DM-9553 would indicate you do agree, but can you please confirm when you have a moment?

Show
Lauren MacArthur added a comment - Ping Bob Armstrong . Your review of DM-9553 would indicate you do agree, but can you please confirm when you have a moment?
Hide
Bob Armstrong added a comment -

Yes, I agree that the HSC version is doing better and that we should be using that for the time being.

Show
Bob Armstrong added a comment - Yes, I agree that the HSC version is doing better and that we should be using that for the time being.
Hide
Lauren MacArthur added a comment -

So...reviewed?!

Show
Lauren MacArthur added a comment - So...reviewed?!
Hide
Lauren MacArthur added a comment -

Thanks Bob Armstrong!

Show
Lauren MacArthur added a comment - Thanks Bob Armstrong !

#### People

Assignee:
Lauren MacArthur
Reporter:
Lauren MacArthur
Reviewers:
Bob Armstrong
Watchers:
Bob Armstrong, Lauren MacArthur


text:
# What is the historical reasoning for electron orbital names?

Electron orbitals are referred to as s, p, d and f. I have read that there was a Latinate basis for this, but never found anything more specific. (Obviously, the discovery of electron orbitals by Bohr et. al. post-dated the fall of the Roman Empire by nearly 1500 years, so I realize that any such naming convention, if ancient Greek or Latin, would have been inspirational rather than originally sourced.)


text:
NZ Level 4
Problems with patterns with rational numbers
Lesson

In Looking for Patterns, we discovered that if a sequence of numbers increase or decrease by a regular amount, we can describe this as a number pattern. So far, we've only looked at numbers that increase or decrease by a whole number. Now we are going to build on that knowledge and find patterns with fractions and decimals as well.

Let's start by watching a video.

## Summary

1. Decide whether the numbers are increasing or decreasing.
2. Work out how much they are increasing/ decreasing by each time.
3. Now you can write a rule to describe the pattern and to find the next number in the pattern (e.g. "Add $0.7$0.7 each time," or "Subtract $\frac{1}{3}$13 each time.")
4. Use the rule you found to work out the next number in the pattern.

#### Worked Examples

##### Question 1

Complete the pattern.

1.  $\frac{1}{10}$110 $\frac{2}{10}$210 $\frac{3}{10}$310 $\editable{}$ $\editable{}$ $\editable{}$

##### Question 2

Complete the pattern.

1.  $4.2$4.2 $4.0$4.0 $3.8$3.8 $\editable{}$ $\editable{}$ $\editable{}$

##### Question 3

Complete the pattern.

1.  $\frac{1}{10}$110 $\frac{2}{10}$210 $\frac{3}{10}$310 $\editable{}$ $\editable{}$ $\editable{}$
2. What is the rule for finding the next number in the pattern?

Subtract $\frac{1}{10}$110

A

Add $1$1

B

Add $\frac{1}{10}$110

C

Subtract $1$1

D

Subtract $\frac{1}{10}$110

A

Add $1$1

B

Add $\frac{1}{10}$110

C

Subtract $1$1

D

### Outcomes

#### NA4-2

Understand addition and subtraction of fractions, decimals, and integers

#### NA4-9

Use graphs, tables, and rules to describe linear relationships found in number and spatial patterns


text:
Sidebar

Part I
The limits of empiricism.

Part II
The gap

Part III
Causes and effects

Part IV
Causal intuitions

This is an old revision of the document!

Probabilistic vs. Causal inference

This post revisits the confounding phenomenon under the angle of probabilistic reasoning with conditional probabilities and Bayes' theorem. This analysis reveals what sets probabilistic and causal inference apart. It also shows how probabiistic models and causal models formulate assumptions of a fundamentally different nature.

Tip: Feel free to jump to the conclusion if you find this discussion too technical.

Treatments and outcomes

Suppose for instance that we have access to a large trove of medical reports describing the outcomes of applying medical treatment to patients displaying certain symptoms. In the following, we use variable $Y$ to denote observable outcomes such as “patient is considered cured after five days”; we use variable $X$ to denote the treatment selected by a doctor; and we use variable $Z$ to represent the known contextual information. Although we refer to $Z$ as the symptoms variable for simplicity, it really represents all the observed and recorded context of the treatment decision: patient symptoms, patient history, hospital history, place and time, or even environmental factors such as the pollution level.

We merely want to know which treatment $X$ works best for symptoms $Z$.

This question is natural but also ambiguous. Did we mean

• Which treatment $X$ has historically worked best for patients with specific symptoms $Z$, or
• Which treatment $X$ would work best for patients with specific symptoms $Z$?

Confounding exists because these two questions often have different answers.

Conditioning

To answer the first question, we merely need to go through our medical records and count the observed outcomes $Y$ for each symptom-treatment pair $(Z,X)$. If we assume that our records are independent samples from a joint probability distribution $P(Z,X,Y)$, this amounts to estimating the conditional probability distribution $P(Y|Z,X)$.

Since it is very unlikely that our trove of medical reports covers all possible combinations of symptoms $Z$ and treatments $X$ we may have no data to estimate $P(Y|Z,X)$ when $(Z,X)$ is one of these missing pairs. This is not a problem if our goal is merely to answer the first question because saying which treatments have historically worked best does not require us to know anything about treatments we never tried. In contrast, the second question is more demanding because the best treatment for symptoms $Z$ could possibly be a treatment that was never tried for such symptoms. This difference is only the tip of a much larger iceberg.

Interventions

Essentially the second question envisions an intervention to change the treatment selection policy. Instead of doing whatever the doctors were doing to select a treatment during the data collection period, we are considering an alternate treatment selection policy and we would like to know about its performance.

We can approach such an intervention by decomposing the joint distribution as $$\label{eq:xyz} P(Z,X,Y) = P(Z) \, P(X|Z) \, P(Y|Z,X)~.$$ This particular ordering of the variables is attractive because it obeys the arrow of time: first come the symptoms with distribution $P(Z)$, then comes the treatment selection with distribution $P(X|Z)$, and finally comes the treatment outcome with distribution $P(Y|X,Z)$.

Graphical representation[1] of the decomposition \eqref{eq:xyz}.
Each node in this graph represents one variable and receives arrows from all variables that condition the corresponding term in the decomposition.

We would like to know how our medical records would look like if we were to follow an alternate policy to select a treatment $X$ given symptoms $Z$. This calls for replacing the term $P(X|Z)$ in the decomposition \eqref{eq:xyz} by a new conditional distribution $\textcolor{red}{P^*(X|Z)}$ that represents the alternate treatment selection policy. $$\label{eq:xyz:interv} \textcolor{red}{P^*(Z,X,Y)} = P(Z) \, \textcolor{red}{P^*(X|Z)} \, P(Y|Z,X)~.$$

Does the new joint distribution $\textcolor{red}{P^*(Z,X,Y)}$ represents what one could observe if one were to implement the new treatment policy? Equivalently, do the conditional distributions $P(Z)$ and $P(Y|Z,X)$ remain invariant when one changes the treatment policy $P(X|Z)$.

Nontrivial assumption: Changing the treatment selection policy in decomposition \eqref{eq:xyz} leaves the terms $P(Z)$ and $P(Y|Z,X)$ invariant.

Such an assumption is not a part of our probabilistic model of the data, namely the assumption that the medical records were independently sampled from a joint distribution $P(Z,X,Y)$. To determine whether this assumption is correct or not, we must invoke pieces of knowledge that do not change the probabilistic model itself. These pieces of knowledge are often formulated in causal terms:

• The distribution of symptoms $P(Z)$ could be changed by causal factors beyond our control such as the appearance of new viral strains. We can avoid such difficulties by reformulating our question with a different tense : which treatment selection policy would have worked best if it had been applied to the cases described in our trove of medical records? This is called a counterfactual question because it pertains to something that did not happen and cannot happen anymore. Since this question it applies to past cases, the unobserved environmental factors can be assumed to remain identical. Meanwhile, answering this counterfactual question still provides useful knowledge.
• Since the symptoms are observed before the treatment selection, we can argue that the changing the treatment cannot change the symptoms. In the context of the counterfactual question, this means that their distribution $P(Z)$ is not affected by changes to the treatment selection policy $P(X|Z)$.
• The invariance of the conditional outcome distribution $P(Y|Z,X)$ is harder to justify. For instance, we may believe that the outcome $Y$ is a deterministic function of the observed symptoms $Z$, the selected treatments $X$, and, possibly, an independent roll of the dices. But what to conclude if we believe instead that the outcome could depend on symptoms that were not observed or not recorded in the medical records?

Unobserved variables

Probabilities are often used to represent processed that we cannot model completely. For instance, what happens when we roll the dices might depend on their initial configuration, the speed of our motion, the exact moment we release the dices, the temperature of the air, etc. Since we do not know these things, we simply say that each face of a dice is shown with equal chance.

We shall now change our model to include a new variable $U$ that represents additional information that was not recorded in the medical reports and therefore is no longer accessible. The exact nature of the information $U$ is not important at this point, except for the fact that it may impact which treatment was applied as well as its outcome. Such a variable $U$ is often called an unobserved variable because its value is unknown at the time of the analysis of the data.

Interventions in the presence of unobserved variables

The canonical decomposition then becomes $$\label{eq:xyzu} P(Z,U,X,Y) = P(Z) \, P(U|Z) \, P(X|Z,U) \, P(Y|X,Z,U) ~.$$

Canonical decomposition with an unobserved variable $U$.

We can then write the observed joint distribution $P(Z,X,Y)$ as \begin{align*} P(Z,X,Y) &= \sum_U P(Z,U,X,Y) \\ &= P(Z) \, \sum_U P(U|Z) \, P(X|U,Z) \, P(Y|X,U,Z)~. \end{align*}

The term $P(X|Z,U)$ that represents which treatments $X$ were applied now depends on both the symptoms $Z$ and the unobserved variable $U$. Proceeding as in the previous section, we replace this term by the conditional distribution $\textcolor{red}{P^*(X|Z)}$ that represents an alternate treatment policy. Note that the alternate policy cannot depend on $U$ because we do not know $U$. This gives the following expression for the alternate joint distribution $$\label{eq:xyzu:interv} \textcolor{red}{P^*(Z,X,Y)} = P(Z) \, \textcolor{red}{P^*(X|Z)} ~ \textcolor{blue}{\underbrace{\sum_U P(U|Z) \, P(Y|Z,X,U)}_{P^*(Y|Z,X)} }$$

New assumption: We now assume here that changing the treatment policy leaves the terms $P(Z)$, $P(U|Z)$, and $P(Y|Z,X,U)$ invariant.

The nature of this new assumption depends of course on the assumed nature of the unobserved variable $U$. For instance, if the variable $U$ is constant, our new assumption is equivalent to our previous assumption, namely the invariance of $P(Z)$ and $P(Y|Z,X)$. We now would like to know whether there are choices of $U$ that make this assumption different and lead to different conclusions.

This boils down to determining whether the blue term in \eqref{eq:xyzu:interv} $\textcolor{blue}{P^*(Y|Z,X) = \sum_U P(U|Z) P(Y|Z,X,U) } ~,$ is equal to $P(Y|Z,X) = \sum_U P(Y,U|Z,X) = \sum_U P(U|Z,X) P(Y|Z,X,U)$ If these terms were equal, expressions \eqref{eq:xyzu:interv} and \eqref{eq:xyz:interv} would be identical and therefore would lead to the same conclusions regardless of the nature of the unknown information $U$. Unfortunately the first expression has $P(U|Z)$ where the second expression has $P(U|Z,X)$.

These two conditional distribution are nevertheless equal in two important cases:

• when the unobserved variable $U$ has no impact on the outcomes,that is, when $P(Y|Z,X,U)=P(Y|Z,X)$, and
• when the unobserved variable $U$ had no impact on the selected treatments, that is, when $P(X|Z,U)=P(X|Z)$.

Proof: In the first case, we can indeed write $P^*(Y|Z,X) = \sum_U P(U|Z) P(Y|Z,X,U) = \big( \sum_U P(U|Z) \big) P(Y|Z,X) = P(Y|Z,X)~.$ For the second case, decomposing $P(X,U|Z)$ in two ways, $P(X,U|Z) = P(X|Z) P(U|Z,X) = P(U|Z) P(X|Z,U)~,$ shows that $P(X|Z,U){=}P(X|Z) \Longleftrightarrow P(U|Z){=}P(U|Z,X)$. Therefore $P^*(Y|Z,X){=}P(Y|Z,X)$. $~\blacksquare$

However, when the unobserved variable $U$ impacts both the treatments and the outcomes, the two conditional distributions $\textcolor{blue}{P^*(Y|Z,X)}$ and $P(Y|Z,X)$ are not equal. Since equations \eqref{eq:xyz:interv} and \eqref{eq:xyzu:interv} are different, it is very likely that these two approaches lead to different joint distributions $\textcolor{red}{P^*(Z,X,Y)}$ and therefore different conclusions about which treatment works best for which symptom. To make things worse, we cannot in general estimate $\textcolor{blue}{P^*(Y|Z,X)}$ as defined in equation \eqref{eq:xyzu:interv} because it depends on the unobserved variable $U$ which cannot be found in our medical records.

Conclusion

This example illustrates a fundamental difference between probabilistic and causal inference.

• Probabilistic inference: Knowing the joint distribution of the observed variables is enough to compute all the conditional distributions and therefore sufficient to answer any probabilistic inference question pertaining to the observed variablers.
• Causal inference: Knowing the joint distribution of the observed variables is generally not sufficient to answer a causal inference question pertaining to the observed variable: the outcome of interventions on the observed variables potentially depends on unobserved parts of the system.

This also implies that probabilistic and causal modeling are fundamentally different

• Probabilistic models make it easier to estimate the joint distribution of the observed variable. Making conditional independence assumptions or making parametric assumptions helps us to produce an estimate using only a limited number of examples.
• Causal models potentially make it possible to estimate the outcome of interventions. We simply cannot give an answer without making invariance assumptions or making independence assumption with respect to unobserved quantities.

[1] Judea Pearl, 1988. Probabilistic Reasoning in Intelligent Systems. Morgan-Kaufmann.
feuilleton/confounding-bayes.1552713721.txt.gz · Last modified: 2019/03/16 01:22 by leonb