text:
# Full Halo Coronal Mass Ejections: Arrival at the Earth

Authors
Type
Preprint
Publication Date
Jun 17, 2014
Submission Date
Jun 17, 2014
Identifiers
DOI: 10.1002/2014JA020001
Source
arXiv
A geomagnetic storm is mainly caused by a front-side coronal mass ejection (CME) hitting the Earth and then interacting with the magnetosphere. However, not all front-side CMEs can hit the Earth. Thus, which CMEs hit the Earth and when they do so are important issues in the study and forecasting of space weather. In our previous work (Shen et al., 2013), the de-projected parameters of the full-halo coronal mass ejections (FHCMEs) that occurred from 2007 March 1 to 2012 May 31 were estimated, and there are 39 front-side events could be fitted by the GCS model. In this work, we continue to study whether and when these front-side FHCMEs (FFHCMEs) hit the Earth. It is found that 59\% of these FFHCMEs hit the Earth, and for central events, whose deviation angles $\epsilon$, which are the angles between the propagation direction and the Sun-Earth line, are smaller than 45 degrees, the fraction increases to 75\%. After checking the deprojected angular widths of the CMEs, we found that all of the Earth-encountered CMEs satisfy a simple criterion that the angular width ($\omega$) is larger than twice the deviation angle ($\epsilon$). This result suggests that some simple criteria can be used to forecast whether a CME could hit the Earth. Furthermore, for Earth-encountered CMEs, the transit time is found to be roughly anti-correlated with the de-projected velocity, but some events significantly deviate from the linearity. For CMEs with similar velocities, the differences of their transit times can be up to several days. Such deviation is further demonstrated to be mainly caused by the CME geometry and propagation direction, which are essential in the forecasting of CME arrival.


text:
# nLab Bézout ring

Contents

### Context

#### Algebra

higher algebra

universal algebra

## Theorems

#### Constructivism, Realizability, Computability

intuitionistic mathematics

# Contents

## Definition

There are multiple definitions of a Bézout ring:

### In commutative rings

###### Definition

A commutative ring $R$ is a Bézout ring if for every element $a \in R$ and $b \in R$, there exists elements $x \in R$, $y \in R$ called Bézout coefficients and $g \in R$ called a common divisor, such that $a \cdot x + b \cdot y = g$, $g \vert a$ and $g \vert b$.

###### Definition

A commutative ring $R$ is a Bézout ring if it has functions $\beta_0:R \times R \to R$, $\beta_1:R \times R \to R$, $\gamma:R \times R \to R$ such that for every element $a \in R$ and $b \in R$, $a \cdot \beta_0(a, b) + b \cdot \beta_1(a, b) = \gamma(a, b)$, $\gamma(a, b) \vert a$ and $\gamma(a, b) \vert b$.

###### Definition

A commutative ring $R$ is a Bézout ring if every ideal with 2 generators is a principal ideal:

###### Definition

A commutative ring $R$ is a Bézout ring if every finitely generated ideal is a principal ideal.

If the commutative ring is a GCD ring and the common divisor is the greatest common divisor, then the Bézout ring condition $a \cdot \beta_0(a, b) + b \cdot \beta_1(a, b) = \gcd(a, b)$ is called the Bézout identity. There might be multiple Bézout coefficient functions for each Bézout ring.

format: plain


text:
# Divide 4 digit number by 1 digit number resulting in decimal answer

Lesson

## Dividing with remainders

When we divide numbers, we are essentially sharing. Sometimes we can share equally so that there are no remainders. Other times, we do have remainders, and need to express our answer as a decimal. We have looked at how to solve division problems that result in decimal answers when we divide by a one-digit number.

### Strategies to help us

Now let's imagine you are dividing by a two-digit number, such as $315\div25$315÷25. We know that $100$100 is $4\times25$4×25 so $300$300 is $3$3 groups of $4\times25$4×25, or $12$12 groups of $25$25. There is still $15$15 left though, and we can't make a group of $25$25 from $15$15. We can, however, express $\frac{15}{25}$1525 as a decimal.

In our first video, we work through an example like this, as well as using the strategy of dividing by $10$10, to help when we need to divide by $20$20. Dividing by $10$10 is something we use often, and a great strategy to help us here.


text:
# Vector

Calculate length of the vector v⃗ = (9.75, 6.75, -6.5, -3.75, 2).

|v| =  14.18

### Step-by-step explanation:

$\mathrm{\mid }v\mathrm{\mid }=\sqrt{9.7{5}^{2}+6.7{5}^{2}+\left(-6.5{\right)}^{2}+\left(-3.75{\right)}^{2}+{2}^{2}}=14.18$

Did you find an error or inaccuracy? Feel free to write us. Thank you!

Tips to related online calculators
Our vector sum calculator can add two vectors given by their magnitudes and by included angle.
Do you want to convert length units?
Pythagorean theorem is the base for the right triangle calculator.

#### You need to know the following knowledge to solve this word math problem:

We encourage you to watch this tutorial video on this math problem:

## Related math problems and questions:

• 3d vector component
The vector u = (3.9, u3) and the length of the vector u is 12. What is is u3?
• Angle of the body diagonals
Using vector dot product calculate the angle of the body diagonals of the cube.
• Calculate 6
Calculate the distance of a point A[0, 2] from a line passing through points B[9, 5] and C[1, -1].
• Body diagonal
Calculate the cube volume, whose body diagonal size is 75 dm. Draw a picture and highlight the body diagonal.
• Vectors
Vector a has coordinates (8; 10) and vector b has coordinates (0; 17). If the vector c = b - a, what is the magnitude of the vector c?
• Cuboid
Cuboid with edge a=6 cm and space diagonal u=31 cm has volume V=900 cm3. Calculate the length of the other edges.
• Space diagonal
The space diagonal of a cube is 129.91 mm. Find the lateral area, surface area and the volume of the cube.
• Vectors abs sum diff
The vectors a = (4,2), b = (- 2,1) are given. Calculate: a) |a+b|, b) |a|+|b|, c) |a-b|, d) |a|-|b|.
• Space diagonal angles
Calculate the angle between the body diagonal and the side edge c of the block with dimensions: a = 28cm, b = 45cm and c = 73cm. Then, find the angle between the body diagonal and the plane of the base ABCD.
• Body diagonal
Cuboid with base 7cm x 3,9cm and body diagonal 9cm long. Find the height of the cuboid and the length of the diagonal of the base,
• Vertices of a right triangle
Show that the points D(2,1), E(4,0), F(5,7) are vertices of a right triangle.
• Body diagonal
Calculate the length of the body diagonal of the 6cm cube.
• Vector 7
Given vector OA(12,16) and vector OB(4,1). Find vector AB and vector |A|.
• Cube diagonal
Determine the length of the cube diagonal with edge 37 mm.
• Space vectors 3D
The vectors u = (1; 3; -4), v = (0; 1; 1) are given. Find the size of these vectors, calculate the angle of the vectors, the distance between the vectors.
• Unit vector 2D
Determine coordinates of unit vector to vector AB if A[-6; 8], B[-18; 10].
• Diagonals of a prism
The base of the square prism is a rectangle with dimensions of 3 dm and 4 dm. The height of the prism is 1 m. Find out the angle between the body diagonal with the diagonal of the base.


text:
## One thought on “O level papers from 1957, 1962, and 1968”

1. I sat GCE O level in 1968, not sure if it was this board

My son is just sitting GCSE maths now, so we compared this to contemprary papers.

This is a bit harder (differentiation but also integration to find area under the graph etc) but crucially you only have to do three of the five questions in section b, so you can for example get through with an A without knowing any calculus, whereas with modern papers you have to answer EVERY question, so there’s no ecape, if you don’t udertand a particular topic you’re doomed

So I think the modern paper is possibly the tougher


text:
# RankNTypes via Lambda Calculus

RankNTypes is a language extension in Haskell that allows you to write even more polymorphic programs. The most basic explanation is that it allows the implementer of a function to pick a type, rather than the caller of the function. A very brief version of this explanation follows:

# The Typical Explanation

Consider the identity function, or const:

id :: a -> a
id x = x

const :: a -> b -> a
const a b = a

These functions work for any types that the caller of the function picks. Which means that, as implementers, we can’t know anything about the types involved.

Let’s say we want to apply a function to each element in a tuple. Without a type signature, we can write:

applyToBoth f (a, b) = (f a, f b)

Vanilla Haskell will provide this type:

applyToBoth :: (a -> a) -> (a, a) -> (a, a)

This is a perfectly useful type, but what if we want to apply it to a tuple containing two different types? Well, we can’t do anything terribly interesting with that - if we don’t know anything about the type, the only thing we can provide is id.

applyToBoth :: (forall x. x -> x) -> (a, b) -> (a, b)
applyToBoth f (a, b) = (f a, f b)

And that forall x inside of a parentheses is a RankNType. It allows the implementer of the function to select the type that the function will be used at, and the caller of the function must provide something sufficiently polymorphic.

This explanation is a bit weird and difficult, even though it captures the basic intuition. It’s not super obvious why the caller or the implementer gets to pick types, though. Fortunately, by leveraging the lambda calculus, we can make this more precise!

# Whirlwind Tour of Lambda

Feel free to skip this section if you’re familiar with the lambda calculus. We’re going to work from untyped, to simply typed, and finally to the polymorphic lambda calculus. This will be sufficient for us to get a feeling for what RankNTypes are.

## Untyped Lambda Calculus

The untyped lambda calculus is an extremely simple programming language with three things:

1. Variables
2. Anonymous Functions (aka lambdas)
3. Function Application

This language is Turing complete, surprisingly. We’ll use Haskell syntax, but basically, you can write things like:

id = \x -> x

const = \a -> \b -> a

apply = \f -> \a -> f a

## Simply Typed Lambda Calculus

The simply typed lambda calculus adds an extremely simple type system to the untyped lambda calculus. All terms must be given a type, and we will have a pretty simple type system - we’ll only have Unit and function arrows. A lambda will always introduce a function arrow, and a function application always eliminates it.

id :: Unit -> Unit
id = \(x :: Unit) -> x

idFn :: (Unit -> Unit) -> (Unit -> Unit)
idFn = \(f :: Unit -> Unit) -> f

const :: Unit -> Unit -> Unit
const = \(a :: Unit) -> \(b :: Unit) -> a

apply :: (Unit -> Unit) -> Unit -> Unit
apply = \(f :: Unit -> Unit) -> \(a :: Unit) -> f a

This is a much less powerful programming language - it is not even Turing Complete. This makes sense - type systems forbid certain valid programs that are otherwise syntactically valid.

The type system in this is only capable of referring to the constants that we provide. Since we only have Unit and -> as valid type constants, we have a super limited ability to write programs. We can still do quite a bit - natural numbers and Boolean types are perfectly expressible, but many higher order combinators are impossible.

## Polymorphic Lambda Calculus

The magic of the lambda calculus is that we have a means of introducing variables. The problem of the simply typed lambda calculus is that we don’t have variables. So we can introduce type variables.

Like Haskell, we’ll use forall to introduce type variables. In a type signature, the syntax will be the same. However, unlike Haskell, we’re going to have explicit type variable application and introduction at the value level as well.

Let’s write id with our new explicit type variables.

id :: forall a. a -> a
id = forall a. \(x :: a) -> x

Let’s write const and apply.

const :: forall a. forall b. a -> b -> a
const = forall a. forall b. \(x :: a) -> \(y :: b) -> x

apply :: forall a. forall b. (a -> b) -> a -> b
apply = forall a. forall b. \(f :: a -> b) -> \(x :: a) -> f x

Finally, let’s apply some type variables.

constUnit :: Unit -> Unit -> Unit
constUnit =
const @Unit @Unit

idUnitFn :: (Unit -> Unit) -> (Unit -> Unit)
idUnitFn =
id @(Unit -> Unit) f

idReturnUnitFn :: forall a. (a -> Unit) -> (a -> Unit)
idReturnUnitFn =
forall a. id @(a -> Unit)

constUnitFn :: Unit -> (Unit -> Unit) -> Unit
constUnitFn =
const @Unit @(Unit -> Unit)

We’re passing types to functions. With all of these simple functions, the caller gets to provide the type. If we want the implementer to provide a type, then we’d just put the forall inside a parentheses. Let’s look at the applyBoth from above. This time, we’ll have explicit type annotations and introductions!

applyBoth
:: forall a. forall b. (forall x. x -> x) -> (a, b) -> (a, b)
applyBoth =
forall a. forall b.           -- [1]
\(f :: forall x. x -> x) ->   -- [2]
\((k, h) :: (a, b)) ->        -- [3]
(f @a k, f @b h)          -- [4]

There’s a good bit going on here, so let’s break it down on a line-by-line basis.

1. Here, we’re introducing our type variables a and b so that we can refer to them in the type signatures of our variables, and apply them to our functions.
2. Here, we’re introducing our first value parameter - the function f, which itself has a type that accepts a type variable.
3. Now, we’re accepting our second value parameter - a tuple (k, h) :: (a, b). We can refer to a and b in this signature because we’ve introduced them in step 1.
4. Finally, we’re supplying the type @a to our function f in the left hand of the tuple, and the type @b to the type in the right. This allows our types to check.

Let’s see what it looks like to call this function. To give us some more interesting types to work with, we’ll include Int and Bool literals.

foo :: (Int, Bool)
foo =
applyBoth
@Int @Bool
_f
(3, True)

We haven’t decided what _f will look like exactly, but the type of the value is forall x. x -> x. So, syntactically, we’ll introduce our type variable, then our value-variable:

foo :: (Int, Bool)
foo =
applyBoth
@Int @Bool
(forall x. \(a :: x) -> (_ :: x))
(3, True)

As it happens, the only value we can possibly plug in here is a :: x to satisfy this. We know absolutely nothing about the type x, so we cannot do anything with it.

foo :: (Int, Bool)
foo =
applyBoth
@Int @Bool
(forall x. \(a :: x) -> a)
(3, True)

# Tug of War

applyBoth is an awful example of RankNTypes because there’s literally nothing useful you can do with it. The reason is that we don’t give the caller of the function any options! By giving the caller of the function more information, they can do more useful and interesting things with the results.

This mirrors the guarantee of parametric polymorphism. The less that we know about our inputs, the less we can do with them - until we get to types like const :: a -> b -> a where the implementation is completely constrained.

What this means is that we provide, as arguments to the callback function, more information!

Let’s consider this other type:

applyBothList :: (forall x. [x] -> Int) -> ([a], [b]) -> (Int, Int)
applyBothList f (as, bs) =
(f as, f bs)

Now the function knows a good bit more: we have a list as our input (even if we don’t know anything aobut the type), and the output is an Int. Let’s translate this to our polymorphic lambda calculus.

applyBothList =
forall a. forall b.
\(f :: forall x. [x] -> Int) ->
\( as :: [a], bs :: [b] ) ->
( f @a as, f @b bs )

When we call this function, this is what it looks like:

    applyBothList
@Int @Char
(forall x. \(xs :: [x]) -> length @x xs * 2)
( [1, 2, 3], ['a', 'b', 'c', 'd'] )

# Constraints?

In Haskell, a type class constraint is elaborated into a record-of-functions that is indexed by the type.

class Num a where
fromInteger :: Integer -> a
(+) :: a -> a -> a
(*) :: a -> a -> a
(-) :: a -> a -> a
-- etc...

-- under the hood, this is the same thing:

data NumDict a = NumDict
{ fromInteger :: Integer -> a
, (+) :: a -> a -> a
, (-) :: a -> a -> a
, (*) :: a -> a -> a
}

When you have a function that accepts a Num a argument, GHC turns it into a NumDict a and passes it explicitly.

-- Regular Haskell:
square :: Num a => a -> a
square a = a * a

-- What hapens at runtime:
square :: NumDict a -> a -> a
square NumDict {..} a = a * a

Or, for a simpler variant, let’s consider Eq.

-- Regular Haskell:
class Eq a where
(==) :: a -> a -> Bool

-- Runtime dictionary:
newtype EqDict a = EqDict { (==) :: a -> a -> Bool }

-- Regular:
allEqual :: (Eq a) => a -> a -> a -> Bool
allEqual x y z =
x == y && y == z && x == z

-- Runtime dictionary:
allEqual :: EqDict a -> a -> a -> a -> Bool
allEqual (EqDict (==)) x y z =
x == y && y == z && x == z

(Note that binding a variable name to an operator is perfectly legal!)

One common way to extend the power or flexibility of a RankNTypes program is to include allowed constraints in the callback function. Knowing how and when things come into scope can be tricky, but if we remember our polymorphic lambda calculus, this becomes easy.

Consider this weird signature:

weirdNum :: (forall a. Num a => a) -> String

This isn’t exactly a function. What sort of things can we call here?

Well, we have to produce an a. And we know that we have a Num a constraint. This means we can call fromInteger :: Integer -> a. And, we can also use any other Num methods - so we can add to it, double it, square it, etc.

So, calling it might look like this:

main = do
putStrLn \$ weirdNum (fromInteger 3 + 6 * 2)

Let’s elaborate this to our lambda calculus. We’ll convert the type class constraint into an explicit dictionary, and then everything should work normally.

weirdNum =
\(number :: forall a. NumDict a -> a) ->
show @Int intShowDict(number @Int intNumDict)

Now, let’s call this:

    weirdNum
( forall a.
\(dict :: NumDict a) ->
fromInteger dict 3
)

# More on the Lambda Calculus

If you’ve found this elaboration interesting, you may want to consider reading Type Theory and Formal Proof. This book is extremely accessible, and it taught me almost everything I know about the lambda calculus.


text:
# Getting Started with MLFlow

Marton Trencseni - Sun 10 January 2021 - Data

## Introduction

For the last few months I’ve been using MFlow in production, specifically its Tracking component. MLFlow is an open source project for lifecycle tracking and serving of ML models, coming out of Databricks. MLFlow is model agnostic, so you can use with SKLearn, XGBoost, Pytorch, Tensorflow, FBProphet, anything. The best way to get an initial understanding of MLFlow Tracking is to watch the first 25 minutes of this talk by Corey Zumar, who works on MLFlow at Databricks.

MLFlow Tracking is a simple client/server solution to log, track and share model metrics at scale. Using MLFlow makes sense both during the development of the model and also once the model is running in production.

## Using MLFlow for model development

In this scenario, I’m using an ipython notebook and iterating on a model. I’m either reading training data from a files or straight from the database, training models, evaluating on test data, rinse and repeats potentially 100s of times, over days, weeks or months. With MLFlow, I can continuously track various metrics and artifacts of my models runs, such as:

• the current source code for the model training/running
• size/shape of the data I'm using for training
• various metrics and distributions of the training and test data
• model runtime and memory usage
• goodness metrics such as accurary, f1 score, precision, recall, TPR, FPR, etc.
• various plots such as ROC

With MLFlow I achieve a kind of raw versioning of my model development.

## Using MLFlow in production

In production can mean several things:

1. Some models are batchy, and are re-trained at pre-specified intervals (eg. hourly, daily or weekly) on new data, and then emit their prediction for existing data into a table, which is then read out by other processes.
2. Other models are re-trained at regular intervals like above, but then serve prediction requests in real-time, eg. over an HTTP API.
3. In advanced use-cases models are also updated in real-time as new training data comes in, but this is not typical outside of advanced Internet companies.

MLFlow Tracking is agnostic to the above, so it can be used in all scenarios. Personally I'm using it in scenario #1 use-cases so far, from Airflow.

## Setting up MLFlow and the artifact gotcha

Setting up MLFlow is easy. Just create a new venv and pip install mlflow. You will need to pip install mlflow on both the server and all the clients that will be emitting tracking metrics to MLFlow. Remember that you can !pip install mlflow from ipython notebooks.

Now, we can start the server, like:

mlflow server --backend-store-uri XXX --default-artifact-root YYY -h 0.0.0.0 -p 5000

What is backend-store-uri and default-artifact-root?

We will use MLFlow for storing metrics like accuracy, essentially in a flat key-value manner. It will store these in the backend store, which can be a filesystem location or a database like Postgresql. We will also send files to MLFlow for tracking, such as the source code currently running, or a plot we generated (eg. an ROC curve). These will be sent and stored as files under artifact root**, which has to be a filesystem or an S3 bucket.

The big gotcha is that the MLFlow client library:

• when sending metrics, it sends those to the MLFlow server, which stores them in the backend store; the client does not access the backend store directly
• when sending artifacts, the MLFlow client library puts them directly into the artifact store, so both the client and server needs to have access to it! This is very unexpected because it goes against basic client/server principles. For this reason, although you can start up MLFlow by specifying a directory on the server as the artifact root, client calls to save artifacts will fail. You need to specify something like an S3 bucket, and both the client and server needs an AWS access key to read/write!

I have set up MLFlow to use the server's local filesystem for backend store and a shared (between server and clients) S3 bucket for artifact storage.

Once the server is up and running, you can open it in your browser, you should see an empty page like this:

## Sending tracking data to MLFlow

Now we can send tracking data to the MLFlow server. Fundamentally the steps are:

• set up a connection
• set the experiment; if the experiment doesn’t exist, it will be created automatically (the experiment is essentially the project you’re working on)
• open a new experiment run
• log params, metrics and artifacts
• check the results on the web console!

In code:

import os
import mlflow

mlflow.set_tracking_uri('http://127.0.0.1:5000')  # set up connection
mlflow.set_experiment('test-experiment')          # set the experiment
with mlflow.start_run():                          # open new experiment run
mlflow.log_artifact(os.path.abspath(__file__), 'source code')
mlflow.log_param('some parameter', 1)
mlflow.log_metric('accuracy', 0.9)

The experiment test-experiment will show up on the web console:

Inside the experiment are the experiment runs. Selecting the latest one we will see our logged data:

## Conclusion

This was a quick introduction on how to set up MLFlow and how to get some initial data into it. Surprisingly, there is not much more handholding that you will get from MLFlow. Although there is experimental integration of MLFlow into common ML libraries such as SKL (mlflow.sklearn), Pytorch (mlflow.pytorch) and many others, most of the relevant metrics for your model you will have to log manually using the functions above: log_artifact(), log_param(), log_metric(). For example, to save an ROC curve, you will have to generate the plot using pyplot, save it to a .png file, and then save that file as an artifact. In later posts I plan to discuss useful patterns for MLFlow.

Happy MLFlowing!


text: i p {\displaystyle X_{n}\to X} i − . ≥ E(X) = x 10 20 30 40 P(X = x) 10 50 15 50 5 50 20 50 | The expected values of the powers of X are called the moments of X; the moments about the mean of X are expected values of powers of X − E[X]. {\displaystyle \operatorname {P} (X=+\infty )>0,} , then the expected value of ω X ] by the inversion formula: For the expected value of − This formula can also easily be adjusted for the continuous case. x . = + X Méré claimed that this problem couldn't be solved, and that it showed just how flawed mathematics was when it came to its application to the real world. , denoted X X ) {\displaystyle A} n They only informed a small circle of mutual scientific friends in Paris about it.[6].  The following list includes some of the more basic ones. p = Long-run average value of a random variable, This article is about the term used in probability theory and statistics. = 0 {\displaystyle x_{i}} d 1 1 define a sequence of random variables, with ∞ = i {\displaystyle |\psi \rangle } X , = A The expected value informs about what to expect in an experiment "in the long run", after many trials. The only possible values that we can have are 0, 1, 2 and 3. X {\displaystyle {\hat {A}}} {\displaystyle \omega \in \Omega ,}, X {\displaystyle X} + , X + X , . 0 ( R . P ≤ Conversely, if {\displaystyle X^{-}(\omega )\geq -x,} = Recalling that X g [ } M 1 What Is the Skewness of an Exponential Distribution? X X X = ⟨ to denote expected value goes back to W. A. Whitworth in 1901. { The probability density function They solved the problem in different computational ways, but their results were identical because their computations were based on the same fundamental principle. , p ) x i [ {\displaystyle p_{1},p_{2},\ldots ,p_{k},} − n x X P ⋅ ∣ i {\displaystyle X^{-}(\omega )\geq -x. Therefore, the general formul… x ) , c is the Fourier transform of {\displaystyle p_{1}=p_{2}=\cdots =p_{k}}  1 < { E ( σ , + . . x {\displaystyle \varphi _{X}} The expression for P To see this, let  {\displaystyle \{Y_{n}:n\geq 0\}} = } x EV– the expected value 2. {\displaystyle {\mathbf {1} }_{\mathcal {A}}} Expected Value In a probability distribution, the weighted average of possible values of a random variable, with weights given by their respective theoretical probabilities, is known as the expected value, usually represented by E (x). English Translation", "Earliest uses of symbols in probability and statistics", "Generalizations of some probability inequalities and $L^{p}$ convergence of random variables for any monotone measure", https://en.wikipedia.org/w/index.php?title=Expected_value&oldid=990727183, Creative Commons Attribution-ShareAlike License, An example where the expectation is infinite arises in the context of the, For an example where the expectation is not well-defined, suppose the random variable, The following statements regarding a random variable, For a non-negative integer-valued random variable, This page was last edited on 26 November 2020, at 04:41. {\displaystyle n\geq 1,} c ( ∞ i X | is related to its characteristic function ⟨ E is the sum of ∞ {\displaystyle X^{+}(\omega )=0} The law of large numbers demonstrates (under fairly mild conditions) that, as the size of the sample gets larger, the variance of this estimate gets smaller. 1 {\displaystyle X^{-}(\omega )} 0 The use of the letter In German, {\displaystyle c_{i}.} Analogous to the discrete case, the expected value of X ) = We will let the probability density function of X be given by the function f(x). ≥ P The first variation of the expected value formula is the EV of one event repeated several times (think about tossing a coin). If I expect a or b, and have an equal chance of gaining them, my Expectation is worth (a+b)/2. lim x ( X ) In classical mechanics, the center of mass is an analogous concept to expectation. ) The moments of some random variables can be used to specify their distributions, via their moment generating functions. {\displaystyle X_{n}} ( {\displaystyle p_{i}} The random variable X is discrete and finite. ω  Neither Pascal nor Huygens used the term "expectation" in its modern sense. We have, E ( There are many applications for the expected value of a random variable. {\displaystyle c} ) occurring with probabilities X j M E { x > xn, and respective probabilities of p1, p2, p3, . {\displaystyle U} of a scalar random variable ∞ Let's say that we repeat this experiment over and over again. ] In such a case, the EV can be found using the following formula: Where: 1. − X ( ) 2 ∫ {\displaystyle X^{+}(\omega )=\max(X(\omega ),0)} Σ − . A respectively. − − The only possible values that we can have are 0, 1, 2 and 3. with equiprobable outcomes ) )  {\displaystyle x_{1},x_{2},\ldots ,x_{k}} {\displaystyle \operatorname {E} [X_{n}]\to \operatorname {E} [X]} ⟨ → [ 1 p − X X {\displaystyle X} {\displaystyle p_{1},p_{2},\ldots ,} where [5] This problem had been debated for centuries, and many conflicting proposals and solutions had been suggested over the years, when it was posed to Blaise Pascal by French writer and amateur mathematician Chevalier de Méré in 1654. μ + [ We now turn to a continuous random variable, which we will denote by X. and hence {\displaystyle (\operatorname {E} [X])_{ij}=\operatorname {E} [X_{ij}].}. ] E X ) There are a number of inequalities involving the expected values of functions of random variables. , = (a.s). 0 The latter happens whenever ω


text:
Now showing items 1-1 of 1

• #### Uniformly Diophantine Numbers in a Fixed Real Quadratic Field

(Cambridge University Press, 2009)
The field $\mathbb{Q}(\sqrt5)$ contains the infinite sequence of uniformly bounded continued fractions $[\overline{1, 4, 2, 3}], [\overline{1, 1, 4, 2, 1, 3}], [\overline{1, 1, 1, 4, 2, 1, 1, 3}]$, ..., and similar ...


text:
Contents

Idea

Recall that the $n$th symmetric product (or symmetric power) of a space, say $X$, is what you get if you take $n$ points in $X$ without considering the order in which they appear. Since repetitions are allowed, one has to think carefully as to how to deal with multiplicities: either to respect them or to ignore them. The first case, respecting multiplicities, means that $\{0,1,1\}$ and $\{0,0,1\}$ are not considered equivalent. The second means that they are.

On this page we use the first definition, respecting multiplicities, and work with the circle, $S^1$, as our original space. The resulting spaces have straightforward descriptions and simple homotopy types: all are homotopic to the circle. These descriptions can be found in MR0210096

There is a link between this space and the unitary group of a finite dimensional complex Hilbert space. The conjugacy class of a unitary matrix is determined completely by its eigenvalues with their multiplicities in that two unitary matrices are conjugate if and only if their sets-with-multiplicities (bags) of eigenvalues are the same. The eigenvalues of a unitary matrix lie on a circle, but as we are considering the collections as sets and not ordered sets, we must consider the set of eigenvalues as a point in the symmetric product of the circle. Hence knowing this space tells us about the space of conjugacy classes of unitary matrices.

Definition

The notion of the symmetric product of a topological space is an application of the construction of the symmetric power in a symmetric monoidal category, where the category is $\Top$ and the monoidal structure is given by the cartesian product.

Definition

Let $X$ be a topological space. Let $n \in \mathbb{N}$. The $n$th symmetric product of $X$, written $SP^n(X)$, is quotient of $X^n$ by the action of the $n$th symmetric group acting by permuting the coordinates.

On this page, we are most interested in the case $X = S^1$ but it will be instructive to consider also $\mathbb{C}^*$, the non-zero complex numbers, and $\mathbb{R}$. This is because of the existence of the inclusion $S^1 \to \mathbb{C}^*$ and the exponential map $\mathbb{R} \to S^1$.

Properties

The main property of $SP^n(S^1)$ is the following description, due to H. R. Morton in MR0210096.

Proposition

The topological space $SP^n(S^1)$ is a fibre bundle over $S^1$ with fibre an $n-1$ simplex. If $n$ is odd, the bundle is orientable; if $n$ is even then it is not.

In particular, $SP^2(S^1)$ is a Möbius strip.

Before proving this, let us give the descriptions of $SP^n(\mathbb{C}^*)$ and $SP^n(\mathbb{R})$.

Proposition

The topological space $SP^n(\mathbb{C}^*)$ is homeomorphic to $\mathbb{C}^{(n-1)} \times \mathbb{C}^*$.

Proof

The proof rests on giving an alternative description of $SP^n(\mathbb{C}^*)$ in which the lack of ordering of the points is built in at the start. This description is given by taking the polynomial whose roots are the points (here we can see why it is important to take note of the multiplicities).

We define a map $SP^n(\mathbb{C}^*) \to \Poly_n$, the space of polynomials of degree at most $n$, by sending $[\zeta_1,\dots,\zeta_n]$ to the monic polynomial $(z - \zeta_1)\cdots (z - \zeta_n)$. This is a homeomorphism onto its image. That image is the space of monic polynomials with non-zero constant term (as all the $\zeta_j$ are non-zero). There is an obvious homeomorphism of this space to $\mathbb{C}^{n-1} \times \mathbb{C}^*$ given by taking coefficients.

This space is relevant because the construction $SP^n(-)$ respects homotopy equivalences. Hence $SP^n(S^1)$ is homotopy equivalent to $S^1$ and the map $SP^n(S^1) \to S^1$ is given by multiplying the $n$ elements of a point in $SP^n(S^1)$.

Corollary

The space $SP^n(S^1)$ is Hausdorff.

Proof

It embeds in the Hausdorff space $SP^n(\mathbb{C}^*)$.

Proposition

The space $SP^n(\mathbb{R})$ is homeomorphic to $\mathbb{R} \times (\mathbb{R}_+)^{n-1}$.

Proof

The idea of this proof is that although in $SP^n(\mathbb{R})$ an $n$-tuple of points has no intrinsic order (due to the action of the symmetric group), we can always impose an order from “outside” by taking the points in the order in which they occur in $\mathbb{R}$. Thus any element of $SP^n(\mathbb{R})$ has a unique representation as $(t_1,t_2,\dots,t_n)$ where $t_j \le t_{j+1}$. We define the map $SP^n(\mathbb{R}) \to \mathbb{R} \times (\mathbb{R}_+)^{n-1}$ by:

$(t_1,t_2, \dots, t_n) \mapsto (t_1, t_2 - t_1, t_3 - t_2, \dots, t_n - t_{n-1}).$

There is another map which is worth mentioning. The space $\mathbb{R}^n$ has an invariant subspace under the action of the symmetric group (the $n$-fold diagonal) and it is possible to find a homeomorphism $SP^n(\mathbb{R}) \to \mathbb{R} \times (\mathbb{R}_+)^{n-1}$ where the first map is the orthogonal projection onto this subspace. The projection is given by the map which sends $\{t_1,\dots,t_n\}$ to the average value. The fibre of this map is the quotient by the action of the symmetric group of the space of vectors in $\mathbb{R}^n$ whose components sum to zero. As they sum to zero, knowing the differences between the points (in the order imposed from $\mathbb{R}$) is enough to specify the points themselves. The resulting map is thus:

$(t_1,t_2,\dots,t_n) \mapsto \left(\frac{1}{n} \sum t_j, t_2 - t_1, \dots, t_n - t_{n-1}\right).$
Proof of Proposition 1

Now let us prove the proposition. Guided by the description for $SP^n(\mathbb{C}^*)$, we define $p \colon SP^n(S^1) \to S^1$ by $p(\{\zeta_1,\dots,\zeta_n\}) = \zeta_1 \dots \zeta_n$. Let us show that this is a fibre bundle. For $\lambda \in S^1$ we define a map $p^{-1}(\lambda) \times (S^1 \setminus \{\overline{\lambda}\}) \to p^{-1}(S^1 \setminus \{\overline{\lambda}\})$ by:

$p(\{\zeta_1,\dots,\zeta_n\},\lambda e^{i t}) = \{\zeta_1 e^{i t/n}, \dots, \zeta_n e^{i t/n}\}$

where $t \in (-\pi,\pi)$.

It remains to determine the fibre at $1$ and the gluing map at, say, $-1$.

To do this, we consider the exponential map $SP^n(\mathbb{R}) \to SP^n(S^1)$. We use the second description of $SP^n(\mathbb{R})$ as $\mathbb{R} \times (\mathbb{R}_+)^{n-1})$ to view $SP^n(\mathbb{R})$ as a bundle over $\mathbb{R}$. With this picture, the exponential map $SP^n(\mathbb{R}) \to SP^n(S^1)$ is a bundle map covering the exponential map $\mathbb{R} \to S^1$. In particular, we have an induced map $(\mathbb{R}_+)^{n-1} \to p^{-1}(1)$ given by the following recipe:

1. Start with $(r_1,r_2,\dots,r_{n-1}) \in (\mathbb{R}_+)^{n-1}$.
2. Form the sequence of partial sums $(s_1,s_2,\dots,s_n)$ where $s_k = \sum_{j \lt k} r_j$. Note that $s_1 = 0$.
3. Adjust so that their average (equivalently, sum) is $0$ by setting $t_k = s_k - \frac{1}{n} \sum s_j$.
4. Apply the exponential function to produce $\{e^{2 \pi i t_k}\}$ in $SP^n(S^1)$.

To use this to identify the fibre of $p^{-1}(1)$ we restrict this to a simplex. The simplex that we choose at the start is:

$\Delta^n = \{(r_1,r_2,\dots,r_{n-1}) \in [0,1]^n : \sum r_j \le 1\}.$

At the second step, this becomes:

$\{(s_1,s_2,\dots,s_n) \in [0,1]^n : s_j \le s_{j+1}\}.$

At the third step, this becomes:

$\{(t_1,t_2,\dots,t_n) \in \mathbb{R} : \sum t_j = 0,\; t_n \le t_1 + 1\}.$

Thus far, all the maps are by homeomorphisms of their ambient spaces and so are homeomorphisms as they are bijections.

We now wish to determine the image of this in $SP^n(S^1)$. Let $\{\zeta_1,\dots,\zeta_n\}$ be a point in $p^{-1}(1)$. We order them cyclically around the circle going anticlockwise. To turn this into a proper order, we need to choose a first point. If that point is a multiple point, we do not assume that the other points follow immediately after it: some may but the others may occur at the end of the list when we have gone all around the circle. With a multiple point then the decision that that contains the first point also contains a partition of the multiplicities into “at the start of the list” and “at the end of the list”.

Having chosen the first point, we now choose a preimage of that point in $\mathbb{R}$, say $t_1$. This defines a logarithm on the circle with branch cut at the first point. We then proceed around the circle, lifting the other points to $\mathbb{R}$ using the same logarithm. If the chosen point had multiplicities and some are at the end of the list, then these are lifted consistently with having gone around the circle, which means that they are lifted to $t_1 + 1$. The result of this lifting is a set of points $(t_1,t_2,\dots,t_n)$ with $t_j \le t_{j+1}$ and $t_n \le t_1 + 1$. The sum of these points in the line is in the preimage of the product of the points in the circle and thus is an integer.

To see that we can obtain any integer for the sum, consider what happens if we change our choice of first point to the next point anticlockwise. If our original point was multiple and there are others at the start of the list then this means that we shift one point to the end of the list. If we have moved to a new point and it is multiple, then we put all of its points at the start of the list and none at the end. When looking at what happens to the logarithm, we have shifted the cut around (possibly) and now lift starting at $t_2$. The last point that we reach is the one below $t_1$, but we have gone around the circle so we actually reach $t_1 + 1$. Thus the lift of the $n$-tuple of points is now $(t_2,t_3,\dots,t_n,t_1+1)$. The sum has increased by $1$. Hence by choosing the right first point, and the right start to the logarithm, we can ensure that we get an $n$-tuple of points in $\mathbb{R}$ which sum to $0$. The conclusion of all of this is that at the fourth step, when restricting everything to the simplex, the map is surjective onto $p^{-1}(1)$.

It is also injective. The above discussion shows that changing the choice of first point changes the sum by integral values and it is also clear that changing the starting point of the logarithm changes it by multiples of $n$. It is therefore not possible to find two distinct starting points and two distinct lifts which both sum to $0$.

As the simplex is compact and $p^{-1}(1)$ is Hausdorff, the map $\Delta^n \to p^{-1}(1)$ is thus a homeomorphism.

The last step is to identify the transition map. As we go around the circle, we need to adjust the above to take into account the variation in sum. This can be done at the last step where we map to $SP^n(S^1)$ by multiplying each term by $e^{2 \pi i \tau/n}$, where $e^{2 \pi i \tau}$ is the desired product of all the points. The effect that this has on the logarithm is, after a complete revolution, to add $\frac{1}{n}$ to each component. This results in an $n$-tuple with sum $1$ so to correct that we have to move one term from the end to the beginning. This results in a coordinate transformation $(t_1,t_2,\dots,t_n) \mapsto (t_n - 1, t_1, t_2, \dots, t_{n-1})$ which is orientable if $n$ is odd and unorientable if $n$ is even.

Let us illustrate this for the case $n = 2$. Then $SP^2(S^1)$ consists of equivalence classes of pairs of points $\{\zeta_1,\zeta_2\}$ in $S^1$, with repetition allowed. In the fibre of $p$ at $1$ we have the condition $\zeta_1 \zeta_2 = 1$ and so we can write our pair as $\{\zeta,\overline{\zeta}\}$.

On the subset $\zeta \ne -1$ there is a clear parametrisation with domain $[0,1)$ given by $t \mapsto \{e^{i \pi t}, e^{-i \pi t}\}$. The claim is that this extends to a homeomorphism $[0,1] \to p^{-1}(1)$ by sending $1$ to $\{-1,-1\}$. We can define the inverse map directly by sending $\zeta$ to $\Re(\zeta)$ and then composing with an appropriate inverse trigonometric function, but it is more instructive to consider why this works.

Let us imagine that we approach $\{-1,-1\}$ and pass through it. Both before and after, we have two dots moving around the circle mirroring each other. At the crucial time, they meet at $-1$, and then move apart again. Since they are mirroring each other, one comes back along the top part of the circle and one along the bottom. The crucial piece of the puzzle is that we cannot tell which is which. So as far as we are concerned, the two dots may have passed through each other or may have bounced back off each other again.

Hence the fibre at $p^{-1}(1)$ is $[0,1]$.

Now consider what happens as we move around the circle. Suppose that we look at a path on the boundary which starts at the image of $0$ as we move around, then when we are at $e^{2 \pi i t} \in S^1$, we have two points at $e^{\pi i t}$. After going round a full revolution, our double point has only reached $e^{\pi i} = -1$ which is the image of $1$. Hence we have a Möbius strip.

Conjugacy Classes of Unitary Matrices

The symmetric product $SP^n(S^1)$ can be identified with the space of conjugacy classes of unitary transformations on $\mathbb{C}^n$, aka unitary $n \times n$-matrices. This is because the conjugacy class of a unitary transformation is characterised by the eigenvalues of a matrix in the class, including their multiplicities, and these lie in $S^1$. Hence $U_n/conj \simeq SP^n(S^1)$ and the induced map $U_n \to S^1$ is the determinant mapping.

References

• Morton, H. R. (1967). Symmetric products of the circle. Proc. Cambridge Philos. Soc., 63, 349–352. MR0210096
Revised on June 27, 2013 18:42:01 by Andrew Stacey (92.21.157.68)


text:
# VB Script to monitor folder modified

Hi,
Currently I´m monitoring some critical transfer folders with the attached script, this is working fine, but there are some folders that only hosts files for a few seconds, so now I need that it alerts if the folder has been modified, because on the tests that I have made I can not detect the changes, only when the folder has been modified, so, I´d like to know if there´s a way to send an alarm do it, maybe an error code or an statistic.

' Set base folder to monitor
Const conBaseDir = "\\xxx.xxx.xxx.xxx\E\$\Folder"
Const conInterval = 5

' Create file system object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Access folder we are monitoring
Set objFolder = objFSO.GetFolder(conBaseDir)

' Initialize flags
intReturn = 0
intCount = 0

' See if there are any files in the folder currently
For Each objFile In objFolder.Files
' Check if older than 5 minutes, if so indicate "old" files
If DateDiff("n", objFile.DateCreated, Now) > conInterval Then
Wscript.Echo "Message: File older than 5 mins: [" & objFile.Name & "], Created at: [" & objFile.DateCreated & "]"
intReturn = 1
intCount = intCount + 1

Else
' Otherwise just indicate there are new files
Wscript.Echo "Message: File added to queue: [" & objFile.Name & "], Created at: [" & objFile.DateCreated & "]"
If intReturn = 0 Then intReturn = 2
intCount = intCount + 1
End If
Next

' If no files found in queue, see if we might have missed some since last check
If intReturn = 0 Then
If DateDiff("n", objFolder.DateLastModified, Now) < conInterval Then
WScript.Echo "Message: No new files found, but queue modified at: [" & objFolder.DateLastModified & "]"
intReturn = 0
intCount = intCount + 1
End If
End If

' Return appropriate return code to calling program
WScript.Echo vbCrLf & "Statistic:" & intCount
WScript.Quit(intReturn)

###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IT / Software Engineering ConsultantCommented:
Did a test here, script works fine.  Below is the output from my test.  I created a folder named "x:\ee\EE26938811\dir", waited over 5 minutes, and ran the VBS.  It only displayed the Statistics:0 message.  Then I created a file in the folder, and deleted it, to force an update to the folder last changed date.  Rerunning the VBS it messaged that the folder had been changed, and returned the correct statistic.  What are you seeing different than this?

X:\ee\EE26938811>dir
Volume in drive X is Data
Volume Serial Number is F40B-7077

Directory of X:\ee\EE26938811

04/06/2011  09:27 PM    <DIR>          .
04/06/2011  09:27 PM    <DIR>          ..
04/06/2011  09:26 PM    <DIR>          dir
04/06/2011  09:27 PM             1,476 EE26938811.vbs
1 File(s)          1,476 bytes
3 Dir(s)  15,485,386,752 bytes free

X:\ee\EE26938811>cscript EE26938811.vbs

Statistic:0

X:\ee\EE26938811>echo.>dir\test.txt

X:\ee\EE26938811>del dir\test.txt

X:\ee\EE26938811>dir
Volume in drive X is Data
Volume Serial Number is F40B-7077

Directory of X:\ee\EE26938811

04/06/2011  09:27 PM    <DIR>          .
04/06/2011  09:27 PM    <DIR>          ..
04/06/2011  09:33 PM    <DIR>          dir
04/06/2011  09:27 PM             1,476 EE26938811.vbs
1 File(s)          1,476 bytes
3 Dir(s)  15,485,386,752 bytes free

X:\ee\EE26938811>cscript EE26938811.vbs
Message: No new files found, but queue modified at: [04/06/2011 9:33:58 PM]

Statistic:1

~bp

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Hi billprew,

Thanks as always for your help.

The output information is correct, in fact, the script is running pretty fine, the folder modified information shows ok and it has been a very huge help. The thing is that there are 4 folders that I need to monitor due their critical mission and our monitoring software runs the script every 60 seconds at minimum, so it shows me the modified date/time of the folder as a message and it is ok, but I can´t generate an alarm with the message for those special folders because I need to obtain an output of the date/time information as an exit code, for example, please see this script that checks a file when it has been modified. The idea is doing the same but with a folder and thanks again:
Usage: FILEPATH  Local or UNC Path of the target file ) STATEDIR ( A Directory where a state file used by the script each run may be stored)
Const  FAIL = 1, SUCCESS = 0
Dim lstArgs, STATE_PATH
Dim boolStateFound
Dim strFileName, strStateFile, strStateFound, strDateModified, strStateDate, strStateSize, strSize
Dim objFso, objFile, objStateFile, objStream

'get arguments
Set lstArgs = WScript.Arguments

If lstArgs.Count = 2 Then

strFileName  = Trim( lstArgs( 0 ))
STATE_PATH   = Trim( lstArgs( 1 ))

Else

WScript.Echo "Message: Usage: FILE_NAME STATEDIR" & vbCRLF & "FILE_NAME = Local or UNC Path of the target file"
WScript.Echo "Statistic: 0"
WScript.Quit( FAIL )

End If

Set objFso = Wscript.CreateObject( "Scripting.FileSystemObject" )

'check for the existence of the file, and exit if not found
If Not objFso.FileExists(strFileName) Then

WScript.Echo "Statistic: 0"
WScript.Quit( FAIL )

End If

'get the file's modified date
Set objFile = objFso.GetFile(strFileName)
strDateModified = CStr(objFile.DateLastModified)
strSize         = CStr(objFile.Size)

If Not objFso.FolderExists(STATE_PATH) Then

objFso.CreateFolder(STATE_PATH)

End If

'create the state file name
If InStr(strFileName, "\\") = 1 Then

strStateFile = STATE_PATH & Replace(strFileName, "\", ".", 3) & ".state"

Else

strStateFile = STATE_PATH & Replace(strFileName, "\", ".") & ".state"

End If

'now remove spaces and colons from the path (if any exist)

strStateFile = Replace(strStateFile, ":", "")

boolStateFound = true

'check for the existence of the corresponding state file and create if not found
If Not objFso.FileExists( strStateFile ) Then

objFso.CreateTextFile(strStateFile)
boolStateFound = false

End If

If boolStateFound Then
'retrieve the state info

Set objStateFile = objFso.OpenTextFile(strStateFile, 1, false)
objStateFile.close

'compare with the last known modification
If strStateDate <= strDateModified And strSize = strStateSize Then

WScript.Echo "Message: File " & strFileName & " has not been modified "
WScript.Echo "Statistic: " & strSize
WScript.Quit( SUCCESS )

End If

'executed if modified date does not match - file must be modified
' uncomment the next line if you would like the state file to update even when it has been modified
WScript.Echo "Message: File " & strFileName & " has been modified "
WScript.Echo "Statistic: " & strSize
WScript.Quit(3)

End If

WScript.Echo "Message: File " & strFileName & " has been baselined."
WScript.Echo "Statistic: " & strSize
WScript.Quit( SUCCESS )

'update the state file

Set objStateFile = objFso.GetFile(strStateFile)
Set objStream = objStateFile.OpenAsTextStream(2, -2)
objStream.WriteLine(strDateModified)
objStream.WriteLine(strSize)
objStream.close

End Function

IT / Software Engineering ConsultantCommented:
It's not clear to me from your last post what change(s) you are in need of to the script.  Could you explain further, and post a sample of the output you would like generated please.

~bp
Author Commented:
Hi,

The output that I was specting is the statistic count, but checking the script running on all 5 minutes cycle the statistic is ok.

Thanks
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.


text:
7. Singular Value Decomposition (SVD)¶

In addition to regular packages contained in Anaconda by default, this lecture also requires:

!pip install quandl

Collecting quandl

  Downloading Quandl-3.7.0-py2.py3-none-any.whl (26 kB)
Requirement already satisfied: inflection>=0.3.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quandl) (0.5.1)
Requirement already satisfied: requests>=2.7.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quandl) (2.27.1)
Requirement already satisfied: six in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quandl) (1.16.0)
Requirement already satisfied: pandas>=0.14 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quandl) (1.4.2)

Collecting more-itertools
?25l
|██████▍                         | 10 kB 43.4 MB/s eta 0:00:01
|████████████▊                   | 20 kB 49.5 MB/s eta 0:00:01
|███████████████████             | 30 kB 39.3 MB/s eta 0:00:01
|█████████████████████████▍      | 40 kB 24.7 MB/s eta 0:00:01
|███████████████████████████████▊| 51 kB 29.3 MB/s eta 0:00:01
|████████████████████████████████| 51 kB 1.4 MB/s
?25hRequirement already satisfied: numpy>=1.8 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quandl) (1.21.5)
Requirement already satisfied: python-dateutil in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quandl) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from pandas>=0.14->quandl) (2021.3)

Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests>=2.7.0->quandl) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests>=2.7.0->quandl) (1.26.9)
Requirement already satisfied: certifi>=2017.4.17 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests>=2.7.0->quandl) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests>=2.7.0->quandl) (2.0.4)

Installing collected packages: more-itertools, quandl

Successfully installed more-itertools-8.13.0 quandl-3.7.0

import numpy as np
import numpy.linalg as LA
import matplotlib.pyplot as plt
%matplotlib inline
import quandl as ql
import pandas as pd

7.1. Overview¶

The singular value decomposition is a work-horse in applications of least squares projection that form a foundation for some important machine learning methods.

This lecture describes the singular value decomposition and two of its uses:

• principal components analysis (PCA)

• dynamic mode decomposition (DMD)

Each of these can be thought of as a data-reduction procedure designed to capture salient patterns by projecting data onto a limited set of factors.

7.2. The Setup¶

Let $$X$$ be an $$m \times n$$ matrix of rank $$r$$.

Necessarily, $$r \leq \min(m,n)$$.

In this lecture, we’ll think of $$X$$ as a matrix of data.

• each column is an individual – a time period or person, depending on the application

• each row is a random variable measuring an attribute of a time period or a person, depending on the application

We’ll be interested in two cases

• A short and fat case in which $$m << n$$, so that there are many more columns than rows.

• A tall and skinny case in which $$m >> n$$, so that there are many more rows than columns.

We’ll apply a singular value decomposition of $$X$$ in both situations.

In the first case in which there are many more observations $$n$$ than random variables $$m$$, we learn about a joint distribution by taking averages across observations of functions of the observations.

Here we’ll look for patterns by using a singular value decomposition to do a principal components analysis (PCA).

In the second case in which there are many more random variables $$m$$ than observations $$n$$, we’ll proceed in a different way.

We’ll again use a singular value decomposition, but now to do a dynamic mode decomposition (DMD)

7.3. Singular Value Decomposition¶

A singular value decomposition of an $$m \times n$$ matrix $$X$$ of rank $$r \leq \min(m,n)$$ is

$X = U \Sigma V^T$

where

\begin{align*} UU^T & = I & \quad U^T U = I \cr VV^T & = I & \quad V^T V = I \end{align*}

where

• $$U$$ is an $$m \times m$$ matrix whose columns are eigenvectors of $$X^T X$$

• $$V$$ is an $$n \times n$$ matrix whose columns are eigenvectors of $$X X^T$$

• $$\Sigma$$ is an $$m \times n$$ matrix in which the first $$r$$ places on its main diagonal are positive numbers $$\sigma_1, \sigma_2, \ldots, \sigma_r$$ called singular values; remaining entries of $$\Sigma$$ are all zero

• The $$r$$ singular values are square roots of the eigenvalues of the $$m \times m$$ matrix $$X X^T$$ and the $$n \times n$$ matrix $$X^T X$$

• When $$U$$ is a complex valued matrix, $$U^T$$ denotes the conjugate-transpose or Hermitian-transpose of $$U$$, meaning that $$U_{ij}^T$$ is the complex conjugate of $$U_{ji}$$.

• Similarly, when $$V$$ is a complex valued matrix, $$V^T$$ denotes the conjugate-transpose or Hermitian-transpose of $$V$$

In what is called a full SVD, the shapes of $$U$$, $$\Sigma$$, and $$V$$ are $$\left(m, m\right)$$, $$\left(m, n\right)$$, $$\left(n, n\right)$$, respectively.

There is also an alternative shape convention called an economy or reduced SVD .

Thus, note that because we assume that $$X$$ has rank $$r$$, there are only $$r$$ nonzero singular values, where $$r=\textrm{rank}(X)\leq\min\left(m, n\right)$$.

A reduced SVD uses this fact to express $$U$$, $$\Sigma$$, and $$V$$ as matrices with shapes $$\left(m, r\right)$$, $$\left(r, r\right)$$, $$\left(r, n\right)$$.

Sometimes, we will use a full SVD in which $$U$$, $$\Sigma$$, and $$V$$ have shapes $$\left(m, m\right)$$, $$\left(m, n\right)$$, $$\left(n, n\right)$$

Caveat: The properties

\begin{align*} UU^T & = I & \quad U^T U = I \cr VV^T & = I & \quad V^T V = I \end{align*}

apply to a full SVD but not to a reduced SVD.

In the tall-skinny case in which $$m > > n$$, for a reduced SVD

\begin{align*} UU^T & \neq I & \quad U^T U = I \cr VV^T & = I & \quad V^T V = I \end{align*}

while in the short-fat case in which $$m < < n$$, for a reduced SVD

\begin{align*} UU^T & = I & \quad U^T U = I \cr VV^T & = I & \quad V^T V \neq I \end{align*}

When we study Dynamic Mode Decomposition below, we shall want to remember this caveat because we’ll be using reduced SVD’s to compute key objects.

7.4. Reduced Versus Full SVD¶

Earlier, we mentioned full and reduced SVD’s.

In a full SVD

• $$U$$ is $$m \times m$$

• $$\Sigma$$ is $$m \times n$$

• $$V$$ is $$n \times n$$

In a reduced SVD

• $$U$$ is $$m \times r$$

• $$\Sigma$$ is $$r \times r$$

• $$V$$ is $$n \times r$$

Let’s do a some small exercise to compare full and reduced SVD’s.

First, let’s study a case in which $$m = 5 > n = 2$$.

(This is a small example of the tall-skinny that will concern us when we study Dynamic Mode Decompositions below.)

import numpy as np
X = np.random.rand(5,2)
U, S, V = np.linalg.svd(X,full_matrices=True)  # full SVD
Uhat, Shat, Vhat = np.linalg.svd(X,full_matrices=False) # economy SVD
print('U, S, V ='), U, S, V

U, S, V =

(None,
array([[-0.34052222, -0.09787182, -0.5846155 , -0.72972194,  0.01401177],
[-0.38181254, -0.26160055,  0.4990526 , -0.20008981, -0.70476585],
[-0.33771234,  0.69106226,  0.45761617, -0.29529329,  0.33432416],
[-0.74468446,  0.09913197, -0.31013576,  0.58232208, -0.01829527],
[-0.26393036, -0.65923597,  0.32182989, -0.03424646,  0.62530105]]),
array([1.60274772, 0.59508313]),
array([[-0.70109594, -0.71306696],
[ 0.71306696, -0.70109594]]))

print('Uhat, Shat, Vhat = '), Uhat, Shat, Vhat

Uhat, Shat, Vhat =

(None,
array([[-0.34052222, -0.09787182],
[-0.38181254, -0.26160055],
[-0.33771234,  0.69106226],
[-0.74468446,  0.09913197],
[-0.26393036, -0.65923597]]),
array([1.60274772, 0.59508313]),
array([[-0.70109594, -0.71306696],
[ 0.71306696, -0.70109594]]))

rr = np.linalg.matrix_rank(X)
print('rank of X - '), rr

rank of X -

(None, 2)

Properties:

• Where $$U$$ is constructed via a full SVD, $$U^T U = I_{r \times r}$$ and $$U U^T = I_{m \times m}$$

• Where $$\hat U$$ is constructed via a reduced SVD, although $$\hat U^T \hat U = I_{r \times r}$$ it happens that $$\hat U \hat U^T \neq I_{m \times m}$$

We illustrate these properties for our example with the following code cells.

UTU = U.T@U
UUT = U@U.T
print('UUT, UTU = '), UUT, UTU

UUT, UTU =

(None,
array([[ 1.00000000e+00, -8.05184352e-17, -1.19656263e-16,
-2.48986421e-17, -6.82998569e-17],
[-8.05184352e-17,  1.00000000e+00,  2.14558810e-17,
-8.38393706e-17, -9.77995777e-17],
[-1.19656263e-16,  2.14558810e-17,  1.00000000e+00,
-7.17705303e-17,  1.45382600e-16],
[-2.48986421e-17, -8.38393706e-17, -7.17705303e-17,
1.00000000e+00, -4.66847349e-17],
[-6.82998569e-17, -9.77995777e-17,  1.45382600e-16,
-4.66847349e-17,  1.00000000e+00]]),
array([[ 1.00000000e+00, -8.14900249e-18, -9.65482051e-19,
-1.90029973e-16,  1.58919362e-17],
[-8.14900249e-18,  1.00000000e+00,  2.40409630e-17,
2.80505338e-17, -4.58320922e-17],
[-9.65482051e-19,  2.40409630e-17,  1.00000000e+00,
-1.38376530e-17,  2.96849500e-17],
[-1.90029973e-16,  2.80505338e-17, -1.38376530e-17,
1.00000000e+00,  1.93847587e-17],
[ 1.58919362e-17, -4.58320922e-17,  2.96849500e-17,
1.93847587e-17,  1.00000000e+00]]))

UhatUhatT = Uhat@Uhat.T
UhatTUhat = Uhat.T@Uhat
print('UhatUhatT, UhatTUhat= '), UhatUhatT, UhatTUhat

UhatUhatT, UhatTUhat=

(None,
array([[ 0.12553427,  0.15561898,  0.04736303,  0.24387938,  0.15439477],
[ 0.15561898,  0.21421567, -0.05183946,  0.25839689,  0.27322842],
[ 0.04736303, -0.05183946,  0.59161667,  0.31999549, -0.36644056],
[ 0.24387938,  0.25839689,  0.31999549,  0.56438209,  0.13119347],
[ 0.15439477,  0.27322842, -0.36644056,  0.13119347,  0.5042513 ]]),
array([[ 1.00000000e+00, -8.14900249e-18],
[-8.14900249e-18,  1.00000000e+00]]))

Remark: The cells above illustrate application of the fullmatrices=True and full-matrices=False options. Using full-matrices=False returns a reduced singular value decomposition. This option implements an optimal reduced rank approximation of a matrix, in the sense of minimizing the Frobenius norm of the discrepancy between the approximating matrix and the matrix being approximated. Optimality in this sense is established in the celebrated Eckart–Young theorem. See https://en.wikipedia.org/wiki/Low-rank_approximation.

When we study Dynamic Mode Decompositions below, it will be important for us to remember the following important properties of full and reduced SVD’s in such tall-skinny cases.

Let’s do another exercise, but now we’ll set $$m = 2 < 5 = n$$

import numpy as np
X = np.random.rand(2,5)
U, S, V = np.linalg.svd(X,full_matrices=True)  # full SVD
Uhat, Shat, Vhat = np.linalg.svd(X,full_matrices=False) # economy SVD
print('U, S, V ='), U, S, V

U, S, V =

(None,
array([[-0.56798888,  0.82303623],
[-0.82303623, -0.56798888]]),
array([2.00712531, 0.41399433]),
array([[-0.34791301, -0.60810382, -0.40868281, -0.42717968, -0.39957748],
[ 0.62772545,  0.07120616, -0.10971881, -0.7297166 ,  0.23741504],
[-0.07114726, -0.36995093,  0.89371147, -0.24168038, -0.03073731],
[ 0.55088397, -0.66837365, -0.10113969,  0.46921007,  0.13934199],
[-0.41997883, -0.20384405, -0.10950213, -0.08039718,  0.87384837]]))

print('Uhat, Shat, Vhat = '), Uhat, Shat, Vhat

Uhat, Shat, Vhat =

(None,
array([[-0.56798888,  0.82303623],
[-0.82303623, -0.56798888]]),
array([2.00712531, 0.41399433]),
array([[-0.34791301, -0.60810382, -0.40868281, -0.42717968, -0.39957748],
[ 0.62772545,  0.07120616, -0.10971881, -0.7297166 ,  0.23741504]]))

rr = np.linalg.matrix_rank(X)
print('rank X = '), rr

rank X =

(None, 2)

7.5. Digression: Polar Decomposition¶

A singular value decomposition (SVD) is related to the polar decomposition of $$X$$

$X = SQ$

where

\begin{align*} S & = U\Sigma U^T \cr Q & = U V^T \end{align*}

and $$S$$ is evidently a symmetric matrix and $$Q$$ is an orthogonal matrix.

7.6. Principle Components Analysis (PCA)¶

Let’s begin with a case in which $$n >> m$$, so that we have many more observations $$n$$ than random variables $$m$$.

The matrix $$X$$ is short and fat in an $$n >> m$$ case as opposed to a tall and skinny case with $$m > > n$$ to be discussed later.

We regard $$X$$ as an $$m \times n$$ matrix of data:

$X = \begin{bmatrix} X_1 \mid X_2 \mid \cdots \mid X_n\end{bmatrix}$

where for $$j = 1, \ldots, n$$ the column vector $$X_j = \begin{bmatrix}X_{1j}\\X_{2j}\\\vdots\\X_{mj}\end{bmatrix}$$ is a vector of observations on variables $$\begin{bmatrix}x_1\\x_2\\\vdots\\x_m\end{bmatrix}$$.

In a time series setting, we would think of columns $$j$$ as indexing different times at which random variables are observed, while rows index different random variables.

In a cross section setting, we would think of columns $$j$$ as indexing different individuals for which random variables are observed, while rows index different random variables.

The number of positive singular values equals the rank of matrix $$X$$.

Arrange the singular values in decreasing order.

Arrange the positive singular values on the main diagonal of the matrix $$\Sigma$$ of into a vector $$\sigma_R$$.

Set all other entries of $$\Sigma$$ to zero.

7.7. Relationship of PCA to SVD¶

To relate a SVD to a PCA (principal component analysis) of data set $$X$$, first construct the SVD of the data matrix $$X$$:

(7.1)$X = U \Sigma V^T = \sigma_1 U_1 V_1^T + \sigma_2 U_2 V_2^T + \cdots + \sigma_r U_r V_r^T$

where

$U=\begin{bmatrix}U_1|U_2|\ldots|U_m\end{bmatrix}$
$\begin{split} V^T = \begin{bmatrix}V_1^T\\V_2^T\\\ldots\\V_n^T\end{bmatrix} \end{split}$

In equation (7.1), each of the $$m \times n$$ matrices $$U_{j}V_{j}^T$$ is evidently of rank $$1$$.

Thus, we have

(7.2)$\begin{split} X = \sigma_1 \begin{pmatrix}U_{11}V_{1}^T\\U_{21}V_{1}^T\\\cdots\\U_{m1}V_{1}^T\\\end{pmatrix} + \sigma_2\begin{pmatrix}U_{12}V_{2}^T\\U_{22}V_{2}^T\\\cdots\\U_{m2}V_{2}^T\\\end{pmatrix}+\ldots + \sigma_r\begin{pmatrix}U_{1r}V_{r}^T\\U_{2r}V_{r}^T\\\cdots\\U_{mr}V_{r}^T\\\end{pmatrix} \end{split}$

Here is how we would interpret the objects in the matrix equation (7.2) in a time series context:

• $$V_{k}^T= \begin{bmatrix}V_{k1} & V_{k2} & \ldots & V_{kn}\end{bmatrix} \quad \textrm{for each} \ k=1, \ldots, n$$ is a time series $$\lbrace V_{kj} \rbrace_{j=1}^n$$ for the $$k$$th principal component

• $$U_j = \begin{bmatrix}U_{1k}\\U_{2k}\\\ldots\\U_{mk}\end{bmatrix} \ k=1, \ldots, m$$ is a vector of loadings of variables $$X_i$$ on the $$k$$th principle component, $$i=1, \ldots, m$$

• $$\sigma_k$$ for each $$k=1, \ldots, r$$ is the strength of $$k$$th principal component

7.8. PCA with Eigenvalues and Eigenvectors¶

We now use an eigen decomposition of a sample covariance matrix to do PCA.

Let $$X_{m \times n}$$ be our $$m \times n$$ data matrix.

Let’s assume that sample means of all variables are zero.

We can assure this by pre-processing the data by subtracting sample means.

Define the sample covariance matrix $$\Omega$$ as

$\Omega = XX^T$

Then use an eigen decomposition to represent $$\Omega$$ as follows:

$\Omega =P\Lambda P^T$

Here

• $$P$$ is $$m×m$$ matrix of eigenvectors of $$\Omega$$

• $$\Lambda$$ is a diagonal matrix of eigenvalues of $$\Omega$$

We can then represent $$X$$ as

$X=P\epsilon$

where

$\epsilon\epsilon^T=\Lambda .$

We can verify that

$XX^T=P\Lambda P^T .$

It follows that we can represent the data matrix as

$\begin{equation*} X=\begin{bmatrix}X_1|X_2|\ldots|X_m\end{bmatrix} =\begin{bmatrix}P_1|P_2|\ldots|P_m\end{bmatrix} \begin{bmatrix}\epsilon_1\\\epsilon_2\\\ldots\\\epsilon_m\end{bmatrix} = P_1\epsilon_1+P_2\epsilon_2+\ldots+P_m\epsilon_m \end{equation*}$

where

$\epsilon\epsilon^T=\Lambda .$

To reconcile the preceding representation with the PCA that we obtained through the SVD above, we first note that $$\epsilon_j^2=\lambda_j\equiv\sigma^2_j$$.

Now define $$\tilde{\epsilon_j} = \frac{\epsilon_j}{\sqrt{\lambda_j}}$$, which evidently implies that $$\tilde{\epsilon}_j\tilde{\epsilon}_j^T=1$$.

Therefore

\begin{split} \begin{aligned} X&=\sqrt{\lambda_1}P_1\tilde{\epsilon_1}+\sqrt{\lambda_2}P_2\tilde{\epsilon_2}+\ldots+\sqrt{\lambda_m}P_m\tilde{\epsilon_m}\\ &=\sigma_1P_1\tilde{\epsilon_2}+\sigma_2P_2\tilde{\epsilon_2}+\ldots+\sigma_mP_m\tilde{\epsilon_m} , \end{aligned} \end{split}

which evidently agrees with

$X=\sigma_1U_1{V_1}^{T}+\sigma_2 U_2{V_2}^{T}+\ldots+\sigma_{r} U_{r}{V_{r}}^{T}$

provided that we set

• $$U_j=P_j$$ (the loadings of variables on principal components)

• $${V_k}^{T}=\tilde{\epsilon_k}$$ (the principal components)

Since there are several possible ways of computing $$P$$ and $$U$$ for given a data matrix $$X$$, depending on algorithms used, we might have sign differences or different orders between eigenvectors.

We can resolve such ambiguities about $$U$$ and $$P$$ by

1. sorting eigenvalues and singular values in descending order

2. imposing positive diagonals on $$P$$ and $$U$$ and adjusting signs in $$V^T$$ accordingly

7.9. Connections¶

To pull things together, it is useful to assemble and compare some formulas presented above.

First, consider the following SVD of an $$m \times n$$ matrix:

$X = U\Sigma V^T$

Compute:

\begin{align*} XX^T&=U\Sigma V^TV\Sigma^T U^T\cr &\equiv U\Sigma\Sigma^TU^T\cr &\equiv U\Lambda U^T \end{align*}

Thus, $$U$$ in the SVD is the matrix $$P$$ of eigenvectors of $$XX^T$$ and $$\Sigma \Sigma^T$$ is the matrix $$\Lambda$$ of eigenvalues.

Second, let’s compute

\begin{align*} X^TX &=V\Sigma^T U^TU\Sigma V^T\\ &=V\Sigma^T{\Sigma}V^T \end{align*}

Thus, the matrix $$V$$ in the SVD is the matrix of eigenvectors of $$X^TX$$

Summarizing and fitting things together, we have the eigen decomposition of the sample covariance matrix

$X X^T = P \Lambda P^T$

where $$P$$ is an orthogonal matrix.

Further, from the SVD of $$X$$, we know that

$X X^T = U \Sigma \Sigma^T U^T$

where $$U$$ is an orthonal matrix.

Thus, $$P = U$$ and we have the representation of $$X$$

$X = P \epsilon = U \Sigma V^T$

It follows that

$U^T X = \Sigma V^T = \epsilon$

Note that the preceding implies that

$\epsilon \epsilon^T = \Sigma V^T V \Sigma^T = \Sigma \Sigma^T = \Lambda ,$

so that everything fits together.

Below we define a class DecomAnalysis that wraps PCA and SVD for a given a data matrix X.

class DecomAnalysis:
"""
A class for conducting PCA and SVD.
"""

def __init__(self, X, n_component=None):

self.X = X

self.Ω = (X @ X.T)

self.m, self.n = X.shape
self.r = LA.matrix_rank(X)

if n_component:
self.n_component = n_component
else:
self.n_component = self.m

def pca(self):

𝜆, P = LA.eigh(self.Ω)    # columns of P are eigenvectors

ind = sorted(range(𝜆.size), key=lambda x: 𝜆[x], reverse=True)

# sort by eigenvalues
self.𝜆 = 𝜆[ind]
P = P[:, ind]
self.P = P @ diag_sign(P)

self.Λ = np.diag(self.𝜆)

self.explained_ratio_pca = np.cumsum(self.𝜆) / self.𝜆.sum()

# compute the N by T matrix of principal components
self.𝜖 = self.P.T @ self.X

P = self.P[:, :self.n_component]
𝜖 = self.𝜖[:self.n_component, :]

# transform data
self.X_pca = P @ 𝜖

def svd(self):

U, 𝜎, VT = LA.svd(self.X)

ind = sorted(range(𝜎.size), key=lambda x: 𝜎[x], reverse=True)

# sort by eigenvalues
d = min(self.m, self.n)

self.𝜎 = 𝜎[ind]
U = U[:, ind]
D = diag_sign(U)
self.U = U @ D
VT[:d, :] = D @ VT[ind, :]
self.VT = VT

self.Σ = np.zeros((self.m, self.n))
self.Σ[:d, :d] = np.diag(self.𝜎)

𝜎_sq = self.𝜎 ** 2
self.explained_ratio_svd = np.cumsum(𝜎_sq) / 𝜎_sq.sum()

# slicing matrices by the number of components to use
U = self.U[:, :self.n_component]
Σ = self.Σ[:self.n_component, :self.n_component]
VT = self.VT[:self.n_component, :]

# transform data
self.X_svd = U @ Σ @ VT

def fit(self, n_component):

# pca
P = self.P[:, :n_component]
𝜖 = self.𝜖[:n_component, :]

# transform data
self.X_pca = P @ 𝜖

# svd
U = self.U[:, :n_component]
Σ = self.Σ[:n_component, :n_component]
VT = self.VT[:n_component, :]

# transform data
self.X_svd = U @ Σ @ VT

def diag_sign(A):
"Compute the signs of the diagonal of matrix A"

D = np.diag(np.sign(np.diag(A)))

return D

We also define a function that prints out information so that we can compare decompositions obtained by different algorithms.

def compare_pca_svd(da):
"""
Compare the outcomes of PCA and SVD.
"""

da.pca()
da.svd()

print('Eigenvalues and Singular values\n')
print(f'λ = {da.λ}\n')
print(f'σ^2 = {da.σ**2}\n')
print('\n')

fig, axs = plt.subplots(1, 2, figsize=(14, 5))
axs[0].plot(da.P.T)
axs[0].set_title('P')
axs[0].set_xlabel('m')
axs[1].plot(da.U.T)
axs[1].set_title('U')
axs[1].set_xlabel('m')
plt.show()

# principal components
fig, axs = plt.subplots(1, 2, figsize=(14, 5))
plt.suptitle('principal components')
axs[0].plot(da.ε.T)
axs[0].set_title('ε')
axs[0].set_xlabel('n')
axs[1].plot(da.VT[:da.r, :].T * np.sqrt(da.λ))
axs[1].set_title('$V^T*\sqrt{\lambda}$')
axs[1].set_xlabel('n')
plt.show()

For an example PCA applied to analyzing the structure of intelligence tests see this lecture Multivariable Normal Distribution.

Look at the parts of that lecture that describe and illustrate the classic factor analysis model.

7.10. Dynamic Mode Decomposition (DMD)¶

We turn to the case in which $$m >>n$$.

Here an $$m \times n$$ data matrix $$\tilde X$$ contains many more random variables $$m$$ than observations $$n$$.

This tall and skinny case is associated with Dynamic Mode Decomposition.

Dynamic mode decomposition was introduced by [Sch10],

You can read more about Dynamic Mode Decomposition here [KBBWP16] and here [BK19] (section 7.2).

We want to fit a first-order vector autoregression

(7.3)$X_{t+1} = A X_t + C \epsilon_{t+1}$

where $$\epsilon_{t+1}$$ is the time $$t+1$$ instance of an i.i.d. $$m \times 1$$ random vector with mean vector zero and identity covariance matrix and

where the $$m \times 1$$ vector $$X_t$$ is

(7.4)$X_t = \begin{bmatrix} X_{1,t} & X_{2,t} & \cdots & X_{m,t} \end{bmatrix}^T$

and where $$T$$ again denotes complex transposition and $$X_{i,t}$$ is an observation on variable $$i$$ at time $$t$$.

We want to fit equation (7.3).

Our data are organized in an $$m \times (n+1)$$ matrix $$\tilde X$$

$\tilde X = \begin{bmatrix} X_1 \mid X_2 \mid \cdots \mid X_n \mid X_{n+1} \end{bmatrix}$

where for $$t = 1, \ldots, n +1$$, the $$m \times 1$$ vector $$X_t$$ is given by (7.4).

Thus, we want to estimate a system (7.3) that consists of $$m$$ least squares regressions of everything on one lagged value of everything.

The $$i$$’th equation of (7.3) is a regression of $$X_{i,t+1}$$ on the vector $$X_t$$.

We proceed as follows.

From $$\tilde X$$, we form two $$m \times n$$ matrices

$X = \begin{bmatrix} X_1 \mid X_2 \mid \cdots \mid X_{n}\end{bmatrix}$

and

$X' = \begin{bmatrix} X_2 \mid X_3 \mid \cdots \mid X_{n+1}\end{bmatrix}$

Here $$'$$ does not indicate matrix transposition but instead is part of the name of the matrix $$X'$$.

In forming $$X$$ and $$X'$$, we have in each case dropped a column from $$\tilde X$$, the last column in the case of $$X$$, and the first column in the case of $$X'$$.

Evidently, $$X$$ and $$X'$$ are both $$m \times n$$ matrices.

We denote the rank of $$X$$ as $$p \leq \min(m, n)$$.

Two possible cases are

• $$n > > m$$, so that we have many more time series observations $$n$$ than variables $$m$$

• $$m > > n$$, so that we have many more variables $$m$$ than time series observations $$n$$

At a general level that includes both of these special cases, a common formula describes the least squares estimator $$\hat A$$ of $$A$$ for both cases, but important details differ.

The common formula is

(7.5)$\hat A = X' X^+$

where $$X^+$$ is the pseudo-inverse of $$X$$.

Formulas for the pseudo-inverse differ for our two cases.

When $$n > > m$$, so that we have many more time series observations $$n$$ than variables $$m$$ and when $$X$$ has linearly independent rows, $$X X^T$$ has an inverse and the pseudo-inverse $$X^+$$ is

$X^+ = X^T (X X^T)^{-1}$

Here $$X^+$$ is a right-inverse that verifies $$X X^+ = I_{m \times m}$$.

In this case, our formula (7.5) for the least-squares estimator of the population matrix of regression coefficients $$A$$ becomes

$\hat A = X' X^T (X X^T)^{-1}$

This formula is widely used in economics to estimate vector autorgressions.

The right side is proportional to the empirical cross second moment matrix of $$X_{t+1}$$ and $$X_t$$ times the inverse of the second moment matrix of $$X_t$$.

This least-squares formula widely used in econometrics.

Tall-Skinny Case:

When $$m > > n$$, so that we have many more variables $$m$$ than time series observations $$n$$ and when $$X$$ has linearly independent columns, $$X^T X$$ has an inverse and the pseudo-inverse $$X^+$$ is

$X^+ = (X^T X)^{-1} X^T$

Here $$X^+$$ is a left-inverse that verifies $$X^+ X = I_{n \times n}$$.

In this case, our formula (7.5) for a least-squares estimator of $$A$$ becomes

(7.6)$\hat A = X' (X^T X)^{-1} X^T$

This is the case that we are interested in here.

If we use formula (7.6) to calculate $$\hat A X$$ we find that

$\hat A X = X'$

so that the regression equation fits perfectly, the usual outcome in an underdetermined least-squares model.

Thus, we want to fit equation (7.3) in a situation in which we have a number $$n$$ of observations that is small relative to the number $$m$$ of variables that appear in the vector $$X_t$$.

To reiterate and offer an idea about how we can efficiently calculate the pseudo-inverse $$X^+$$, as our estimator $$\hat A$$ of $$A$$ we form an $$m \times m$$ matrix that solves the least-squares best-fit problem

(7.7)$\hat A = \textrm{argmin}_{\check A} || X' - \check A X ||_F$

where $$|| \cdot ||_F$$ denotes the Frobeneus norm of a matrix.

The minimizer of the right side of equation (7.7) is

(7.8)$\hat A = X' X^{+}$

where the (possibly huge) $$n \times m$$ matrix $$X^{+} = (X^T X)^{-1} X^T$$ is again a pseudo-inverse of $$X$$.

The $$i$$th row of $$\hat A$$ is an $$m \times 1$$ vector of regression coefficients of $$X_{i,t+1}$$ on $$X_{j,t}, j = 1, \ldots, m$$.

For some situations that we are interested in, $$X^T X$$ can be close to singular, a situation that can make some numerical algorithms be error-prone.

To confront that possibility, we’ll use efficient algorithms for computing and for constructing reduced rank approximations of $$\hat A$$ in formula (7.6).

The $$i$$th row of $$\hat A$$ is an $$m \times 1$$ vector of regression coefficients of $$X_{i,t+1}$$ on $$X_{j,t}, j = 1, \ldots, m$$.

An efficient way to compute the pseudo-inverse $$X^+$$ is to start with a singular value decomposition

(7.9)$X = U \Sigma V^T$

We can use the singular value decomposition (7.9) efficiently to construct the pseudo-inverse $$X^+$$ by recognizing the following string of equalities.

(7.10)\begin{split} \begin{aligned} X^{+} & = (X^T X)^{-1} X^T \\ & = (V \Sigma U^T U \Sigma V^T)^{-1} V \Sigma U^T \\ & = (V \Sigma \Sigma V^T)^{-1} V \Sigma U^T \\ & = V \Sigma^{-1} \Sigma^{-1} V^T V \Sigma U^T \\ & = V \Sigma^{-1} U^T \end{aligned} \end{split}

(Since we are in the $$m > > n$$ case in which $$V^T V = I$$ in a reduced SVD, we can use the preceding string of equalities for a reduced SVD as well as for a full SVD.)

Thus, we shall construct a pseudo-inverse $$X^+$$ of $$X$$ by using a singular value decomposition of $$X$$ in equation (7.9) to compute

(7.11)$X^{+} = V \Sigma^{-1} U^T$

where the matrix $$\Sigma^{-1}$$ is constructed by replacing each non-zero element of $$\Sigma$$ with $$\sigma_j^{-1}$$.

We can use formula (7.11) together with formula (7.8) to compute the matrix $$\hat A$$ of regression coefficients.

Thus, our estimator $$\hat A = X' X^+$$ of the $$m \times m$$ matrix of coefficients $$A$$ is

(7.12)$\hat A = X' V \Sigma^{-1} U^T$

In addition to doing that, we’ll eventually use dynamic mode decomposition to compute a rank $$r$$ approximation to $$\hat A$$, where $$r < p$$.

Remark: We described and illustrated a reduced singular value decomposition above, and compared it with a full singular value decomposition. In our Python code, we’ll typically use a reduced SVD.

Next, we describe alternative representations of our first-order linear dynamic system.

7.11. Representation 1¶

In this representation, we shall use a full SVD of $$X$$.

We use the $$m$$ columns of $$U$$, and thus the $$m$$ rows of $$U^T$$, to define a $$m \times 1$$ vector $$\tilde b_t$$ as follows

(7.13)$\tilde b_t = U^T X_t$

and

(7.14)$X_t = U \tilde b_t$

(Here we use the notation $$b$$ to remind ourselves that we are creating a basis vector.)

Since we are using a full SVD, $$U U^T$$ is an $$m \times m$$ identity matrix.

So it follows from equation (7.13) that we can reconstruct $$X_t$$ from $$\tilde b_t$$ by using

• Equation (7.13) serves as an encoder that rotates the $$m \times 1$$ vector $$X_t$$ to become an $$m \times 1$$ vector $$\tilde b_t$$

• Equation (7.14) serves as a decoder that recovers the $$m \times 1$$ vector $$X_t$$ by rotating the $$m \times 1$$ vector $$\tilde b_t$$

Define a transition matrix for a rotated $$m \times 1$$ state $$\tilde b_t$$ by

(7.15)$\tilde A = U^T \hat A U$

We can evidently recover $$\hat A$$ from

$\hat A = U \tilde A U^T$

Dynamics of the rotated $$m \times 1$$ state $$\tilde b_t$$ are governed by

$\tilde b_{t+1} = \tilde A \tilde b_t$

To construct forecasts $$\overline X_t$$ of future values of $$X_t$$ conditional on $$X_1$$, we can apply decoders (i.e., rotators) to both sides of this equation and deduce

$\overline X_{t+1} = U \tilde A^t U^T X_1$

where we use $$\overline X_t$$ to denote a forecast.

7.12. Representation 2¶

This representation is related to one originally proposed by [Sch10].

It can be regarded as an intermediate step to a related and perhaps more useful representation 3.

As with Representation 1, we continue to

• use a full SVD and not a reduced SVD

As we observed and illustrated earlier in this lecture, for a full SVD $$U U^T$$ and $$U^T U$$ are both identity matrices; but under a reduced SVD of $$X$$, $$U^T U$$ is not an identity matrix.

As we shall see, a full SVD is too confining for what we ultimately want to do, namely, situations in which $$U^T U$$ is not an identity matrix because we use a reduced SVD of $$X$$.

But for now, let’s proceed under the assumption that both of the preceding two requirements are satisfied.

Form an eigendecomposition of the $$m \times m$$ matrix $$\tilde A = U^T \hat A U$$ defined in equation (7.15):

(7.16)$\tilde A = W \Lambda W^{-1}$

where $$\Lambda$$ is a diagonal matrix of eigenvalues and $$W$$ is an $$m \times m$$ matrix whose columns are eigenvectors corresponding to rows (eigenvalues) in $$\Lambda$$.

When $$U U^T = I_{m \times m}$$, as is true with a full SVD of $$X$$, it follows that

(7.17)$\hat A = U \tilde A U^T = U W \Lambda W^{-1} U^T$

Evidently, according to equation (7.17), the diagonal matrix $$\Lambda$$ contains eigenvalues of $$\hat A$$ and corresponding eigenvectors of $$\hat A$$ are columns of the matrix $$UW$$.

Thus, the systematic (i.e., not random) parts of the $$X_t$$ dynamics captured by our first-order vector autoregressions are described by

$X_{t+1} = U W \Lambda W^{-1} U^T X_t$

Multiplying both sides of the above equation by $$W^{-1} U^T$$ gives

$W^{-1} U^T X_{t+1} = \Lambda W^{-1} U^T X_t$

or

$\hat b_{t+1} = \Lambda \hat b_t$

where now our encoder is

$\hat b_t = W^{-1} U^T X_t$

and our decoder is

$X_t = U W \hat b_t$

We can use this representation to construct a predictor $$\overline X_{t+1}$$ of $$X_{t+1}$$ conditional on $$X_1$$ via:

(7.18)$\overline X_{t+1} = U W \Lambda^t W^{-1} U^T X_1$

In effect, [Sch10] defined an $$m \times m$$ matrix $$\Phi_s$$ as

(7.19)$\Phi_s = UW$

and represented equation (7.18) as

(7.20)$\overline X_{t+1} = \Phi_s \Lambda^t \Phi_s^+ X_1$

Components of the basis vector $$\hat b_t = W^{-1} U^T X_t \equiv \Phi_s^+$$ are often called DMD modes, or sometimes also DMD projected nodes.

We turn next to an alternative representation suggested by Tu et al. [TRL+14], one that is more appropriate to use when, as in practice is typically the case, we use a reduced SVD.

7.13. Representation 3¶

Departing from the procedures used to construct Representations 1 and 2, each of which deployed a full SVD, we now use a reduced SVD.

Again, we let $$p \leq \textrm{min}(m,n)$$ be the rank of $$X$$.

Construct a reduced SVD

$X = \tilde U \tilde \Sigma \tilde V^T,$

where now $$U$$ is $$m \times p$$ and $$\Sigma$$ is $$p \times p$$ and $$V^T$$ is $$p \times n$$.

Our minimum-norm least-squares estimator approximator of $$A$$ now has representation

$\hat A = X' \tilde V \tilde \Sigma^{-1} \tilde U^T$

Paralleling a step in Representation 1, define a transition matrix for a rotated $$p \times 1$$ state $$\tilde b_t$$ by

(7.21)$\tilde A =\tilde U^T \hat A \tilde U$

Because we are now working with a reduced SVD, so that $$\tilde U \tilde U^T \neq I$$, since $$\hat A \neq \tilde U \tilde A \tilde U^T$$, we can’t simply recover $$\hat A$$ from $$\tilde A$$ and $$\tilde U$$.

Nevertheless, hoping for the best, we persist and construct an eigendecomposition of what is now a $$p \times p$$ matrix $$\tilde A$$:

(7.22)$\tilde A = W \Lambda W^{-1}$

Mimicking our procedure in Representation 2, we cross our fingers and compute the $$m \times p$$ matrix

(7.23)$\tilde \Phi_s = \tilde U W$

that corresponds to (7.19) for a full SVD.

At this point, it is interesting to compute $$\hat A \tilde \Phi_s$$:

\begin{split} \begin{aligned} \hat A \tilde \Phi_s & = (X' \tilde V \tilde \Sigma^{-1} \tilde U^T) (\tilde U W) \\ & = X' \tilde V \tilde \Sigma^{-1} W \\ & \neq (\tilde U W) \Lambda \\ & = \tilde \Phi_s \Lambda \end{aligned} \end{split}

That $$\hat A \tilde \Phi_s \neq \tilde \Phi_s \Lambda$$ means, that unlike the corresponding situation in Representation 2, columns of $$\tilde \Phi_s = \tilde U W$$ are not eigenvectors of $$\hat A$$ corresponding to eigenvalues $$\Lambda$$.

But in a quest for eigenvectors of $$\hat A$$ that we can compute with a reduced SVD, let’s define

$\Phi \equiv \hat A \tilde \Phi_s = X' \tilde V \tilde \Sigma^{-1} W$

It turns out that columns of $$\Phi$$ are eigenvectors of $$\hat A$$, a consequence of a result established by Tu et al. [TRL+14].

To present their result, for convenience we’ll drop the tilde $$\tilde \cdot$$ above $$U, V,$$ and $$\Sigma$$ and adopt the understanding that each of them is computed with a reduced SVD.

Thus, we now use the notation that the $$m \times p$$ matrix $$\Phi$$ is defined as

(7.24)$\Phi = X' V \Sigma^{-1} W$

Proposition The $$p$$ columns of $$\Phi$$ are eigenvectors of $$\check A$$.

Proof: From formula (7.24) we have

\begin{aligned} \hat A \Phi & = (X' V \Sigma^{-1} U^T) (X' V \Sigma^{-1} W) \cr & = X' V \Sigma^{-1} \tilde A W \cr & = X' V \Sigma^{-1} W \Lambda \cr & = \Phi \Lambda \end{aligned}

Thus, we have deduced that

(7.25)$\hat A \Phi = \Phi \Lambda$

Let $$\phi_i$$ be the the $$i$$the column of $$\Phi$$ and $$\lambda_i$$ be the corresponding $$i$$ eigenvalue of $$\tilde A$$ from decomposition (7.22).

Writing out the $$m \times 1$$ vectors on both sides of equation (7.25) and equating them gives

$\hat A \phi_i = \lambda_i \phi_i .$

Thus, $$\phi_i$$ is an eigenvector of $$\hat A$$ that corresponds to eigenvalue $$\lambda_i$$ of $$\tilde A$$.

This concludes the proof.

Also see [BK19] (p. 238)

7.13.1. Decoder of $$X$$ as linear projection¶

From eigendecomposition (7.25) we can represent $$\hat A$$ as

(7.26)$\hat A = \Phi \Lambda \Phi^+ .$

From formula (7.26) we can deduce the reduced dimension dynamics

$\check b_{t+1} = \Lambda \check b_t$

where

(7.27)$\check b_t = \Phi^+ X_t$

Since $$\Phi$$ has $$p$$ linearly independent columns, the generalized inverse of $$\Phi$$ is

$\Phi^{\dagger} = (\Phi^T \Phi)^{-1} \Phi^T$

and so

(7.28)$\check b = (\Phi^T \Phi)^{-1} \Phi^T X$

$$\check b$$ is recognizable as the matrix of least squares regression coefficients of the matrix $$X$$ on the matrix $$\Phi$$ and

$\check X = \Phi \check b$

is the least squares projection of $$X$$ on $$\Phi$$.

By virtue of least-squares projection theory discussed here https://python-advanced.quantecon.org/orth_proj.html, we can represent $$X$$ as the sum of the projection $$\check X$$ of $$X$$ on $$\Phi$$ plus a matrix of errors.

To verify this, note that the least squares projection $$\check X$$ is related to $$X$$ by

$X = \Phi \check b + \epsilon$

where $$\epsilon$$ is an $$m \times n$$ matrix of least squares errors satisfying the least squares orthogonality conditions $$\epsilon^T \Phi =0$$ or

(7.29)$(X - \Phi \check b)^T \Phi = 0_{m \times p}$

Rearranging the orthogonality conditions (7.29) gives $$X^T \Phi = \check b \Phi^T \Phi$$ which implies formula (7.28).

7.13.2. Alternative algorithm¶

There is a better way to compute the $$p \times 1$$ vector $$\check b_t$$ than provided by formula (7.27).

In particular, the following argument from [BK19] (page 240) provides a computationally efficient way to compute $$\check b_t$$.

For convenience, we’ll do this first for time $$t=1$$.

For $$t=1$$, we have

(7.30)$X_1 = \Phi \check b_1$

where $$\check b_1$$ is an $$r \times 1$$ vector.

Recall from representation 1 above that $$X_1 = U \tilde b_1$$, where $$\tilde b_1$$ is the time $$1$$ basis vector for representation 1.

It then follows from equation (7.24) that

$U \tilde b_1 = X' V \Sigma^{-1} W \check b_1$

and consequently

$\tilde b_1 = U^T X' V \Sigma^{-1} W \check b_1$

Recall that from equation (7.12), $$\tilde A = U^T X' V \Sigma^{-1}$$.

It then follows that

$\tilde b_1 = \tilde A W \check b_1$

and therefore, by the eigendecomposition (7.16) of $$\tilde A$$, we have

$\tilde b_1 = W \Lambda \check b_1$

Consequently,

$\check b_1 = ( W \Lambda)^{-1} \tilde b_1$

or

(7.31)$\check b_1 = ( W \Lambda)^{-1} U^T X_1 ,$

which is computationally more efficient than the following instance of equation (7.27) for computing the initial vector $$\check b_1$$:

(7.32)$\check b_1= \Phi^{+} X_1$

Users of DMD sometimes call components of the basis vector $$\check b_t = \Phi^+ X_t \equiv (W \Lambda)^{-1} U^T X_t$$ the exact DMD modes.

Conditional on $$X_t$$, we can compute our decoded $$\check X_{t+j}, j = 1, 2, \ldots$$ from either

(7.33)$\check X_{t+j} = \Phi \Lambda^j \Phi^{+} X_t$

or

(7.34)$\check X_{t+j} = \Phi \Lambda^j (W \Lambda)^{-1} U^T X_t .$

We can then use $$\check X_{t+j}$$ to forcast $$X_{t+j}$$.

7.14. Using Fewer Modes¶

Some of the preceding formulas assume that we have retained all $$p$$ modes associated with the positive singular values of $$X$$.

We can adjust our formulas to describe a situation in which we instead retain only the $$r < p$$ largest singular values.

In that case, we simply replace $$\Sigma$$ with the appropriate $$r \times r$$ matrix of singular values, $$U$$ with the $$m \times r$$ matrix of whose columns correspond to the $$r$$ largest singular values, and $$V$$ with the $$n \times r$$ matrix whose columns correspond to the $$r$$ largest singular values.

Counterparts of all of the salient formulas above then apply.

7.15. Source for Some Python Code¶

You can find a Python implementation of DMD here:

https://mathlab.github.io/PyDMD/


text:
# Question

A sample of 12 drivers shows the time that they spent (in minutes) stopped in rush-hour traffic on a specific snowy day last winter.
52 56 53
61 49 51
53 58 53
60 71 58
Find the range, variance, and standard deviation unless the question asks for something different. Assume the data represent samples, and use the shortcut formula for the unbiased estimator to compute the variance and standard deviation.

Sales0
Views38


text:
# Finite Math Examples

The slope of the best fit regression line can be found using the formula .
The y-intercept of the best fit regression line can be found using the formula .
Sum up the values of the first column of data .
Simplify the expression.
Sum up the values of the second column of data .
Simplify the expression.
Sum up the values of .
Simplify the expression.
Sum up the values of .
Simplify the expression.
Sum up the values of .
Simplify the expression.
Fill in the computed values.
Simplify the expression.
Fill in the computed values.
Simplify the expression.
Fill in the values of slope and y-intercept into the slope y-intercept formula.

We're sorry, we were unable to process your request at this time

Step-by-step work + explanations
•    Step-by-step work
•    Detailed explanations
•    Access anywhere
Access the steps on both the Mathway website and mobile apps
$--.--/month$--.--/year (--%)


text:
Math shortcuts, Articles, worksheets, Exam tips, Question, Answers, FSc, BSc, MSc

#### Keep Connect with Us

• =

• Welcome in Math School.
• This is beta verion of our website.

Complex Varialbes and Applications (Seventh Edition) by James Ward Brown and Ruel V. Churchill

MathSchoolinternational.com contain houndreds of Free Math e-Books. Which cover almost all topics of mathematics. To see an extisive list of Complex Analysis eBooks . We hope mathematician or person who’s interested in mathematics like these books.

Complex Varialbes and Applications (Seventh Edition) written by James Ward Brown , Professor of Mathematics, The University of Michigan--Dearborn and Ruel V. Churchill , Late Professor of Mathematics, The University of Michigan. The first objective of the book is to develop those parts of the theory which are prominent in applications of the subject. The second objective is to furnish an introduction to applications of residues and conformal mapping. Special emphasis is given to the use of conformal mapping in solving boundary value problems that arise in studies of heat conduction, electrostatic potential, and fluid flow. Hence the book may be considered as a companion volume to the authors' "Fourier Series and Boundary Value Problems" and Rue! V, Churchill's "Operational Mathematics," where other classical methods for solving boundary value problems in partial differential equations are developed. The latter book also contains further applications of residues in connection with Laplace transforms. This book has been used for many years in a three-hour course given each term at The University of Michigan. The classes have consisted mainly of seniors and graduate students majoring in mathematics, engineering, or one of the physical sciences. Before taking the course, the students have completed at least a three-term calculus sequence, a first course in ordinary differential equations, and sometimes a term of advanced calculus. In order to accommodate as wide a range of readers as possible, there are footnotes referring to texts that give proofs and discussions of the more delicate results from calculus that are occasionally needed. Some of the material in the book need not be covered in lectures and can be left for students to read on their own. If mapping by elementary functions and applications of conformal mapping are desired earlier in the course, one can skip to Chapters 8, 9, and 10 immediately after Chapter 3 on elementary functions.

Complex Varialbes and Applications (Seventh Edition) written by James Ward Brown and Ruel V. Churchill cover the following topics.

• Preface

• 1. Complex Numbers
Sums and Products 1 Basic Algebraic Properties
Further Properties
Moduli
Complex Conjugates
Exponential Form
Products and Quotients in Exponential Form
Roots of Complex Numbers
Examples
Regions in the Complex Plane

• 2. Analytic Functions
Functions of a Complex Variable
Mappings
Mappings by the Exponential Function
Limits
Theorems on Limits
Limits Involving the Point at Infinity
Continuity
Derivatives
Differentiation Formulas
Cauchy-Riemann Equations
Sufficient Conditions for Differentiability
Polar Coordinates
Analytic Functions
Examples
Harmonic Functions
Uniquely Determined Analytic Functions
Reflection Principle

• 3. Elementary Functions
The Exponential Function
The Logarithmic Function
Branches and Derivatives of Logarithms
Some Identities Involving Logarithms
Complex Exponents
Trigonometric Functions
Hyperbolic Functions
Inverse Trigonometric and Hyperbolic Functions

• 4. Integrals
Derivatives of Functions w(t)
Definite Integrals of Functions w(t)
Contours
Contour Integrals
Examples
Upper Bounds for Moduli of Contour Integrals
Antiderivatives
Examples
Cauchy-Goursat Theorem
Proof of the Theorem
Simply and Multiply Connected Domains
Cauchy Integral Formula
Derivatives of Analytic Functions
Liouville's Theorem and the Fundamental Theorem of Algebra
Maximum Modulus Principle

• 5. Series
Convergence of Sequences 175
Convergence of Series 178
Taylor Series 182
Examples 185
Laurent Series 190
Examples 195
Absolute and Uniform Convergence of Power Series 200
Continuity of Sums of Power Series 204
Integration and Differentiation of Power Series 206
Uniqueness of Series Representations 210
Multiplication and Division of Power Series 215

• 6. Residues and Poles
Residues
Cauchy's Residue Theorem
Using a Single Residue
The Three Types of Isolated Singular Points
Residues at Poles
Examples
Zeros of Analytic Functions
Zeros and Poles
Behavior off Near Isolated Singular Points

• 7. Applications of Residues
Evaluation of Improper Integrals
Example
Improper Integrals from Fourier Analysis
Jordan's Lemma
Indented Paths
An Indentation Around a Branch Point
Integration Along a Branch Cut
Definite integrals involving Sines and Cosines
Argument Principle
Rouch6's Theorem
Inverse Laplace Transforms
Examples

• 8. Mapping by Elementary Functions
Linear Transformations
The Transformation w = liz
Mappings by 1/z
Linear Fractional Transformations
An Implicit Form
Mappings of the Upper Half Plane
The Transformation w = sin z
Mappings by z"' and Branches of z
Square Roots of Polynomials
Riemann Surfaces
Surfaces for Related Functions

• 9. Conformal Mapping
Preservation of Angles
Scale Factors
Local Inverses
Harmonic Conjugates
Transformations of Harmonic Functions
Transformations of Boundary Conditions

• 10. Applications of Conformal Mapping
Steady Temperatures in a Half Plane
A Related Problem
Electrostatic Potential
Potential in a Cylindrical Space
Two-Dimensional Fluid Flow
The Stream Function
Flows Around a Corner and Around a Cylinder

• 11. The Schwarz-Christoffel Transformation
Mapping the Real Axis onto a Polygon
Schwarz-Christoffel Transformation
Triangles and Rectangles
Degenerate Polygons
Fluid Flow in a Channel Through a Slit
Flow in a Channel with an Offset
Electrostatic Potential about an Edge of a Conducting Plate

• 12. Integral Formulas of the Poisson Type
Poisson Integral Formula
Dirichlet Problem for a Disk
Related Boundary Value Problems
Schwarz Integral Formula
Dirichiet Problem for a Half Plane
Neumann Problems

• Appendixes

• Bibliography

• Table of Transformations of Regions

• Index

• ##### Math Books of COMPLEX ANALYSIS

Geometry of Complex Numbers by Hans Schwerdtfeger
• Free
• English
• Page 225
##### SHORTCUT TRICKS (Division)
• Divisible by 2 Shortcut trick
• Divisible by 3 Shortcut trick
• Divisible by 4 Shortcut trick
• Divisible by 5 Shortcut trick
• Divisible by 6 Shortcut trick
• Divisible by 7 Shortcut trick
• Divisible by 8 Shortcut trick
• Divisible by 9 Shortcut trick
• Divisible by 10 Shortcut trick


text:
1. Science
2. Physics
3. a charge q is placed at one of the corners...

# Question: a charge q is placed at one of the corners...

###### Question details

A charge q is placed at one of the corners of a cube of side a, as shown below. Find the magnitude of the electric flux through the shaded face due to q. Assume q>0.