text:
Proctor: Indeed’s A/B Testing Framework

(Editor’s Note: This post is the first of a series about Proctor, Indeed’s open source A/B testing framework.)

A/B Testing at Indeed

Indeed’s mission is to help people get jobs. We are always asking ourselves the question “What’s best for the jobseeker?” We answer that question by testing and measuring everything. We strive to test every new feature and every improvement in every product at Indeed, and we measure the impact of those changes to ensure they are helping us achieve our mission.

In October 2013, <NAME> and <NAME> presented an @IndeedEng talk on Proctor, Indeed’s A/B testing framework. In that talk, we announced that we had made Proctor available open source. Since then, we have also open sourced Proctor Webapp, the web application that we use to manage Proctor test definitions.

In the October talk, Tom gave the example of a simple A/B test to determine if changing the background color of a button would improve user experience. Figure 1 shows control group A, in which we haven’t changed our Find Jobs button, and test group B, in which the button has a blue background.

Figure 1: Testing an existing black text on gray background find jobs button treatment (A) against a version with a white text and blue background (B)

As discussed in our logrepo talk and blog post, we log everything at Indeed so that we can analyze, learn, and improve our products. For this simple test, we logged the group (A or B) of each user visiting Indeed and the subsequent clicks. Then we used our analysis tools to determine that the test group led to more searches and greater overall user engagement.

The example above has one test behavior, but we typically try out multiple alternate behaviors in a given test. In this test, we would be likely to try more than one different background color.

We can also test multiple ideas at the same time, as in the example in Figure 2, in which one test is for the button text and the other is for the background color. Testing multiple variables (like text and color) for a particular area of functionality is known as “multivariate testing.”

Figure 2: Running two tests on the same button simultaneously—where we test changes to text color, background, and text content (“find jobs” against “search”).

We’ve been doing A/B testing at Indeed for years, and many of the lessons we learned informed the development of Proctor. The October talk covers in more detail Proctor’s design decisions and ways to use for it for more than just A/B testing. In this blog post, we focus on some of Proctor’s key features and concepts, and we explain the nuts and bolts of how we use Proctor at Indeed.

Proctor Features and Concepts

Standard representation

Proctor provides a standard JSON representation of test definitions and allows adjustments to those definitions to be deployed independently of code. We refer to the full set of test definitions as the test matrix. A test matrix can be distributed to multiple applications as a single file, allowing for greater agility when managing tests and for sharing of consistent test definitions across multiple applications. Figure 3 shows a very simple version of our button test, with 50% of users allocated to the control group A (bucket 0) and 50% to the test group B (bucket 1).

"buttontst": {
"description": "backgroundcolortest",
"salt": "buttontst",
"buckets": [
{
"name": "control",
"value": 0,
"description": "current button treatment (A)"
},
{
"name": "altcolor",
"value": 1,
"description": "test background color (B)"
}
],
"allocations": [
{
"ranges": [
{
"length": 0.5,
"bucketValue": 0
},
{
"length": 0.5,
"bucketValue": 1
}
]
}
],
"testType": "USER"
}

Figure 3: a simple Proctor test definition

To understand this example, here is a quick overview of some Proctor terminology:

• Every test has a testType. The most common type is USER, meaning that we use a user identifier to map to a test variation. More on test types later.
• Each test is made of an array of buckets and an array of allocations.
• A bucket is a variation, or group, within a Proctor test definition. Each bucket has a short name, an integer value, and a human-friendly description.
• An allocation specifies the size of the buckets as an array of ranges. Each range has a length between 0 and 1 and a reference to the bucketValue for the bucket. Ranges in an allocation must sum to 1. You can have more than one allocation if you use rules (more about that later).

Proctor Webapp

Using the Proctor Webapp, you can manage and deploy test definitions from a web browser. You can customize the application in a number of ways, allowing integration with:

• revision control systems for maintaining history of test changes,
• issue tracking systems for managing test modification workflow, and
• other external tools, such as build and deployment systems.

Figure 4: Screenshot of a test definition in the Proctor Webapp

Java code generation from JSON test specifications

Test specifications in Proctor are JSON files that are independent of the test definitions and allow applications to declare the tests and buckets of which they are aware. They can be used in the build process for Java code generation and at runtime to load the relevant subset of the test matrix.

Code generation is optional but provides compile-time type-safety, so you don’t have to litter your code with string literals containing test and bucket names. The generated classes also make it easier to work with tests in Java code and in template languages (figure 5 shows a JSP example). Furthermore, the generated Java objects enable serialization of test group membership into formats like JSON or XML.

<c:if test="${groups.buttontstAltColor}"> .searchBtn { background-color: #2164f3; color: #ffffff; } </c:if>  Figure 5: Conditional CSS based on test group membership in a JSP template Rule-based contextual allocation Using Proctor’s rule definition language, your system can apply tests and test allocations by evaluating rules against runtime context. For example, you can define your entire test to only be available for a certain segment of users, or you can adjust the allocation of test groups depending on the segment. Your test could be 50% A and 50% B for users in one country, and 25% each A/B/C/D for users in all other countries. Rule-based group assignment allows for great flexibility in how you roll out and evaluate your tests. "allocations" : [ { "rule" : "'US' == country && 'en' == userLanguage", "ranges": [ { "length": 0.5, "bucketValue": 0 }, { "length": 0.5, "bucketValue": 1 } ] }, { "rule" : null, "ranges" : [ { "length" : 1.0, "bucketValue" : -1 } ] } ]  Figure 6: 50/50 test for US English, test inactive (bucket -1) for everyone else Payloads The ability to attach data payloads to test groups in test definitions allows you to simplify your code. In figures 7 and 8, we demonstrate how the color being tested for the button can be specified as a payload in the test definition and accessed in the template. Although in this example the total amount of template code is not reduced, if you had multiple test variations, each with its own color, the use of payloads would result in fewer lines of code. "buckets": [ { "name": "control", "value": 0, "description": "current button treatment (A)", "payload": { "stringValue": "#dddddd" } }, { "name": "altcolor", "value": 1, "description": "test background color (B)", "payload": { "stringValue": "#2164f3″ } } ]  Figure 7: Attaching a data payload containing a color value to the test group B <style> .searchBtn { background-color:${groups.buttontstPayload}; }
</style>

Figure 8: Using the data payload in CSS in a JSP template

Flexible test types

Proctor has a flexible concept of test types, allowing bucket determination to be based on user (typically defined by a tracking cookie value), account ID (which can be fixed across devices), email address, or completely random across requests. You can also extend Proctor with your own test types. Custom test types are useful, for example, when you want test group determination to be based on a context- or content-based attribute such as page URL or content category.

Unbiased, Independent Tests

To assign a bucket for a test, Proctor maps the input identifiers (e.g. user ID) to an integer value using a uniformly distributed hash function. The range assignments for a bucket determine the range of integers that define each bucket. Figure 9 shows a simple example with a 50/50 control/test distribution. Since the hash function is uniform, the distribution of bucket assignments should be unbiased.

Figure 9: 50/50 control/test buckets mapped onto an integer range for use with hash function

Furthermore, Proctor tests are independent, meaning that group membership in one test has no correlation with membership in another. This independence is accomplished by assigning a different salt to each test. The salt is used along with the identifiers as input to the hash function. Including the salt in the test definition allows for two advanced features:

1. You can intentionally align buckets in different tests (make them dependent) by sharing a salt (shared salts must start with “&”). In practice, we have very rarely seen the need to align two tests in this way.
2. You can “shuffle” the distribution of a test by changing its salt, resulting in completely different output from the hash function. This shuffling can be used to reassure yourself that there is no accidental bias in a test.

Proctor at Indeed

Proctor has become a crucial part of Indeed’s data-driven approach to product development, with over 100 tests and 300 test variations currently in production. In our next post, we will provide more details on how we use Proctor at Indeed.

UPDATE: Our second post in this series, How Indeed Uses Proctor for A/B Testing is now available.

format: plain


text:
# height pressure air hose

#### How powerful does an air pump have to be to make a …

Power is a function of both flow rate and pressure. That question is nicely answered below. There are other questions you should consider. Industrial gasses are compressed more than that so you should be able to find a commercial air compressor to

#### Dishwasher Air Gap and High Loop Options - The Spruce …

The air gap works by allowing fresh air into the drain hose if there is a backup causing negative pressure. This eliminates any suction force that can draw water back into the dishwasher chaer. Air gaps are designed to fit into an existing mounting hole on the top of the sink (or they can mount to any type of countertop).

#### Air Lift Performance | Performance Air Suspension and …

Air Lift Performance is the performance division of Air Lift Company and produces full air ride and air management systems for lowered and performance vehicles. Our bolt-on, direct-OEM-replacement kits are designed precisely for each individual chassis and with a …

#### Pump and hoist assely

Unit height, raised position 97.00 in. (2,464 mm) Hoist capacity 200 lbs. (91 Kg) Operating pressure (hoist) 40 to 100 psi (3 to 7 bar) Pump V350400000 Pump ratio 50:1 Pump maximum working pressure 5,000 psi (345 bar) (limited by hose working pressure) 3/

#### How to Increase Water Pressure in Your House | The …

15/1/2019· Pressure Booster If your water department can''t deliver more pressure and you have a 3/4-in. or bigger copper or plastic water main coming into your house, consider installing a water pressure booster. Water pressure boosters like the one shown here are available

#### 6 Best High-pressure Hose Nozzles [Aug 2020] Reviews …

11/8/2020· Below are the best high-pressure hose nozzles that we’ve tested and meticulously egorized. Read on! Here are the best high-pressure hose nozzles you can buy in 2020: Best Overall: Dradco Heavy Duty Brass Fireman Style Hose NozzleBest For Heavy Use: Gilmour 855032-1001

#### ® Hose and Hose Asselies – hydraulic hose and …

Hose Asselies are available in a broad line of high, medium and low-pressure options, and are engineered and tested far beyond industry standards for top performance and long life. ToughGuard™ hoses feature a highly abrasion-resistant polyethylene cover that has surpassed two million cycles of abrasion testing without failure.

#### Hydraulic Pumps | High Pressure Power Units | Enerpac

Hydraulic Pumps Enerpac hydraulic pumps are available in over 1,000 different configurations. Whatever your high pressure pump needs are, speed, control, intermittent or heavy-duty performance, you can be sure that Enerpac has a hydraulic power unit to suit the appliion.Featuring Hand, Battery, Electric, Air and Gasoline powered models, with multiple reservoir and valve configurations

#### Volkswagen Golf (MK7) Air Ride | Air Lift Performance - …

Air Lift Performance is now offering Universal Height Sensor Brackets, designed to work with any suspension system, guaranteeing the maximum drop with the ultimate level of adjustability. With just a little fabriion, you can achieve the lowest low, no matter your vehicle.

#### How to Calculate Force Based on Pressure - dummies

The air pressure at sea level is a standard pressure that people refer to as 1 atmosphere (abbreviated atm): If you convert an atmosphere to pounds per square inch, it’s about 14.7 psi. That means that 14.7 pounds of force are pressing in on every square inch of your body at sea level.

#### The Most General Appliions of Bernoulli’s Equation | …

Pressure in the water stream becomes equal to atmospheric pressure once it emerges into the air. All preceding appliions of Bernoulli’s equation involved simplifying conditions, such as constant height or constant pressure.

#### Industrial Hoses from Flexicraft

BB1 is a corrugated bronze hose with a single bronze braid. It has a high pressure capacity at high temperatures. It is resistant to bursting, cracking, and crushing, while being quite flexible. 1/4" to 3" diameters. -50F to 450F. BB1 BRAIDED

#### Air line products and accessories

8 Air line products and accessories – ARO-style air couplers and nipples ARO-style couplers and nipples for 1/4 in. ID Models 5862, 13329, 13331 Fits ARO style nipples for 1/4 in. ID hose.Maximum operating pressure 300 psi (21 bar). 1/4 in. NPT (f) inlet. in. NPT (f) inlet.

#### Calculation of pressure drop in pipework - KAESER

Calculations regarding pressure losses in pipework and fittings are made simple with our calculation tool. The nominal length of the pipeline is calculated by adding together the length of the straight pipeline and the equivalent lengths of the fittings installed.

#### Solutions to the Fluid Mechanics Problem - Google Docs

1.Find the pressure increase in the fluid in a syringe when a nurse applies a force of 42 N to the syringe''s circular piston, which has a radius of 1.1 cm. Solution: …

#### Pressure Drop Online-Calculator

Pressure Drop Online-Calculator Calculation of pressure drops of flowing liquids and gases in pipes and pipe elements (laminar and turbulent flow). Note: Calculations are possible only, if Javascript is activated in your browser. Pressure Drop Online-Calculator for

#### High-Pressure PVC Air Hose - Goldsione

High-Pressure PVC Air Hose Features: Being made from superior compound PVC and rubber materials and high tensile polyester thread, the PVC reinforced gas hose is durable, long-lasting, safe, colorful, light, flexible, elastic, portable, excellent adaptability, and low coefficient of swell, resistant to high pressure and erosion.

#### Pressure and Flow Rate | All About Circuits

3/3/2012· This subject can get quite complex, but it is instructional to look at a simple case of a circular pipe with laminar flow with average velocity $$v_a$$. The change in pressure is approximately given as follows. $$P=\rho g z + {{8\pi \mu L }\over{A}}v_a$$ where ρ is density, g is gravitational accelleration, z is change in vertical height, μ is the viscocity, L is the length and A is the

#### Online pressure drop calculator

Task: Calculate pressure drop of 2000 m 3 /h of air flowing through closed rectangle chanel to open atmosphere. Chanel width is 400 mm and height is 250 mm. Chanel is with surface roughness of 0.01 mm. Local resistance coefficient is line is 3.5.

#### High Temperature & High Pressure Hose - MSC …

Find High Temperature & High Pressure Hose at MSC Industrial Supply, serving the metalworking, safety, and MRO industries for over 75 years Continental ContiTech 50'' Long, 1/2 Description: Inside Diameter (Inch) 1/2 Outside Diameter (Decimal Inch) 0.8400

#### Adjusting an Air Compressor Regulator | DoItYourself

An air compressor regulator controls the air pressure that is flowing through an air compressor. Regulators are found in tools that use air compressors as well as in tanks that release gas, like oxygen or helium. Air Compressors Air compressors are used in a wide variety of different types of appliions.

#### Air Hose Reel - Water Hose Reel - Oil Hose Reel | GSES

Air hose reels and water hose reels are wound with low pressure rubber hose with working pressures not much more than 300 lbs. Water and air pressure seldom exceed 200 lbs. of pressure so there is no need to use corded reinforced air hose or water hose.

#### Solved: Calculate the maximum height to which water …

From Bernoulli’s equation to find the maximum height to which water could be squirted with the hose if it emerges from the nozzle is, Here, are the pressure, velocity and height of the nozzle. are the pressure, velocity and height of fluid at a given point in the hose.

#### Air Compressors | Power Tools | Screwfix

Portable air compressors are good for light, quick jobs as they tend to have a smaller tank with a handle and wheels to make them easy to manoeuvre. The size of the tank will determine how much air is stored and therefore how long it will run so if you are using tools that require a high volume of air for longer, then you should consider a larger tank.

#### Retractable Hose Reels | Hoses, Bundles & More | Hoselink

Whilst standard hose reels have a 12mm internal hose diameter, our Hi-Flow Reels feature a slightly larger 14mm diameter hose, resulting in up to 25% better water flow output than standard reels. For this reason, we suggest anyone experiencing low or medium water pressure, or anyone connected to tank water, to opt for the Hi-Flow model to minimise loss of pressure.

#### Absolute Pressure Calculator

The calculator can calculate the absolute pressure or gauge pressure or atmospheric pressure as selected from drop-down based on given appropriate values. Pressure is the force per unit area applied to any object in a direction perpendicular to the surface.

#### High Spray Hose Nozzle Attachments-1000243 - The …

The Turbo Jet is an amazing, all-new spray nozzle attachment that turns your ordinary water hose into a high-pressure power washer. Bulky pressure washers are expensive, heavy and use gas or electricity. The Turbo Jet''s clever design uses a controlled flow to

#### COXREELS 100 ft. Hand Crank Hose Reel, 3/8" Hose …

Overall Height 13-1/2" Overall Width 18-1/4" Overall Length 12" Hose Ends 3/8" (M)NPT Housing Material Steel Max. Pressure Rating 4000 psi Max. Temp. Rating 225 Degrees F Bearings EPDM Bearings Color Black Seal Type Viton(R) Swivel Material 5/8"

#### WAH JOO SENG INTERNATIONAL TRADING PTE LTD

Founded in 1974, we have grown to be a leading distributor in industrial hoses and couplings. Our key capabilities includes providing solutions in fluid transfer solution products and services. Over the years, we have gained recognition for our products and services

#### An In-depth Explanation of the Venturi Effect and its …

Since the hose has a narrow opening, the flow rate of the water increases, which creates a low-pressure area. This causes the air in the bilge compartment to exert pressure on the water in the bilge, forcing it to enter the hose and leave the ship.


text:
# Lessons 1–5Self Assessment 1

For each statement, rate your understanding according to the continuum, and then provide evidence for your rating.

I understand and can do it accurately.I understand most of the time, but I’m still working on it.I don’t understand this yet.
I can

graph a quadratic function in the form: .

Evidence Rating

I can

write the equation of a quadratic function, given the graph of a parabola.

Evidence Rating

I can

determine if a trinomial is a perfect square.

Evidence Rating

I can

complete the square to convert a quadratic function to vertex form.

Evidence Rating

## Next steps

My plan for mastering this content is…

# Lessons 6–10Self Assessment 2

For each statement, rate your understanding according to the continuum, and then provide evidence for your rating.

I understand and can do it accurately.I understand most of the time, but I’m still working on it.I don’t understand this yet.
I can

factor a trinomial.

Evidence Rating

I can

factor an expression in the form: .

Evidence Rating

I can

graph a quadratic function in the form: .

Evidence Rating

I can

be efficient and accurate in converting from one quadratic form to another in order to have the form that is most useful for finding what I need.

Evidence Rating

## Next steps

My plan for mastering this content is…


text:
# $$\frac{{\frac{{{{0.1}^2}}}{{\left( {\frac{{37}}{{25}} - 0.1} \right)}} + \frac{{{{0.2}^2}}}{{\left( {\frac{{37}}{{25}} - 0.2} \right)}} + \frac{{{{0.3}^2}}}{{\left( {\frac{{37}}{{25}} - 0.3} \right)}} + (0.1) + (0.2) + (0.3)}}{{\frac{{0.1}}{{\left( {\frac{{37}}{{25}} - 0.1} \right)}} + \frac{{0.2}}{{\left( {\frac{{37}}{{25}} - 0.2} \right)}} + \frac{{0.3}}{{\left( {\frac{{37}}{{25}} - 0.3} \right)}}}}$$

This question was previously asked in
WB TET 2017 Official Paper (Held On : 31 Jan 2021)
View all WB TET Papers >
1. 0.1
2. 0.2
3. 0.3
4. $$\frac{{37}}{{25}}$$

Option 4 : $$\frac{{37}}{{25}}$$
Free
WBTET Paper 1 (Success Mantra) Mini MockTest
6.8 K Users
50 Questions 50 Marks 50 Mins

## Detailed Solution

Suppose a = 0.1; b= 0.2; c=0.3 and x=37/25

$$\dfrac{\frac{a^2}{x-a}\;+\;\frac{b^2}{x-b}\;+\;\frac{c^2}{x-c}\;+\;a\;+\;b\;+\;c}{\frac{a}{x-a}\;+\;\frac{b}{x-b}\;+\;\frac{c}{x-c}}$$

Now we can write the above equation as:-

$$\dfrac{\frac{a^2}{x-a}\;+a\;+\;\frac{b^2}{x-b}\;+b\;+\;\frac{c^2}{x-c}+\;c}{\frac{a}{x-a}\;+\;\frac{b}{x-b}\;+\;\frac{c}{x-c}}$$

By taking LCM of numerator we get:-

$$\dfrac{\frac{a^2+ax-a^2}{x-a}\;+\;\frac{b^2+bx-b^2}{x-b}+\;\frac{c^2+cx-c^2}{x-c}}{\frac{a}{x-a}\;+\;\frac{b}{x-b}\;+\;\frac{c}{x-c}}$$

Here a2, b2 and c2 get cancel, then equation becomes:-

$$\dfrac{\frac{ax}{x-a}\;+\;\frac{bx}{x-b}+\;\frac{cx}{x-c}}{\frac{a}{x-a}\;+\;\frac{b}{x-b}\;+\;\frac{c}{x-c}}$$

By taking 'x' as common from numerator, we get-

$$\dfrac{x\left(\frac{a}{x-a}\;+\;\frac{b}{x-b}+\;\frac{c}{x-c}\right)}{\frac{a}{x-a}\;+\;\frac{b}{x-b}\;+\;\frac{c}{x-c}}=x$$

Now terms of numerator and denominator got cancel and only 'x' left.

= x

and here x = 37/25

Hence, the correct answer is 37/25.


text:
Finding fixed point of a function

I wanted to show that in general, T has a unique fixed point and to determine that fixed point of T such that $Tf = f$

$T : (C[0,1], \left\lVert.\right\rVert_{inf} \rightarrow C[0,1], \left\lVert.\right\rVert_{inf} )$, with $\left\lVert f\right\rVert_{inf} = \sup_ {x\in [0,1]}{|f(x)|}$ be defined by

$(Tf)(x) = \int_0^1\frac{1}{2}(xy-1)(f(y) + 1)\mathrm{d}y$

Thanks for the help.

• Welcome to MSE. You will have more chances to have your question answered if you show what you have done so far towards solving the problem, where you have encountered difficulties, etc. – user539887 May 20 '18 at 21:02
• Contraction Mapping Theorem? – glowstonetrees May 20 '18 at 21:03

Existence and Uniqueness:

\begin{align} & \lVert (Tf)(x) - (Tg)(x) \rVert \\ = & \bigg\lVert \int_0^1\frac{1}{2}(xy-1)(f(y) + 1)dy - \int_0^1\frac{1}{2}(xy-1)(g(y) + 1)dy \bigg\rVert \\ = & \sup_{x \in [0,1]} \bigg| \int_0^1\frac 12 (xy-1)(f(y)-g(y))dy \bigg| \\ ≤& \sup_{x \in [0,1]} \int_0^1 \bigg| \frac 12 (xy-1)(f(y)-g(y))\bigg| dy \\ =& \sup_{x \in [0,1]} \frac 12 \int_0^1 |xy-1| \bigl|f(y)-g(y)\bigl|dy \\ ≤ & \frac 12 \int_0^1 \bigl|f(y)-g(y)\bigl|dy && x,y\in[0,1] \implies |xy-1|≤1\\ ≤ & \frac 12 \int_0^1 \sup_{y \in [0,1]}|f(y)-g(y)|dy \\ = & \frac 12 \sup_{y \in [0,1]}|f(y)-g(y)| \\ = & \frac 12 \lVert f-g \rVert \end{align}

Hence, this map is a contraction with constant $\frac 12$, and so by the Contraction Mapping Theorem, a unique fixed point exists.

Construction:

\begin{align} (Tf)(x) = f(x) \implies f(x) & = \int_0^1 \frac 12 (xy-1)(f(y)+1)dy \\ & = \frac x2 \int_0^1y(f(y)+1)dy - \frac 12 \int_0^1 (f(y)+1)dy \\ & = Ax+B \end{align}

for some constants $A$ and $B$.

i.e. $f$ must be a linear function of the form $f(x)=Ax+B$. Plug this back into the above:

\begin{align} & (Tf)(x) \equiv f(x) \\ \implies & Ax+B \equiv \int_0^1 \frac 12 (xy-1)(Ay+B+1)dy \\ \implies & Ax+B \equiv \biggl( \frac A6 + \frac B4 + \frac 14 \biggl)x + \biggl(-\frac A4 - \frac B2 - \frac 12 \biggl) \end{align}

Comparing coefficients, we get

$$\begin{pmatrix} \frac 56 & -\frac 14 \\ \frac 14 & \frac 32 \end{pmatrix} \begin{pmatrix} A \\ B \end{pmatrix} = \begin{pmatrix} \frac 14 \\ -\frac 12 \end{pmatrix}$$

This gives $A = \dfrac{4}{21}$ and $B = -\dfrac{23}{63}$, and so the unique fixed point is

$$f(x) = \dfrac{4}{21} x -\dfrac{23}{63}$$

• Thanks a lot !! In addition how can I get that fixed point of T – Dereje May 20 '18 at 21:32
• The fixed point doesn't look so nice, not sure if I made some sort of error, but that is the idea – glowstonetrees May 20 '18 at 22:10
• Thanks again. I don't see any error ! – Dereje May 20 '18 at 23:25


text:
# Linear Algebra - Proofs involving Inverses

1. Jan 21, 2009

### descendency

Two fairly simple proof problems. . . why aren't they simpler? :(
1. The problem statement, all variables and given/known data
Let A be an nxn matrix...
If A is not invertible then there exists an nxn matrix B such that AB = 0, B != 0. (not equal to)

2. Relevant equations
None really.

3. The attempt at a solution
Obviously, when A is the zero matrix, AB = 0.

If we call A the coefficient matrix in the system of equations Ax = 0, then x = x1B1 + x2B2 + ... + xnBn, where B = [B1|B2|...|Bn].

I can't seem to explain why that works. Is it obvious enough just to say that or is there a step of explanation I have left out?

--------------------------------------------------------------------------------

1. The problem statement, all variables and given/known data
If A is an m x n matrix, B is an n x m matrix and n < m, then AB is not invertible.

2. Relevant equations

3. The attempt at a solution
Obviously, A and B are not square and are therefore not invertible. Does that fact really matter? The product of invertible matrices is invertible, but is the product of non invertible matrices also non invertible?

2. Jan 21, 2009

### sutupidmath

Well, what i would say is that: We know that an invertible matrix is nonsingular,moreover, a matrix is invertible if and only if it is non-singular. So, since here A is supposed to be non-invertible, it means that A is singular. What this means is that: There exists some non-zero vector, call it b such that Ab=0.
Extrapolating from this, we can argue that, there will be some non-zero vectors, call them

$$\arrow B_1, B_2,...B_n$$ such that $$A*B_i=0$$, for all i=1,2,....n.

So, if we built our matrix $$B=[B_1,B_2,...,B_n]$$

We have actuall proven that AB=0. Where as we can clearly see B is not the zero matrix.

3. Jan 21, 2009

### descendency

How can I guarrantee that B is not zero?

4. Jan 21, 2009

### Dick

You know there is a vector Ab=0 with b not equal to zero, as sutupidmath said. You also seem to know the column space of a matrix represents it's range. So build a matrix whose column space is only multiples of b.

5. Jan 21, 2009

### descendency

Thanks everyone. Think I have it now.


text:
# Effecient way to compare data tables

First I would ask if you have tried this in a simple for/foreach loop instead and compared the performance?

At the moment you are creating a new Enumerable and then copying to a datatable. If you use a for/foreach loop then you can compare and copy in the same iteration.

You should also look at the string comparison. At the moment you are trimming then converting to lowercase. This will allocate new memory for each operation for each string as strings are immutable. So in your where statement you are basically doing this (up to) 8 times per iteration.

I would also ask if you really need Trim()? Is it likely that one DT will have a space at the front of the string and the other not? Or will a comparison still be true? Don't trim strings unless really needed.

Then you should use case insensitive string comparison rather than converting ToLower. This will be quicker. According to MS StringComparison.OrdinalIgnoreCase is better performing.

Do these and then compare performance and see how much difference you have

See also: https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings

Update:

This intrigued me, so I went back and done some tests. I generated 10,000 rows of random(ish) data in two datatables where every second row would match and executed your comparison vs a simplified for loop comparison with a String comparison like this:

  for (int i = 0; i < dt1.Rows.Count; i++)
{
if (dt1.Rows[i]["N"].ToString().Equals(dt2.Rows[i]["N"].ToString(), StringComparison.OrdinalIgnoreCase)
&& dt1.Rows[i][columnName].ToString().Equals(dt2.Rows[i][columnName].ToString(), StringComparison.OrdinalIgnoreCase))
{
dtDifference.Rows.Add(dt1.Rows[i].ItemArray);
}
}

Your code = 66,000ms -> 75,000ms

For loop code = 12ms -> 20ms

A significant difference!

Then I did a comparison using the for loop method but with the two different string comparison types for the string. Using my string comparison, vs yours. But I had to test on 1 million rows for this, to get a significant difference.

This differend by between 200ms and 800ms

So it seems in this case that the string comparison is not a major factor.

So it seems that your Linq query creating the datarows is what is taking the majority of time and not the comparison of the rows themselves.

So switch to using the for loop, and all will be well in the world again!


text:
# Two perpendicular charged infinite lines

1. Jun 25, 2014

### brkomir

1. The problem statement, all variables and given/known data
On a long dielectric line a charge with density $10^{-3}$ is applied one half with positive charge and the other half with negative charge. Perpendicular to the first line and 5 cm away from it we have another line with the same charge density and also half of it is positive while the other half is negative. Points on the line where the charge changes from positive to negative, are the closest. (meaning they are 5 cm apart). Determine the vector of force between the lines.

2. Relevant equations

3. The attempt at a solution

I hope at least some of the things written below are ok:

Density of charge is $\rho =e/l$ meaning $de=\rho \frac{dx}{l}$.

Vector from the origin to the point on horizontal line $\vec r=(x,0,h)$ if $h$ is the distance between the lines. Vector from the origin to the point on vertical line is $\vec r^{'}=(0,y,0)$

So finally
$dF=dedE=\frac{\rho ^2}{l^2}dxdy\frac{1}{4\pi \epsilon _0}\frac{(x,-y,h)}{(x^2+y^2+z^2)^{3/2}}$

But if I integrate this from $-\infty$ to $\infty$ the integral does not converge... Did I do anything wrong or is this simply the correct answer? :/

2. Jun 25, 2014

### Staff: Mentor

e is usually the (negative) charge of a single electron, using it for an arbitrary charge is a bit confusing.

Where did you take into account that the two halves have opposite charge?


text:
# What is pH in chemistry?

$p H = - {\log}_{10} \left[{H}_{3} {O}^{+}\right]$
$p H$, literally, $\text{pouvoir hydrogeene}$ or $\text{power of hydrogen}$ is a measure of the concentration of hydrogen ion in aqueous solution. In precalculator days, the use of logartihmic tables greatly simplified complex calculation, which is why these scales were developed. There should be 2 logarithmic functions on your calculator, ${\log}_{10}$ and ${\log}_{e}$ or $\ln$.
You should be able to tell me the values of ${\log}_{10} 100$, ${\log}_{10} 1000$, and ${\log}_{10} 0.1$; these are all simple whole numbers.


text:
# Astronomy:Lambda Boötis star

Short description: Peculiar star with unusually low amount of iron

A Lambda Boötis star is a type of peculiar star which has an unusually low abundance of iron peak elements in its surface layers. One possible explanation for this is that it is the result of accretion of metal-poor gas from a circumstellar disc, and a second possibility is the accretion of material from a hot Jupiter suffering from mass loss. The prototype is Lambda Boötis.[1]

## References

1. <NAME>. (2015). "Lambda Boo Abundance Patterns: Accretion from Orbiting Sources". The Astronomical Journal 150 (6): 166. doi:10.1088/0004-6256/150/6/166. Bibcode2015AJ....150..166J.


text:
Lattice QCD study of $B_s\to D_s \ell \bar\nu_\ell$ decay near zero recoil - Archive ouverte HAL Access content directly
Conference Papers Year : 2013

## Lattice QCD study of $B_s\to D_s \ell \bar\nu_\ell$ decay near zero recoil

(1) , (2) , (1) , (2)
1
2
<NAME>
<NAME>

#### Abstract

We study the hadronic matrix elements describing the $B_s \to D_s\ell \bar\nu_\ell$ decay in and beyond the Standard Model. By using the twisted mass QCD on the lattice with $N_f=2$ dynamical flavors we compute the normalization $\mathscr G_s(1)$ of the form factor dominating $B_s\to D_s \ell \bar\nu_\ell$ in the SM. We also make the first lattice determination of $F_0(q^2)/F_+(q^2)$ and $F_T(q^2)/F_+(q^2)$ near zero recoil (near $q^2_{\rm max}$). We briefly discuss the non-strange case $B \to D\ell \bar\nu_\ell$ as well.

### Dates and versions

in2p3-00948544 , version 1 (18-02-2014)

### Identifiers

• HAL Id : in2p3-00948544 , version 1
• ARXIV :

### Cite

<NAME>, <NAME>, <NAME>, <NAME>. Lattice QCD study of $B_s\to D_s \ell \bar\nu_\ell$ decay near zero recoil. 31st International Symposium on Lattice Field Theory - LATTICE 2013, 2013, Mainz, Germany. pp.384. ⟨in2p3-00948544⟩

### Export

BibTeX TEI Dublin Core DC Terms EndNote Datacite

30 View


text:
# Idea of integrable systems

I do not quite understand the idea of an integrable dynamical system. Does it mean that the EOMs are analytically and exactly solvable? What are the necessary and sufficient conditions such that a system is integrable?

There has been extensive discussion on this here. Infact the question was posed by <NAME>, a well known mathematician. I hope it helps.

For mathematicians the question is very hard, for physicists the following jargon is used to intuitively define integrability: solvable=integrable, separable=integrable, existence of a Lax pair=integrable, # of conserved quantities equats to # of degrees of freedom = integrable.

It is interesting that the mathematicians have managed to find the exceptions to all the intuitive definitions. In general the most general physical definition is the following: if there is no of chaos then the system is integrable.

For more information look at Zakharov V.E. What is integrability (Springer, 1992).


text:
# A bullet of mass $10\ g$ traveling horizontally with a velocity of $150\ ms^{-1}$ strikes a stationary wooden block and comes to rest in $0.03\ s$. Calculate the distance of penetration of the bullet into the block. Also, calculate the magnitude of the force exerted by the wooden block on the bullet.

#### Complete Python Prime Pack for 2023

9 Courses     2 eBooks

#### Artificial Intelligence & Machine Learning Prime Pack

6 Courses     1 eBooks

#### Java Prime Pack 2023

9 Courses     2 eBooks

Given: A bullet of mass $10\ g$ traveling horizontally with a velocity of $150\ ms^{-1}$ strikes a stationary wooden block and comes to rest in $0.03\ s$.

To do: To calculate the distance of penetration of the bullet into the block. Also, to calculate the magnitude of the force exerted by the wooden block on the bullet.

Solution:

Mass of the bullet $m=10\ g=\frac{10}{1000}\ kg.=\frac{1}{100}\ kg.$

Initial velocity $u=150\ ms^{-1}$

Final velocity $v=0$

Time $t=0.03\ s$

Therefore, acceleration $a=\frac{v-u}{t}$

$=\frac{0-150}{0.03}$

$=-500\ ms^{-2}$

Let $s$ be the distance of penetration of the bullet into the block.

On using $v^2=u^2+2as$

$0^2=150^2+2\times(-150)s$

Or $0=22500-300s$

Or $300s=22500$

Or $s=\frac{22500}{300}$

Or $s=75\ m$

And the force exerted by the wooden block on the bullet $F=ma$

$=\frac{1}{100}\ kg.\times -500\ ms^{-2}$

$=-5\ N$     [$-ve$ sign indicates the opposite direction]

Thus, the distance of penetration of the bullet into the block is $75\ m$, and the force exerted by the wooden block on the bullet is $-5\ N$.

Updated on 10-Oct-2022 13:22:36


text:
RUS  ENG JOURNALS   PEOPLE   ORGANISATIONS   CONFERENCES   SEMINARS   VIDEO LIBRARY   PERSONAL OFFICE
 General information Latest issue Forthcoming papers Archive Impact factor Subscription Guidelines for authors License agreement Submit a manuscript Search papers Search references RSS Latest issue Current issues Archive issues What is RSS

 Mat. Sb.: Year: Volume: Issue: Page: Find

 Mat. Sb. (N.S.), 1988, Volume 136(178), Number 2(6), Pages 260–273 (Mi msb1740)

On sufficient sets in spaces of entire functions of several variables

A. B. Sekerin

Abstract: The main result is
Theorem 1. {\it Let $D$ be a bounded convex domain in $\mathbf C^n,$ $n\geqslant2,$ with $0\in D$. Let $H(z)=\max_{\lambda\in\overline D}\mathbf{Re}\langle\lambda,z\rangle$. Let $L(z)$ be an entire function of exponential type whose zero set $S$ is the union of planes $P_m=ż:\langle a_m,z\rangle=c_m\},$ $m\in\mathbf N,$ $|a_m|=1$. Suppose the following conditions hold}:
a) {\it there exist constants $c,$ $r_0,$ $d_0,$ $\gamma\in(0,1),$ such that the estimate
$$|\ln|L(z)|-H(z)|\leqslant c|\ln d||z|^{1-\gamma}$$
holds if the point $z\in\mathbf C^n,$ satisfies $|z|\geqslant r_0,$ $\inf_{w\in S}|z-w|=d(z,S)\geqslant d>0,$ $d<d_0$};
b) {\it for every $m$ the restriction of the entire function $(\langle a_m,z\rangle-c_m)^{-1}L(z)$ to the plane $P_m$ is not identically zero};
c) {\it there exist constants $c$ and $N$ such that for $m\ne k$ either $d(P_m,P_k)\geqslant c|c_m|^{-N}|c_k|^{-N}$ or $1-|\langle a_m,\overline a_k\rangle|\geqslant c|c_m|^{-N}|c_k|^{-N}$.
Then every analytic function $f(z)$ in the domain $D$ can be represented by a series
$$f(z)=\sum_{m=1}^\infty\int_{P_m}\exp\langle\lambda,z\rangle d\mu_m(\lambda)$$
converging in the topology of $H(D)$.}
Bibliography: 11 titles.

Full text: PDF file (768 kB)
References: PDF file   HTML file

English version:
Mathematics of the USSR-Sbornik, 1989, 64:1, 263–276

Bibliographic databases:

UDC: 517.537
MSC: Primary 32A15; Secondary 32A30, 30A50

Citation: A. B. Sekerin, “On sufficient sets in spaces of entire functions of several variables”, Mat. Sb. (N.S.), 136(178):2(6) (1988), 260–273; Math. USSR-Sb., 64:1 (1989), 263–276

Citation in format AMSBIB
\Bibitem{Sek88} \by A.~B.~Sekerin \paper On sufficient sets in spaces of entire functions of several variables \jour Mat. Sb. (N.S.) \yr 1988 \vol 136(178) \issue 2(6) \pages 260--273 \mathnet{http://mi.mathnet.ru/msb1740} \mathscinet{http://www.ams.org/mathscinet-getitem?mr=954928} \zmath{https://zbmath.org/?q=an:0668.32004|0651.32002} \transl \jour Math. USSR-Sb. \yr 1989 \vol 64 \issue 1 \pages 263--276 \crossref{https://doi.org/10.1070/SM1989v064n01ABEH003306}


text:
# If I have one inch of rise for every 12 inches of length what is the slope?

$\frac{1}{12}$
So the slope here would be $\frac{1}{12}$.


text:
# How to plot a 2D RNA structure in python using dot-bracket input?

I need some help with forgi library for visualisation of RNA secondary structure.

I have an RNA sequence and dot-bracket notation of the secondary structure and I would like to plot 2D graph like that you can find here.

The input file is a .fx file, or a fasta file where the sequence is single-line and the third line is the dot-bracket notation of the RNA structure.

>1y26
CGCUUCAUAUAAUCCUAAUGAUAUGGUUUGGGAGUUUCUACCAAGAGCCUUAAACUCUUGAUUAUGAAGUG
((((((((((..(((((((.......)))))))......).((((((.......))))))..)))))))))

If there any other possibilities to plot it in real-time (for instance, in jupyter notebook avoiding any crossing external scripts), I will be very thankful to learn them!

• Hi there, do I understand right that you got an RNA sequence and you with to predict the secondary structure and plot it within a jupyter notebook? Could you maybe edit your question to clarify what is exactly your input and desired output? – <NAME> Dec 11 '18 at 14:13
• cross posted : biostars.org/p/353919 – Pierre Dec 11 '18 at 17:54
• @KamilSJaron, hi! I have an RNA sequence with it dot-bracket notation, for instance: seq = 'AAAACCGGGCCUUUUACCCCAAAUUGGAA' dot_bracket = '((((..(((..)))..))))...((..))' And for this seq and dot_bracket I want to plot 2D graph where edges will be biult according to dot_bracket and top will show the necessary nucleotide – kitsune_breeze Dec 12 '18 at 8:28
• @kitsune_breeze Ah, I got it. Just note that you can edit your question to improve and I would strongly encourage you to do that if you find new clues or to add more details. For instance, what was the problem with forgi library? Could you share what you tried and what was the error you got? – <NAME> Dec 12 '18 at 12:24
• Awesome, that's something we can work at. Just edit your question and add this information. Something like, "I know how to create the plot in terminal by running .... However, I don't know how to call the command from jupyter notebook". I am trying to convince you here, that you should not write more information in comments but directly to question. ;-) – <NAME> Dec 12 '18 at 15:04


text:
When I ran

SocialMediaData["Facebook", "FriendNetwork"]

I used to get all of my Facebook friends (or at least almost all of them)--nearly 1000. But now when I run the same code Mathematica only shows a network of 7 friends. If I use "Friends" instead of "FriendNetwork", it shows 8 names.

Can anyone help me with this?

Thank you.

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Oct 23 '15 at 17:19
• I noticed this too, it only showed 4 for me. But I couldn't be bothered to get to the bottom of it. – Szabolcs Oct 23 '15 at 18:19
• I believe this is because Facebook changed their API policies so now it returns a much more restricted data set than before. – Stefan R Oct 23 '15 at 18:30


text:
# UNILORIN CBT PRACTICE

You have 30 minutes, “Click on start button below to begin test.”

0%

UNILORIN Post UTME CBT PRACTICE

1 / 52

The news papers reported that the meeting -------yesterday between the labour
luck

2 / 52

SYNONYMS:
Choose a word which has the same or nearly the same meaning as the first word.
Astonish:

3 / 52

If the exchange rate is US$1 = N150, how much is US$ 500 in naira?

4 / 52

If the exchange rate is US$1 = N150, how much is US$ 500 in naira?

5 / 52

"My Heart Jumped into my mouth"
What is the meaning of the above statement?

6 / 52

Choose a word opposite in meaning to the first word
Liberty:

7 / 52

The ------ in today’s issue of The Punch News paper focused on inflation

8 / 52

"He must carry his cross" means

9 / 52

Which of the following is not a disease of the blood?

10 / 52

Under whose regime were Delta and Adamawa States created?

11 / 52

Choose a word which has the same or nearly the same meaning as the first word.
Stubborn

12 / 52

President Jonathan’s speech------ at 9pm yesterday

13 / 52

She was the first woman to stand ______ election to parliament

14 / 52

You live in a bungalow made entirely of red wood. What colour would the stairs be?

15 / 52

Sir Richard’s constitution was introduced in Nigeria in

16 / 52

50 men can build a house in 60 days. How many more men of equal strength and
ability must be put on so as to finish a similar house in 40 days

17 / 52

Choose a word which has the same or nearly the same meaning as the first word.
Dear:

18 / 52

19 / 52

They waited in a state of feverish anxiety ______ their mother to come home.

20 / 52

A labourer is paid ₦5,400.00k per month. What is his total salary in 134 years?

21 / 52

The body charged with the responsibility of regulating and protecting consumers against illicit foods and drugs in Nigeria

22 / 52

The following are stationery EXCEPT.

23 / 52

Which of these is NOT a fruit?

24 / 52

Poem is to a poet, as --- is to a novelist:

25 / 52

SYNONYMS:
Choose a word which has the same or nearly the same meaning as the first word.
Feeble:

26 / 52

Whose face is on a five hundred naira note

27 / 52

Choose a word opposite in meaning to the first word
Spendthrift:

28 / 52

Someone who persist in doing the wrong thing even after he has been punished is said to be

29 / 52

It is right to say, switch-------or put-------the light subject to the type of light.

30 / 52

He got the job and suddenly became swollen headed means

31 / 52

What prefix can be added to the word "manage" from the list below?

32 / 52

A number of people listening to a concert

33 / 52

Choose a word which has the same or nearly the same meaning as the first word.
Miserable:

34 / 52

Which of the following has the highest population in the world?

35 / 52

The first man to get to the space is

36 / 52

She adores eating junks but _______ eating fruits

37 / 52

A patient suffering from Night blindness requires

38 / 52

At the baseball game, Henry was sitting in seat 253. Marla was sitting to the right of
Henry in seat 254. In the seat to the left of Henry was George. Inez was sitting to the
left of George. Which seat is Inez sitting in?

39 / 52

The handset won’t work, the battery has run--------

40 / 52

Every participant ________ reported for the opening ceremony

41 / 52

..................... is the fastest way of getting information to millions of
people at the same time.

42 / 52

Which is the greatest of the following fractions?

43 / 52

The windows of a building have 6 sides and 6 angles. What type of a polygon are the
windows?

44 / 52

Third World countries are found in

45 / 52

Bisi is older than Ore, Dele is older than Bisi.Who is the youngest of all?

46 / 52

Choose a word which has the same or nearly the same meaning as the first word.
Boss:

47 / 52

Humility is a virtue while ______ can be regarded as a vice

48 / 52

The brevity of the first message contrasts with the _______ of the second message.

49 / 52

The instrument used to measure air pressure is called

50 / 52

Choose a word opposite in meaning to the first word
Sharp:

51 / 52

Complete the following simile:
Olu is as hungry as a:

52 / 52

Solve 1/4 of 20/7


text:
Note:
• MSTotal is not usually shown in an ANOVA table but it is an important value (i.e., the overall variance ignoring the groups).
• When you see a question about a “variance” then it will be answered with an “MS”. Questions about variance of individuals will NOT be MSAmong. Variances ignoring groups uses the simple model and will thus be MSTotal.

ANOVA Table 1

Source df SS MS F p-value
Among 7 35819 5117 3.5 0.010
Within 24 35088 1462 - -
Total 31 70907 - - -
1. See completed table above. Note the following
• dfamong and SSamong came from subtracting within values from total values.
• MSamong came from SSamong divided by dfamong.
• F is then MSamong divided by MSwithin.
• The p-value came from distrib(3.5,distrib="f",df1=7,df2=24,lower.tail=FALSE).
2. The number of groups = 7+1 = 8 (i.e., dfamong+1).
3. The number of individuals = 31+1 = 32 (i.e., dftotal+1).
4. The variability among individuals within groups is sp2 = MSwithin = 1462.
5. The variability among individuals ignoring groups is s2 = MStotal = $$\frac{70907}{31}$$ = 2287.3.
6. Yes, there is a difference among the group means because the p-value is less than 0.05.


text:
# 2011A&A...533A.131P

 other querymodes : Identifierquery Coordinatequery Criteriaquery Referencequery Basicquery Scriptsubmission TAP Outputoptions Help

 Query : 2011A&A...533A.131P

2011A&A...533A.131P - Astronomy and Astrophysics, volume 533A, 131-131 (2011/9-1)

Two phase, inward-then-outward migration of Jupiter and Saturn in the gaseous solar nebula.

<NAME>. and <NAME>.

Abstract (from CDS):

It has recently been shown that the terrestrial planets and asteroid belt can be reproduced if the giant planets underwent an inward-then-outward migration (the Grand Tack''; Walsh and collaborators). Inward migration occurs when Jupiter opens a gap and type II migrates inward. The planets tack'' and migrate outward when Saturn reaches the gap-opening mass and is caught in the 3:2 resonance with Jupiter. The aim is to test the viability of the Grand Tack model and to study the dynamical evolution of Jupiter and Saturn during their growth from 10 M cores. We have performed numerical simulations using a grid-based hydrodynamical code. Most of our simulations assume an isothermal equation of state for the disk but a subset use a fully-radiative version of the code. For an isothermal disk the two phase migration of Jupiter and Saturn is very robust and independent of the mass-growth history of these planets provided the disk is cool enough. For a radiative disk we find some outcomes with two phase migrations and others with more complicated behavior. We construct a simple, 1D model of an evolving viscous disk to calculate the evolution of the disk's radiative properties: the disk transitions from radiative to isothermal from its outermost regions inward in time. We show that a two-phase migration is a natural outcome at late times even under the limiting assumption that isothermal conditions are required. Thus, our simulations provide strong support for the Grand Tack scenario.

Journal keyword(s): accretion, accretion disks - planets and satellites: formation - hydrodynamics - methods: numerical

Full paper

 Number of rows : 2
N Identifier Otype ICRS (J2000)
RA
ICRS (J2000)
DEC
Mag U Mag B Mag V Mag R Mag I Sp type #ref
1850 - 2023
#notes
1 HD 45364 PM* 06 25 38.4743561928 -31 28 51.430718388   8.82 8.06     G8V 116 1
2 HD 128311 BY* 14 36 00.5602765558 +09 44 47.454573266 9.232 8.441 7.446 6.895 6.425 K3V 292 1

To bookmark this query, right click on this link: simbad:objects in 2011A&A...533A.131P and select 'bookmark this link' or equivalent in the popup menu

2022.12.06-12:16:49

© Université de Strasbourg/CNRS


text:
## Two tailed Z-test

The Z-test is used when you want to compare the means of two large samples (>30 observations). In a two sided Z test, you test the null-hypothesis that µ1 = µ2. Contrary, in a one sided test Z test, you test the null-hypothesis µ1 ≥ µ2 or µ1 ≤ µ2.

You need to check the following assumptions before proceeding with the Z-test:

1. The observations are independent
2. The samples have the same variance
3. That the Central Limit Theorem holds true (it does if the sample sizes > 30)

The Z-test relies on the test statistic Z, which is calculated by:

where  $\overline{x}_1$ and $\overline{x}_2$ are the sample means,   $s_1^2$ and $s_2^2$  are the sample variances, and  $n_1$ and $n_2$ are the sample sizes of sample 1 and 2, respectively.

The null hypothesis is rejected when Z > 1.96 and 2.58 at a significance level of α = 0.05 and 0.01, respectively. That is, you are certain at a degree of 95 and 99 %, respectively, that the null-hypothesis can be rejected, i.e. the means differ.

Example

You want to test if the monthly salaries of industrial workers differ between China and India.

1. Construct the null-hypothesis

H0: the mean salary in China and India do not differ (µChina = µIndia)

Take a random sample of at least 30 salaries of industrial workers from China and India.

1. Calculate the mean ($\overline{x}$) and variance ($s^2$) for each sample, in this case:

3. Check that the variances are equal
– Perform a F-test, calculate the F statistic

– Calculate the degrees of freedom ($v$)
$v_{china} = 45 - 1 = 44$
$v_{india} = 32 - 1 = 31$

– Check the critical value for F at α=0.05 where v1 = 44 and v2 = 31 in a table of critical F values: Fα=0.05 = 1.8-2.01

– Compare the calculated F statistic with Fα=0.05

F < Fα=0.05 = 1.14 < 1.8

– Reject H0 or H

H0 can’t be rejected; the assumption of equal variances holds true.

4. Calculate the Z statistic:

– Look up the critical value for Z at α = 0.05

In the case of critical values for Z we don’t have to check a table it is simply Zα=0.05 = 1.96, independent of the degrees of freedom of the samples as the test relies on the Central Limit Theorem.

5. Compare the calculated Z statistic with Zα=0.05

Z > Zα=0.05 = 12.3 > 1.96

Z is even greater than Zα=0.01 = 2.58

6. Reject H0 or H1

H0 can be rejected; the mean salary in China and India differ (µChina ≠ µIndia)

7. Interpret the result

We are more than 99 % certain that the salaries of industrial workers in China are higher compared to India.

How to do it in R

#Check the assumption of equal variances using F-test
f.test<-function(var.max,var.min) var.max/var.min

f.test(2.4,2.1)

#Function to calculate the Z statistic

z<-function(x1,x2,s1,s2,n1,n2)
abs(x1-x2)/sqrt(s1/n1+s2/n2)
}

z(7.8,3.5,2.4,2.1,45,32)

### Two tailed Z-test in depth

The theory behind the Z-test is relies on the Central Limit Theorem and is quite straightforward.

The Central Limit Theorem says that estimations of a population parameter from a large number of samples, with size n, conform to a normal distribution. The population parameter can for example be the mean and the standard deviation. Other parameters can also be considered such as the difference between the means of two populations (d).

In the Z-test you want to know if there is a real difference between the mean of two populations, µpop1 and µpop2.

As the calculated means from samples are estimations and therefore could differ from the true means (µpop1 and µpop2) due to sampling error we need to perform a statistical test (a Z-test). We simply need to find out whether the difference between the estimated means are a true difference or due to chance.

If there is no difference between the means of two populations then d = µpop1 – µpop2 = 0

Every time you estimate a mean from two populations, you can calculate a difference (d) between the means. Just as in the case with means, a large number of d estimated from samples conforms to a normal distribution according to the Central Limit Theorem.

If there is no real difference between the populations, if d = µpop1 – µpop2 = 0, the distribution of d is centered around µ=0 with standard deviation σ. Due to sampling error the estimated d from samples deviates from 0. But, the variability decreases with sample size. Sounds, familiar? Yes, the standard deviation of this distribution is the same as the standard error, the standard error of d (SEd).

Now, this is what you want to find out: does my estimated difference (d) between the means of my two samples belong to a population of d’s where µd=0? i.e. a population of d’s where there is no real difference between the means, where the difference is due to chance.

How do we do that?

We simply calculate the number of standard errors (SEd) between the estimated d and µd = 0.

1. Calculate the distance between the estimated d and µd = 0.

The bars mean that we take the absolute value of the difference, i.e. we ignore any minus sign. This is because we are not interested in which mean that is greater than the other, just that there is a difference.

2. Divide this distance with the standard error of d (SEd):

3. To calculate the number of standard errors between d and µd = 0 we get:

If the Z value exceeds 1.96, the estimated d is not very probable to have been obtained if there is no difference between the means. In other words, the estimated d is far from 0. The chance is less than 5 % that the estimated d belongs to a population of d’s with mean 0.

### How to produce the graph in R

mnorm_plot<-function(my,sigma){
x<-seq((my-(4*sigma)),(my+(4*sigma)),0.05)
mnorm<-function(my, sigma,x){
y<-(1/(sigma*sqrt(2*pi)))*exp(-0.5*((x-my)/sigma)^2)
y
}

p<-matrix(ncol=1,nrow=length(x))

for(i in 1:length(x)) {
p[i]<-mnorm(my,sigma,x[i])
}

plot(x,p,ylab="",xlab="Difference between means",type="n",las=1,bty="l",pch=19,yaxt="n")

lines(x,p,type="l",lwd=1.5)
abline(0,0,col="grey")
segments(my,0.00,my,max(p),col="grey")
mtext("µ",side=3,line=-0.5)
K.L<-my-(1.96*sigma)
K.U<-my+(1.96*sigma)
cord.x<-c(min(x),seq(min(x),K.L,0.01),K.L)
cord.y<-c(0,mnorm(my,sigma,seq(min(x),K.L,0.01)),0)
cord.x2<-c(K.U,seq(K.U,max(x),0.01),max(x))
cord.y2<-c(0,mnorm(my,sigma,seq(K.U,max(x),0.01)),0)
polygon(cord.x,cord.y,col="#C20000",border="black")
polygon(cord.x2,cord.y2,col="#C20000",border="black")

}

mnorm_plot(0,0.35) #The first argument is the difference between means and the second is the standard error


text:
We are working to support a site-wide PDF but it is not yet available. You can download PDFs for individual lectures through the download badge on each lecture page.

Code should execute sequentially if run in a Jupyter notebook

# Markov Perfect Equilibrium¶

## Contents¶

In addition to what’s in Anaconda, this lecture will need the following libraries

In [1]:
!pip install quantecon

## Overview¶

This lecture describes the concept of Markov perfect equilibrium

Markov perfect equilibrium is a key notion for analyzing economic problems involving dynamic strategic interaction, and a cornerstone of applied game theory

In this lecture we teach Markov perfect equilibrium by example

We will focus on settings with

• two players
• linear transition rules for the state

Other references include chapter 7 of [LS18]

## Background¶

Markov perfect equilibrium is a refinement of the concept of Nash equilibrium

It is used to study settings where multiple decision makers interact non-cooperatively over time, each seeking to pursue its own objective

The agents in the model face a common state vector, the time path of which is influenced by – and influences – their decisions

In particular, the transition law for the state that confronts each agent is affected by decision rules of other agents

Individual payoff maximization requires that each agent solve a dynamic programming problem that includes this transition law

Markov perfect equilibrium prevails when no agent wishes to revise its policy, taking as given the policies of all other agents

Well known examples include

• Choice of price, output, location or capacity for firms in an industry (e.g., [EP95], [Rya12], [DS10])
• Rate of extraction from a shared natural resource, such as a fishery (e.g., [LM80], [VL11])

Let’s examine a model of the first type

### Example: A duopoly model¶

Two firms are the only producers of a good the demand for which is governed by a linear inverse demand function

$$p = a_0 - a_1 (q_1 + q_2) \tag{1}$$

Here $p = p_t$ is the price of the good, $q_i = q_{it}$ is the output of firm $i=1,2$ at time $t$ and $a_0 > 0, a_1 >0$

In (1) and what follows,

• the time subscript is suppressed when possible to simplify notation
• $\hat x$ denotes a next period value of variable $x$

Each firm recognizes that its output affects total output and therefore the market price

The one-period payoff function of firm $i$ is price times quantity minus adjustment costs:

$$\pi_i = p q_i - \gamma (\hat q_i - q_i)^2, \quad \gamma > 0 , \tag{2}$$

Substituting the inverse demand curve (1) into (2) lets us express the one-period payoff as

$$\pi_i(q_i, q_{-i}, \hat q_i) = a_0 q_i - a_1 q_i^2 - a_1 q_i q_{-i} - \gamma (\hat q_i - q_i)^2 , \tag{3}$$

where $q_{-i}$ denotes the output of the firm other than $i$

The objective of the firm is to maximize $\sum_{t=0}^\infty \beta^t \pi_{it}$

Firm $i$ chooses a decision rule that sets next period quantity $\hat q_i$ as a function $f_i$ of the current state $(q_i, q_{-i})$

An essential aspect of a Markov perfect equilibrium is that each firm takes the decision rule of the other firm as known and given

Given $f_{-i}$, the Bellman equation of firm $i$ is

$$v_i(q_i, q_{-i}) = \max_{\hat q_i} \left\{\pi_i (q_i, q_{-i}, \hat q_i) + \beta v_i(\hat q_i, f_{-i}(q_{-i}, q_i)) \right\} \tag{4}$$

Definition A Markov perfect equilibrium of the duopoly model is a pair of value functions $(v_1, v_2)$ and a pair of policy functions $(f_1, f_2)$ such that, for each $i \in \{1, 2\}$ and each possible state,

• The value function $v_i$ satisfies the Bellman equation (4)
• The maximizer on the right side of (4) is equal to $f_i(q_i, q_{-i})$

The adjective “Markov” denotes that the equilibrium decision rules depend only on the current values of the state variables, not other parts of their histories

“Perfect” means complete, in the sense that the equilibrium is constructed by backward induction and hence builds in optimizing behavior for each firm at all possible future states

• These include many states that will not be reached when we iterate forward on the pair of equilibrium strategies $f_i$ starting from a given initial state

### Computation¶

One strategy for computing a Markov perfect equilibrium is iterating to convergence on pairs of Bellman equations and decision rules

In particular, let $v_i^j,f_i^j$ be the value function and policy function for firm $i$ at the $j$-th iteration

Imagine constructing the iterates

$$v_i^{j+1}(q_i, q_{-i}) = \max_{\hat q_i} \left\{\pi_i (q_i, q_{-i}, \hat q_i) + \beta v^j_i(\hat q_i, f_{-i}(q_{-i}, q_i)) \right\} \tag{5}$$

These iterations can be challenging to implement computationally

However, they simplify for the case in which the one-period payoff functions are quadratic and the transition laws are linear — which takes us to our next topic

## Linear Markov perfect equilibria¶

As we saw in the duopoly example, the study of Markov perfect equilibria in games with two players leads us to an interrelated pair of Bellman equations

In linear quadratic dynamic games, these “stacked Bellman equations” become “stacked Riccati equations” with a tractable mathematical structure

We’ll lay out that structure in a general setup and then apply it to some simple problems

### Coupled linear regulator problems¶

We consider a general linear quadratic regulator game with two players

For convenience, we’ll start with a finite horizon formulation, where $t_0$ is the initial date and $t_1$ is the common terminal date

Player $i$ takes $\{u_{-it}\}$ as given and minimizes

$$\sum_{t=t_0}^{t_1 - 1} \beta^{t - t_0} \left\{ x_t' R_i x_t + u_{it}' Q_i u_{it} + u_{-it}' S_i u_{-it} + 2 x_t' W_i u_{it} + 2 u_{-it}' M_i u_{it} \right\} \tag{6}$$

while the state evolves according to

$$x_{t+1} = A x_t + B_1 u_{1t} + B_2 u_{2t} \tag{7}$$

Here

• $x_t$ is an $n \times 1$ state vector and $u_{it}$ is a $k_i \times 1$ vector of controls for player $i$
• $R_i$ is $n \times n$
• $S_i$ is $k_{-i} \times k_{-i}$
• $Q_i$ is $k_i \times k_i$
• $W_i$ is $n \times k_i$
• $M_i$ is $k_{-i} \times k_i$
• $A$ is $n \times n$
• $B_i$ is $n \times k_i$

### Computing Equilibrium¶

We formulate a linear Markov perfect equilibrium as follows

Player $i$ employs linear decision rules $u_{it} = - F_{it} x_t$, where $F_{it}$ is a $k_i \times n$ matrix

A Markov perfect equilibrium is a pair of sequences $\{F_{1t}, F_{2t}\}$ over $t = t_0, \ldots, t_1 - 1$ such that

• $\{F_{1t}\}$ solves player 1’s problem, taking $\{F_{2t}\}$ as given, and
• $\{F_{2t}\}$ solves player 2’s problem, taking $\{F_{1t}\}$ as given

If we take $u_{2t} = - F_{2t} x_t$ and substitute it into (6) and (7), then player 1’s problem becomes minimization of

$$\sum_{t=t_0}^{t_1 - 1} \beta^{t - t_0} \left\{ x_t' \Pi_{1t} x_t + u_{1t}' Q_1 u_{1t} + 2 u_{1t}' \Gamma_{1t} x_t \right\} \tag{8}$$

subject to

$$x_{t+1} = \Lambda_{1t} x_t + B_1 u_{1t}, \tag{9}$$

where

• $\Lambda_{it} := A - B_{-i} F_{-it}$
• $\Pi_{it} := R_i + F_{-it}' S_i F_{-it}$
• $\Gamma_{it} := W_i' - M_i' F_{-it}$

This is an LQ dynamic programming problem that can be solved by working backwards

The policy rule that solves this problem is

$$F_{1t} = (Q_1 + \beta B_1' P_{1t+1} B_1)^{-1} (\beta B_1' P_{1t+1} \Lambda_{1t} + \Gamma_{1t}) \tag{10}$$

where $P_{1t}$ solves the matrix Riccati difference equation

$$P_{1t} = \Pi_{1t} - (\beta B_1' P_{1t+1} \Lambda_{1t} + \Gamma_{1t})' (Q_1 + \beta B_1' P_{1t+1} B_1)^{-1} (\beta B_1' P_{1t+1} \Lambda_{1t} + \Gamma_{1t}) + \beta \Lambda_{1t}' P_{1t+1} \Lambda_{1t} \tag{11}$$

Similarly, the policy that solves player 2’s problem is

$$F_{2t} = (Q_2 + \beta B_2' P_{2t+1} B_2)^{-1} (\beta B_2' P_{2t+1} \Lambda_{2t} + \Gamma_{2t}) \tag{12}$$

where $P_{2t}$ solves

$$P_{2t} = \Pi_{2t} - (\beta B_2' P_{2t+1} \Lambda_{2t} + \Gamma_{2t})' (Q_2 + \beta B_2' P_{2t+1} B_2)^{-1} (\beta B_2' P_{2t+1} \Lambda_{2t} + \Gamma_{2t}) + \beta \Lambda_{2t}' P_{2t+1} \Lambda_{2t} \tag{13}$$

Here in all cases $t = t_0, \ldots, t_1 - 1$ and the terminal conditions are $P_{it_1} = 0$

The solution procedure is to use equations (10), (11), (12), and (13), and “work backwards” from time $t_1 - 1$

Since we’re working backwards, $P_{1t+1}$ and $P_{2t+1}$ are taken as given at each stage

Moreover, since

• some terms on the right hand side of (10) contain $F_{2t}$
• some terms on the right hand side of (12) contain $F_{1t}$

we need to solve these $k_1 + k_2$ equations simultaneously

#### Key insight¶

A key insight is that equations (10) and (12) are linear in $F_{1t}$ and $F_{2t}$

After these equations have been solved, we can take $F_{it}$ and solve for $P_{it}$ in (11) and (13)

#### Infinite horizon¶

We often want to compute the solutions of such games for infinite horizons, in the hope that the decision rules $F_{it}$ settle down to be time invariant as $t_1 \rightarrow +\infty$

In practice, we usually fix $t_1$ and compute the equilibrium of an infinite horizon game by driving $t_0 \rightarrow - \infty$

This is the approach we adopt in the next section

### Implementation¶

We use the function nnash from QuantEcon.py that computes a Markov perfect equilibrium of the infinite horizon linear quadratic dynamic game in the manner described above

## Application¶

Let’s use these procedures to treat some applications, starting with the duopoly model

### A duopoly model¶

To map the duopoly model into coupled linear-quadratic dynamic programming problems, define the state and controls as

$$x_t := \begin{bmatrix} 1 \\ q_{1t} \\ q_{2t} \end{bmatrix} \quad \text{and} \quad u_{it} := q_{i,t+1} - q_{it}, \quad i=1,2$$

If we write

$$x_t' R_i x_t + u_{it}' Q_i u_{it}$$

where $Q_1 = Q_2 = \gamma$,

$$R_1 := \begin{bmatrix} 0 & -\frac{a_0}{2} & 0 \\ -\frac{a_0}{2} & a_1 & \frac{a_1}{2} \\ 0 & \frac{a_1}{2} & 0 \end{bmatrix} \quad \text{and} \quad R_2 := \begin{bmatrix} 0 & 0 & -\frac{a_0}{2} \\ 0 & 0 & \frac{a_1}{2} \\ -\frac{a_0}{2} & \frac{a_1}{2} & a_1 \end{bmatrix}$$

then we recover the one-period payoffs in expression (3)

The law of motion for the state $x_t$ is $x_{t+1} = A x_t + B_1 u_{1t} + B_2 u_{2t}$ where

$$A := \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}, \quad B_1 := \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}, \quad B_2 := \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}$$

The optimal decision rule of firm $i$ will take the form $u_{it} = - F_i x_t$, inducing the following closed loop system for the evolution of $x$ in the Markov perfect equilibrium:

$$x_{t+1} = (A - B_1 F_1 -B_1 F_2 ) x_t \tag{14}$$

### Parameters and Solution¶

Consider the previously presented duopoly model with parameter values of:

• $a_0 = 10$
• $a_1 = 2$
• $\beta = 0.96$
• $\gamma = 12$

From these we compute the infinite horizon MPE using the preceding code

In [2]:
"""

@authors: <NAME>, <NAME>, <NAME>

"""
import numpy as np
import quantecon as qe

# == Parameters == #
a0 = 10.0
a1 = 2.0
β = 0.96
γ = 12.0

# == In LQ form == #
A = np.eye(3)
B1 = np.array([[0.], [1.], [0.]])
B2 = np.array([[0.], [0.], [1.]])

R1 = [[      0.,     -a0 / 2,          0.],
[-a0 / 2.,          a1,     a1 / 2.],
[       0,     a1 / 2.,          0.]]

R2 = [[     0.,           0.,      -a0 / 2],
[     0.,           0.,      a1 / 2.],
[-a0 / 2,      a1 / 2.,           a1]]

Q1 = Q2 = γ
S1 = S2 = W1 = W2 = M1 = M2 = 0.0

# == Solve using QE's nnash function == #
F1, F2, P1, P2 = qe.nnash(A, B1, B2, R1, R2, Q1,
Q2, S1, S2, W1, W2, M1,
M2, beta=β)

# == Display policies == #
print("Computed policies for firm 1 and firm 2:\n")
print(f"F1 = {F1}")
print(f"F2 = {F2}")
print("\n")

Computed policies for firm 1 and firm 2:

F1 = [[-0.66846615  0.29512482  0.07584666]]
F2 = [[-0.66846615  0.07584666  0.29512482]]

Running the code produces the following output

One way to see that $F_i$ is indeed optimal for firm $i$ taking $F_2$ as given is to use QuantEcon.py’s LQ class

In particular, let’s take F2 as computed above, plug it into (8) and (9) to get firm 1’s problem and solve it using LQ

We hope that the resulting policy will agree with F1 as computed above

In [3]:
Λ1 = A - B2 @ F2
lq1 = qe.LQ(Q1, R1, Λ1, B1, beta=β)
P1_ih, F1_ih, d = lq1.stationary_values()
F1_ih

Out[3]:
array([[-0.66846613,  0.29512482,  0.07584666]])

This is close enough for rock and roll, as they say in the trade

Indeed, np.allclose agrees with our assessment

In [4]:
np.allclose(F1, F1_ih)

Out[4]:
True

### Dynamics¶

Let’s now investigate the dynamics of price and output in this simple duopoly model under the MPE policies

Given our optimal policies $F1$ and $F2$, the state evolves according to (14)

The following program

• imports $F1$ and $F2$ from the previous program along with all parameters
• computes the evolution of $x_t$ using (14)
• extracts and plots industry output $q_t = q_{1t} + q_{2t}$ and price $p_t = a_0 - a_1 q_t$
In [5]:
import matplotlib.pyplot as plt

AF = A - B1 @ F1 - B2 @ F2
n = 20
x = np.empty((3, n))
x[:, 0] = 1, 1, 1
for t in range(n-1):
x[:, t+1] = AF @ x[:, t]
q1 = x[1, :]
q2 = x[2, :]
q = q1 + q2       # Total output, MPE
p = a0 - a1 * q   # Price, MPE

fig, ax = plt.subplots(figsize=(9, 5.8))
ax.plot(q, 'b-', lw=2, alpha=0.75, label='total output')
ax.plot(p, 'g-', lw=2, alpha=0.75, label='price')
ax.set_title('Output and prices, duopoly MPE')
ax.legend(frameon=False)
plt.show()

<Figure size 900x580 with 1 Axes>

Note that the initial condition has been set to $q_{10} = q_{20} = 1.0$

To gain some perspective we can compare this to what happens in the monopoly case

The first panel in the next figure compares output of the monopolist and industry output under the MPE, as a function of time

The second panel shows analogous curves for price

Here parameters are the same as above for both the MPE and monopoly solutions

The monopolist initial condition is $q_0 = 2.0$ to mimic the industry initial condition $q_{10} = q_{20} = 1.0$ in the MPE case

As expected, output is higher and prices are lower under duopoly than monopoly

## Exercises¶

### Exercise 1¶

Replicate the pair of figures showing the comparison of output and prices for the monopolist and duopoly under MPE

Parameters are as in duopoly_mpe.py and you can use that code to compute MPE policies under duopoly

The optimal policy in the monopolist case can be computed using QuantEcon.py’s LQ class

### Exercise 2¶

In this exercise we consider a slightly more sophisticated duopoly problem

It takes the form of infinite horizon linear quadratic game proposed by Judd [Jud90]

Two firms set prices and quantities of two goods interrelated through their demand curves

Relevant variables are defined as follows:

• $I_{it}$ = inventories of firm $i$ at beginning of $t$
• $q_{it}$ = production of firm $i$ during period $t$
• $p_{it}$ = price charged by firm $i$ during period $t$
• $S_{it}$ = sales made by firm $i$ during period $t$
• $E_{it}$ = costs of production of firm $i$ during period $t$
• $C_{it}$ = costs of carrying inventories for firm $i$ during $t$

The firms’ cost functions are

• $C_{it} = c_{i1} + c_{i2} I_{it} + 0.5 c_{i3} I_{it}^2$
• $E_{it} = e_{i1} + e_{i2}q_{it} + 0.5 e_{i3} q_{it}^2$ where $e_{ij}, c_{ij}$ are positive scalars

Inventories obey the laws of motion

$$I_{i,t+1} = (1 - \delta) I_{it} + q_{it} - S_{it}$$

Demand is governed by the linear schedule

$$S_t = D p_{it} + b$$

where

• $S_t = \begin{bmatrix} S_{1t} & S_{2t} \end{bmatrix}'$
• $D$ is a $2\times 2$ negative definite matrix and
• $b$ is a vector of constants

Firm $i$ maximizes the undiscounted sum

$$\lim_{T \to \infty}\ {1 \over T}\ \sum^T_{t=0}\ \left( p_{it} S_{it} - E_{it} - C_{it} \right)$$

We can convert this to a linear quadratic problem by taking

$$u_{it} = \begin{bmatrix} p_{it} \\ q_{it} \end{bmatrix} \quad \text{and} \quad x_t = \begin{bmatrix} I_{1t} \\ I_{2t} \\ 1 \end{bmatrix}$$

Decision rules for price and quantity take the form $u_{it} = -F_i x_t$

The Markov perfect equilibrium of Judd’s model can be computed by filling in the matrices appropriately

The exercise is to calculate these matrices and compute the following figures

The first figure shows the dynamics of inventories for each firm when the parameters are

In [6]:
δ = 0.02
D = np.array([[-1, 0.5], [0.5, -1]])
b = np.array([25, 25])
c1 = c2 = np.array([1, -2, 1])
e1 = e2 = np.array([10, 10, 3])

Inventories trend to a common steady state

If we increase the depreciation rate to $\delta = 0.05$, then we expect steady state inventories to fall

This is indeed the case, as the next figure shows

## Solutions¶

### Exercise 1¶

First let’s compute the duopoly MPE under the stated parameters

In [7]:
# == Parameters == #
a0 = 10.0
a1 = 2.0
β = 0.96
γ = 12.0

# == In LQ form == #
A  = np.eye(3)
B1 = np.array([[0.], [1.], [0.]])
B2 = np.array([[0.], [0.], [1.]])
R1 = [[      0.,      -a0/2,          0.],
[-a0 / 2.,         a1,     a1 / 2.],
[       0,    a1 / 2.,          0.]]

R2 = [[     0.,          0.,     -a0 / 2],
[     0.,          0.,     a1 / 2.],
[-a0 / 2,     a1 / 2.,          a1]]

Q1 = Q2 = γ
S1 = S2 = W1 = W2 = M1 = M2 = 0.0

# == Solve using QE's nnash function == #
F1, F2, P1, P2 = qe.nnash(A, B1, B2, R1, R2, Q1,
Q2, S1, S2, W1, W2, M1,
M2, beta=β)

Now we evaluate the time path of industry output and prices given initial condition $q_{10} = q_{20} = 1$

In [8]:
AF = A - B1 @ F1 - B2 @ F2
n = 20
x = np.empty((3, n))
x[:, 0] = 1, 1, 1
for t in range(n-1):
x[:, t+1] = AF @ x[:, t]
q1 = x[1, :]
q2 = x[2, :]
q = q1 + q2       # Total output, MPE
p = a0 - a1 * q   # Price, MPE

Next let’s have a look at the monopoly solution

For the state and control we take

$$x_t = q_t - \bar q \quad \text{and} \quad u_t = q_{t+1} - q_t$$

To convert to an LQ problem we set

$$R = a_1 \quad \text{and} \quad Q = \gamma$$

in the payoff function $x_t' R x_t + u_t' Q u_t$ and

$$A = B = 1$$

in the law of motion $x_{t+1} = A x_t + B u_t$

We solve for the optimal policy $u_t = - Fx_t$ and track the resulting dynamics of $\{q_t\}$, starting at $q_0 = 2.0$

In [9]:
R = a1
Q = γ
A = B = 1
lq_alt = qe.LQ(Q, R, A, B, beta=β)
P, F, d = lq_alt.stationary_values()
q_bar = a0 / (2.0 * a1)
qm = np.empty(n)
qm[0] = 2
x0 = qm[0] - q_bar
x = x0
for i in range(1, n):
x = A * x - B * F * x
qm[i] = float(x) + q_bar
pm = a0 - a1 * qm

Let’s have a look at the different time paths

In [10]:
fig, axes = plt.subplots(2, 1, figsize=(9, 9))

ax = axes[0]
ax.plot(qm, 'b-', lw=2, alpha=0.75, label='monopolist output')
ax.plot(q, 'g-', lw=2, alpha=0.75, label='MPE total output')
ax.set(ylabel="output", xlabel="time", ylim=(2, 4))
ax.legend(loc='upper left', frameon=0)

ax = axes[1]
ax.plot(pm, 'b-', lw=2, alpha=0.75, label='monopolist price')
ax.plot(p, 'g-', lw=2, alpha=0.75, label='MPE price')
ax.set(ylabel="price", xlabel="time")
ax.legend(loc='upper right', frameon=0)
plt.show()

### Exercise 2¶

We treat the case $\delta = 0.02$

In [11]:
δ = 0.02
D = np.array([[-1, 0.5], [0.5, -1]])
b = np.array([25, 25])
c1 = c2 = np.array([1, -2, 1])
e1 = e2 = np.array([10, 10, 3])

δ_1 = 1 - δ

Recalling that the control and state are

$$u_{it} = \begin{bmatrix} p_{it} \\ q_{it} \end{bmatrix} \quad \text{and} \quad x_t = \begin{bmatrix} I_{1t} \\ I_{2t} \\ 1 \end{bmatrix}$$

we set up the matrices as follows:

In [12]:
# ==  Create matrices needed to compute the Nash feedback equilibrium == #

A = np.array([[δ_1,      0,    -δ_1 * b[0]],
[  0,    δ_1,    -δ_1 * b[1]],
[  0,      0,             1]])

B1 = δ_1 * np.array([[1, -D[0, 0]],
[0, -D[1, 0]],
[0,       0]])
B2 = δ_1 * np.array([[0, -D[0, 1]],
[1, -D[1, 1]],
[0,       0]])

R1 = -np.array([[0.5 * c1[2],     0,    0.5 * c1[1]],
[          0,     0,              0],
[0.5 * c1[1],     0,         c1[0]]])
R2 = -np.array([[0,               0,              0],
[0,     0.5 * c2[2],    0.5 * c2[1]],
[0,     0.5 * c2[1],         c2[0]]])

Q1 = np.array([[-0.5 * e1[2], 0], [0, D[0, 0]]])
Q2 = np.array([[-0.5 * e2[2], 0], [0, D[1, 1]]])

S1 = np.zeros((2, 2))
S2 = np.copy(S1)

W1 = np.array([[           0,             0],
[           0,             0],
[-0.5 * e1[1],    b[0] / 2.]])
W2 = np.array([[           0,             0],
[           0,             0],
[-0.5 * e2[1],    b[1] / 2.]])

M1 = np.array([[0, 0], [0, D[0, 1] / 2.]])
M2 = np.copy(M1)

We can now compute the equilibrium using qe.nnash

In [13]:
F1, F2, P1, P2 = qe.nnash(A, B1, B2, R1,
R2, Q1, Q2, S1,
S2, W1, W2, M1, M2)

print("\nFirm 1's feedback rule:\n")
print(F1)

print("\nFirm 2's feedback rule:\n")
print(F2)

Firm 1's feedback rule:

[[ 2.43666582e-01  2.72360627e-02 -6.82788293e+00]
[ 3.92370734e-01  1.39696451e-01 -3.77341073e+01]]

Firm 2's feedback rule:

[[ 2.72360627e-02  2.43666582e-01 -6.82788293e+00]
[ 1.39696451e-01  3.92370734e-01 -3.77341073e+01]]

Now let’s look at the dynamics of inventories, and reproduce the graph corresponding to $\delta = 0.02$

In [14]:
AF = A - B1 @ F1 - B2 @ F2
n = 25
x = np.empty((3, n))
x[:, 0] = 2, 0, 1
for t in range(n-1):
x[:, t+1] = AF @ x[:, t]
I1 = x[0, :]
I2 = x[1, :]
fig, ax = plt.subplots(figsize=(9, 5))
ax.plot(I1, 'b-', lw=2, alpha=0.75, label='inventories, firm 1')
ax.plot(I2, 'g-', lw=2, alpha=0.75, label='inventories, firm 2')
ax.set_title(rf'$\delta = {δ}$')
ax.legend()
plt.show()

• Share page