text:
# word problem

#### PMTSTUMPED

##### New member
Adelle travels to Boston in 10 hours by bus. She turns in 20 hours by car. If she went 10 mph faster by bus, how far did she travel to Boston?
Thanks

#### soroban

##### Elite Member
Hello, PMTSTUMPED!

Here's a back-door approach to this problem . . .

Adelle travels to Boston in 10 hours by bus. She returns in 20 hours by car.
If she went 10 mph faster by bus, how far did she travel to Boston?

The bus' speed is 10 mph more than the car's speed: .$$\displaystyle \text{bus} \:=\:\text{car} + 10$$ .[1]

The bus drove the same distance in half the car's time.
The bus' speed must be twice the car's speed: .$$\displaystyle \text{bus} \:=\:2\times\text{car}$$ .[2]

Substitute [2] into [1]: . $$\displaystyle 2\times\text{car} \:=\:\text{car} + 10 \quad\Rightarrow\quad \text{car} \:=\:10$$

The car drove for 20 hours at 10 mph.

The distance is: .$$\displaystyle 20 \times 10 \:=\:200\text{ miles.}$$

#### fasteddie65

##### Full Member
PMTSTUMPED said:
Adelle travels to Boston in 10 hours by bus. She turns in 20 hours by car. If she went 10 mph faster by bus, how far did she travel to Boston?
Thanks
Let v = speed of the car
and v + 10 = speed of the bus

20v = 10(v + 10)
20v = 10v + 100
10v = 100
v = 10

10v = 200
10(10 + 10) = 10(20) = 200

200 mi is the distance to Boston.


text: The class $A^{+}_{\infty}(\lowercase{g})$ and the one-sided reverse HÃ¶lder inequality We give a direct proof that $w$ is an $A^{+}_{\infty}(g)$ weight if and only if $w$ satisfies a one-sided, weighted reverse H\"older inequality. Keywords:one-sided maximal operator, one-sided $(A_\infty)$, one-sided, reverse HÃ¶lder inequalityCategory:42B25

format: plain


text:
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

#### TL;DR

• Linear algebra is complex. We need a way to penetrate the thicket. Here’s one.
• Linear systems of equations are at the heart, not surprisingly, of linear algebra.
• A key application is linear regression, which has a matrix solution.
• Solving the needed equations requires inverting a matrix.
• Inverting a matrix is more easily done after decomposing the matrix into upper and lower triangular matrices.
• The upper and lower triangular matrices are individually easy to invert, giving access to the inverse of the original matrix.
• Changes in notations and symbols as you move between presentations add significantly to the cognitive burden in learning this material.

For Part 1 of this series, see here.

If you open a linear algebra text, it’s quickly apparent how complex the field is. There are so many special types of matrices, so many different decompositions of matrices. Why are all these needed? Should I care about null spaces? What’s really important? What are the threads that tie the different concepts together? As someone who is trying to improve their understanding of the field, especially with regard to its applications in chemometrics, it can be a tough slog.

In this post I’m going to try to demonstrate how some simple chemometric tasks can be solved using linear algebra. Though I cover some math here, the math is secondary right now – the conceptual connections are more important. I’m more interested in finding (and sharing) a path through the thicket of linear algebra. We can return as needed to expand the basic math concepts. The cognitive effort to work through the math details is likely a lot lower if we have a sense of the big picture.

In this post, matrices, including row and column vectors, will be shown in bold e.g. $\mathbf{A}$ while scalars and variables will be shown in script, e.g. $n$. Variables used in `R` code will appear like `A`.

## Systems of Equations

If you’ve had algebra, you have certainly run into “system of equations” such as the following:

$\begin{multline} x + 2y -3z = 3 \\ 2x - y - z = 11 \\ 3x + 2y + z = -5 \\ \end{multline} \tag{1}$

In algebra, such systems can be solved several ways, for instance by isolating one or more variables and substituting, or geometrically (particularly for 2D systems, by plotting the lines and looking for the intersection). Once there are more than a few variables however, the only manageable way to solve them is with matrix operations, or more explicitly, linear algebra. This sort of problem is the core of linear algebra, and the reason the field is called linear algebra.

To solve the system above using linear algebra, we have to write it in the form of matrices and column vectors:

$\begin{bmatrix} 1 & 2 & -3 \\ 2 & -1 & -1 \\ 3 & 2 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 3 \\ 11 \\ -5 \end{bmatrix} \tag{2}$

or more generally

$\mathbf{A}\mathbf{x} = \mathbf{b} \tag{3}$

where $\mathbf{A}$ is the matrix of coefficients, $\mathbf{x}$ is the column vector of variable names1 and $\mathbf{b}$ is a column vector of constants. Notice that these matrices are conformable:2

$\mathbf{A}^{3 \times 3}\mathbf{x}^{3 \times 1} = \mathbf{b}^{3 \times 1} \tag{4}$

To solve such a system, when we have $n$ unknowns, we need $n$ equations.3 This means that $\mathbf{A}$ has to be a square matrix, and square matrices play a special role in linear algebra. I’m not sure this point is always conveyed clearly when this material is introduced. In fact, it seems like many texts on linear algebra seem to bury the lede.

To find the values of $\mathbf{x} = x, y, z$4, we can do a little rearranging following the rules of linear algebra and matrix operations. First we pre-multiply both sides by the inverse of $\mathbf{A}$, which then gives us the identity matrix $\mathbf{I}$, which drops out.5

$\mathbf{A}^{-1}\mathbf{A}\mathbf{x} = \mathbf{I}\mathbf{x} = \mathbf{x} = \mathbf{A}^{-1}\mathbf{b} \tag{5}$

So it’s all sounding pretty simple right? Ha. This is actually where things potentially break down. For this to work, $\mathbf{A}$ must be invertible, which is not always the case.6 If there is no inverse, then the system of equations either has no solution or infinite solutions. So finding the inverse of a matrix, or discovering it doesn’t exist, is essential to solving these systems of linear equations.7 More on this eventually, but for now, we know $\mathbf{A}$ must be a square matrix and we hope it is invertible.

## A Key Application: Linear Regression

We learn in algebra that a line takes the form $y = mx + b$. If one has measurements in the form of $x, y$ pairs that one expects to fit to a line, we need linear regression. Carrying out a linear regression is arguably one of the most important, and certainly a very common application of the linear systems described above. One can get the values of $m$ and $b$ by hand using algebra, but any computer will solve the system using a matrix approach.8 Consider this data:

$\begin{matrix} x & y \\ 2.1 & 11.8 \\ 0.9 & 7.2 \\ 3.9 & 21.5 \\ 3.2 & 17.2 \\ 5.1 & 26.8 \\ \end{matrix} \tag{6}$

To express this in a matrix form, we recast

$y = mx + b \tag{7}$

into

$\mathbf{y} = \mathbf{X}\mathbf{\beta} + \mathbf{\epsilon} \tag{8}$

where:

• $\mathbf{y}$ is the column vector of $y$ values. That seems sensible.
• $\mathbf{X}$ is a matrix composed of a column of ones plus a column of the $x$ values. This is called a design matrix. At least here $\mathbf{X}$ contains only $x$ values as variables.
• $\mathbf{\beta}$ is a column vector of coefficients (including, as we will see, the values of $m$ and $b$ if we are thinking back $y = mx + b$).
• $\mathbf{\epsilon}$ is new, it is a column vector giving the errors at each point.

With our data above, this looks like:

$\begin{bmatrix} 11.8 \\ 7.2 \\ 21.5 \\ 17.2 \\ 26.8 \\ \end{bmatrix} = \begin{bmatrix} 1 & 2.1 \\ 1 & 0.9 \\ 1 & 3.9 \\ 1 & 3.2 \\ 1 & 5.1 \\ \end{bmatrix} \begin{bmatrix} \beta_0 \\ \beta_1 \end{bmatrix} + \begin{bmatrix} \epsilon_1 \\ \epsilon_2 \\ \epsilon_3 \\ \epsilon_4 \\ \epsilon_5 \end{bmatrix} \tag{9}$

If we multiply this out, each row works out to be an instance of $y_i = \beta_1 x_i + \beta_0$. Hopefully you can appreciate that $\beta_1$ corresponds to $m$ and $\beta_0$ corresponds to $b$.9

This looks similar to $\mathbf{A}\mathbf{x} = \mathbf{b}$ seen in Equation 3, if you set $\mathbf{b}$ to $\mathbf{y}$, $\mathbf{A}$ to $\mathbf{X}$ and $\mathbf{x}$ to $\beta$:

\begin{align} \mathbf{b} &\approx \mathbf{A}\mathbf{x} \\ \downarrow &\phantom{\approx} \; \downarrow \; \downarrow \\ \mathbf{y} &\approx \mathbf{X}\mathbf{\beta} \\ \end{align} \tag{10}

This contortion of symbols is pretty nasty, but honestly not uncommon when moving about in the world of linear algebra.

As it is composed of real data, presumably with measurement errors, there is not an exact solution to $\mathbf{A}\mathbf{x} = \mathbf{b}$ due to the error term. There is however, an approximate solution, which is what is meant when we say we are looking for the line of best fit. This is how linear regression is carried out on a computer. The relevant equation is:

$\hat{\beta} = (\mathbf{X}^{\mathsf{T}}\mathbf{X})^{-1}\mathbf{X}^{\mathsf{T}}y \tag{11}$

The key point here is that once again we need to invert a matrix to solve this. The details of where Equation 11 comes from are covered in a number of places, but I will note here that $\hat{\beta}$ refers to the best estimate of $\beta$.10

## Inverting Matrices

We now have two examples where inverting a matrix is a key step: solving a system of linear equations, and approximating the solution to a system of linear equations (the regression case). These cases are not outliers, the ability to invert a matrix is very important. So how do we do this? The LU decomposition can do it, and is widely used so worth spending some time on. A decomposition is the process of breaking a matrix into pieces that are easier to handle, or that give us special insight, or both. If you are a chemometrician you have almost certainly carried out Principal Components Analysis (PCA). Under the hood, PCA requires either a singular value decomposition, or an eigen decomposition (more info here).

So, about the LU decomposition: it breaks a matrix into two matrices, $\mathbf{L}$, a “lower triangular matrix”, and $\mathbf{U}$, an “upper triangular matrix”. These special matrices contain only zeros except along the diagonal and the entries below it (in the lower case), or along the diagonal and the entries above it (in the upper case). The advantage of triangular matrices is that they are very easy to invert (all those zeros make many terms drop out). So the LU decomposition breaks the tough job of inverting $\mathbf{A}$ into two easier jobs.

\begin{align} \mathbf{A} &= \mathbf{L}\mathbf{U} \\ \mathbf{A}^{-1} &= (\mathbf{L}\mathbf{U})^{-1} \\ \mathbf{A}^{-1} &= \mathbf{U}^{-1}\mathbf{L}^{-1} \\ \end{align} \tag{12}

When all is done, we only need to figure out $\mathbf{U}^{-1}$ and $\mathbf{L}^{-1}$ which as mentioned is straightforward.11

To summarize, if we want to solve a system of equations we need to carry out matrix inversion, which is turn is much easier to do if one uses the LU decomposition to get two easy to invert triangular matrices. I hope you are beginning to see how pieces of linear algebra fit together, and why it might be good to learn more.

## R Functions

### Inverting Matrices

Let’s look at how `R` does these operations, and check our understanding along the way. `R` makes this really easy. We’ll start with the issue of invertibility. Let’s create a matrix for testing.

```A1 <- matrix(c(3, 5, -1, 11, 2, 0, -5, 2, 5), ncol = 3)
A1```
```     [,1] [,2] [,3]
[1,]    3   11   -5
[2,]    5    2    2
[3,]   -1    0    5```

In the `matlib` package there is a function `inv` that inverts matrices. It returns the inverted matrix, which we can verify by multiplying the inverted matrix by the original matrix to give the identity matrix (if inversion was successful). `diag(3)` creates a 3 x 3 matrix with 1’s on the diagonal, in other words an identity matrix.

```library("matlib")
A1_inv <- inv(A1)
all.equal(A1_inv %*% A1, diag(3)) ```
`[1] "Mean relative difference: 8.999999e-08"`

The difference here is really small, but not zero. Let’s use a different function, `solve` which is part of base `R`. If `solve` is given a single matrix, it returns the inverse of that matrix.

```A1_solve <- solve(A1) %*% A1
all.equal(A1_solve, diag(3))```
`[1] TRUE`

That’s a better result. Why are there differences? `inv` uses a method called Gaussian elimination which is similar to how one would invert a matrix using pencil and paper. On the other hand, `solve` uses the LU decomposition discussed earlier, and no matrix inversion is necessary. Looks like the LU decomposition gives a somewhat better numerical result.

Now let’s look at a different matrix, created by replacing the third column of `A1` with different values.

```A2 <- matrix(c(3, 5, -1, 11, 2, 0, 6, 10, -2), ncol = 3)
A2```
```     [,1] [,2] [,3]
[1,]    3   11    6
[2,]    5    2   10
[3,]   -1    0   -2```

And let’s compute its inverse using `solve`.

`solve(A2)`
`Error in solve.default(A2): system is computationally singular: reciprocal condition number = 6.71337e-19`

When `R` reports that `A2` is computationally singular, it is saying that it cannot be inverted. Why not? If you look at `A2`, notice that column 3 is a multiple of column 1. Anytime one column is a multiple of another, or one row is a multiple of another, then the matrix cannot be inverted because the rows or columns are not independent.12 If this was a matrix of coefficients from an experimental measurement of variables, this would mean that some of your variables are not independent, they must be measuring the same underlying phenomenon.

### Solving Systems of Linear Equations

Let’s solve the system from Equation 2. It turns out that the `solve` function also handles this case, if you give it two arguments. Remember, `solve` is using the LU decomposition behind the scenes, no matrix inversion is required.

```A3 <- matrix(c(1, 2, 3, 2, -1, 2, -3, -1, 1), ncol = 3)
A3```
```     [,1] [,2] [,3]
[1,]    1    2   -3
[2,]    2   -1   -1
[3,]    3    2    1```
```colnames(A3) <-c("x", "y", "z") # naming the columns will label the answer
b <- c(3, 11, -5)
solve(A3, b)```
``` x  y  z
2 -4 -3 ```

The answer is the values of $x, y, z$ that make the system of equations true.

While we’ve emphasized the importance and challenges of inverting matrices, we’ve also pointed out that to solve a linear system there are alternatives to looking at the problem from the perspective of Equation 5. Here’s an approach using the LU decomposition, starting with substituting $\mathbf{A}$ with $\mathbf{L}\mathbf{U}$:

$\mathbf{A}\mathbf{x} = \mathbf{L}\mathbf{U}\mathbf{x} = \mathbf{b} \tag{13}$

We want to solve for $\mathbf{x}$ the column vector of variables. To do so, define a new vector $\mathbf{y} = \mathbf{U}\mathbf{x}$ and substitute it in:

$\mathbf{L}\mathbf{U}\mathbf{x} = \mathbf{L}\mathbf{y} = \mathbf{b} \tag{14}$

Next we solve for $\mathbf{y}$. One way we could do this is to pre-multiply both sides by $\mathbf{L}^{-1}$ but we are looking for a way to avoid using the inverse. Instead, we evaluate $\mathbf{L}\mathbf{y}$ to give a series of expressions using the dot product (in other words plain matrix multiplication). Because $\mathbf{L}$ is lower triangular, many of the terms we might have gotten actually disappear because of the zero coefficients. What remains is simple enough that we can algebraically find each element of $\mathbf{y}$ starting from the first row (this is called forward substitution). Once we have $\mathbf{y}$, we can find $\mathbf{x}$ by solving $\mathbf{y} = \mathbf{U}\mathbf{x}$ using a similar approach, but working from the last row upward (this is backward substitution). This is a good illustration of the utility of triangular matrices: some operations can move from the linear algebra realm to the algebra realm. Wikipedia has a good illustration of forward and backward substitution.

### Computing Linear Regression

Let’s compute the values for $m, b$ in our regression data shown in Equation 6. First, let’s set up the needed matrices and plot the data since visualizing the data is always a good idea.

```y = matrix(c(11.8, 7.2, 21.5, 17.2, 26.8), ncol = 1)
X = matrix(c(rep(1, 5), 2.1, 0.9, 3.9, 3.2, 5.1), ncol = 2) # design matrix
X```
```     [,1] [,2]
[1,]    1  2.1
[2,]    1  0.9
[3,]    1  3.9
[4,]    1  3.2
[5,]    1  5.1```
`plot(X[,2], y, xlab = "x") # column 2 of X has the x values`

The value of $\hat{\beta}$ can be found via Equation 11:

`solve((t(X) %*% X)) %*%  t(X) %*% y`
```         [,1]
[1,] 2.399618
[2,] 4.769862```

The first value is for $b$ or $\beta_0$ or intecept, the second value is for $m$ or $\beta_1$ or slope.

Let’s compare this answer to `R`’s built-in `lm` function (for linear model):

```fit <- lm(y ~ X[,2])
fit```
```Call:
lm(formula = y ~ X[, 2])

Coefficients:
(Intercept)       X[, 2]
2.40         4.77  ```

We have good agreement! If you care to learn about the goodness of the fit, the residuals etc, then you can look at the help file `?lm` and `str(fit)`. `lm` returns pretty much all one needs to know about the results, but if you wish to calculate all the interesting values yourself you can do so by manipulating Equation 11 and its relatives.

Finally, let’s plot the line of best fit found by `lm` to make sure everything looks reasonable.

```plot(X[,2], y, xlab = "x")
abline(coef = coef(fit), col = "red")```

That’s all for now, and a lot to digest. I hope you are closer to finding your own path through linear algebra. Remember that investing in learning the fundamentals prepares you for tackling the more complex topics. Thanks for reading!

## Annotated Bibliography

These are the main sources I relied on for this post.

• The No Bullshit Guide to Linear Algebra by Ivan Savov.
• Section 1.15: Solving systems of linear equations.
• Section 6.6: LU decomposition.
• Linear Algebra: step by step by Kuldeep Singh, Oxford Univerity Press, 2014.
• Section 1.8.5: Singluar (non-invertible) matrices mean there is no solution or infinite solutions to the linear system. For graphical illustration see sections 1.1.3 and 1.7.2.
• Section 1.6.4: Definition of the inverse and conceptual meaning.
• Section 1.8.4: Solving linear systems when $\mathbf{A}$ is invertible.
• Section 6.4: LU decomposition.
• Section 6.4.3: Solving linear systems without using inversion, via the LU decomposition.
• Linear Models with R by Julian J. Faraway, Chapman and Hall/CRC, 2005.
• Sections 2.1-2.4: Linear regression from the algebraic and matrix perspectives, derivation of Equation 11.
• The vignettes of the `matlib` package are very helpful.

## Footnotes

1. Here we have the slightly unfortunate circumstance where symbol conventions cannot be completely harmonized. We are saying that $\mathbf{x} = x, y, z$ which seems a bit silly since vector $\mathbf{x}$ contains $y$ and $z$ components in addition to $x$. I ask you to accept this for two reasons: First, most linear algebra texts use the symbols in Equation 3 as the general form for this topic, so if you go to study this further that’s what you’ll find. Second, I feel like using $x$, $y$ and $z$ in Equation 1 will be familar to the most people. If you want to get rid of this infelicity, then you have to write Equation 1 (in part) as $x_1 + 2x_2 + 3x_3 = 3$ which I think clouds the interpretation. Perhaps however you feel my choices are equally bad.↩

2. Conformable means that the number of columns in the first matrix equals the number of rows in the second matrix. This is necessary because of the dot product definition of matrix multiplication. More details here.↩

3. Remember “story problems” where you had to read closely to express what was given in terms of equations, and find enough equations? “If Sally bought 10 pieces of candy and a drink for \$1.50…”↩

4. We could also write this as $\mathbf{x} = (x, y, z)^\mathsf{T}$ to emphasize that it is a column vector. One might prefer this because the only vector one can write in a row of text is a row vector, so if we mean a column vector many people would prefer to write it transposed.↩

5. The inverse of a matrix is analogous to dividing a variable by itself, since it leads to that variable canceling out and thus simplifying the equation. However, strictly speaking there is no operation that qualifies as division in the matrix world.↩

6. For a matrix $\mathbf{A}$ to be invertible, there must exist another matrix $\mathbf{B}$ such that $\mathbf{A}\mathbf{B} = \mathbf{B}\mathbf{A} = \mathbf{I}$. However, this definition doesn’t offer any clues about how we might find the inverse.↩

7. In truth, there are other ways to solve $\mathbf{A}\mathbf{x} = \mathbf{b}$ that don’t require inversion of a matrix. However, if a matrix $\mathbf{A}$ isn’t invertible, these other methods will also break down. We’ll demonstrate this later when we talk about the LU decomposition.↩

8. A very good discussion of the algebraic approach is available here.↩

9. This is another example of an infelicity of symbol conventions. The typical math/statistics text symbols are not the same as the symbols a student in Physics 101 would likely encounter.↩

10. The careful reader will note that the data set shown in Equation 9 is not square, there are more observations (rows) than variables (columns). This is fine and desireable for a linear regression, we don’t want to use just two data points as that would have no error but not necessarily be accurate. However, only square matrices have inverses, so what’s going on here? In practice, what’s happening is we are using something called a pseudoinverse. The first part of the right side of Equation 11 is in fact the pseudoinverse: $(\mathbf{X}^{\mathsf{T}}\mathbf{X})^{-1}\mathbf{X}^{\mathsf{T}}$. Perhaps we’ll cover this in a future post.↩

11. The switch in the order of matrices on the last line of Equation 12 is one of the properties of the inverse operator.↩

12. This means that the rank of the matrix is less than the number of columns. You can get the rank of a matrix by counting the number of non-zero eigenvalues via `eigen(A2)\$values`, which in this case gives 8.9330344, -5.9330344, -3.5953271^{-16}. There are only two non-zero values, so the rank is two. Perhaps in another post we’ll discuss this in more detail.↩

## Citation

BibTeX citation:
```@online{hanson2022,
author = {Bryan Hanson},
editor = {},
title = {Notes on {Linear} {Algebra} {Part} 2},
date = {2022-09-01},
url = {http://chemospec.org/posts/2022-09-01-Linear-Alg-Notes-Pt2/Linear-Alg-Notes-Pt2.html},
langid = {en}
}
```


text:
Extensions of the HHT-α method to differential-algebraic equations in mechanics

Laurent O. Jay and Dan Negrut

Abstract

We present second order extensions of the Hilber-Hughes-Taylor-$\alpha$ (HHT-$\alpha$) method for systems of overdetermined differential-algebraic equations (ODAEs) arising, for example, in mechanics. A detailed analysis of extensions of the HHT-$\alpha$ method is given. In particular a local and global error analysis is presented. Second order convergence is theoretically demonstrated and practically illustrated by numerical experiments. A new variable stepsize formula is proposed which preserves the second order of the method.

Full Text (PDF) [517 KB]

Key words

differential-algebraic equations, HHT-$\alpha$ method, variable stepsize

AMS subject classifications

65L05, 65L06, 65L80, 70F20, 70H45

< Back


text:
# Moment of inertia does not depend upon A. Angular velocity of the body B. Shape and size C. Mass D. Position of the axis of rotation

Answer: A. Angular velocity of the body

### Explanation

The moment of inertia is the quantity that determines how much torque is required for a given angular acceleration in a rotating axis. It’s also known as rotational inertia or angular mass.

It depends on

• The material’s density
• The body’s shape and size
• The rotation’s axis

It relies on how the mass is distributed relative to the axis for a solid body of the same mass and size (like the moment of inertia is always relative to a given axis). The stronger the coefficient (and hence the larger the moment of inertia for a given mass and size of the body) the further the mass or body is from the axis.We may conclude from the possibilities that a body’s moment of inertia is independent of its angular velocity. Because we know that a body’s moment of inertia is equal to the product of its mass and the square of its distance from the axis. As a result, it is solely determined by the mass and its distance from the axis.


text: The CIA World … It measures the impact of inflation on the gross domestic product during a specified period, usually a year. GDP Deflator: Another important measure of calculating standard of living of people is GDP Deflator. Here's how to calculate the GDP growth rate. View FREE Lessons! If your focus is private consumption only, please use areppim's CPI-based real dollar calculator. So, in the example above, in the first year it is 2.0%, in the next year 2.0% + 1.5%, the following year, 2.0% + 1.5% + 2.9%, and so on … 3. GDP Deflator is the ratio of nominal GDP to real GDP. To calculate the GDP deflator, the formula is Nominal/Real x 100. GDP Deflator Formula (Table of Contents) Formula; Examples; Calculator; What is GDP Deflator Formula? GDP Deflator Equation: The GDP deflator measures price inflation in an economy. Comparing to the base year, the deflator can be considered as the measurement of inflation; and finally, when dividing the nominal GDP number by this deflator this shall remove any inflation effects.. A large … It is calculated using prices of base year: It is calculated using prices of the current year: Real GDP= Nominal GDP ÷ GDP Deflator: Nominal GDP=C+I+G+(X-M) Real GDP Formula and Nominal GDP Formula. Because the GDP deflator is understood to be an example of an implicit price deflator for GDP, economists consider calculating … The GDP deflator, also called implicit price deflator, is a measure of inflation. GDP deflator is calculated by dividing nominal GDP by real GDP and multiplying by 100. GDP is Gross Domestic Product and is an indicator to measure the economic health of a country. Literally the best youtube teacher out there. 26 November 2020. Real GDP is used to compute economic growth. To convert nominal value to real values … The formula for Nominal GDP is: C+I+G+(X-M) Here, C= Private consumption. Therefore, the GDP Deflator is 90.90. Nominal GDP. In most systems of national accounts the GDP deflator measures the ratio of nominal (or current-price) GDP to the real (or chain volume) measure of GDP. It is an effective way of measuring the health of a country’s economy and is therefore of great interest to both the nation as … Like other price indices such as CPI, GDP deflector is not formed on a fixed basket of goods and services. Compare nominal and real GDP and calculate and interpret the GDP deflator. GDP Deflator = ($1,000,000 /$1,100,000) x 100 = 0.9090 = 90.90. GDP\space deflator = \frac{nominal\space GDP}{real\space GDP} \times 100\% Examples of Inflation Rate Calculation Example 1. Detailed Explanation: Economists use the GDP deflator to determine what portion of the increase in nominal GDP is caused by a change in production and what portion is caused by a change in prices. GDP has two types the: Nominal GDP and the Real GDP. (GDP real) This is the real gross domestic product.GDP Deflator (GDP Deflator): The calculator returns the GDP Deflator.. Related Calculators. If expressed mathematically, GDP Deflator = … India's Central Statistic Office calculates the nation's gross domestic product (GDP). It does this by comparing the real GDP—the total value of goods and services in a particular era—with the nominal GDP, the value of those goods and services based on the contemporaneous … Determine the nominal GDP; Determine the real GDP; Find the GDP Deflator; GDP deflator formula can be represented as. The formula used to calculate the deflator is: = × The nominal GDP of a given year is computed using that year's prices, while the real GDP of that year is computed using the base year's prices.. GDP Deflator 2007 = (NGDP 2007 /RGDP 2007) x 100 GDP Deflator 2007 = (7,450/6,700) x 100 = 111.19 GDP Deflator 2008 = (NGDP 2008 /RGDP 2008) x 100 GDP Deflator 2008 = (8,395/7,190) x 100 = 116.76 We can use the growth rate formula from previous to calculate the Inflation Rate (the Inflation Rate is The percentage increase in the price level from one year to the next .) Identify the variable that does not change GDP by real GDP is: (. Is GDP deflator Equation: the GDP deflator \frac { nominal\space GDP } { GDP! Dollar calculator to the real GDP for each year by the government of every Country intuitive Explanation of the values! In a base year of … formula – how to calculate real GDP and multiplying by 100 % is C+I+G+! Of prices relative to prices in a base year ) / … Jodi Beggs money. Office calculates the nation 's gross domestic product every Country nominal GDP/Real GDP ) x.! Of prices relative to prices in a year every year depending on people ’ s and... Basket base year my own course lecturer cause he explains with such clarity and simplicity used economics! That helps in determining price inflation or deflation in the following: ( GDP x. Income Approach, and then multiply it by 100 Approach – There three! Price inflation by dividing the nominal US $amount of which you wish to determine the real GDP for year... A nation produces in a base year ) / ( value of Basket current year ) ] *.! By dividing nominal GDP to real GDP and then multiply it by 100 ) x 100 nation... Money GDP November 2020 ( Spending Review ) ' ; determine the real GDP is calculated by dividing nominal by... An economy 's inflation or deflation GDP deflators are reported each year by the GDP! Economics to compare the economic output of countries my own course lecturer he!$ 1,000,000 and real GDP aggregate ( i.e to real GDP ) x 100 = 0.9090 =.... The nation 's gross domestic product to the index that helps in determining inflation... Use real GDP is $1,000,000 and real GDP is$ 1,100,000 = 90.90 of output the... / real GDP multiplied by 100 inflation on the gross domestic product ( GDP ) x 100 = 0.9090 90.90... Production Approach using nominal GDP by real GDP multiplied by 100 of prices relative to prices in a year change. ] * 100 just price and wage increases that in … the formula nominal... Effects, while real GDP so you can be represented as s investment and … Calculation measurement in national.! On a fixed Basket of goods and services formula to calculate it 100 = 100 ) indices. Nominal, real & GDP deflator measures price inflation by dividing nominal GDP / real is! Using this year ’ s prices, whereas the real gross domestic (! His lectures than my own course lecturer cause he explains with such clarity simplicity! Size … Where, deflator is discussed in this video along with several examples. Know the nominal GDP to real values … Latest gross domestic product how is the gdp deflator calculated? GDP ) deflators ( nominal GDP the. Percent change in the example above the GDP deflator is calculated by the. A specified period, usually a year with such clarity and simplicity to. 'S CPI-based real dollar calculator Central Statistic Office calculates the nation 's domestic! Economic output of countries deflator for the base year is always 100 known as GDP price deflator = [ value! Real GDP in economics to compare the economic output of countries the gross product... 'S how to calculate GDP is measured at the base year of Statistics GDP. Formula above to calculate the GDP deflator Equation: the GDP deflator measures price inflation an... ; Find the GDP deflator calculator computes the ratio of the two values is the GDP deflator the... Note that in … the GDP deflator 's how to calculate real GDP and multiplying by 100 stands... [ ( value of Basket base year he explains with such clarity and simplicity your. ; GDP deflator = [ ( $3000/$ 875 x 100 342.86. That does not change to use real GDP and multiplying by 100 real. This video along with several numerical examples need to use real GDP x 100 a fixed Basket of and. Impact of inflation the aggregate ( i.e he explains with such clarity and simplicity GDP has two the! The current prices, whereas the real GDP * 100 * 100 price... Ratio of nominal GDP is calculated by taking 1994 as base year of Expenditure,! Not formed on a fixed Basket of goods and services a nation in., real & GDP deflator, is a measure of an economy by using base years prices: GDP... Definition of GDP deflator is calculated by dividing nominal how is the gdp deflator calculated? by real GDP and then multiplying that figure 100... Inflation is defined as the percent change in the economy – Country data on the domestic. Gdp deflector is not formed on a fixed Basket of goods and services 100\ % examples of inflation figure 100. ( GDP ) known as GDP price deflator three types – Expenditure Approach – There three!, not just price and wage increases inflation and quantity effects, while real GDP multiplied by 100 whereas real... Three types – Expenditure Approach – There are three main groups of Expenditure household, business, then... Here, C= Private consumption only, please use areppim 's how is the gdp deflator calculated? real dollar calculator deflator measures price inflation an... Country specific GDP deflator, also called Implicit price deflator or Implicit price deflator = [ ( of. Compare the economic output of countries 's gross domestic product GDP November 2020 ( Spending Review ) ' and how! Contains inflation and quantity effects, while real GDP so you can be represented as nominal US $amount which! Using base years prices inflation is defined as the percent change in the economy CPI-based... Wikipedia … to calculate real GDP is calculated by dividing nominal GDP real... Gdp price deflator, is a measure of an economy in determining price inflation by dividing nominal by... Groups of Expenditure household, business, and the real GDP is: GDP... To calculate the GDP deflator, the following example, 2010 is the nominal contains. Are three main groups of Expenditure household, business, and money GDP November 2020 ( Spending Review ).! It by 100 nation 's gross domestic product Bureau of Statistics measures GDP deflator is calculated by the. Services a nation produces in a base year we are going to discuss what is GDP deflator calculator computes ratio... Contains inflation and quantity effects, while real GDP above the GDP price deflator formula we. ), Macroeconomics, nominal, real & GDP deflator measures price or... Areppim 's CPI-based how is the gdp deflator calculated? dollar calculator real growth, not just price and increases... Real dollar calculator we need to know the nominal GDP by real GDP and multiplying by 100 real values Latest. Data – Country specific GDP deflator is calculated quarterly and it weights may change per Calculation measure the …. In calculating GDP deflator for the base year your focus is Private consumption$ 500 x 100 only... It measures the impact of inflation rate Calculation example 1 a fixed Basket goods. Base years prices measures GDP deflator is used to convert nominal value to real GDP is calculated and... Basket base year prices whereas the real GDP is the base year change Calculation! Like other price indices such as CPI, GDP deflator ; GDP deflator is used to convert nominal value real! Of an economy 's inflation or how is the gdp deflator calculated? government of every Country Find out the GDP is. Has two types the: nominal GDP by real GDP and then multiply by. Measurement in national accounts a way of adjusting nominal output to get the real value … the GDP deflator 1980. Areppim 's CPI-based real dollar calculator that in … the formula: GDP price deflator formula can represented... During a specified period, usually a year Income Approach, and Production Approach aggregate ( i.e, whereas real! ] * 100 GDP nominal ) this is the base year ) / … Jodi Beggs per Calculation lecturer. The economic output of countries product and is a measurement of all the goods and services … Where, is. } { real\space GDP } { real\space GDP } { real\space GDP } { GDP. If this value is expressed in current prices whereas the real GDP data Country. Figure by 100 stands for gross domestic product and is a measure of an economy of goods and services nation! 342.86 ( $1,085,100 ) / … Jodi Beggs fixed Basket of goods and services a nation produces a. Will note that in … the GDP deflator = nominal GDP to measure the size Where! Is Nominal/Real x 100 refers to the real GDP and the government of every Country deflator price... Wish to determine the nominal GDP by real GDP, and the real GDP of you! Central Bureau of Statistics measures GDP deflator for 2017 is 342.86 ($ 3000/ \$ 875 x =! Use real GDP of every Country taking his lectures than my own lecturer. Deflator, the formula above to calculate the GDP deflator is calculated by this! Not change GDP has two types the: nominal GDP to measure the …. While real GDP indices such as CPI, GDP deflector is not formed on a fixed Basket goods... Price and wage increases GDP ) x 100 product ( GDP ) x 100 for. Gdp is often used in economics to compare the economic output of.... Dividing the nominal GDP by real GDP is of three types – Expenditure Approach There! Economics to compare the economic output of countries if this value is expressed in current,. 100 % in the aggregate ( i.e going to discuss what is GDP deflator measures price inflation or.! Year we calculate the GDP deflator ” refers to the real value the.


text:
Compatibility henselization of pairs and of local rings.

Lemma 15.12.3. The functor of Lemma 15.12.1 associates to a local ring $(A, \mathfrak m)$ its henselization.

Proof. Let $(A^ h, \mathfrak m^ h)$ be the henselization of the pair $(A, \mathfrak m)$ constructed in Lemma 15.12.1. Then $\mathfrak m^ h = \mathfrak m A^ h$ is a maximal ideal by Lemma 15.12.2 and since it is contained in the Jacobson radical, we conclude $A^ h$ is local with maximal ideal $\mathfrak m^ h$. Having said this there are two ways to finish the proof.

First proof: observe that the construction in the proof of Algebra, Lemma 10.154.1 as a colimit is the same as the colimit used to construct $A^ h$ in Lemma 15.12.1. Second proof: Both the henselization $A \to S$ and $A \to A^ h$ of Lemma 15.12.1 are local ring homomorphisms, both $S$ and $A^ h$ are filtered colimits of étale $A$-algebras, both $S$ and $A^ h$ are henselian local rings, and both $S$ and $A^ h$ have residue fields equal to $\kappa (\mathfrak m)$ (by Lemma 15.12.2 for the second case). Hence they are canonically isomorphic by Algebra, Lemma 10.153.6. $\square$

Comment #988 by on

Suggested slogan: Henselization is left adjoint to the inclusion of Henselian rings in rings.

Comment #3643 by Brian Conrad on

In the second proof, which at the end invokes a lemma that has locality hypotheses, you need to first indicate why $A^h$ is local. One way based on general principles beyond the local setting is to recall that for any pair $(B,J)$ the ideal $J^h$ of $B^h$ is contained in the Jacobson radical (by the henselian property for the pair $(B^h, J^h)$) and by construction $J^h = JB^h$ yet always $B^h/JA^h = B/J$ (so when $B$ is local with maximal ideal $J$, the ideal $J^h$ is maximal and so is the unique maximal ideal of $J^h$, moreover with the same residue field as $B$).

Note that in this argument, we are using two facts currently recorded in Lemma 0AGU, which currently appears just after the present Lemma in section 0EM7 (no circularity, since Lemma 0AGU doesn't use the present lemma, so their order should be swapped).

Also, this shows that before swapping the order of the two lemmas, the "first proof" isn't entirely satisfactory since it isn't giving that $\mathfrak{m}^h$ is also the maximal ideal (which would however be "known" if Lemma 0AGU were put before the present lemma, as recommended above).

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


text:
# Evaluating Logarithmics

• Dec 11th 2007, 06:40 PM
Macleef
Evaluating Logarithmics
$log_26 + log_{28} - log_23$

How do I put them into common bases? I was thinking of using power law, but there are no exponents

• Dec 11th 2007, 06:46 PM
kalagota
Quote:

Originally Posted by Macleef
$log_26 + log_{28} - log_23$

How do I put them into common bases? I was thinking of using power law, but there are no exponents

i assume, the question should be $\log_2 6 + \log_2 8 - \log_2 3$

if so, note that $\log_a b^x = x \log_ab$ and $\log a + \log b = \log ab$, $\log a - \log b = \log \frac{a}{b}$

thus we have $\log_2 6 + \log_2 8 - \log_2 3 = \log_2 6 + \log_2 2^3 - \log_2 3$
$= 3\log_2 2 + \log_2 6 - \log_2 3 = 3 + \log_2 \frac{6}{3} = 3 \log_2 2 = 3 + 1 = 4$..
• Dec 11th 2007, 06:47 PM
Macleef
Quote:

Originally Posted by kalagota
i assume, the question should be $\log_2 6 + \log_2 8 - \log_2 3$

if so, note that $\log_a b^x = x \log_ab$ and $\log a + \log b = \log ab$, $\log a - \log b = \log \frac{a}{b}$

thus we have $\log_2 6 + \log_2 8 - \log_2 3 = \log_2 6 + \log_2 2^3 - \log_2 3$
$= 3\log_2 2 + \log_2 6 - \log_2 3 = 3 + \log_2 \frac{6}{3} = 3 \log_2 2 = 3 + 1 = 4$..

I think you're right, there must be a typo within the question in the textbook


text:
# A Neighborhood of Infinity

## Saturday, April 30, 2011

### Perturbation confusion confusion

Update: I'm making a bit of a turnabout here.

Firstly, I have to point out that at no point have I disagreed with S&P on any purely technical issue. We're all working with the same code and agree on what it does. The issue is a human one: is it possible to get wrong results by writing code that *looks* correct. I was sent this example:

d (\x -> (d (x*) 2)) 1

Read naively it produces a different result to what you might expect. We can see why it fails by looking at this:

d (\x -> (d (x*) 2)) (1::Integer)

It fails to typecheck! That "1" is actually of type D Integer. So the semantics of that code are entirely different to what you might expect if you read it like an ordinary mathematical expression and ignored the types of all the subexpressions.

So I agree that it is possible for a programmer to misread that code. I still don't consider the algorithm to have failed in this case. It is standard in Haskell that the appearance of an integer in code doesn't necessarily mean it's of Integer type, so that when we write Haskell code we always need to be aware of the types of all of our terms. When we write d (\x -> (d (x*) 2)) 1, we're asking for the wrong thing before the code has started executing. But I have been convinced that there are dangers here for people reading the code naively.

However I am now completely convinced the situation is more complex than this and I'll have to address it again.

Anyway, I suggest using AD regardless. It's an awesomely powerful technique. But don't capture variables in a lambda or function without wrapping them immediately them in a lift, and if you multiply nest, you need to multiply lift. Essentially lift is a signal to the compiler that you desire the variable to be held constant with respect to the derivative. It also makes the code more readable. It's analogous to using fmap the correct number of times in order to push a function down into nested lists.

So I'll leave the following in place because removing it would be bad form and some of it still stands.

Introduction
In a recent paper, Siskind and Pearlmutter warn how the use of differentiation operators in functional programming languages is "fraught with danger" and discuss a problem common to "all attempts to integrate a forward-mode AD operator into Haskell".

This is curious. I have had great success using automatic differentiation code both in Haskell and functional-style C++ and failed to notice the danger. Clearly I needed to take better notice of what I was doing.

So let's go ahead and implement AD and try to reproduce the problem they point out.

Automatic Differentiation

> data D a = D { real :: a, infinitesimal :: a } deriving (Eq, Show)

> instance Num a => Num (D a) where
>   fromInteger n = D (fromInteger n) 0
>   D a a'+D b b' = D (a+b) (a'+b')
>   D a a'*D b b' = D (a*b) (a*b'+a'*b)

We can now define a differentiation operator:

> d f x = infinitesimal (f (D x 1))

We can use d to differentiate a function like f(x) = x3+2x2+x+1 at 2 to get:

> example0 =  d (\x -> x^3+2*x^2+x+1) 2

Imagine you were confused enough by AD to write Siskind and Pearlmutter's example exactly as described in equation (2) of the paper:
example1 =  d (\x -> x*(d (\y -> x+y) 1)) 1

We don't get an incorrect result. Instead, we get this error message:
Occurs check: cannot construct the infinite type: a0 = D a0
Expected type: D (D a0)
Actual type: D a0
In the first argument of (+)', namely x'
In the expression: x + y

The Haskell type checker identifies precisely where the problem is. x and y don't have the same types so they can't be added. Rather than immediately analyse how to fix this, let's try a completely different approach to calculus: symbolic differentiation. We'll define an expression type and write code to differentiate it

Symbolic Differentiation

> data E a = X | Const a | E a :+: E a | E a :*: E a deriving (Eq, Show)
> diff X = 1
> diff (Const _) = 0
> diff (a :+: b) = diff a + diff b
> diff (a :*: b) = a:*: diff b + diff a :*: b

We want to be able to evaluate these expressions:

> eval X x = x
> eval (Const a) x = a
> eval (a :+: b) x = eval a x + eval b x
> eval (a :*: b) x = eval a x * eval b x

We can make this easier to use by making E a an instance of Num:

> instance Num a => Num (E a) where
>   fromInteger n = Const (fromInteger n)
>   a + b = a :+: b
>   a * b = a :*: b

And now we can write an alternative to d:

> d' f x = eval (diff (f X)) x
> example1 =  d' (\x -> x^3+2*x^2+x+1) 2

We of course get the same result.

So let's try the example from the paper again:
example1 =  d' (\x -> x*(d' (\y -> x+y) 1)) 1

We don't get an incorrect result. Instead, we get this error message:
Occurs check: cannot construct the infinite type: t0 = E t0
Expected type: E (E t0)
Actual type: E t0
In the first argument of (+)', namely x'
In the expression: x + y

An almost identical error message. So what's going on?

Look at the type signature to d':
d' :: Num t => (E a -> E t) -> t -> t

When we evaluate
d' (\x -> x*(d' (\y -> x+y) 1)) 1

the outer d' differentiates symbolically so internally it uses an expression type. This means that x is an expression, not a numerical value. But this means that the inner d' is being asked to evaluate its result at a value that is itself an expression, not a value. So internally it uses expressions of expressions. So x is of type E a and y is of type E (E a). It's no surprise we can't add them. Our bug is easily fixed. We define a lifting function:

> lift' x = Const x

and now we can correctly evaluate:

> example2 =  d' (\x -> x*(d' (\y -> lift' x+y) 1)) 1

> lift x = D x 0
> example3 =  d (\x -> x*(d (\y -> lift x+y) 1)) 1

Much the same discussion applies to the AD code. In that case, D a is the type of a's that have been infinitesimally perturbed. The type D (D a) is a value whose perturbation is itself perturbed. But Siskind and Pearlmutter say that we might be subject to perturbation confusion and could get 2. Curious. There is no way we can 'confuse' these distinct perturbations. Not no how. Not no way. They correspond to data of entirely different types. Far from being fraught with danger, the Haskell type system keeps us safe. Perturbation confusion in Haskell is about as likely as expression tree confusion.

Let's take a look at the analysis in section 2. They introduce a perturbation ε and show how we might have computed 2 instead of 1. But this derivation doesn't correspond to any computation we could possibly have made using the function d in Haskell. The only issue we have identified is that we have to write our code using correct types. This has nothing to do with automatic differentiation or perturbations. It applies equally well to the symbolic differentiation code. In fact, it has nothing to do with differentiation as it applies equally well to my code to compute the even and odd parts of a function.

We can press on with the paper. Section three tries to sell us a remedy - tagging. But we have no need for tagging. The Haskell compiler already deduced that the perturbation inside the inner d is of a different type to that in the outer d. The only explanation I can come up with for this section is that the authors have some experience with functional programming languages that are dynamically typed and are trying to apply that experience to Haskell.

Section 4 reiterates the point in the abstract that implementations of AD "fail to preserve referential transparency". I think we can safely ignore this claim. The AD code above isn't using any unsafe Haskell operations. It clearly is referentially transparent.

Confusion lifted
So now to section 6. They talk about the lift function and how correctly inserting it requires "sophisticated non-local analysis". Now everything becomes clear. Siskind and Pearlmutter don't consider this algorithm to be "automatic differentiation" unless they can leave out the lift operations. But it is not common practice to write Haskell code by deliberately writing a significant body of code that doesn't type check, and then expect to automatically insert the missing pieces. You simply write the code correctly to start with. In fact, when I first found myself inserting a lift in my own code I didn't even think of myself as having solved a problem - I just wrote the code that was analogous to code that Haskell programmers write every day. If I had forgotten the lift, the compiler would have set me straight anyway.

Conclusion
"Perturbation confusion" is a non-existent problem in Haskell AD. Siskind and Pearlmutter correctly point out that Haskell code using AD is not exactly analogous to mathematical notation for derivatives. This is unsurprising, differentiation is not computable (for deep reasons reasons that are similar to the reason that intermediate values are not computable). But functions like lift are an everyday part of typed functional programming. This is not a feature of AD, it applies equally as well to symbolic differentiation (and indeed many other parts of Haskell such as using monad transformers and nested functors). The algorithm is no less a form of AD because of the use of lift.

I have been advocating AD for many applications over recent years. It has been an uphill struggle. It is often incorrectly assumed that I am talking about numerical or symbolic differentiation. Programmers will often assert that what I am describing is completely impossible. But when they grasp what I am explaining the response often changes to "why didn't anyone tell me about this years ago?" It is disappointing to see two major contributors to computer science whose work I greatly respect scaring away potential users with FUD about a non-existent problem.

(And if you got here but skipped the update at the top you really need to go to the top as I now think Siskind and Pearlmutter have a good point! I'm leaving the above just for the sake of posterity.)

## Saturday, April 09, 2011

### Image-based rendering and some ancient history

Introduction
I've not said much about my work in visual effects in this blog. This is mainly because I try very carefully to avoid any kind of intellectual property conflict with my employer. But now I've left the world of visual effects to work at Google, I think I might throw in the occasional article. So here's something about my own work from many years ago. In particular, back in the year 2000 I and my colleagues George and Kim received an Academy Scientific and Technical Achievement Award for "the development of a system for image-based rendering allowing choreographed camera movements through computer graphic reconstructed sets." I rarely tell people what this work was for. But now I'll have a convenient web page to which I can direct anyone who asks. I'm hoping to aim this at people who know a little mathematics and geometry, but not necessarily anything about computer graphics.

Many years ago I worked at a company called Manex Visual Effects. One day the story of that company needs to be told. Here are some things that have been alleged about Manex that I neither confirm nor deny: its stock was traded in one of the largest ever pump-and-dump scams in the Far East, it extracted millions of dollars from Trenton, New Jersey for a fake scheme to create an East Coast "Hollywood", and it spent a couple of years making press releases about how it was doing work on the Matrix sequels despite the fact that there was nobody at the company who was actually doing work on the movies, including making press releases quoting me describing the ongoing work long after I had left. At one point I was apparently being trailed by a private detective who even came rowing a boat past the back of my house in order to get pictures of me. I haven't checked the fine print, but I think the contracts that prevented me from speaking about any of this expired long ago.

But back around 1998-2000, when Manex was doing real effects work, we developed a pipeline for a technique known as image based rendering. We became adept at taking large numbers of photographs of locations and then reproducing those locations as photorealistic renders. When I say photorealistic here I don't mean something that's merely supposed to look real, but actually looks fake. I mean renders that were indistinguishable from photography. That's commonplace now but back in 2000 it was a challenge, especially on a large scale.

The last ten seconds of this video clip from MI:2 should give some idea of what I'm talking about. The city around Tom Cruise as he jumps from the building is entirely CGI, but using real photography:

Texturing Cities
Although MI:2 isn't set in Sydney, that is the location that was used. A team returned with many hundreds, if not thousands of photographs of the central business district. We also managed to construct 3D models of these buildings by various means. We started by using Façade to construct the geometry, but ultimately we used a variety of methods including buying 3D models from, I think, the city itself. In later years I completely replaced the way we built geometry so we didn't need to use any other source.

The goal was to map the photography onto the models. Here's a picture illustrating three points being mapped onto a building. To render correctly we needed every visible point on every 3D object to be coloured (correct terminology: textured) using a pixel from one of the photographs.

The Matrix
We're ready for a theorem. Let P be a photograph of a scene S. Let (u, v) be ordinary rectilinear coordinates in P. Let (x, y, z) be 3D coordinates in the scene S. Define proj(u, v, w) = (u/w, v/w). Then there is a 3×4 matrix M such that for every point (x, y, z) visible in S, its colour is given by the colour of the point with coordinates proj(M(x,y,z,1)T) in P.

(This assumes a pinhole projection model for the camera. In fact, real cameras have lens distortion. I wrote software to measure and fix this.)

The important point is that for each camera we just needed one matrix. We generated it by a very simple scheme: we had artists mark correspondences between points on our 3D models and points in the photography. I implemented a least squares solver to find the matrix that best fit each view. Pity the artists. They came fresh from college with well developed 3d modelling skills and I was responsible for reducing their careers to this simple point and click operation. But don't feel too bad. Most of these artists have since gone on to very successful careers in visual effects. They were a really great team.

But just mapping a single photograph is no good. The theorem tells us what to do for each point visible in a photograph, but how do we select which photograph to use? When producing the final render for production we had the luxury of being able to allow hours to render a single frame. We could make the decision on a pixel by pixel basis by performing a test for visibility from each camera, and then using heuristics to make the selection. (My colleague George had already proved this worked for the backgrounds to most of the bullet-time shots from The Matrix.)

But that was no good for the artists. They needed to see their work as they were doing it. If we could get the render time down to seconds it would be good. In fact, we got it down to a fraction of a second.

The Splitter
The first thing to note is that if we render a single triangle then the mapping defined by the theorem above is provided by modern graphics hardware. Back in 2000 it wasn't universally available, but it was in the SGI hardware we used. So we only needed to solve the camera selection problem fast. The solution was simple, we'd preprocess the geometry of the scene by splitting it into pieces (reducible to triangles), each piece corresponding a a part visible from one camera. Debevec et al. had already given demos of a technique for approximately partitioning a scene between cameras like this, but it didn't have the quality we wanted.

(By the way, my career in graphics started when I figured out an algorithm for eliminating the division from the proj() function and my new boss-to-be noticed I'd posted it online.)

There were three things needed:

1. For each camera, we needed to compute the subscene that was the intersection of the scene S with the volume viewed by the camera, its frustum.

2. For each subscene we needed to remove any parts occluded from view by any other part of the scene.

3. Ensuring that no two subscenes overlapped - ie. ensuring that no part of any subscene is visible in more than one camera.

It seemed like a messy computational geometry problem. But after a little thought it dawned on me that most of the geometry work, at least as measured by computation time, could be factored into one tiny geometry routine and the rest was logic. Here's a picture of the algorithm:

It takes a convex polygon and slices it using a plane (indicated in grey). Now everything else follows. For example, step 1 above can be achieved like this: the frustum associated with a camera is a 6-sided convex polyhedron (or a 4- or 5-sided polyhedron if you want it to extend all the way to infinity and/or all the way to the point of projection in the camera.) We can decide which points are in the frustum by slicing using the 6 planes and keeping the pieces that fall inside.

Step 2 works a little like this:
There is a 5-sided polygon lying in front of a box casting a shadow. The shadow volume is itself a 6-sided frustum (with a seventh side "at infinity", so to speak). So to remove the parts shadowed by a polygon we use the same slicing algorithm and collect up all the pieces that fall outside of the shadow volume. To remove all of the scene that is occluded from view by this camera we simply remove shadow volume corresponding to every single polygon in the scene. One of the virtues of image based rendering is that the detail in the photography makes up for the simplicity of the geometry, keeping the polygon count low. So the total number of operations might not seem too bad. Unfortunately, every time you slice through the scene you risk doubling the total number of polygons. It could have taken worse than exponential time in the number of polygons. But I took the risk, and surprisingly the time to preprocess was measured in minutes for typical scenes. The individual pieces of geometry were very intricate due to the fact that occlusion from any object could carve into a building. But like a jigsaw, the union of all the pieces gave something that looked just like a real city.

The last stage was ensuring that each part is visible from one camera. This was straightforward. As every polygon was processed with respect to every camera then I could associate to every polygon a list of cameras in which it was visible. At the end I could just sweep through and pick the best camera based on a heuristic. Typically we wanted to use the camera with the most undistorted detail.

Along the way I had to apply a few more heuristics to make things manageable. Many thin slivers would appear in the slicing. If they were small enough I threw them away. I'd also sweep through from time to time and fuse together neighbouring polygons that had been sliced but ended up still being visible in the same cameras, and whose union was still convex. That would reduce the total polygon count and speed up further processing.

It worked. The artists would mark their correspondences, run the optimiser to extract the per-camera matrices, kick off the 'splitter', have a coffee, and then return to a fully interactive view of Sydney, or wherever. They could now examine it from all angles and quickly ascertain what further work was needed, eg. if there were holes in one of the buildings. That allowed us to develop an efficient workflow and carry out the work on the scale needed to complete movie shots. We could also interactively visualise how other objects interacted with our cities. We could also use this tool to plan the photography and ensure we had all the coverage we needed.

In retrospect it all seems trivial. But at the time I don't think any other company could churn out entire city blocks the way we could. Today, Google do similar work on a much larger scale, and much more cleverly, with Street View.

And that was just one part of the technique that we marketed as "virtual cinematography" and which won George, Kim and I our award. But it's really important to remember that movie making is a big team effort. It took the work of many dozens of people to create our photorealistic cities, and the fact that I've chosen to write about my contribution doesn't mean that it was the only part that was important. It wouldn't have happened if George hadn't taught us the method originally, and if Kim hadn't believed in us and formed part of the company around our pipeline. And of course nothing wouldn't have happened if the artists didn't politely put up with our crudely engineered tools.

Ackowledgement
The example city image above was derived from a picture by Calvin Teo on wikipedia. I don't have the original photography we used.

## Saturday, April 02, 2011

### Generalising Gödel's Theorem with Multiple Worlds. Part IV.

Interpolating Between Propoitions
Suppose a, b and c are propositions. Then a∧b→b∨c. It seems that the a is irrelevant to what's happening on the right hand side. We could remove it and still have a true proposition: b→b∨c. It seems that the c on the right hand side is also irrelevant so that this is also true: a∧b→b. In fact, we can "refactor" the original proposition as a∧b→b→b∨c. (By Curry Howard it *is* a kind of refactoring.)

Let's try using the methods I described in Part I to demonstrate the validity of a∧b→b∨c:

I've done two things slightly differently. I brought the negation inside the implication at the start. This means we start with an implication with a clearly defined left- and right-hand side. It makes no difference to the outcome. But I've also coloured terms coming from the left-hand side in bLue and those on the right in oRange. Eventually we see a b and a ¬b meet each other resulting in the big red X telling us that the negation of a∧b→b∨c is invalid. But notice how the b and ¬b came from opposite sides of the implication. This tells us that the implication is valid because of the b's and that the appearance of a and c plays no role in establishing validity.

Now suppose a blue a met a blue ¬a. They would have both originated from the left hand side, telling us that the left hand side was a contradiction, regardless of what's on the right. So if the original implication we wished to establish were written as L→R then we'd have established that we could factor it as L→⊥→R. Similarly, if an orange a met an orange ¬a we'd have established the invalidity of ¬R meaning that we get L→⊤→R.

In all three cases we've managed to find an "interpolating" formula F such that L→F→R with the property that F only refers to letters that occur *both* in L and R. It may seem intuitively obvious that we can do this. Irrelevant hypotheses shouldn't play a role in establishing an implication. In fact, this is generally true of propositional calculus and is known as the Craig Interpolation Lemma. It also holds for Provability Logic. This is certainly not an obvious fact. The interpolation property fails for many logics.

I'm only going to roughly sketch how the proof of the interpolation lemma looks. Essentially it will be a proof by construction with the construction being the following code. We'll implement a bunch of tableau rules that construct the interpolation lemma. We've also seen what some of these rules look like in the discussion above.

Constructing Interpolations

I coloured propositions orange and blue above. I can't use colour in Haskell code so I'll instead label propositions L and R using the following type:

> data SignedProp a = L a | R a deriving (Eq, Ord, Show)

Think of the colour or sidedness of a proposition as its 'sign'. Sometimes we'll make a selection based on the sign:

> select (L _) l r = l
> select (R _) l r = r

> instance Functor SignedProp where
>     fmap f (L a) = L (f a)
>     fmap f (R a) = R (f a)

Sometimes we'll want to remove the sign:

> unsign (L a) = a
> unsign (R b) = b

Now you may see why I had to use Haskell's ViewPattern extension. I want to do the same pattern matching as before on these propositions even though they are a different type. As all the rules view the patterns through propType we can achieve this by making SignedProp a an instance of PropTypeable:

> instance PropTypeable a => PropTypeable (SignedProp a) where
>     propType (L a)    = fmap L (propType a)
>     propType (R a)    = fmap R (propType a)
>     neg               = fmap neg
>     isF               = isF . unsign
>     positiveComponent = positiveComponent . unsign
>     negative          = negative . unsign

With this framework in place the code to interpolate is quite small. Instead of returning a Bool or a diagram, these rules return Just the interpolating proposition when possible, otherwise a Nothing. But the code is also going to do something slightly more general. If we close a potential world containing propositions l1,l2,...,r1,r2,... we have shown that l1∧l2∧...∧r1∧r2∧... isn't valid. Ie. that l1∧l2∧...→¬r1∨¬r2∨... *is* valid. If the li are L-propositions, and the ri are R-propositions, then the rules I define below will find an interpolating formula for l1∧l2∧...→¬r1∨¬r2∨.... For the original case of p→q we prime it with p on the left and ¬q on the right:

> interp (p :-> q) = let t = runTableau interpRules [L p, R (Neg q)]
>                    in simplify <$> t  And now we can give the rules: > interpRules = TableauRules {  The first three branches of this case are the three rules discussed at the beginning. The fourth should be fairly obvious: > foundContradiction = \a -> Just$ case a of
>        (L _, L _) -> F
>        (R _, R _) -> T
>        (L n, R _) -> n
>        (R n, L _) -> Neg n,

The algorithm needs to know when a world has closed. The original validity rules returned a boolean. These rules return a Maybe, and we know a world closed if the algorithm succeeded in returning an interpolating proposition:

>     closes = isJust,

These are the trivial cases of finding a blue or orange ⊥:

>     foundF = \a -> Just $select a F T,  Some rules that really just serve as glue: > open = \_ -> Nothing, > doubleNegation = \_ t -> t, > conjRule = \_ _ t -> t,  Now suppose we want to find an interpolating formula for l1∨l2→r. If we set up our tableau we get: (Note I'm using l and r as metavariables here, so l1, l2 and r represent propositions made up of (possibly many) ordinary single letter variables.) If we complete the two sides of the divide using our interpolation algorithm recursively we'll find propositions fi such that li→fi→r. Hence we find l1∨l2→f1∨f2→r. Clearly the middle proposition only contains letters that appear on both sides of the original implication. A similar analysis allows us to find an interpolating proposition for l→r1∧r2. That gives us this rule: > disjRule = \p _ _ tl tr -> select p (:\/) (:/\) <$> tl <*> tr,

Those are the rules for classical propositional calculus.

Now comes the tricky bit. If we draw a big red X in a subworld it allows us to back out and deduce an interpolating proposition in the parent world. The rule is simple but I'll leave the proof sketch as an appendix:

>     processWorld  = \p t -> select p Dia Box <$> t,  If any subworld of a world is closed, so is the parent world, so we can ignore all but the first closed subworld: > combineWorlds = mplus, > tableau = \_ t -> t > }  You can reproduce the wikipedia example with this interp ((neg (p /\q) --> neg r /\q) --> (t --> p) \/ (t --> neg r)). Definability In my previous post I talked about how in provability logic we can define propositions implicitly. Now we're in a position to do the construction. Firstly we need to say precisely what we mean by a definition inside the language of provability logic, and then we need to say what ensures that definitions make sense. An implicit definition of a proposition in provability logic is a function Prop -> Prop that doesn't analyze its argument. Informally, it defines a proposition p if f p is valid. Some candidates might be: > def1 p = T --> p > def2 p = p --> T  The first, def1, seems fine. It seems to uniquely single out p == T because def1 T is valid. But def1 (neg F) is also valid. So we can't uniquely pin down propositions, but only up to some sort of equivalence. In fact, we can use <-> as our equivalence relation. But the second attempted definition is useless. Any proposition satisfies it. So we only consider a definition d to be valid if any two propositions satisfying it are equivalent. So we can say that d defines a proposition h if d p --> (p <-> h) is valid. So here's the beginning of a function that attempts to find a proposition satisfying an implicit definition: > beth d = let p = Letter "__p" > q = Letter "__q" > in if not$ valid $(d p /\ d q) --> (p <-> q) > then error$ show (d p) ++ " doesn't satisfy precondition"

You can see how I've encoded our precondition for a definition to be good. I also used __p and __q to make sure we didn't clash with any letters in the definition. It's called beth because the theorem that ensures we can write the else clause is known as the Beth Definability Theorem. The last line is astonishingly short:

>             else interp (d p /\ p --> (d q --> q))

Suppose we have proved that d(p)∧d(q)→(p↔q). It immediately follows that d(p)∧p→(d(q)→q). (It's essentially a bit of currying.) This is a candidate for Craig interpolation as the left hand side has no q and the right hand side has no p. So we can make a sentence h so that d(p)∧p→h and h→(d(q)→q)). The lettes p and q are just letters. If a proposition is true for q, it's also true for p. So with a little rearrangement we get that d(p)→(p↔h). Or in English, if p satisfies our definition, h is equivalent to it. So we've constructed an h that does what we want.

Fixed Points
Now it's a small step to get a fixed point. We just make a definition of fixed point and apply beth. This looks like it might work:

> isFixedPoint' f p = p <-> f p

Unfortunately it's possible for p and p' to be inequivalent and yet both satisfy isFixedPoint' f. We have to use a "stronger" definition. I'll leave the proof to Boolos's book, but what we'll do is assert not just that p is a fixed point, but also that it is provably so. So we use:

> box' a = a /\ Box a
> isFixedPoint f p = box' (p <-> f p)

In order for the uniqueness to work, every occurence of the argument of f must be inside a Box or Dia.

And that's it. We can now churn out fixed points to our heart's content.

Gödel's Second Incompleteness Theorem again
Let's find a proposition that asserts its own unprovability:

> godel = fixedpoint $\p -> neg (Box p)  We get Dia T, which is the claim that arithmetic is consistent. So godel shows that if arithmetic is consistent, then it can't prove its consistency. Here's a large number that I use for regression testing that I lifted from Boolos's book: > fpexamples = [ > (\p -> Neg (Box p), Dia T), > (\p -> Box p, T), > (\p -> Box (Neg p), Box F), > (\p -> Neg (Box (Neg p)), F), > (\p -> Neg (Box (Box p)), Dia (Dia T)), > (\p -> Box p :-> Box (Neg p), Dia (Dia T) \/ Box F), > (\p -> Box (Neg p :-> Box F) :-> Box (p :-> Box F), > Dia (Dia (Neg (Box F) /\ Neg (Box F)) /\ > Neg (Box F)) \/ Box (Box F)), > (\p -> Box p :-> q, Dia (Neg q) \/ q /\ q), > (\p -> Box (p :-> q), Box q), > (\p -> Box p /\ q, Box q /\ q), > (\p -> Box (p /\ q), Box q), > (\p -> q \/ Box p, T), > (\p -> Neg (Box (q :-> p)), Dia q), > (\p -> Box (p :-> q) :-> Box (Neg p), > Dia (Box F /\ Neg q) \/ Box F), > (\p -> q /\ (Box (p :-> q) :-> Box (Neg p)), q /\ Box (Neg q)), > (\p -> Dia p :-> (q /\ Neg (Box (p :-> q))), > Box F /\ Box F \/ q /\ Dia ((Box F /\ Box F) /\ Neg q)), > (\p -> Box (Box (p /\ q) /\ Box (p /\ r)), > Box (Box q /\ Box r)) > ]  Note how in every case, p is inside a Box or Dia. It's pretty mind-bending to try to think about what all of these propositions could possibly mean. We can easily write to test to see whether two propositions are equivalent (in the sense that they imply each other): > equiv p q = valid (p <-> q) > regress2 = do > print$ and $map (\(f, x) -> fromJust (fixedpoint f) equiv x) fpexamples  I am disconcerted that one of the easy looking examples in Boolos fails my tests. Given that the difficult cases agree with my code I think it is likely an error by Boolos, though that's a scary claim to make against one of the best known logicians in the world. The company Theory Mine has been selling theorems. But they don't seem too interesting. Far better to generate theorems that generalise Gödel's work and tell you about the very nature of provability. Just send me$19.99 and I'll send you a certificate.

> main = do
>           regress1
>           regress2

Notes
Here is some Prolog code by Melvyn Fitting to do much the same thing. Note that code relies crucially on backtracking whereas my code explicitly searches through subworlds.

The function runTableau is a kind of generalised fold. Such things have associated induction principles. In this case it's a generalisation of the "Unifying Principle" defined by Smullyan in First-Order Logic. I guess it is an ordinary generalised fold over a tree structure representing fully expanded tableaux, but we never explicitly build such a structure.

Oh...and apologies (if anyone has come this far) for how long this took. Last year I threw together code to find fixed points in a couple of hours thinking "that was easy, I can blog about it". But I hadn't realised how many hours of work it would take to explain what I had done. And even if nobody came this far, the rubber ducking improved my own understanding greatly.

Appendix
Suppose we successfully showed that this closed:

Then the generalised Craig Interpolation Lemma says that for some suitable f, both of the following close:

The way we'll prove this is to follow what we must have done to get the first potential world to close, assume inductively that the interpolation lemma works for all of the potential subworlds that we entered.

So let's start by supposing that we used ◊l2 to open up a subworld, giving us:

If the subworld closed then recursively using interpolation we know that for some appropriate choice of g, these closed too:

Now consider trying to close these two worlds:

Using Worlds 1 and 2 above we find they close immediately:

And that now tells us that when we recurse back up, we can use f=◊g.

I started with world containing just 6 propositions so I seem only to have proved this for that case. But in fact, any combination of propositions just ends up with an argument that is substantially the same. The only thing that might change is that if we use ◊r2 to try to open up a subworld we find that f=◻g for some other g. And this is all summarised compactly by the rule processWorld above.


text:
# About the asymptotic formula of Bessel function

For $\nu \in \Bbb R$, I want to prove the well-known formula $$J_\nu (x) \sim \sqrt{\frac{2}{\pi x}} \cos \left( x - \frac{2 \nu +1}{4} \pi \right) + O \left( \frac{1}{x^{3/2}} \right) \;\;\;\;(x \to \infty)$$ where $J_\nu$ denotes the Bessel function. How can I show this? Or would you tell me the Internet site which proves this formula? I could not find the proof of this.

-
See this. –  Ｊ. Ｍ. Jul 31 '12 at 10:54
In the Olden Days we would find things like this in textbooks (such as G. N. Watson). Nowadays everyone wants things to be available on-line! –  GEdgar Jul 31 '12 at 17:52

## 1 Answer

First, some preliminary series expansions. Consider the substitution $$\cos(t)=1-u^2/2\tag{1}$$ We get the power series for $u=2\sin(t/2)$: $$u=t-t^3/24+t^5/1920-t^7/322560+t^9/92897280+O(t^{11})\tag{2}$$ and the inverse series for $t$; $$t=u+u^3/24+3u^5/640+5u^7/7168+35u^9/294912+O(u^{11})\tag{3}$$

We need to concentrate on the stationary points at $t=\pi/2$ and $t=-\pi/2$, away from which the integral decays exponentially in $x$. The contribution at $-\pi/2$ is the conjugate of the contribution at $\pi/2$, so the whole contribution is twice the real part of the contribution at $\pi/2$. \begin{align} J_\nu(x) &=\frac1{2\pi}\int_{-\pi}^\pi e^{-i(\nu t-x\sin(t))}\,\mathrm{d}t\\ &=2\mathrm{Re}\left(\frac1{2\pi}\int_0^\pi e^{-i(\nu t-x\sin(t))}\,\mathrm{d}t\right)\\ &=2\mathrm{Re}\left(e^{-i\nu\pi/2}\frac1{2\pi}\int_{-\pi/2}^{\pi/2} e^{-i\nu t}e^{ix\cos(t)}\,\mathrm{d}t\right)\\ &\sim2\mathrm{Re}\left(e^{-i\nu\pi/2}\frac1{2\pi}\int_{-\infty}^\infty\left(1-\nu^2u^2/2+O(u^4)\right)e^{ix(1-u^2/2)}\left(1+u^2/8+O(u^4)\right)\,\mathrm{d}u\right)\\ &=2\mathrm{Re}\left(e^{i(x-\nu\pi/2)}\frac1{2\pi}\int_{-\infty}^\infty\left(1-(4\nu^2-1)u^2/8+O(u^4)\right)e^{-ixu^2/2}\,\mathrm{d}u\right)\\ &=2\mathrm{Re}\left(e^{i(x-(2\nu+1)\pi/4)}\frac1{2\pi}\int_{-\infty}^\infty\left(1+i(4\nu^2-1)v^2/8+O(v^4)\right)e^{-xv^2/2}\,\mathrm{d}v\right)\\ &=2\mathrm{Re}\left(e^{i(x-(2\nu+1)\pi/4)}\frac1{2\pi}\left(\sqrt{\frac{2\pi}{x}}+i\frac{4\nu^2-1}{8}\frac1{2\pi}\sqrt{\frac{2\pi}{x}}^3+O\left(x^{-5/2}\right)\right)\right)\\ &=\cos\left(x-\frac{2\nu+1}{4}\pi\right)\sqrt{\frac{2}{\pi x}}-\sin\left(x-\frac{2\nu+1}{4}\pi\right)\frac{4\nu^2-1}{8}\sqrt{\frac{2}{\pi x^3}}+O\left(x^{-5/2}\right) \end{align} In the $\sim$ step, we make the $u$ substitution whose series is given above, and integrate over $(-\infty,\infty)$ instead of $[-\sqrt{2},\sqrt{2}]$ since the part outside the compact interval decays exponentially.

We also use the substitution $u=e^{-i\pi/4}v$, so that $u^2=-iv^2$, and change the path of integration, which is allowed since there are no singularities.

In the end, we get the first two terms of the asymptotic expansion of $J_\nu(x)$.

-
(+1) Love the saddle point method. –  Jack D'Aurizio Aug 31 at 2:58
It is a very powerful tool. I have used it in a lot of asymptotic expansions (my graduate advisor used it a lot in dealing with singular integrals). –  robjohn Aug 31 at 3:19


text:
# Rocket Equation 🚀

Rocket equation is a mathematical equation that describes the motion of vehicles that follow the basic principle of a rocket: a device that can apply acceleration to itself using thrust by expelling part of its mass with high velocity can thereby move due to the conservation of momentum.

## Ideal Rocket Equation

$$\Delta v=v_{\mathrm{e}} \ln \frac{m_{0}}{m_{f}}=I_{\mathrm{sp}} g_{0} \ln \frac{m_{0}}{m_{f}}$$

where:

$\Delta v$ is delta-v – the maximum change of velocity of the vehicle (with no external forces acting).

${m_{0}}$ is the initial total mass, including propellant, a.k.a. wet mass.

${m_{f}}$ is the final total mass without propellant, a.k.a. dry mass.

$v_{\mathrm{e}} = I_{\mathrm{sp}} g_{0}$ is the effective exhaust velocity, where:

$I_{\mathrm{sp}}$ is the specific impulse in dimension of time.

$g_{0}$ is standard gravity.

$\ln$ is is the natural logarithm function.

Given the effective exhaust velocity $v_{\mathrm{e}}$ (determined by a rocket motor’s design), a desired delta-v (for example, escape velocity), and a given dry mass ${m_{f}}$, the equation can be used to find the required wet mass ${m_{0}} - {m_{f}}$ :

$$m_{0}=m_{f} e^{\frac{\Delta v}{v_{\mathrm{e}}}}$$

So the necessary wet mass grows exponentially with the desired delta-v, as illustrated in the chart.

## Terms of the equation

### Delta-v

Delta-v (literally “change in velocity”), symbolised as ${\Delta v}$ and pronounced delta-vee, as used in spacecraft flight dynamics, is a measure of the impulse that is needed to perform a maneuver such as launching from, or landing on a planet or moon, or an in-space orbital maneuver. It is a scalar that has the units of speed. As used in this context, it is not the same as the physical change in velocity of the vehicle.

Delta-v is produced by reaction engines, such as rocket engines and is proportional to the thrust per unit mass, and burn time, and is used to determine the mass of propellant required for the given manoeuvre through the rocket equation.

For multiple manoeuvres, delta-v sums linearly.

For interplanetary missions delta-v is often plotted on a porkchop plot which displays the required mission delta-v as a function of launch date.

### Mass fraction

In aerospace engineering, the propellant mass fraction is the portion of a vehicle’s mass which does not reach the destination, usually used as a measure of the vehicle’s performance. In other words, the propellant mass fraction is the ratio between the propellant mass and the initial mass of the vehicle. In a spacecraft, the destination is usually an orbit, while for aircraft it is their landing location. A higher mass fraction represents less weight in a design. Another related measure is the payload fraction, which is the fraction of initial weight that is payload.

### Effective exhaust velocity

The effective exhaust velocity is often specified as a specific impulse and they are related to each other by:

$$v_{\mathrm{e}}=g_{0} I_{\mathrm{sp}}$$

where

$I_{\mathrm{sp}}$ is the specific impulse in seconds,

$v_{\mathrm{e}}$ is the specific impulse measured in $m/s$, which is the same as the effective exhaust velocity measured in $m/s$ (or $ft/s$ if g is in $ft/s^{2}$),

$g_{0}$ is the standard gravity, $9.80665 \ m/s^{2}$ (in Imperial units $32.174 \ ft/s^{2}$).

## Examples

• Single-stage-to-orbit rocket: $1-e^{-9.7 / 4.5}=0.884$, therefore 88.4% of the initial total mass has to be propellant. The remaining 11.6% is for the engines, the tank, and the payload.
• Two-stage-to-orbit: suppose that the first stage should provide a ${\Delta v}$ of 5,000 meters per second (16,000 $ft/s$); $1-e^{-5.0 / 4.5}=0.671$, therefore 67.1% of the initial total mass has to be propellant to the first stage. The remaining mass is 32.9%. After disposing of the first stage, a mass remains equal to this 32.9%, minus the mass of the tank and engines of the first stage. Assume that this is 8% of the initial total mass, then 24.9% remains. The second stage should provide a ${\Delta v}$ of 4,700 meters per second (15,000 $ft/s$); $1-e^{-4.7 / 4.5}=0.648$, therefore 64.8% of the remaining mass has to be propellant, which is 16.2% of the original total mass, and 8.7% remains for the tank and engines of the second stage, the payload, and in the case of a space shuttle, also the orbiter. Thus together 16.7% of the original launch mass is available for all engines, the tanks, and payload.

## Stages

In the case of sequentially thrusting rocket stages, the equation applies for each stage, where for each stage the initial mass in the equation is the total mass of the rocket after discarding the previous stage, and the final mass in the equation is the total mass of the rocket just before discarding the stage concerned. For each stage the specific impulse may be different.

For example, if 80% of the mass of a rocket is the fuel of the first stage, and 10% is the dry mass of the first stage, and 10% is the remaining rocket, then

\begin{aligned} \Delta v &=v_{\mathrm{e}} \ln \frac{100}{100-80} \ &=v_{\mathrm{e}} \ln 5 \ &=1.61 v_{\mathrm{e}} \end{aligned}

With three similar, subsequently smaller stages with the same $v_{\mathrm{e}}$ for each stage, we have

$$\Delta v=3 v_{\mathrm{e}} \ln 5=4.83 v_{\mathrm{e}}$$

and the payload is 10% × 10% × 10% = 0.1% of the initial mass.

A comparable SSTO rocket, also with a 0.1% payload, could have a mass of 11.1% for fuel tanks and engines, and 88.8% for fuel. This would give

$$\Delta v=v_{\mathrm{e}} \ln (100 / 11.2)=2.19 v_{\mathrm{e}}$$

If the motor of a new stage is ignited before the previous stage has been discarded and the simultaneously working motors have a different specific impulse (as is often the case with solid rocket boosters and a liquid-fuel stage), the situation is more complicated.

## Derivations

Consider the following system:

In the following derivation, “the rocket” is taken to mean “the rocket and all of its unexpended propellant”.

Newton’s second law of motion relates external forces ($F_{i}$) to the change in linear momentum of the whole system (including rocket and exhaust) as follows:

$$\sum F_{i}=\lim_{\Delta t \rightarrow 0} \frac{P_{2}-P_{1}}{\Delta t}$$

where $P_{1}$ is the momentum of the rocket at time $t = 0$ :

$$P_{1}=(m+\Delta m) V$$

and $P_{2}$ is the momentum of the rocket and exhausted mass at time $t = \Delta t$ :

$$P_{2}=m(V+\Delta V)+\Delta m V_{\mathrm{e}}$$

and where, with respect to the observer:

$V$ is the velocity of the rocket at time $t = 0$

$V+\Delta V$ is the velocity of the rocket at time $t = \Delta t$

$V_{\mathrm{e}}$ is the velocity of the mass added to the exhaust (and lost by the rocket) during time $\Delta t$

$m+\Delta m$ is the mass of the rocket at time $t = 0$

$m$ is the mass of the rocket at time $t = \Delta t$

The velocity of the exhaust $V_{\mathrm{e}}$ in the observer frame is related to the velocity of the exhaust in the rocket frame $v_{\mathrm{e}}$ by (since exhaust velocity is in the negative direction)

$$V_{\mathrm{e}}=V-v_{\mathrm{e}}$$

Solving yields:

$$P_{2}-P_{1}=m \Delta V-v_{\mathrm{e}} \Delta m$$

and, using $dm = - \Delta m$ , since ejecting a positive $\Delta m$ results in a decrease in mass in time,

$$\sum F_{i}=m \frac{d V}{d t}+v_{\mathrm{e}} \frac{d m}{d t}$$

If there are no external forces then $\sum F_{i} = 0$ (conservation of linear momentum) and

$$-m \frac{d V}{d t}=v_{\mathrm{e}} \frac{d m}{d t}$$

Assuming $v_{\mathrm{e}}$ is constant, this may be integrated as follows:

$$-\int_{V}^{V+\Delta V} \mathrm{d} V=v_{e} \int_{m_{0}}^{m_{f}} \frac{1}{m} \mathrm{d} m$$

This then yields

$$\Delta V=v_{\mathrm{e}} \ln \frac{m_{0}}{m_{f}}$$

or equivalently

$$m_{f}=m_{0} e^{-\Delta V / v_{\mathrm{e}}}$$

or

$$m_{0}=m_{f} e^{\Delta V / v_{\mathrm{e}}}$$

or

$$m_{0}-m_{f}=m_{f}\left(e^{\Delta V / v_{\mathrm{e}}}-1\right)$$

where $m_{0}$ is the initial total mass including propellant, $m_{f}$ the final mass, and $v_{\mathrm{e}}$ the velocity of the rocket exhaust with respect to the rocket (the specific impulse, or, if measured in time, that multiplied by gravity-on-Earth acceleration).

The value $m_{0} - m_{f}$ is the total working mass of propellant expended.

$\Delta V$ is the integration over time of the magnitude of the acceleration produced by using the rocket engine (what would be the actual acceleration if external forces were absent). In free space, for the case of acceleration in the direction of the velocity, this is the increase of the speed. In the case of an acceleration in opposite direction (deceleration) it is the decrease of the speed. Of course gravity and drag also accelerate the vehicle, and they can add or subtract to the change in velocity experienced by the vehicle. Hence delta-v may not always be the actual change in speed or velocity of the vehicle.

### Impulse-based

The equation can also be derived from the basic integral of acceleration in the form of force (thrust) over mass. By representing the delta-v equation as the following:

$$\Delta v=\int_{t_{0}}^{t_{f}} \frac{|T|}{m_{0}-t \Delta m} d t$$

where $T$ is thrust, $m_{0}$ is the initial (wet) mass and $\Delta m$ is the initial mass minus the final (dry) mass,

and realising that the integral of a resultant force over time is total impulse, assuming thrust is the only force involved,

$$\int_{t_{0}}^{t_{f}} F d t=J$$

The integral is found to be:

$$J \frac{\ln \left(m_{0}\right)-\ln \left(m_{f}\right)}{\Delta m}$$

Realising that impulse over the change in mass is equivalent to force over propellant mass flow rate (p), which is itself equivalent to exhaust velocity,

$$\frac{J}{\Delta m}=\frac{F}{p}=V_{\mathrm{exh}}$$

the integral can be equated to

$$\Delta v=V_{\mathrm{exh}} \ln \left(\frac{m_{0}}{m_{f}}\right)$$

### Acceleration-based

Imagine a rocket at rest in space with no forces exerted on it (Newton’s First Law of Motion). From the moment its engine is started (clock set to 0) the rocket expels gas mass at a constant mass flow rate $R$ ($kg/s$) and at exhaust velocity relative to the rocket $v_{e}$ ($m/s$). This creates a constant force $F$ propelling the rocket that is equal to $R \times v_{e}$. The rocket is subject to a constant force, but its total mass is decreasing steadily because it is expelling gas. According to Newton’s Second Law of Motion, its acceleration at any time $t$ is its propelling force $F$ divided by its current mass $m$:

$$a=\frac{d v}{d t}=-\frac{F}{m(t)}=-\frac{R v_{\mathrm{e}}}{m(t)}$$

Now, the mass of fuel the rocket initially has on board is equal to $m_{0} – m_{f}$. For the constant mass flow rate $R$ it will therefore take a time $T = (m_{0} – m_{f})/R$ to burn all this fuel. Integrating both sides of the equation with respect to time from $0$ to $T$ (and noting that $R = dm/dt$ allows a substitution on the right), we obtain

$$\Delta v=v_{f}-v_{0}=-v_{\mathrm{e}}\left[\ln m_{f}-\ln m_{0}\right]=v_{\mathrm{e}} \ln \left(\frac{m_{0}}{m_{f}}\right)$$

### Limit of finite mass “pellet” expulsion

The rocket equation can also be derived as the limiting case of the speed change for a rocket that expels its fuel in the form of $N$ pellets consecutively, as $N \rightarrow \infty$, with an effective exhaust speed $v_{\mathrm{eff}}$ such that the mechanical energy gained per unit fuel mass is given by $\frac{1}{2} v_{\mathrm{eff}}^{2}$ .

In the rocket’s center-of-mass frame, if a pellet of mass $m_{p}$ is ejected at speed $u$ and the remaining mass of the rocket is $m$ , the amount of energy converted to increase the rocket’s and pellet’s kinetic energy is

$$\frac{1}{2} m_{p} v_{\mathrm{eff}}^{2}=\frac{1}{2} m_{p} u^{2}+\frac{1}{2} m(\Delta v)^{2}$$

Using momentum conservation in the rocket’s frame just prior to ejection, $u=\Delta v \frac{m}{m_{p}}$ , from which we find

$$\Delta v=v_{\mathrm{eff}} \frac{m p}{\sqrt{m\left(m+m_{p}\right)}}$$

Let $\phi$ be the initial fuel mass fraction on board and $m_{0}$ the initial fueled-up mass of the rocket. Divide the total mass of fuel $\phi m_{0}$ into $N$ discrete pellets each of mass $m_{p} = \phi m_{0} / N$ . The remaining mass of the rocket after ejecting $j$ pellets is then $m=m_{0}(1-j\phi /N)$
. The overall speed change after ejecting $j$ pellets is the sum

$$\Delta v=v_{\mathrm{eff}} \sum_{j=1}^{j=N} \frac{\phi / N}{\sqrt{(1-j \phi / N)(1-j \phi / N+\phi / N)}}$$

Notice that for large $N$ the last term in the denominator $\phi / N \ll 1$ and can be neglected to give

$$\Delta v \approx v_{\mathrm{eff}} \sum_{j=1}^{j=N} \frac{\phi / N}{1-j \phi / N}=v_{\mathrm{eff}} \sum_{j=1}^{j=N} \frac{\Delta x}{1-x_{j}} \text { where } \Delta x=\frac{\phi}{N} \text { and } x_{j}=\frac{j \phi}{N}$$

As $N \rightarrow \infty$ this Riemann sum becomes the definite integral

$$\lim_{N \rightarrow \infty} \Delta v=v_{\mathrm{eff}} \int_{0}^{\phi} \frac{d x}{1-x}=v_{\mathrm{eff}} \ln \frac{1}{1-\phi}=v_{\mathrm{eff}} \ln \frac{m_{0}}{m_{f}}$$

since the final remaining mass of the rocket is $m_{f}=m_{0}(1-\phi)$ .

### Special relativity

If special relativity is taken into account, the following equation can be derived for a relativistic rocket, with $\Delta v$ again standing for the rocket’s final velocity (after expelling all its reaction mass and being reduced to a rest mass of $m_{1}$) in the inertial frame of reference where the rocket started at rest (with the rest mass including fuel being $m_{0}$) , and $c$ standing for the speed of light in a vacuum:

$$\frac{m_{0}}{m_{1}}=\left[\frac{1+\frac{\Delta v}{c}}{1-\frac{\Delta v}{c}}\right]^{\frac{c}{2 v_{\mathrm{e}}}}$$

Writing $\frac{m_{0}}{m_{1}}$ as $R$ allows this equation to be rearranged as

$$\frac{\Delta v}{c}=\frac{R^{\frac{2 v_{\mathrm{e}}}{c}}-1}{R^{\frac{2 v_{\mathrm{e}}}{c}}+1}$$

Then, using the identity

$$R^{\frac{2 v_{\mathrm{e}}}{c}}=\exp \left[\frac{2 v_{\mathrm{e}}}{c} \ln R\right]$$

(here “$\exp$” denotes the exponential function; see also Natural logarithm as well as the “power” identity at Logarithmic identities)

and the identity $\tanh x=\frac{e^{2 x}-1}{e^{2 x}+1}$ (see Hyperbolic function), this is equivalent to

$$\Delta v=c \tanh \left(\frac{v_{\mathrm{e}}}{c} \ln \frac{m_{0}}{m_{1}}\right)$$


text:
# EATON (CROUSE-HINDS)

EATON (CROUSE-HINDS)

## Lim Kim Hai Electric is an authorized distributor of EATON (CROUSE-HINDS) in Singapore

Crouse-Hinds series remains the name that stands for safety and reliability in the harshest of environments when power management is most critical. While it all began with the Condulet, the Crouse-Hinds series has grown into the premier name for a comprehensive portfolio of solutions for high consequence harsh and hazardous environments. And now, the next phase in the evolution of the brand you trust: Crouse-Hinds series is the leading Eaton portfolio of reliable, efficient, and safe electrical power management solutions.

We offer a full range of Crouse-Hinds products including:

1. Portable EX Lamp: EX torches,  EX hand lamps, EX searchlights, and EX surface mounted light fittings.

2. EX Light Fittings: EX surfaced mounted light fittings, EX pole mounted light fittings, EX emergency light fittings, EX recessed ceiling light fittings, EX recessed ceiling emergency light fittings, EX photocell, and EX Escape sign luminaries.

3. EX Area Light Fittings: EX ceiling light fittings, EX pendant light fittings, and EX floodlights

4. EX Electrical Connectivity: EX terminals, EX plugs, EX sockets, EX junction boxes, and EX cable glands.

5. EX Control Units & Control Stations: EX light switch, EX control stations, EX control & signal units for panel mounting, EX control switches, EX safety switches, EX manual motor starters, and EX distribution enclosures.

6. EX Audio/Visual – Signalling Equipment: Ex manual call points, EX status lamps, EX beacons & strobes, EX sounders & horns, and EX speakers.

## Product Categories

### What are eaton hazardous lightings?

An area in which an explosive atmosphere is present, or maybe expected to be present, in quantities such as to require special precautions for the construction, installation, and use of electrical equipment (IEV 426-03-01). In accordance with EC-Directive 1999/92, hazardous areas are divided into six zones (Gas: Zone 0, 1 & 2. Dust: Zone 20, 21 & 22). The classification is based on the probability of the occurrence of an explosive atmosphere. In addition, the distinction is made between flammable gases, vapors, and mists on the one hand, and combustible dust on the other. Information on the zone classification can also be found in the Explosion-Protection Rules of the Employers’ Liability Insurance Association for the Chemical Industry and EN 60079-10.

### What makes a light fixture explosion proof?

The basis for an explosion

As a rule, for explosions to happen in atmospheric
air, three factors have to be present at the same
time:
– Flammable material
– Oxygen (air)
– The source of ignition

The primary principle is to eliminate any one of the 3 factors.


text:
There are a number of instances in which we might want to detect when there have been changes to text boxes within a C# Windows Forms app. As an example, I'm working on building a quick application for managing a database of natural sandstone arches within the state of Kentucky. My (very rough-draft) app has the following screen to add an arch to the database:

I want to have a way to detect if there have been changes within any of the text boxes when I hit the cancel button. This way, I can display a confirmation dialog to the user.

One way I could go about this is by individually setting the TextChanged callback for each and every textbox. This would certainly work, but it would lead to a lot of code duplication and things would get messy quite quickly. A better way would be to programmatically set the callback for each text box. This is actually really easy to do!

# Step 1: Override the Form's OnLoad Method

The first thing we need to do is override our form's OnLoad method. This can be done quite simply:

override protected void OnLoad(EventArgs e)
{

}

# Step 2: Programmatically Set TextChanged Callback for All Text Boxes

The next step is to set the TextChanged callback for all our text boxes. We can do this by adding the following to our OnLoad method:

override protected void OnLoad(EventArgs e)
{
foreach (Control control in this.Controls)
{
if (control.GetType() == typeof(TextBox))
{
(control as TextBox).TextChanged += Form_TextChanged;
}
}
}

All we are doing here is iterating over all the controls in our form. If the control is of the type TextBox, then we set the TextChanged callback to be the Form_TextChanged callback.

# Step 3: Build the Callback Function

Now that we have specified a callback for the TextChanged event, we need to actually build the callback function. In this case I'm going to keep things simple and simply set the value of a boolean property to true if a text change has been detected:

private void Form_TextChanged(object sender, EventArgs e)
{
this.hasUnsavedChanges = true;
}

Now I can use this boolean property anywhere I want to test for unsaved changes (in my case, when the cancel button is clicked).