text:
## Resources

We conclude each chapter with links to additional resources. In this introduction, these are pointers to the materials and software requirements of this book, as well as related resources on R and the tidyverse .

### This book and course

Resources related to this book and course at the University of Konstanz, 2022:

### Textbook

The textbook for this course is Data Science for Psychologists :

Some topics not covered here contain pointers to R for Data Science .

### Software and packages

Working through this book assumes an installation of three types of software programs:

1. An R engine: The R project for statistical computing is the origin of all things R. A current distribution of R (e.g., R version 4.2.0) for your machine can be downloaded from one if its mirrors.

2. An R interface: The RStudio IDE (by Posit) provides an integrated development environment (IDE) for R.6

3. Additional tools: The R packages of the tidyverse and ds4psy .

### Language references

As the R language, every R package, and every R function, are extensively documented, the best strategy to answer a question is to consult an official source of reference (rather than doing an internet search). While the official references of the R language can initially be intimidating, they are the most authoritative and often the fastest way of finding answers:

• Most questions concerning details of R can be settled by reading the R Language Definition that is available from the Help page of any R system.

• The details of particular functions are best resolved by studying the function’s documentation. For a function named foo, its documentation can be shown by evaluating ?foo. Even when some of the documentation may be hard to understand, working through the Examples is usually helpful.

• For a general collection of materials and scripts, see The R Manuals and other documentation. Corresponding links are provided on the main Help page of any R system.

### The RStudio IDE

The distinctions between R, R packages, and RStudio are somewhat confusing at first and will be explained in more detail in Chapter 1: Basic R concepts and commands (see Section 1.1.3). At this point, it is good to know that we can interact with R and manage our R packages within the RStudio IDE. Given the large variety of functions and levels, this interface is divided into many sub-windows that can be arranged and expanded in various ways. To get started, we only need to distinguish between the main Editor window (typically located on the top left), the Console (for entering R commands), and a few auxiliary windows that may display outputs (e.g., a Viewer for showing visualizations) and provide information on our current Environment or the Packages available on our computer. A useful window is Help: Although its main page provides mostly links to online materials, any R package contains detailed documentations on and examples of its functions that can be browsed in this window.

Figure 0.4 shows the Posit cheatsheets on the RStudio IDE and illustrates that there are dozens of other functions available. As you get more experienced, you will discover lots of nifty features and shortcuts. Especially foldable sections and keyboard shortcuts (see Alt + Shift + K for an overview) can make your life in R a lot easier. But don’t let the abundance of options overwhelm you — I have yet to meet a person who needs or uses all of them.

A useful feature of the RStudio IDE is that collections of files can be combined into projects. For instance, it makes sense to store everything related to this course in a dedicated directory on your hard drive (e.g., in a folder “ds4psy”) and create an RStudio project (also named ds4psy) that uses this directory as its root. An immediate benefit of using projects is that your entire workflow gets more organized.7

### R Markdown

R Markdown allows weaving text and code into reproducible research documents. For quick instructions on combining text and code, see Appendix F, or read the more detailed introduction of Chapter 27: R Markdown of the r4ds textbook. Alternatively, just start with one of the following templates:

• minimal template: rmd_template_s [in .Rmd | .html format]

• medium template: rmd_template_m [in .Rmd | .html format]

• explicit explanations: Rmarkdown_basics [in .Rmd | .html format]

A typical R Markdown document consists of three distinct parts:

1. A header for setting global document options;
2. Text that may contain headings, paragraphs, and itemized lists; and
3. Code chunks that contain and evaluate R code.

When using R Markdown (typically saved as with the file extension .Rmd), you can generate various output formats to show and transfer your work. I recommend generating output documents in HTML format (i.e., .html files), as they can easily be exchanged and shown on most devices and platforms.

Fortunately, the range of commands required to benefit from R Markdown is very limited. For instance, the commands in the help file Help > Markdown Quick Reference of RStudio provide a good start for creating beautiful and functional documents. Beyond these basics, the R Markdown Cheatsheet — also available in RStudio by selecting Help > Cheatsheets > R Markdown Cheat Sheet — provides a more comprehensive overview of R Markdown functionality and commands:

### Other books

This book and course were originally based on R for Data Science . The contents of this book are more general and more tidyverse-centric, but still a classic reference:

• Wickham, H., & Grolemund, G. (2017). R for data science: Import, tidy, transform, visualize, and model data. Sebastopol, Canada: O’Reilly Media, Inc. [Available at http://r4ds.had.co.nz.]

The ebook R for data science: Exercise solutions (by Jeffrey B. Arnold) provides exercise solutions to the exercises in r4ds.

There are many other excellent books (and even more fragmentary and bad books) on data science in R for various audiences. Here are some recommendations for finding additional texts and courses on learning data science or statistics with R:

• Bookdown.org is a major catalyst for data science in R, as it provides many great books on various topics at no charge. The archive page contains books on an even wider selection of topics. Due to the grass-roots nature of the site, many books are unfinished and of low quality. However, there are also many excellent ones. Some easy recommendations include:

### Statistics with R

R does many things beyond statistics. But as R was designed as a programming language for statistics, many textbooks approach R from this angle. Available examples include:

### Web sites and blogs

Online information on R is abundant, but can be hard to navigate. Useful starting points include:

• Intro2R provides a gentle 3-day introduction to R.

• Quick-R (by Robert Kabacoff) is a popular website on R programming that also provides many pointers for using R in statistics.

• R-bloggers collects blog posts on R.

• The Simply statistics blog (by Rafa Irizarry, Roger Peng, and Jeff Leek) provides insightful and inspiring articles on many data science topics.

• The Win vector blog (by John Mount and Nina Zumel) provides noteworthy observations on particular problems and data science in general.

• The Learning Machines blog (by Holger K. von Jouanne-Diedrich) contains many readworthy articles on using R for modeling and machine learning.

• Towards data science provides background articles on current data science issues.

### Educational resources

Other R courses and exercises include:

### Miscellaneous

Other helpful links that do not fit into the above categories include:

[index.Rmd updated on 2023-01-30 18:15:23 by hn.]

### References

Allaire, J. J., Xie, Y., McPherson, J., Luraschi, J., Ushey, K., Atkins, A., … Iannone, R. (2022). rmarkdown: Dynamic documents for R. Retrieved from https://CRAN.R-project.org/package=rmarkdown
Neth, H. (2022). ds4psy: Data science for psychologists. https://doi.org/10.5281/zenodo.7229812
R Core Team. (2022). R base: A language and environment for statistical computing. Retrieved from https://www.R-project.org
Wickham, H. (2014a). Advanced R (1st ed.). Retrieved from http://adv-r.had.co.nz/
Wickham, H. (2015). R packages: Organize, test, document, and share your code. Retrieved from http://adv-r.had.co.nz/
Wickham, H. (2019a). Advanced R (2nd ed.). Retrieved from https://adv-r.hadley.nz/
Wickham, H. (2019c). tidyverse: Easily install and load the ’tidyverse’. Retrieved from https://CRAN.R-project.org/package=tidyverse
Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L. D., François, R., … Yutani, H. (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686. https://doi.org/10.21105/joss.01686
Wickham, H., & Grolemund, G. (2017). R for data science: Import, tidy, transform, visualize, and model data. Retrieved from http://r4ds.had.co.nz
Xie, Y. (2022b). knitr: A general-purpose package for dynamic report generation in r. Retrieved from https://yihui.org/knitr/

1. Installing RStudio typically provides many additional R packages. Two packages we will use extensively are knitr and rmarkdown .↩

2. See the introductory chapters of R for Data Science for short, but helpful instructions on organizing your workflow with RStudio — especially the even-numbered chapters basics (Chapter 4), scripts (Chapter 6), and projects (Chapter 8).↩

3. Disclaimer: When first starting to teach this course, I inherited its materials from Nathaniel. See Rpository.com/learnR/ for a course with corresponding exercises and solutions.↩


text:
Question

# What does polygon mean in Maths?

Open in App
Solution

## Meaning of Polygon:Polygon: A polygon is a two-dimensional closed figure that is obtained by joining three or more straight lines. The joining straight lines are known as the sides of the polygon. A polygon has three or more vertices, angles, and sides. The point of the meeting of the two line segment is known as the vertex of the polygon.A polygon has an equal number of vertices as the number of sides. The line segment that joins the two non-consecutive sides of the vertex is known as the diagonal.Different Polygons on the basis of the number of sides are:Three sides - TriangleFour sides - QuadrilateralFive sides- PentagonSix sides- HexagonSeven sides - HeptagonEight sides- Octagon and so on Thus, a polygon is a two-dimensional closed figure that is obtained by joining the three or more straight lines.

Suggest Corrections
0

format: plain


text:
# Magnetic dipole applet¶

## Purpose¶

The objective is to learn about the magnetic field observed at the ground’s surface, caused by a small buried dipolar magnet. In geophysics, this simulates the observed anomaly over a buried susceptible sphere that is magnetized by the Earth’s magnetic field. By clicking below binder badge, you can run this app!

## Background summary¶

• The link shows the earth’s field that is the result of a large magnet at the center.
• At any point on the earth the magnetic field is characterized by $$|B_0|$$, $$I$$, $$D$$.
• A magnetizable body (with susceptibility kappa), located anywhere on the earth, becomes magnetized. It’s field is like that of a magnetic dipole oriented in the direction of the earth’s field at that location.
$\mathbf{B} = \frac{\mu_0}{4\pi}\Big(\frac{3\mathbf{r}(\mathbf{m}\cdot \mathbf{r})}{r^5}-\frac{\mathbf{m}}{r^3}\Big)$
• The strength of the magnet is $$\mathbf{m}=\kappa\mathbf{H_0}$$ Volume
• The plots show various data: Bt is the projection of the anomalous field onto the direction of the earth’s field
• Bx,By,Bz are projections in the x (northing), y (easting) and z (vertically down) directions
• Bg: is a vertical gradient
• For the app, the observation is 1 meter above the earth’s surface. The depth relates to how far beneath the surface the dipole is situated. A depth of 10 means the dipole is 11m below the sensor.

## Learning with the Magnetic Dipole Applet¶

For many of the questions that follow you should use pencil and paper to draw field lines so that you can sketch projections of the field onto various directions. Do that first and then click on the profile button.

### Bodies at the pole: Earth’s field is vertical¶

• What is the inclination required to simulate a field that is vertically downward?

• Think what the data should like like in plan view. Before you click buttons, Sketch on a piece of paper what you are anticipating for Bt, Bx, By and Bz

• How does Bt compare with Bz? Why?

• Why is Bx negative towards the north but positive towards the south?

• Why does By look like a rotated version of Bx?

• What happens when you change the declination of the inducing field? Why?

• From the default settings, with depth=10 m, try to estimate the depth using

• half width of the Bt anomaly estimated from the color map
• the profile provided at the bottom.
• How do these compare with the value provided by the app when you click half-width?
• Change the “depth” to be 1m.

• Attempt to carry out the same depth of burial analysis
• What do you need to alter to obtain a well-sampled anomaly and good estimates of the depth?

### Bodies at the equator: Earth’s field is horizontal¶

Suppose I=0 (equivalent to having an object buried at the equator.

• What is the inclination and declination required to simulate a field that is horizontal and pointing north?

• Think what the data should like in plan view. Before you click buttons, Sketch on a piece of paper what you are anticipating for

• Bt, Bx, By and Bz
• Bt looks like one of the components, {Bx, By, Bz}. Which one? Why?

• Now change the declination to D=90.

• If you are facing north, which way is the earth’s field pointing? To your right, or to your left?

• Why is the Bt magnetic anomaly negative on the positive east side.

• The By anomaly is interesting.

• What is the name for that type of pattern?
• Usually, if you collect data along two perpendicular lines directly over the top of the object you are looking for, you will see signal from the body. Why do we not see anything in this example?

## Learning with the Monopole window of the applet¶

In reality the isolation of a single magnetic charge (monopole) is not possible. In practise however it can be emulated by placing a magnetizable cylinder in the direction of the Earth’s field. One end of the cylinder will have a negative charge, the other end will have a positive charge. The app allows you to experiment with these situations.

For almost all questions that follow you should use pencil and paper to draw field lines so that you can sketch projections of the field onto various directions. Do that first and then click on the profile button. Many of the questions are similar to what you did with a dipole but the fact that we now have a monopole changes many of the diagrams.

### A vertical pipe in a vertical field¶

• What values of I and D will you use to conduct this simulation?

• Think what the data should like in plan view. Before you click buttons, sketch on paper what you are anticipating for:

• Bt, Bx, By and Bz
• How does Bt compare with Bz? Why?

• Why is Bx negative towards the north but positive towards the south?

• Why does By look like a rotated version of Bx?

• From the default settings, with depth=10 m, try to estimate the depth using halfwidths estimated by different techniques. The relationship between halfwidth and depth for a monopole can be found in the GPG (link);

• half width of the Bt anomaly estimated from the color map
• the profile provided at the bottom.
• How do these compare with the value provided by the app when you click half-width?
• Change the “depth” to be 1m.

• Attempt to carry out the same depth of burial analysis
• What do you need to alter to obtain a well-sampled anomaly and good estimates of the depth?

### A horizontal pipe at the equator¶

• What values of I and D will you use to conduct this simulation?
• Sketch a plan view of the fields {Bt, Bx, By and Bz} and compare with the maps generated by the app
• Bt looks like one of the components, {Bx, By, Bz}. Which one? Why?


text:
• Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

We're also offering banner ads on our site from just \$5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

### #ActualKing Mir

Posted 11 February 2013 - 09:07 PM

Rather than using #define to define constants it's better to just make constants:

const size_t SIZE = 10;
This gives you type control and avoids macro expansion problems like the one you encountered.

Using #define is almost the same as using your a text editor's 'find-and-replace' function. There are some cases where it's useful, but usually it causes more problems than it solves.

Actually, I don't think this is true in C. I couldn't get this to work:
const int N = 10;

struct S {
int i[N];
};

### #1King Mir

Posted 11 February 2013 - 08:57 PM

Rather than using #define to define constants it's better to just make constants:

const size_t SIZE = 10;
This gives you type control and avoids macro expansion problems like the one you encountered.

Using #define is almost the same as using your a text editor's 'find-and-replace' function. There are some cases where it's useful, but usually it causes more problems than it solves.

Actually, I don't think this is true in C. I couldn't get this to work:
const int N = 10;

struct S {
int i[N];
};


text:
# Confusing word problem

#### helpmeddddd

NO POST, As was Unreadable and a fix couldn't be established. Sorry for the inconveni

NO POST, As was Unreadable and a fix couldn't be established. Sorry for the inconvenience.

A band, The committee members of a local operatic and dramatic society organize a one-day music festival. It is held on two stages. The committee is trying to determine how many band acts (comprising two or more people) and how many solo acts (only one person) they will be able to hire for the day with an estimated $120 000 in total available to pay the acts. They want to have 30 acts (utilising the two stages) over the 24-hour period. I know this activity requires you to use systems of equation. And they want me to model the information provided about the fees paid to performers and to provide advice to the organizers on how many band acts and how many solo acts they should I think it;s also a good idea to relate the findings to the context. â€“ b Â±âˆšb2 â€“ 4ac 2a logarithms If y = bx then x = logby logb (xn) = n logbx If y = ex then x = logey (=1n y) Use Resource 1 to provide the organisers with the following information: 1. The change in the number of band acts in 2017 compared to 2016. 2. The fee they should offer to a band act in 2018 if: a. there are 30 acts in total b. all solo acts in will be offered a fee of$2 625 c. the total budget for acts is $120 000. Resource 1: resource 1 There are two different acts â€“ a solo act and a band act. This is information from the previous two years (2016 and 2017) and the plan, so far, for 2018. 2016 â€¢ The number of acts was 22. â€¢ The relationship between the number of solo acts and band acts can be modelled by x2 + y = 402 where x is the number of solo acts and y represents the number of band acts. 2017 valley sounds â€¢ The amount to hire a solo act was$2 500 and the amount to hire a band act was $5 500 â€¢ The relationship between the number of solo acts and band acts can be modelled by xy = 50 + 3x where x is the number of solo acts and y represents the number of band acts. â€¢ The total cost of the acts was$90 000. 2018.

â€¢ The fee for a solo act is planned to be $2 625 and the fee for a band act has not yet been decided upon. â€¢ The relationship between the number of solo acts and band acts can be modelled by 133x + 400y2 = 59 994 where x is the number of solo acts and y represents the number of band acts. â€¢ The committee wants to have 30 acts. â€¢ The total budget for hire of acts is$120 000.

Where should I start all the words have slightly confused me??

Last edited:

#### romsek

Math Team
pls repost this with the latex fixed if you want help

1 person

#### helpmeddddd

@romsek Why does my post do that?

#### Attachments

• 18 KB Views: 4

#### Otis

â€¦ Where should I start all the words have slightly confused me??
Harpazo, that statement is a direct quote from a request for help at another site.

Are you pretending to be that other student? Or, perhaps, you and amathproblemthatneedsolve are the same person? (The submission at that other site was also bungled.)

Regardless, tutoring has been provided in the source thread you copied from. Did you try the suggestions? If not, then why are you still reposting exercises? Is it because you still think math forums need you to repost stuff for the benefit of other students?

I don't understand what you're doing here, either as harpazo, helpmeddddd or the math instructor NinjaX3. I can say, however, that it would be better for you to simply be honest.

:unsure:

1 person

#### topsquark

Math Team
@romsek Why does my post do that?

Similar threads


text:
# Math Help - Circular Permutation??

1. ## Circular Permutation??

if there are 7 boys and 5 girls, how many circular arrangements are possible if the ladies do not sit adjacent to each other.??

2. Seat the boys at the table.
That can be done in $6!$ ways. WHY?
That creates seven places to place five chairs.
So what do you think the answer is?

3. Originally Posted by Plato
Seat the boys at the table.
That can be done in $6!$ ways. WHY?
That creates seven places to place five chairs.
So what do you think the answer is?
i think:-

=6!*p(7,5)
=6!*7!/(7-5)!

???

Tell us what those numbers mean!

5. Originally Posted by Plato

Tell us what those numbers mean!
boys ways;-(7-1)=6!
now there are 5 girls and 7 seats(in b/w boys) so there are P(7,5) number of ways, the girls can sit.
p(7,5)=7!/(7-5)!

i.e, total no. of ways= 6!*p(7,5)
= 6!*7!/(7-5)!
= 1814400 (but this ans is wrong).
ans is = 252

6. Originally Posted by Plato
You need to contact your educational authority.
That is incompetent!
ans=252 is in my book.
what should i do if i m doing any thing wrong with girls ways???
and what should be the ans.??

7. Is it more than a coincidence that $\frac{15120}{60} = 252$?

Maybe the author just miscalculated and divided by 60 somehow

"Sorry guys, I'll fix that in Dinner Party Combinatorics V2.0"


text:
# Differential Geometry, easy question, weird hint making me doubt myself

## Homework Equations

From my notes: $$(\psi_{*}v)_{k}(x)=\sum_{i=1}^{n}v_{i}(x)\frac{{{{{\partial}}}}{\psi_{k}(x)}}{{x_{i}}}$$

## The Attempt at a Solution

Okay so i) is fine (ignoring the typo in the question) but I'm a bit confused about ii)

I don't see any need to bore people with the details but I simply computed $(\psi_{*}v)(x)$ and then did the same for $w$ from the definition and got exactly what I wanted. My question is, is there something I've missed i.e. is there a good reason for that hint to be there? My problem is that if it's as easy as it looks, then I don't see why he would feel the need to give us a hint and then I don't see how using the hint would help get me the wanted answer.

Bear in mind this is assessed to vagueness is wanted.

Last edited:


text:
How do you simplify 3 sqrt (2) + 5 sqrt(2)?

Mar 20, 2016

A different approach!

$8 \sqrt{2} \text{ } \to$ as an $\underline{\text{exact}}$ answer

11.314 to 3decimal places as an $\underline{\text{approximate}}$ value

Explanation:

Compare to :$\text{ } 3 x + 5 x = 8 x$

Suppose that instead of $x$ we had $\sqrt{2}$

Just because it is a square root makes no difference. You are combining 3 of them with 5 of them

so $\text{ } 3 \sqrt{2} + 5 \sqrt{2} = 8 \sqrt{2}$
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Another way!

Common factor is $\sqrt{2}$

color(brown)(3sqrt(2)+5sqrt(2)) =color(blue)(sqrt(2)(3+5)
$= \sqrt{2} \times 8 = 8 \sqrt{2}$


text:
# Confounding

### Confounding

• Confounders: variables that affect both the treatment and the outcome

• If we assign treatment based on a coin flip, since the coin flip doesn’t affect the outcome, it’s not a confounder

• If older people are at higher risk of heart disease (the outcome) and are more likely to receive the treatment, then age is a confounder

• To control for confounders, we need to

1. Identify a set of variables $$X$$ that will make the ignorability assumption hold
• Causal graphs will help answer this question
1. Use statistical methods to control for these variables and estimate causal effects

# Causal Graphs

### Overview of graphical models

• Encode assumption about relationship among variables

• Tells use which variables are independent, dependent, conditionally independent, etc

## Terminologies of Directed Acyclic Graphs (DAGs)

### Terminology of graphs

• Directed graph: shows that $$A$$ affects $$Y$$

• Undirected graph: $$A$$ and $$Y$$ are associated with each other

• Nodes or vertices: $$A$$ and $$Y$$

• We can think of them as variables
• Edge: the link between $$A$$ and $$Y$$

• Directed graph: all edges are directed

• Adjacent variables: if connected by an edge

### Paths

• A path is a way to get from one vertex to another, traveling along edges

• There are 2 paths from $$W$$ to $$B$$:
• $$W \rightarrow Z \rightarrow B$$
• $$W \rightarrow Z \rightarrow A \rightarrow B$$

### Directed Acyclic Graphs (DAGs)

• No undirected paths

• No cycles

• This is a DAG

### More terminology

• $$A$$ is $$Z$$’s parent
• $$D$$ has two parents, $$B$$ and $$Z$$
• $$B$$ is a child of $$Z$$
• $$D$$ is a descendant of $$A$$
• $$Z$$ is a ancestor of $$D$$

## Relationship between DAGs and probability distributions

### DAG example 1

• C is independent of all variables $P(C\mid A, B, D) = P(C)$

• $$B$$ and $$C, D$$ are independent, conditional on $$A$$ $P(B\mid A, C, D) = P(B\mid A) \Longleftrightarrow B \perp C, D \mid A$

• $$B$$ and $$D$$ are marginally dependent $P(B\mid D) \neq P(B)$

### DAG example 2

• $$A$$ and $$B$$ are independent, conditional on $$C$$ and $$D$$ $P(A\mid B, C, D) = P(A\mid C, D) \Longleftrightarrow A \perp B \mid C, D$

• $$C$$ and $$D$$ are independent, conditional on $$A$$ and $$B$$ $P(D\mid A, B, C) = P(D\mid A, B) \Longleftrightarrow D \perp C \mid A, B$

### Decomposition of joint distributions

1. Start with roots (nodes with no parents)

2. Proceed down the descendant line, always conditioning on parents

• $$P(A, B, C, D) = P(C)P(D)P(A\mid D)P(B\mid A)$$

• $$P(A, B, C, D) = P(D)P(A\mid D)P(B\mid D)P(C\mid A, B)$$

### Compatibility between DAGs and distributions

• In the above examples, the DAGs admit the probability factorizations. Hence, the probability function and the DAG are compatible

• DAGs that are compatible with a particular probability function are not necessarily unique

• Example 1:

• Example 2:

• In both of the above examples, $$A$$ and $$B$$ are dependent, i.e., $$P(A, B) \neq P(A) P(B)$$

## Types of paths, blocking, and colliders

### Types of paths

• Forks

• Chains

• Inverted forks

### When do paths induce associations?

• If nodes $$A$$ and $$B$$ are on the ends of a path, then they are associated (via this path), if

• Some information flows to both of them (aka Fork), or
• Information from one makes it to the other (aka Chain)
• Example: information flows from $$E$$ to $$A$$ and $$B$$

• Example: information from $$A$$ makes it to $$B$$

### Paths that do not induce association

• Information from $$A$$ and $$B$$ collide at $$G$$

• $$G$$ is a collider

• $$A$$ and $$B$$ both affect $$G$$:

• Information does not flow from $$G$$ to either $$A$$ or $$B$$
• So $$A$$ and $$B$$ are independent (if this is the only path between them)
• If there is a collider anywhere on the path from $$A$$ to $$B$$, then no association between $$A$$ and $$B$$ comes from this path

### Blocking on a chain

• Paths can be blocked by conditioning on nodes in the path

• In the graph below, $$G$$ is a node in the middle of a chain. If we condition on $$G$$, then we block the path from $$A$$ to $$B$$

• For example, $$A$$ is the temperature, $$G$$ is whether sidewalks are icy, and $$B$$ is whether someone falls
• $$A$$ and $$B$$ are associated marginally
• But if we conditional on the sidewalk condition $$G$$, then $$A$$ and $$B$$ are independent

### Blocking on a fork

• Associations on a fork can also be blocked

• In the following fork, if we condition on $$G$$, then the path from $$A$$ to $$B$$ is block

### No need to to block a collider

• The opposite situation occurs if a conllider is blocked

• In the following inverted fork

• Originally $$A$$ and $$B$$ are not associated, since information collides at $$G$$
• But if we condition on $$G$$, then $$A$$ and $$B$$ become associated
• Example: $$A$$ and $$B$$ are the states of two on/off switches, and $$G$$ is whether the lightbulb is lit up.

• The two switches $$A$$ and $$B$$ are determined by two independent coin flips

• $$G$$ is lit up only if both $$A$$ and $$B$$ are in the on state

• Conditional on $$G$$, the two switches are not independent: if $$G$$ is off, then $$A$$ must be off if $$B$$ is on

## d-separation

### d-separation

• A path is d-separated by a set of nodes $$C$$ if

• It contains a chain ($$D\rightarrow E \rightarrow F$$) and the middle part is in $$C$$, or

• It contains a fork ($$D\leftarrow E \rightarrow F$$) and the middle part is in $$C$$, or

• It contains an inverted fork ($$D\rightarrow E \leftarrow F$$), and the middle part is not in $$C$$, nor are any descendants of it

• Two nodes, $$A$$ and $$B$$, are d-separated by a set of nodes $$C$$ if it blocks every path from $$A$$ to $$B$$. Thus $A\perp B \mid C$

• Recall the ignorability assumption $Y^0, Y^1 \perp A \mid X$

### Confounders on paths

• A simple DAG: $$X$$ is a confounder between the relationship between treatment $$A$$ and outcome $$Y$$

• A slightly more complicated graph

• $$V$$ affects $$A$$ directly
• $$V$$ affects $$Y$$ indirectly, through $$W$$
• Thus, $$V$$ is a confounder

## Frontdoor and backdoor paths

### Frontdoor paths

• A frontdoor path from $$A$$ to $$Y$$ is one that begins with an arrow emanating out of $$A$$

• We do not worry about frontdoor paths, because they capture effects of treatment

• Example: $$A\rightarrow Y$$ is a frontdoor path from $$A$$ to $$Y$$

• Example: $$A\rightarrow Z \rightarrow Y$$ is a frontdoor path from $$A$$ to $$Y$$

### Do not block nodes on the frontdoor path

• If we are interested in the causal effect of $$A$$ on $$Y$$, we should not control for (aka block) $$Z$$

• This is because controlling for $$Z$$ would be controlling for an affect of treatment

• Causal mediation analysis involves understanding frontdoor paths from $$A$$ and $$Y$$

### Backdoor paths

• Backdoor paths from treatment $$A$$ to outcome $$Y$$ are paths from $$A$$ to $$Y$$ that travels through arrows going into $$A$$

• Here, $$A \leftarrow X \rightarrow Y$$ is a backdoor path from $$A$$ to $$Y$$

• Backdoor paths confound the relationship between $$A$$ and $$Y$$, so they need to be blocked!

• To sufficiently control for confounding, we must identify a set of variables that block all backdoor paths from treatment to outcome

• Recall the ignorability: if $$X$$ is this set of variables, then $$Y^0, Y^1 \perp A \mid X$$

### Criteria

• Next we will discuss two criteria to identify sets of variables that are sufficient to control for confounding

• Backdoor path criterion: if the graph is known
• Disjunctive cause criterion: if the graph is not known

## Backdoor path criterion

### Backdoor path criterion

• Backdoor path criterion: a set of variables $$X$$ is sufficient to control for confounding if

• It blocks all backdoor paths from treatment to the outcome, and
• It does not include any descendants of treatment
• Note: the solution $$X$$ is not necessarily unique

### Backdoor path criterion: a simple example

• There is one backdoor path from $$A$$ to $$Y$$

• It is not blocked by a collider
• Sets of variables that are sufficient to control for confounding:

• $$\{V\}$$, or
• $$\{W\}$$, or
• $$\{V, W\}$$

### Backdoor path criterion: a collider example

• There is one backdoor path from $$A$$ to $$Y$$

• It is blocked by a collider $$M$$, so there is no confounding
• If we condition on $$M$$, then it open a path between $$V$$ and $$W$$

• Sets of variables that are sufficient to control for confounding:
• $$\{\}$$, $$\{V\}$$, $$\{W\}$$, $$\{M, V\}$$, $$\{M, W\}$$, $$\{M, V, W\}$$
• But not $$\{M\}$$

### Backdoor path criterion: a multi backdoor paths example

• First path: $$A \leftarrow Z \leftarrow V \rightarrow Y$$

• No collider on this path
• So controlling for either $$Z$$, $$V$$, or both is sufficient
• Second path: $$A \leftarrow W \rightarrow Z \leftarrow V \rightarrow Y$$

• $$Z$$ is a collider
• So controlling $$Z$$ opens a path between $$W$$ and $$V$$
• We can block $$\{V\}$$, $$\{W\}$$, $$\{Z, V\}$$, $$\{Z, W\}$$, or $$\{Z, V, W\}$$
• To block both paths, it’s sufficient to control for

• $$\{V\}$$, $$\{Z, V\}$$, $$\{Z, W\}$$, or $$\{Z, V, W\}$$
• But not $$\{Z\}$$ or $$\{W\}$$

## Disjunctive cause criterion

### Disjunctive cause criterion

• For many problems, it is difficult to write down accurate DAGs
• In this case, we can use the disjunctive cause criterion: control for all observed causes of the treatment, the outcome, or both

• If there exists a set of observed variables that satisfy the backdoor path criterion, then the variables selected based on the disjunctive cause criterion are sufficient to control for confounding

• Disjunctive cause criterion does not always select the smallest set of variable to control for, but it is conceptually simple

### Example

• Observed pre-treatment variables: $$\{M, W, V\}$$

• Unobserved pre-treatment variables: $$\{U_1, U_2\}$$

• Suppose we know: $$W, V$$ are causes of $$A$$, $$Y$$ or both

• Suppose $$M$$ is not a cause of either $$A$$ or $$Y$$

• Comparing two methods for selecting variables
1. Use all pre-treatment covariates: $$\{M, W, V\}$$
2. Use variables based on disjunctive cause criterion: $$\{W, V\}$$

### Example continued: hypothetical DAG 1

1. Use all pre-treatment covariates: $$\{M, W, V\}$$
• Satisfy backdoor path criterion? Yes
1. Use variables based on disjunctive cause criterion: $$\{W, V\}$$
• Satisfy backdoor path criterion? Yes

### Example continued: hypothetical DAG 2

1. Use all pre-treatment covariates: $$\{M, W, V\}$$
• Satisfy backdoor path criterion? Yes
1. Use variables based on disjunctive cause criterion: $$\{W, V\}$$
• Satisfy backdoor path criterion? Yes

### Example continued: hypothetical DAG 3

1. Use all pre-treatment covariates: $$\{M, W, V\}$$
• Satisfy backdoor path criterion? No
1. Use variables based on disjunctive cause criterion: $$\{W, V\}$$
• Satisfy backdoor path criterion? Yes

### Example continued: hypothetical DAG 4

1. Use all pre-treatment covariates: $$\{M, W, V\}$$
• Satisfy backdoor path criterion? No
1. Use variables based on disjunctive cause criterion: $$\{W, V\}$$
• Satisfy backdoor path criterion? No

### References

• Coursera class: “A Crash Course on Causality: Inferring Causal Effects from Observational Data”, by Jason A. Roy (University of Pennsylvania)


text:
# zbMATH — the first resource for mathematics

Subadjunction of log canonical divisors for a subvariety of codimension 2. (English) Zbl 0901.14004
Kawamata, Yujiro (ed.) et al., Birational algebraic geometry. A conference on algebraic geometry in memory of Wei-Liang Chow (1911–1995), Baltimore, MD, USA, April 11–14, 1996. Providence, RI: American Mathematical Society. Contemp. Math. 207, 79-88 (1997).
The classical adjunction formula: $$(K_X+S)|_S\sim K_S$$ relates the canonical divisor of a smooth variety $$X$$ with that of a smooth divisor $$S$$ on $$X$$. If $$X$$ has singularities, then the formula is in general no longer true, as the example of a generator on a quadric cone shows. A subadjunction theorem has been given by the author [Y. Kawamata, “On Fujita’s freeness conjecture for 3-folds and 4-folds”, Math. Ann. 308, No. 3, 491-505 (1997)].
Here the following subadjunction theorem for codimension $$2$$ subvarieties is proved: If $$X$$ is a normal variety, $$D$$ an effective $$\mathbb{Q}$$-Cartier divisor such that $$(X,D)$$ is log canonical, $$W$$ an element of the set of the centres of log canonical singularities, of codimension $$2$$ in $$X$$, then there exist canonically determined effective $$\mathbb{Q}$$-divisors $$M_W$$ and $$D_W$$ on the normalization $$\widetilde W$$ of $$W$$, such that $$\nu^*(K_X+D)\sim_\mathbb{Q} K_{\widetilde W}+M_W+D_W$$ (here $$\nu$$ denotes the normalization map $$\widetilde W\to W$$). The divisor $$D_W$$ is the local contribution coming from the singularities of $$(X,D)$$, while $$M_W$$ is the global contribution coming from the moduli space of curves. Some relationships between the singularities of $$(X,D)$$ and those of the restricted pair are given.
For the entire collection see [Zbl 0869.00030].

##### MSC:
 14C20 Divisors, linear systems, invertible sheaves 14M07 Low codimension problems in algebraic geometry
Full Text:


text:
# Chapter 3 - Exponents, Polynomials and Functions - 3.2 Combining Functions - 3.2 Exercises - Page 244: 45

$51x^2+31x-5$

#### Work Step by Step

Use the FOIL method on the second and third sets of parentheses. Then combine like terms. $(2x^2+3x-9)+(7x+2)^2$ $=(2x^2+3x-9)+(7x+2)(7x+2)$ $=(2x^2+3x-9)+(49x^2+28x+4)$ $=51x^2+31x-5$

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.


text:
# Is there an analogue of curvature in algebraic geometry?

I am not an expert, but there seems to be an enormous technical difference between algebraic geometry and differential/metric geometry stemming from the fact that there is apparently no such thing as curvature in the former context while curvature is everywhere in the latter (indeed, it is hard to produce nontrivial results in Riemannian geometry that DON'T involve curvature). Of course it seems unreasonable to just port definitions of curvature into an algebraic context, but maybe there are constructions that play the same role in algebraic geometry that curvature does in other kinds of geometry. Here are two specific ways the notion of curvature shows up which I can imagine making sense in more general contexts.

Algebraic Chern - Weil Theory? In differential geometry one uses the curvature of a connection on a vector bundle to produce explicit cohomology classes. Does this have an algebraic analogue?

Algebraic Curvature Bounds? One supremely important theme in modern geometry involves proving theorems that depend only on the large scale geometry of a space, and the main strategy is to compare the space to a simpler one with the same large scale properties. This reminds me a little bit of tropical geometry wherein one replaces an algebraic variety with a simple combinatorial proxy, but from what little I know the analogy seems to stop there.

Any thoughts? I hope this question is not too vague, but it seems worthwhile and part of the problem is that I can't formulate a precise question along these lines. Thanks in advance!

-
Personally, I find the question about Algebraic Chern - Weil Theory very interesting. I've wondered for a while now whether any such theory is possible, and I've been unable to find any literature on the subject. –  Dan Ramras Mar 25 '10 at 15:02
The case of Riemann surfaces is instructive. The category of algebraic curves is equivalent to the category of conformal surfaces. However conformal surfaces do not have a unique Riemannian metric structure, so this means that if we want a notion of curvature for algebraic curves, this has to be above and beyond the algebro-geometric structure of a variety. –  Colin Tan Mar 25 '10 at 15:37
I think this is one of the main questions of Algebraic Geometry. Connections are a lot of times algebraic, and then, as it happens in Hodge Theory, one can sometimes circumvent metrics and curvatre by some smart spectral sequences. However, in my opinion this is a very accidental, case by case method. –  Zsolt Patakfalvi Mar 25 '10 at 21:16

An algebraic analog of Chern-Weil theory (explicitly taking symmetric polynomials of curvature) is given by the Atiyah class. Given a vector bundle $E$ on a smooth variety we can consider the short exact sequence $$0\to End(E) \to A(E) \to T_X\to 0$$ where $T_X$ is the tangent sheaf and $A(E)$ is the "Atiyah algebroid" --- differential operators of order at most one acting on sections of $E$, whose symbol is a scalar first order diffop (hence the map to the tangent sheaf). A (holomorphic or algebraic) connection is precisely a splitting of this sequence, and a flat connection is a Lie algebra splitting. Now algebraically such splittings will often not exist (having a holomorphic connection forces your characteristic classes to have type $(p,0)$ rather than the $(p,p)$ you want..) but nonetheless we can define the extension class, which is the Atiyah class $$a_E\in H^1(X, End(E)\otimes \Omega^1_X).$$ This is the analog of the curvature form in the Riemannian world -- we now can take symmetric polynomials in the $End(E)$ factor to get the characteristic classes of $E$ in $H^p(X,\Omega_X^p)$ as desired.

This answer and Mariano's agree of course in the sense that Atiyah classes can be interpreted via Hochschild and cyclic (co)homology and generalized to arbitrary coherent sheaves (or complexes) on varieties (or stacks) (let me stick to characteristic zero to be safe). Namely the Atiyah class of the tangent sheaf can be used to define a Lie algebra structure (or more precisely $L_\infty$) on the shifted tangent sheaf $T_X[-1]$, and Hochschild cohomology is its enveloping algebra. This Lie algebra acts as endomorphisms of any coherent sheaf (which is another way to say Hochschild cohomology is endomorphisms of the identity functor on the derived category), and one can take characters for these modules, recovering the characteristic classes defined concretely above.

(In fact the notion of characters is insanely general... for example an object of any category - with reasonable finiteness - defines a class (or "Chern character") in the Hochschild homology of that category, which is cyclic and so descends to cyclic homology. An example of this is the category of representations of a finite group, whose HH is class functions, recovering usual characters, or coherent sheaves on a variety, recovering usual Chern character. or one can go more general.)

-
"reasonable finiteness" = dualizable? –  Kevin H. Lin Jan 7 '11 at 11:28
Yes, at least in the formulation I know (which is in the revised version of my Character Theory paper with Nadler, out in a week or two) - a dualizable module over an associative algebra object in a symmetric monoidal ∞-category has a Chern character in cyclic homology. –  David Ben-Zvi Jan 7 '11 at 15:26
That's a really nice answer! –  David Speyer Jan 7 '11 at 16:23
I think this answer (and Mariano's) settle my question about Chern-Weil theory in the most satisfying possible way. And from what I have learned since I asked this question long ago, it seems that Joel Fine's answer gives about as much as there is to say about "algebraic curvature bounds". I've learned a lot from these answers - thanks everyone! –  Paul Siegel Mar 27 '11 at 17:56
Here you wrote that $HH^*$ is $End(Id)$ in the derived category: do you have a reference for this fact? –  Mariano Suárez-Alvarez Apr 28 '13 at 8:17

The algebraic Chern-Weyl theory exists. You can find expositions of it in, say, Jean-Louis Loday's Cyclic Homology or in Max Karoubi's Homologie Cyclique Astérisque. It constructs characteristic classes for finitely generated projective modules, and more generally on elements of $K_0$, with values in the cyclic homology of the coordinate algebra, and/or the usual variations of this homology theory. This precisely generalizes the usual case, in view of the Swan-Serre theorem that states that finitely generated projective modules over $C^\infty(M)$ are exactly the same thing as vector bundles over a manifold $M$, and the computation of the (periodic) cyclic homology of $C^\infty(M)$, which turns out to be de Rham cohomology of $M$.

One can also get characteristic cyclic classes on the higher algebraic $K$-groups, and this works more or less automatically not only for commutative algebras but for algebras in general.

If you want non-affine schemes, you can generalize everything with sufficient care to that context.

-
Do the characteristic classes constructed in this way have some relationship with etale chern classes? –  Dan Ramras Mar 25 '10 at 16:54
The Chern-Weyl theory gives you explicit forms, not just cohomology classes. Hence there is a lot more information in it. Do you get anything like that with cyclic cohomology? –  Zsolt Patakfalvi Mar 25 '10 at 21:21
The computation of the classes follows exactly the same pattern as in the classical case, exhibiting specific cycles which represent them. –  Mariano Suárez-Alvarez Mar 25 '10 at 21:35
Interesting... what you describe sounds virtually identical to Connes' construction of the Chern character in noncommutative geometry. I'm a little surprised that everything works in the algebraic context given the amount of analysis involved in Connes' case, but I guess the analysis must secretly not be all that important. I wonder which idea inspired the other. –  Paul Siegel Mar 27 '10 at 3:22
I believe it's Chern-Weil, not Chern-Weyl. –  José Figueroa-O'Farrill Apr 16 '10 at 9:32

One well-studied example is ampleness of an invertible sheaf and positive curvature for a holomorphic line bundle. A theorem of Kodaira says that a holomorphic line bundle over a complex manifold is ample if and only if it admits a metric of positive curvature.

Related to this, in the special case when the line bundle is the canonical bundle and also invoking Yau's proof of the Calabi conjecture, one has the following equivalences:

• A compact complex manifold admits a Kähler metric of positive Ricci curvature only if it is Fano i.e, has ample anticanonical bundle.

• A compact complex manifold admits a Kähler metric of negative Ricci curvature if and only if it has ample canonical bundle.

• A compact complex manfiold admits a Ricci flat Kähler metic if and only if it has torsion first Chern class.

-
I thought we only had "only if" for the case of positive Ricci curvature? I think there's a conjecture of Yau saying that a manifold admits a Ricci-positive Kahler-Einstein metric iff its tangent bundle is stable. –  Gunnar Þór Magnússon Jan 3 '11 at 2:16
Oops, for someone who earns his living in this area that's a massive mistake to make! Of course you're right - there are certainly Fanos which do not have Kahler-Einstein metrics. As for the conjecture of Yau, I believe that the current state of affairs is that one believes that a Fano admits a Kahler-Einstein metric iff it is "K-stable". This is an algebro-geometric stability condition, related to the Hilber-Mumford criterion for a certain infinite dimensional GIT quotient. You can find details in an article of Donaldson called "Scalar curvature and stability of toric varieties", in JDG. –  Joel Fine Jan 7 '11 at 0:56
Just to add, I think the conjecture concerning K-stability should be attributed to Donaldson-Tian-Yau in reverse chronological order, but in the correct order of precision. Also, I've edited my answer to correct the mistake you've pointed out. –  Joel Fine Jan 7 '11 at 0:58

Here is a short overview by Brian Osserman on curvature in algebraic gemetry, incl. the very interesting "p-curvature" which had been used much by N.Katz and Ogus.

-
But p-curvature are usually used in the context where one has a flat vector bundle, which means the curvature vanish and the de Rham "thing" really gives a de Rham "complex". –  temp Jun 5 '12 at 16:46

For varities containing sufficiently many rational curves, the collection of rational curves of minimal degree determine the global geometry to some extent. This collection is known as the variety of minimal rational tangents, or VMRT. The rational curves passing through a general point serve as an alternative to a tangent space.

If the variety has symmetry, for instance a Hermitian symmetric space, then the tangent curves passing through two different points can be compared. This will give the notion of curvature if you ask for. I am aware that Hwang and Mok has done work in this area.

-

Ivey and Landsberg's book "Cartan for Beginners" covers material which you may find interesting. In particular, chapter 3 presents ideas on the geometry of projective varieties from the point of view of moving frames.

The rough idea (which I may be misstating, as this is stuff I haven't absorbed yet) is that differential invariants (various forms of curvature) of maps into homogeneous spaces (e.g. submanifolds of E^3 or projective varieties) come from pulling back the Maurer-Cartan form from the Lie group of transformations under which two maps would be considered equivalent. Thus I think these ideas are more about "extrinsic" differential geometry, but it still may be useful.

-


text:
# Publications of Nicholas J. Kuhn

Books edited

1. (with J.P.C.Greenlees and R.R.Bruner) Homotopy Methods in Algebraic Topology, Proceedings of the 1999 Conference in Boulder, A. M. S. Cont. Math. Series 271, 2001.

Research Papers

All papers since 2002 are available in preprint form at arxiv.org. Many older papers are also available on one or more of the following archives: the Hopf archive at https://hopf.math.purdue.edu, the K–theory archive at https://faculty.math.illinois.edu/K-theory, or the group cohomology archive at https://homepages.abdn.ac.uk/d.j.benson/pages/html/archive.html.

1. The geometry of the James-Hopf Maps, Pac. J. Math. 102 (1982), 397–412.

2. (with S.A.Mitchell and S.B.Priddy) The Whitehead conjecture and splitting $$B(\mathbb Z/2)^k$$, Bull. A. M. S. 7 (1982), 255–258.

3. A Kahn-Priddy sequence and a conjecture of G.W.Whitehead, Math. Proc. Camb. Phil. Soc. 92 (1982), 467–483. (Corrigenda, 95(1984), 189–190.)

4. (with F.R.Cohen, R.L.Cohen, and J.L.Neisendorfer)  Bundles over configuration spaces, Pac. J. Math. 104 (1983), 47–54.

5. The homology of the James-Hopf maps, Ill. J. Math. 27 (1983), 315–333.

6. Spacelike resolutions of spectra, Northwestern Homotopy Theory Conference, Proc. Evanston, 1982, A. M. S. Cont. Math. Series 19 (1983), 153–165.

7. Suspension spectra and homology equivalences, Trans. A. M. S. 283 (1984), 303–313.

8. (with an appendix by P.Landrock) The modular Hecke algebra and Steinberg representation of finite Chevalley groups, J. Algebra 91 (1984), 125–141.

9. Extended powers of spectra and a generalized Kahn-Priddy Theorem, Topology 23 (1985), 473–480.

10. Chevalley group theory and the transfer in the homology of symmetric groups, Topology 24 (1985), 247–264.

11. (with S.B.Priddy)  The transfer and Whitehead’s conjecture, Math. Proc. Camb. Phil. Soc. 98 (1985), 459–480.

12. (with S.A.Mitchell)  The multiplicity of the Steinberg representation of $$GL_n(\mathbb F_q)$$ in the symmetric algebra, Proc. A. M. S. 96(1986), 1–6. 1

13. Exact sequences of spectra and duality, Proc. A. M. S. 97 (1986), 347–351.

14. The mod p K-theory of classifying spaces of finite groups, J. Pure Appl. Alg. 44 (1987), 269–271.

15. The rigidity of L(n), Algebraic Topology – Seattle 1985, Springer Lect. Notes Math. 1286 (1987), 286–292.

16. The Morava K-theories of some classifying spaces, Trans. A. M. S. 304 (1987), 193– 205.

17. The transfer and James-Hopf invariants, Math. Zeit. 196 (1987), 391–405.

18. (with J.C.Harris) Stable decompositions of classifying spaces of finite abelian p-groups, Math. Proc. Camb. Phil. Soc. 103 (1988), 427–449.

19. Morava K-theories and infinite loop spaces, Algebraic Topology, Proc. Arcata, 1986, Springer Lect. Notes Math. 1370 (1989), 243–257.

20. (with D.Carlisle) Subalgebras of the Steenrod algebra and the action of matrices on truncated polynomial algebras, J. Algebra 121 (1989), 370–387.

21. (with D.Carlisle) Smash products of summands of $$B(\mathbb Z/p)^n_+$$, Northwestern Topology Conference, Proc. Evanston, 1988, A. M. S. Cont. Math. Series 96 (1989), 87–102.

22. Character rings in algebraic topology, Advances in Homotopy Theory, Proc. Cortona 1988, L. M. S. Lectures Notes 139 (1989), 111–126.

23. (with J. F. Adams)  Atomic spaces and spectra, Proc. Edin. Math. Soc. 32 (1989), 473–481.

24. (with M.J.Hopkins and D.C.Ravenel)  Morava K-theories of classifying spaces and generalized characters for finite groups, Topology Conference, Proc. Barcelona, 1990, Springer Lecture Notes in Math. 1509 (1992), 186–209.

25. Generic representation theory and Lannes’ T-functor, Adams Memorial Symp., Proc. Manchester, 1990, L. M. S. Lecture Notes 176 vol.2 (1992), 235–262.

26. (with Jeanne Duflot and Mark Winstead)  A classification of polynomial algebras as modules over the Steenrod algebra, Comm. Math. Helv. 68 (1993), 622–632.

27. (with Piotr Krason)  On embedding polynomial functors in symmetric powers, J.Algebra 163 (1994), 281–294.

28. Constructions of families of elements in the stable homotopy groups of spheres, Topology and Representation Theory, Proc. Evanston, 1992, A.M.S. Cont. Math. 158 (1994), 135–155. 2

29. Morita equivalence, GL(n,q) modules, and the Steenrod algebra, Algebraic Topology and its Applications, Proc. Berkeley, 1989, M.S.R.I. Pub. 27 (1994), 125–137.

30. Generic representations of the finite general linear groups and the Steenrod algebra:I, Amer. J. Math. 116 (1994), 327–360.

31. Generic representations of the finite general linear groups and the Steenrod algebra:II, K-theory J. 8 (1994), 395–428.

32. Generic representations of the finite general linear groups and the Steenrod algebra:III, K-theory J. 9 (1995), 273–303.

33. On topologically realizing modules over the Steenrod algebra, Annals of Math. 141 (1995), 321–347.

34. (with M. Slack and F.Williams)  Hopf constructions and higher projective planes for iterated loop spaces, Trans. A.M.S. 347 (1995), 1201–1238.

35. (with M. Winstead)  On torsion in the cohomology of certain mapping spaces, Topology 35 (1996), 875–881.

36. Invariant subspaces of the ring of functions on a vector space over a finite field, J. Algebra 191 (1997), 212–227.

37. Computations in generic representation theory: maps from symmetric powers to composite functors, Trans. A.M.S.350 (1998), 4221–4233.

38. Rational cohomology and cohomological stability in generic representation theory, Amer. J. Math.120 (1998), 1317–1341.

39. (with D. J. Hunter)  Mahowaldean families of elements in stable homotopy groups revisited, Math. Proc. Camb. Phil. Soc. 127 (1999), 237–251.

40. (with D. J. Hunter)  Characterizations of spectra with U-injective cohomology which satisfy the Brown–Gitler property, Trans. A.M.S.352 (2000), 1171–1190.

41. (with M.J.Hopkins and D.C.Ravenel)  Generalized group characters and complex oriented cohomology theories, Journal A.M.S.13 (2000), 553–594.

42. The generic representation theory of finite fields: a survey of basic structure, Infinite Length Modules, Proc. Bielefeld, 1998, Trends in Mathematics, Birkhauser (2000), 193–212.

43. New relationships among loopspaces, symmetric products, and Eilenberg MacLane spaces, Cohomological Methods in Homotopy Theory, Proc. Barcelona, 1998, Birkhauser Verlag Progress in Math 196(2001), 185–216. 3

44. Splitting fields and twisted group rings for the finite general linear groups, Modular Representation Theory of Finite Groups, Proc. Charlottesville, 1998, de Gruyter (2001), 231–237.

45. Stable splittings and the diagonal, Homotopy Methods in Algebraic Topology, Proc. Boulder, CO, 1999, A.M.S. Cont. Math. 271 (2001), 169–181.

46. A stratification of generic representation theory and generalized Schur algebras, K-theory J. 26 (2002), 15–49.

47. (with S.T.Ahearn) Product and other fine structure in polynomial resolutions of mapping spaces, Algebraic and Geometric Topology 2 (2002), 591–647.

48. The McCord model for the tensor product of a space and a commutative ring spectrum, Categorical Decomposition Techniques in Algebraic Topology, Proc. Isle of Skye, Scotland, 2001, Birkhauser Verlag Progress in Math 215 (2003), 213–236.

49. Tate cohomology and periodic localization of polynomial functors, Invent. Math. 157 (2004), 345–370.

50. Localization of Andr´e–Quillen–Goodwillie towers, and the periodic homology of infinite loopspaces, Advances in Math. 201 (2006), 318–378.

51. Mapping Spaces and Homology Isomorphisms, Proc. A.M.S. 134 (2006), 1237–1248. With an appendix joint with G. Arone.

52. Goodwillie towers and chromatic homotopy: an overview, Algebraic Topology, Proc. Kinosaki, Japan, 2003, Geometry and Topology Monographs 10 (2007), 245–279.

53. Primitives and central detection numbers in group cohomology, Advances in Math. 216 (2007), 387–442.

54. The nilpotent filtration and the action of automorphisms on the cohomology of finite p–groups, Math. Proc. Camb. Phil. Soc. 144 (2008), 575–602.

55. A guide to telescopic functors, Johns Hopkins Conference on Algebraic Topology, Proc. Baltimore, 2007, Homology, Homotopy, and Applications 10 (2008), 291–319.

56. Topological nonrealization results via the Goodwillie tower approach to iterated loopspace homology, Algebraic and Geometric Topology 8 (2008), 2109–2129. (Correction: 10 (2010), 531–533.)

57. Nilpotence in group cohomology, Proc. Edin. Math. Soc. 56 (2013), 151–175.

58. (with J. B. McCarty) The mod 2 homology of infinite loopspaces, Algebraic and Geometric Topology 13 (2013), 687–745. 4

59. The Krull filtration of the category of unstable modules over the Steenrod algebra, Math. Zeit. 277 (2014), 917–936.

60. The Whitehead Conjecture, the Tower of $$S^1$$ Conjecture, and Hecke algebras of type A, J. Topology 8 (2015), 118–146.

61. Generic representation theory of finite fields in nondescribing characteristic, Advances in Math. 272 (2015), 598–610.

62. (with Luis A. Pereira)  Operad bimodules, and composition products on Andr´e–Quillen filtrations of algebras, Algebraic and Geometric Topology 17 (2017), 1105–1130.

63. Adams filtration and generalized Hurewicz maps for infinite loopspaces, Invent. Math. 214 (2018), 957--998.

64.  Hopf algebras, quasi-shuffle algebras and the cohomology of $$\Omega \Sigma X$$Advances in Math. 369 (2020), 107013, 30pp.

65. (with Chris J.R.Lloyd)  Chromatic fixed point theory and the Balmer spectrum for extraspecial 2--groups, preprint, 2020.

Reports and other miscellaneous publications

1. Cohomology primitives associated to central extensions, Oberwolfach Reports 2 (2005), 2383–2386.

2. (with Carles Broto,, Nguyen H. V. Hung, John H. Palmieri, Stewart Priddy, and Nobuaki Yagita) The problem session. Proc. School and Conference in Algebraic Topology, Hanoi, 2004, Geometry and Topology Monographs 11 (2007), 435–441.

3. Adams filtration and infinite loopspaces, Oberwolfach Reports 4 (2007), 2703–2705.

4. Restriction to the center in group cohomology, Oberwolfach Reports 7 (2010), 1919– 1922.

5. The mod 2 homology of infinite loopspaces, Oberwolfach Reports 8 (2011), 2660–2663.

6. Generic representations of finite fields in nondescribing characteristic, Oberwolfach Reports 12 (2015), 1377–1379.

7. New results about the equivariant stable homotopy Balmer spectrum, Oberwolfach Reports 16  (2019).


text:
## Elementary Geometry for College Students (6th Edition)

$A = 40.41~cm^2$
Since the vertex angle is $46^{\circ}$, we can let $\theta = \frac{46^{\circ}}{2} = 23^{\circ}$ We can find the area of the triangle: $A = s^2~sin~\theta~cos~\theta$ $A = (10.6~cm)^2~sin~23^{\circ}~cos~23^{\circ}$ $A = 40.41~cm^2$


text:
Determination of the 3He+alpha\to 7Be asymp. normalization coefficients (nucl. vertex constants) and their application for extrapolation of the 3He(alpha,gamma)7Be astroph. S-factors to the solar energy regionDetermination of the 3He+alpha\to 7Be asymp. normalization coefficients (nucl. vertex constants) and their application for extrapolation of the 3He(alpha,gamma)7Be astroph. S-factors to the solar energy region

Access Restriction
Open

 Author Igamov, S. B. ♦ Tursunmakhatov, K. I. ♦ Yarmukhamedov, R. Source arXiv.org Content type Text File Format PDF Date of Submission 2008-05-23 Language English
 Subject Domain (in DDC) Computer science, information & general works ♦ Natural sciences & mathematics ♦ Physics Subject Keyword Nuclear Theory ♦ physics:nucl-th Abstract A new analysis of the precise experimental astrophysical $S$-factors for the direct capture $^3He(\alpha,\gamma)^7{\rm {Be}}$ reaction [B.S. Nara Singh et al., Phys.Rev.Lett. {\bf 93} (2004) 262503; D. Bemmerer et al., Phys.Rev.Lett. {\bf 97} (2006) 122502; F.Confortola et al., Phys.Rev. {\bf C 75} (2007) 065803 and T.A.D.Brown et al., Phys.Rev. {\bf C 76} (2007) 055801] populating to the ground and first excited states of $^7{\rm Be}$ is carried out based on the modified two - body potential approach in which the direct astrophysical $S$-factor, $S_{34}(E)$, is expressed in terms of the asymptotic normalization constants for $^3{\rm {He}}+\alpha\to ^7{\rm {Be}}$ and two additional conditions are involved to verify the peripheral character of the reaction under consideration. The Woods--Saxon potential form is used for the bound ($\alpha+^3{\rm {He}}$)- state and the $^3{\rm {He}}\alpha$- scattering wave functions. New estimates are obtained for the "indirectly measured", values of the asymptotic normalization constants (the nuclear vertex constants) for $^3{\rm {He}}+\alpha\to^7{\rm {Be}}(g.s.)$ and $^3{\rm {He}}+\alpha\to^7{\rm {Be}}(0.429 MeV)$ as well as the astrophysical $S$-factors $S_{34}(E)$ at E$\le$ 90 keV, including $E$=0. The values of asymptotic normalization constants have been used for getting information about the $\alpha$-particle spectroscopic factors for the mirror ($^7Li^7{\rm {Be}}$)-pair. Educational Use Research Learning Resource Type Article Page Count 27


text:
# Experiments in Constraint-based Graphic Design

Standard GUI-based graphic design tools only support a limited “snap to guides” style of positioning, have a basic object grouping system, and implement primitive functionality for aligning or distributing objects. They don’t have a way of remembering constraints and relationships between objects, and they don’t have ways of defining and reusing abstractions. I’ve been dissatisfied with existing tools for design, in particular for creating figures and diagrams, so I’ve been working on a new system called Basalt that matches the way I think: in terms of relationships and abstractions.

Basalt is implemented as a domain-specific language (DSL), and it’s quite different from GUI-based design tools like Illustrator and Keynote. It’s also pretty different from libraries/languages like D3.js, TikZ, and diagrams. At its core, Basalt is based on constraints: the designer specifies figures in terms of relationships, which compile down to constraints that are solved automatically using an SMT solver to produce the final output. This allows the designer to specify drawings in terms of relationships like “these objects are distributed horizontally, with a 1:2:3 ratio of space between them.” Constraints are also a key aspect of how Basalt supports abstraction, because constraints compose nicely.

I’ve been experimenting with this concept, off and on, for the last couple years. Basalt is far from complete, but the exploration has yielded some interesting results already. The prototype is usable enough that I made all the figures in my latest research paper and presentation with it.

If you want to read about the core ideas behind Basalt, take a look at the philosophy section. If you want to hear about my experience using Basalt to design real figures, skip ahead to the case studies section. If you want to see how gradient descent can be used to solve figures, go to the gradient descent section.

# Philosophy

Basalt’s programming model is as follows. Designers write programs that produce figures described in terms of relationships. These relationships are compiled down to constraints, which are then solved automatically.

Basalt is a DSL embedded in a general-purpose programming language, so it inherits support for functional abstraction, classes, and so on. Its constraint-based approach is key to supporting abstractions that compose nicely.

## Specifying drawings in terms of relationships

Basalt’s programming model allows drawings to be specified in terms of relationships between objects. The standard GUI-based tools for graphic design don’t have support for this. They have a limited “snap to guides” style of positioning, plus a basic object grouping system and basic functionality for aligning or distributing objects. They don’t encode figures in terms of primitive objects and constraints; instead, actions like aligning objects imperatively update positions, which is what the underlying representation stores. CAD tools have support for constraints, but they aren’t meant for graphic design.

Consider a figure with the following description. “There is a light grey canvas. In the center is a blue circle with a diameter that is half the canvas width. Circumscribed in the circle is a red square.” The picture looks like this:

Without using constraints, code to generate such a figure in Basalt looks like this:

width = 300
height = 300

bg = Rectangle(0, 0, width, height,
style=Style({Property.fill: RGB(0xe0e0e0)}))
style=Style({Property.stroke: RGB(0x0000ff), Property.fill_opacity: 0}))
rect = Rectangle(x=96.97, y=96.97, width=106.06, height=106.06,
style=Style({Property.stroke: RGB(0xff0000), Property.fill_opacity: 0}))

g = Group([bg, circ, rect])

c = Canvas(g, width=width, height=height)

The designer has to figure out where everything goes, manually computing the anchor points and size. Instead, with constraints, the designer can write down the relationship between the shapes, and the tool will solve the figure:

width = 300
height = 300

bg = Rectangle(0, 0, width, height, style=Style({Property.fill: RGB(0xe0e0e0)}))
circ = Circle(style=Style({Property.stroke: RGB(0x0000ff), Property.fill_opacity: 0}))
rect = Rectangle(style=Style({Property.stroke: RGB(0xff0000), Property.fill_opacity: 0}))

# The Group constructor takes two arguments: the first is a list of objects,
# and the second lists additional constraints, equations that relate the
# objects to one another

g = Group([bg, circ, rect], [
# circle is centered
circ.bounds.center == bg.bounds.center,

# circle diameter is 1/2 of canvas width

# rectangle is centered on circle
rect.bounds.center == circ.bounds.center,

# rectangle is a square
rect.width == rect.height,

# rectangle is circumscribed
])

c = Canvas(g, width=width, height=height)

Every primitive shape knows how to calculate its own bounds based on its internal attributes: for example, a circle’s bounds are $(x-r, y-r)$ to $(x+r, y+r)$, and a group’s bounds are defined in terms of min/max of the individual elements’ bounds. Attributes, as well as bounds, are allowed to be symbolic expressions: e.g. in the code above, the circle is not given a concrete center or radius, so these attributes are each automatically initialized to a fresh Variable(), and then the bounds depend on these variables. They are only assigned a concrete value when the constraint solver runs.

Basalt’s constraint-based approach allows the designer to think in terms of relationships and express those in the specification of the drawing itself, rather than having them be implicit and be manually solved by the designer.

The figure above could feasibly be drawn in Illustrator, though it might require taking out a pencil and paper to calculate positions of objects. Manually solving implicit constraints that are in the designer’s mind but not encoded in the tool, which is what designers currently do with existing programs, is painful and not scalable.

What if the figure design were changed slightly, for example the circle was to be inscribed in the rectangle? With Illustrator, it requires recomputing all the positions by hand; with Basalt, the change is one line of code:

-  # rectangle is circumscribed
+  # circle is inscribed

For a simple figure, making such a change by hand might be feasible, but what if the figure had hundreds of objects? With Illustrator, it would get out of hand to manually position all the objects precisely where they need to go based on the constraints in the designer’s mind. In Basalt, the constraint solver does the difficult job of determining exact positions for objects, and it scales well (for example, this figure has hundreds of objects).

## Supporting abstraction

Constraints lead to a natural way of supporting abstraction, another key aspect necessary for designing sophisticated figures. Sub-components can be specified in terms of their parts and internal constraints. When these components are instantiated for use in a top-level figure (or a higher-level component), the constraints can simply be merged together.

Suppose we wanted to have an abstraction for a circumscribed square and then have four of them, arranged in a 2x2 grid, that fill the canvas. First, we can define the abstraction, a group consisting of a circle and rectangle, with some internal constraints:

def circumscribed_square():
circ = Circle(style=Style({
Property.stroke: RGB(0x0000ff),
Property.fill_opacity: 0
}))
rect = Rectangle(style=Style({
Property.stroke: RGB(0xff0000),
Property.fill_opacity: 0
}))
return Group([circ, rect], [
# rectangle is centered on circle
rect.bounds.center == circ.bounds.center,
# rectangle is a square
rect.width == rect.height,
# rectangle is circumscribed
])

Then, we can instantiate it multiple times and add the constraint that they are arranged in a 2x2 grid and are all the same size:

c1 = circumscribed_square()
c2 = circumscribed_square()
c3 = circumscribed_square()
c4 = circumscribed_square()

g = Group([c1, c2, c3, c4], [
# arranged like
# c1 c2
# c3 c4
c1.bounds.right_edge == c2.bounds.left_edge,
c3.bounds.right_edge == c4.bounds.left_edge,
c1.bounds.bottom_edge == c3.bounds.top_edge,
# and all the same size
c1.bounds.width == c2.bounds.width,
c2.bounds.width == c3.bounds.width,
c3.bounds.width == c4.bounds.width,
])

Finally, we can express the constraint that the figure fills the canvas:

width = 300
height = 300

bg = Rectangle(0, 0, width, height, style=Style({Property.fill: RGB(0xe0e0e0)}))

top = Group([bg, g], [
# figure is centered
g.bounds.center == bg.bounds.center,
# and fills the canvas
g.bounds.height == bg.bounds.height
])

c = Canvas(top, width=width, height=height)

When rendered, this code produces the following figure:

## Constraints as an assembly language

Constraints aren’t necessarily what end-users should write directly, but constraints make for a nice assembly language: it’s easy to express higher-level geometric concepts in terms of Basalt’s constraints. For example, expressing that a set of objects are top-aligned is as simple as this:

def aligned_top(elements):
top = Variable() # some unknown value
return Set([i.bounds.top == top for i in elements])

Other concepts, like objects being horizontally or vertically distributed, being the same width or height, or being inset inside another object, can also be compiled down to constraints. Basalt provides some higher-level geometric primitives, and users can define their own.

# Case studies

Here is a figure I made for a paper (Figure 5), recreated in Basalt:

The figure shows a number of images, along with a classification of those images given by the border color, laid out in a grid. The Basalt code for this figure defines two abstractions that are composed to make the figure:

def bordered_image(source: str, border_color, border_radius):
image = Image(source)
border = Rectangle(style=Style({Property.fill: border_color}))
return Group([border, image], [
])

def grid(elements: List[List[Element]], spacing):
rows = [Group(i) for i in elements]
return Group(rows, [
# all elements are the same size
same_size([i for row in rows for i in row.elements]),
# elements in rows are distributed horizontally
Set([distributed_horizontally(row, spacing) for row in rows]),
# and aligned vertically
Set([aligned_middle(row) for row in rows]),
# rows are distributed vertically
Set([distributed_vertically(rows, spacing)]),
# and aligned horizontally
aligned_center(rows)
])

This figure is simple enough that it would be possible to draw it in a traditional tool like Illustrator, but there are benefits to drawing it programmatically beyond avoiding the annoyance of manually laying out the figure in a GUI-based tool. The paper has 5 figures in this style, with varying images and sizes: using code allowed us to parameterize over these and do the work of designing the figure just once. Furthermore, the figures were meant to go in a paper, a fairly restricted format: for example, the width of our figures was fixed. We needed to decide on figure parameters, such as grid dimensions, border size, and image size, that would make the figures readable, and having the code generate the figures made it easy to explore this parameter space.

The original figures in the paper were actually made without Basalt, because Basalt didn’t exist at the time. Instead, I wrote Python code that directly painted pixels of an output image. The Basalt code is much nicer.

My brother Ashay and I designed the logo for Robust ML. Starting with the general ideas of shields and neural networks, Ashay drew a couple sketches on paper:

Next, I sketched the logo in Illustrator. Even after we had the basic idea for the logo, it took a ton of iteration to figure out the details, including choosing the number of layers in the neural network, the number of nodes in each layer, and the spacing between the nodes in a given layer. Certain changes were easy, like tweaking colors using Illustrator’s recolor artwork feature. Other changes were extremely painful; for example, adding a node required a lot of manual labor, because it required moving nodes and lines as well as creating and positioning a new node and many new lines. Cumulatively, over dozens of iterations of the logo, I spent a couple hours just moving shapes around in Illustrator.

Since then, I have re-made the logo with Basalt, where exploring a parameter space is much easier with the help of the live preview tool.

Here is what the final output looks like:

## Notary architecture figure

This is a figure made in TikZ, from a draft of a recent paper:

Here’s the code for the TikZ figure above. It uses lots of hard-coded positions, with commands like \draw [boxed] (-1,-2.5) rectangle (16.5,4). It was difficult to get the figure to look particularly pretty using TikZ. For the published version of the paper (Figure 1), I designed the figure using Basalt, also changing the styling a bit in the process:

The figure defines and makes use of a number of new abstractions built on top of Basalt’s primitives, including:

• Component — a box, with text centered inside
• Peripheral — a box with rounded corners, with text centered inside
• Wiring — a bunch of line segments, with optional arrowheads, connecting two points, with optional label text

Describing these abstractions once and then using them many times made for a pleasant figure design experience. For example, Wiring was defined once and instantiated 11 times in the figure above. And of course, the entire figure was specified relationally. Concepts like the “Kernel domain” text being centered within its area were easy to express. The code makes use of many geometric primitives, expressing concepts such as a component’s inputs/outputs being evenly spaced along the edge.

## Notary SoC illustration

Here’s another figure from the same paper (Figure 2):

The figures in the paper share abstractions for a consistent look; this figure makes use of the Component and Wiring abstractions from the previous figure. Constraint-based design was especially helpful for designing certain aspects of this figure, such as the spacing for the arrows at the bottom. For example, having the arrows spaced evenly along the entire width of the boxes looks pretty terrible; this was easy to test, only requiring a small change to the I/O Arrows abstraction:

-  distributed_horizontally(arrows.elements, periph_io_spacing),
-  arrows.bounds.center.x == periph.bounds.center.x
+  distributed_horizontally(arrows.elements),
+  arrows.bounds.left == periph.bounds.left,
+  arrows.bounds.right == periph.bounds.right

The constraint-based design, along with Basalt’s live preview tool, made it easy to select other parameters such that they looked good for the final figure.

Implementing this figure in code also made it easy to do things like matching the font size between the figure and the text in the paper. When designing figures in external tools, the graphics are often scaled afterwards to fit in the paper, but this messes with the effective font size. With Basalt, it was easy to design the overall figure, then size it appropriately so it could be included in the paper without rescaling, and finally tweak figure parameters so it could use the same font size as the paper.

## Notary architecture animation

I needed to make a simplified version of the Notary architecture figure for a presentation. Furthermore, I needed to animate the figure over multiple slides to highlight and explain different aspects.

I started out implementing the presentation and the figure in Keynote, but designing the figure in Keynote was a bit of a pain due to having overlapping objects, as well as having details varying between phases of the build. I tried doing everything on one slide, but I ran into limitations with Keynote’s animation system (for example, it’s not possible to make an object appear, then disappear, then appear again). I tried duplicating some objects to work around this issue, but that quickly got out of hand, even with Keynote’s object list. I tried splitting the build over multiple slides, but then making global edits became annoying.

Finally, I switched to using Basalt for the figure (and switched the presentation to Beamer). It was straightforward to design a figure with details that varied depending on the build phase:

Aspects that changed based on the build phase took advantage of a BUILD variable, such as reset_color = red if BUILD == 3 else black. This BUILD variable was set via an environment variable, BUILD = os.environ['BUILD'], so different versions of the figure could be rendered by setting e.g. BUILD=2 and rendering the figure.

## Notary noninterference figure build

The same presentation has another figure that is built up over a series of slides:

It uses the same BUILD variable approach as the previous figure to encode aspects that changed based on the build phase, such as the delimiters along the bottom of the figure:

labels = []
if BUILD >= 1: labels.append('Agent A runs')
if BUILD >= 2: labels.append('Deterministic start')
if BUILD >= 3: labels.append('Agent B runs')
if BUILD == 4:
labels = ['Deterministic start']
delim = LabeledDelimiters(labels)

To render different phases of the build, the figure is rendered with different settings of the variable, e.g. BUILD=3.

This figure was designed to match the same visual language set up in the previous figure. This was easy to achieve by sharing the abstraction with the previous figure (instantiated here with slightly different parameters such as a lower wire count).

Again, Basalt’s live preview tool was helpful in choosing figure parameters, such that the figure looked good and the font size matched other figures in the presentation.

## DFSCQ log figure

I wanted to try to recreate a complex figure from a paper (Figure 9) that I did not write. The original was made in Inkscape by one of the authors of the paper. The goal of the Basalt version was not to create a pixel-perfect recreation but to use Basalt’s approach of building up abstractions to see how it scales to complex figures. Here is a side-by-side comparison showing that Basalt is capable of replicating the figure:

The Inkscape figure is a large collection of manually positioned objects, presumably made with a bunch of copy-pasting. The Basalt figure, on the other hand, defines and uses a number of abstractions, all implemented as classes that build on top of Basalt’s primitives:

• Layer — one of the stacked horizontal boxes with various contents, e.g. “LogAPI”
• Blocks — a sequence of colored rectangles, e.g. the blocks to the right of the “activeTxn” label
• Bracket — a “[” or “]” shape
• BlockList — a list of blocks, consisting of an open bracket, a sequence of blocks separated by commas, and a close bracket, e.g. the contents to the right of the “committedTxns” label (uses Blocks and Bracket)
• LabeledDelimiters — labels corresponding to parts of something, e.g. below the “disk log” (this abstraction is also used in the Notary noninterference figure above)
• DiskLog — contents of a disk log, e.g. to the right of the “disk log” label (uses Blocks)
• Explode — the pair of dotted lines showing one part of the figure exploded out, connecting subparts of certain stacked layers, e.g. in between the “DiskLog” and “Applier” layers
• ArrowFan — arrows fanning out, e.g. in the “Applier” layer

This figure took some effort to implement. Basalt’s live preview tool was immensely helpful while working on this figure: seeing updates to the figure immediately after changing code was essential for building up this complex figure. The sliders were also somewhat helpful in getting the layout to match the original. Playing around with the parameters and seeing the figure redraw itself while maintaining its general structure is pretty neat:

# Discussion

## Solving constraints

Basalt allows designers to specify diagrams in terms of relationships and constraints, which boil down to equations over real variables. Basalt doesn’t place many restrictions over these equations, which gives great flexibility to the user, but it makes the underlying implementation more challenging because it has to solve these equations automatically. Basalt equations can have things like conjunctions and disjunctions, min/max terms, and products/quotients of variables, so in the general case it’s not possible to transform equations into some nice form like a linear program that’s computationally efficient to solve. Basalt equations fit into the logic of quantifier-free non-linear real arithmetic (QFNRA), so at least satisfiability is decidable, but solving isn’t necessarily going to be fast.

Currently, Basalt supports a couple different strategies for solving equations.

### Z3

The current default uses the Z3 theorem prover, a powerful SMT solver that has support for QFNRA and much more. Encoding a constraints from Basalt into a Z3 query is straightforward, and in practice, Z3 works quite well.

### Mixed integer linear programming

Basalt supports compiling a subset of constraints, ones that use linear real arithmetic along with a handful of operations like min/max, into a mixed integer linear program (MILP), which are then solved using a MILP solver, currently CBC through Google OR-Tools. Basalt’s MILP backend is strictly less general than the Z3 backend, and it seems to be slower than Z3 even on the queries it supports, but it was fun to implement.

By far the least useful but most fun equation solver is one based on gradient descent. There’s a straightforward translation from Basalt constraints to a differentiable loss function, and this translation is sound. This means that the loss function has a global minima of $0$ if and only if the original constraints are satisfiable, and when the loss function does have a global minima of $0$, every global minima corresponds in a straightforward way to a satisfying assignment for the original variables.

Now of course, this says nothing about the characteristics of this loss function and whether it’s amenable to optimization via gradient descent. But I went ahead and implemented it anyways, using TensorFlow to handle the task of computing derivatives.

Unlike the other approaches, gradient descent computes the solution iteratively, so it’s possible to animate the solving of a figure, and the results are quite amusing:

## Uniqueness of solutions

Sometimes, users produce figures where the set of constraints has multiple solutions; in other words, the figure is not fully constrained. In my experience, this is almost always indicative of a bug in the figure’s code, because it’s unlikely that the user has two different-looking figures in mind where either figure is acceptable.

Basalt can determine when this situation occurs, because it’s straightforward to encode as an SMT query. If the original set of constraints was $C$, and it has a solution $M = \left(x_1 = v_1 \land x_2 = v_2 \land \cdots x_n = v_n\right)$, then we can ask the SMT solver if $C \land \lnot M$ has a solution. If the new formula is unsatisfiable, then the original solution is unique, and the figure is fully constrained. In the case that the new formula is satisfiable, the SMT solver returns a concrete example of another valid solution. Comparing the two solutions can help a user figure out why a figure is under-constrained.

## Next steps

There is still much work to be done on Basalt.

Right now, it’s an embedded DSL in Python, and the language is a bit clunky. Racket, a programming language for building programming languages, may be a better platform. Tej Chajed and I are currently working on building a more sophisticated version of Basalt as a Racket DSL.

Another thing I’m interested in exploring is having a visual editor for Basalt figures, a kind of hybrid between Basalt’s approach and existing GUI-based tools, because it’s often convenient to be able to drag objects around. This might involve using an approach similar to what’s used in CAD tools or perhaps something more exotic like the technique used in g9.js to have a two-way binding between the code and its visual representation.

There has been a long line of research in the area of constraint-based design, starting with Ivan Sutherland’s Sketchpad in 1963. As far as I know, most of the tools that use these ideas are GUI-based CAD programs, not practical graphic design tools.

# Conclusion

Basalt is an approach to designing figures based on constraints. Basalt’s model allows a designer to think in terms of relationships between objects, and it makes it easy to build and reuse abstractions.