text:
Chapter 12. Sources of Magnetic Fields

# 12.7 Magnetism in Matter

### Learning Objectives

By the end of this section, you will be able to:

• Classify magnetic materials as paramagnetic, diamagnetic, or ferromagnetic, based on their response to a magnetic field
• Sketch how magnetic dipoles align with the magnetic field in each type of substance
• Define hysteresis and magnetic susceptibility, which determines the type of magnetic material

Why are certain materials magnetic and others not? And why do certain substances become magnetized by a field, whereas others are unaffected? To answer such questions, we need an understanding of magnetism on a microscopic level.

Within an atom, every electron travels in an orbit and spins on an internal axis. Both types of motion produce current loops and therefore magnetic dipoles. For a particular atom, the net magnetic dipole moment is the vector sum of the magnetic dipole moments. Values of $\mu$ for several types of atoms are given in Table 12.1. Notice that some atoms have a zero net dipole moment and that the magnitudes of the nonvanishing moments are typically ${10}^{-23}\text{A}·{\text{m}}^{2}.$

Table 12.1 Magnetic Moments of Some Atoms
Atom Magnetic Moment $\left({10}^{-24}\phantom{\rule{0.2em}{0ex}}\text{A}·{\text{m}}^{2}\right)$
H 9.27
He 0
Li 9.27
O 13.9
Na 9.27
S 13.9

A handful of matter has approximately ${10}^{26}$ atoms and ions, each with its magnetic dipole moment. If no external magnetic field is present, the magnetic dipoles are randomly oriented—as many are pointed up as down, as many are pointed east as west, and so on. Consequently, the net magnetic dipole moment of the sample is zero. However, if the sample is placed in a magnetic field, these dipoles tend to align with the field (see Equation 12.14), and this alignment determines how the sample responds to the field. On the basis of this response, a material is said to be either paramagnetic, ferromagnetic, or diamagnetic.

In a paramagnetic material, only a small fraction (roughly one-third) of the magnetic dipoles are aligned with the applied field. Since each dipole produces its own magnetic field, this alignment contributes an extra magnetic field, which enhances the applied field. When a ferromagnetic material is placed in a magnetic field, its magnetic dipoles also become aligned; furthermore, they become locked together so that a permanent magnetization results, even when the field is turned off or reversed. This permanent magnetization happens in ferromagnetic materials but not paramagnetic materials. Diamagnetic materials are composed of atoms that have no net magnetic dipole moment. However, when a diamagnetic material is placed in a magnetic field, a magnetic dipole moment is directed opposite to the applied field and therefore produces a magnetic field that opposes the applied field. We now consider each type of material in greater detail.

### Paramagnetic Materials

For simplicity, we assume our sample is a long, cylindrical piece that completely fills the interior of a long, tightly wound solenoid. When there is no current in the solenoid, the magnetic dipoles in the sample are randomly oriented and produce no net magnetic field. With a solenoid current, the magnetic field due to the solenoid exerts a torque on the dipoles that tends to align them with the field. In competition with the aligning torque are thermal collisions that tend to randomize the orientations of the dipoles. The relative importance of these two competing processes can be estimated by comparing the energies involved. From Equation 12.14, the energy difference between a magnetic dipole aligned with and against a magnetic field is ${U}_{B}=2\mu B.$ If $\mu =9.3\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-24}\text{A}·{\text{m}}^{2}$ (the value of atomic hydrogen) and B = 1.0 T, then

${U}_{B}=1.9\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-23}\text{J}.$

At a room temperature of $27\phantom{\rule{0.2em}{0ex}}\text{°C},$ the thermal energy per atom is

${U}_{T}\approx kT=\left(1.38\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-23}\text{J/K}\right)\left(300\phantom{\rule{0.2em}{0ex}}\text{K}\right)=4.1\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-21}\text{J},$

which is about 220 times greater than ${U}_{B}.$ Clearly, energy exchanges in thermal collisions can seriously interfere with the alignment of the magnetic dipoles. As a result, only a small fraction of the dipoles is aligned at any instant.

The four sketches of Figure 12.23 furnish a simple model of this alignment process. In part (a), before the field of the solenoid (not shown) containing the paramagnetic sample is applied, the magnetic dipoles are randomly oriented and there is no net magnetic dipole moment associated with the material. With the introduction of the field, a partial alignment of the dipoles takes place, as depicted in part (b). The component of the net magnetic dipole moment that is perpendicular to the field vanishes. We may then represent the sample by part (c), which shows a collection of magnetic dipoles completely aligned with the field. By treating these dipoles as current loops, we can picture the dipole alignment as equivalent to a current around the surface of the material, as in part (d). This fictitious surface current produces its own magnetic field, which enhances the field of the solenoid.

We can express the total magnetic field $\stackrel{\to }{\textbf{B}}$ in the material as

$\stackrel{\to }{\textbf{B}}={\stackrel{\to }{\textbf{B}}}_{0}+{\stackrel{\to }{\textbf{B}}}_{m},$

where ${\stackrel{\to }{\textbf{B}}}_{0}$ is the field due to the current ${I}_{0}$ in the solenoid and ${\stackrel{\to }{\textbf{B}}}_{m}$ is the field due to the surface current ${I}_{m}$ around the sample. Now ${\stackrel{\to }{\textbf{B}}}_{m}$ is usually proportional to ${\stackrel{\to }{\textbf{B}}}_{0},$ a fact we express by

${\stackrel{\to }{\textbf{B}}}_{m}=\chi {\stackrel{\to }{\textbf{B}}}_{0},$

where $\chi$ is a dimensionless quantity called the magnetic susceptibility. Values of $\chi$ for some paramagnetic materials are given in Table 12.2. Since the alignment of magnetic dipoles is so weak, $\chi$ is very small for paramagnetic materials. By combining Equation 12.34 and Figure 12.35, we obtain:

$\stackrel{\to }{\textbf{B}}={\stackrel{\to }{\textbf{B}}}_{0}+\chi {\stackrel{\to }{\textbf{B}}}_{0}=\left(1+\chi \right){\stackrel{\to }{\textbf{B}}}_{0}.$

For a sample within an infinite solenoid, this becomes

$B=\left(1+\chi \right){\mu }_{0}nI.$

This expression tells us that the insertion of a paramagnetic material into a solenoid increases the field by a factor of $\left(1+\chi \right).$ However, since $\chi$ is so small, the field isn’t enhanced very much.

The quantity

$\mu =\left(1+\chi \right){\mu }_{0}.$

is called the magnetic permeability of a material. In terms of $\mu ,$ Equation 12.37 can be written as

$B=\mu nI$

for the filled solenoid.

Table 12.2 Magnetic Susceptibilities*Note: Unless otherwise specified, values given are for room temperature.
Paramagnetic Materials $\chi$ Diamagnetic Materials $\chi$
Aluminum $2.2\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$ Bismuth $-1.7\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$
Calcium $1.4\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$ Carbon (diamond) $-2.2\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$
Chromium $3.1\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}$ Copper $-9.7\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-6}$
Magnesium $1.2\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$ Lead $-1.8\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$
Oxygen gas (1 atm) $1.8\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-6}$ Mercury $-2.8\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$
Oxygen liquid (90 K) $3.5\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-3}$ Hydrogen gas (1 atm) $-2.2\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-9}$
Tungsten $6.8\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}$ Nitrogen gas (1 atm) $-6.7\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-9}$
Air (1 atm) $3.6\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-7}$ Water $-9.1\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-6}$

### Diamagnetic Materials

A magnetic field always induces a magnetic dipole in an atom. This induced dipole points opposite to the applied field, so its magnetic field is also directed opposite to the applied field. In paramagnetic and ferromagnetic materials, the induced magnetic dipole is masked by much stronger permanent magnetic dipoles of the atoms. However, in diamagnetic materials, whose atoms have no permanent magnetic dipole moments, the effect of the induced dipole is observable.

We can now describe the magnetic effects of diamagnetic materials with the same model developed for paramagnetic materials. In this case, however, the fictitious surface current flows opposite to the solenoid current, and the magnetic susceptibility $\chi$ is negative. Values of $\chi$ for some diamagnetic materials are also given in Table 12.2.

Water is a common diamagnetic material. Animals are mostly composed of water. Experiments have been performed on frogs and mice in diverging magnetic fields. The water molecules are repelled from the applied magnetic field against gravity until the animal reaches an equilibrium. The result is that the animal is levitated by the magnetic field.

### Ferromagnetic Materials

Common magnets are made of a ferromagnetic material such as iron or one of its alloys. Experiments reveal that a ferromagnetic material consists of tiny regions known as magnetic domains. Their volumes typically range from ${10}^{-12}$ to ${10}^{-8}{\text{m}}^{3},$ and they contain about ${10}^{17}$ to ${10}^{21}$ atoms. Within a domain, the magnetic dipoles are rigidly aligned in the same direction by coupling among the atoms. This coupling, which is due to quantum mechanical effects, is so strong that even thermal agitation at room temperature cannot break it. The result is that each domain has a net dipole moment. Some materials have weaker coupling and are ferromagnetic only at lower temperatures.

If the domains in a ferromagnetic sample are randomly oriented, as shown in Figure 12.24, the sample has no net magnetic dipole moment and is said to be unmagnetized. Suppose that we fill the volume of a solenoid with an unmagnetized ferromagnetic sample. When the magnetic field ${\stackrel{\to }{\textbf{B}}}_{0}$ of the solenoid is turned on, the dipole moments of the domains rotate so that they align somewhat with the field, as depicted in Figure 12.24. In addition, the aligned domains tend to increase in size at the expense of unaligned ones. The net effect of these two processes is the creation of a net magnetic dipole moment for the ferromagnet that is directed along the applied magnetic field. This net magnetic dipole moment is much larger than that of a paramagnetic sample, and the domains, with their large numbers of atoms, do not become misaligned by thermal agitation. Consequently, the field due to the alignment of the domains is quite large.

Besides iron, only four elements contain the magnetic domains needed to exhibit ferromagnetic behavior: cobalt, nickel, gadolinium, and dysprosium. Many alloys of these elements are also ferromagnetic. Ferromagnetic materials can be described using Equation 12.34 through Equation 12.39, the paramagnetic equations. However, the value of $\chi$ for ferromagnetic material is usually on the order of ${10}^{3}$ to ${10}^{4},$ and it also depends on the history of the magnetic field to which the material has been subject. A typical plot of B (the total field in the material) versus ${B}_{0}$ (the applied field) for an initially unmagnetized piece of iron is shown in Figure 12.25. Some sample numbers are (1) for ${B}_{0}=1.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{T},B=0.60\phantom{\rule{0.2em}{0ex}}\text{T},$ and $\chi =\left(\frac{0.60}{1.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}}\right)-1\approx 6.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{3}$; (2) for ${B}_{0}=6.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{T},B=1.5\phantom{\rule{0.2em}{0ex}}\text{T},$ and $\chi =\left(\frac{1.5}{6.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}}\right)-1\approx 2.5\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{3}.$

When ${B}_{0}$ is varied over a range of positive and negative values, B is found to behave as shown in Figure 12.26. Note that the same ${B}_{0}$ (corresponding to the same current in the solenoid) can produce different values of B in the material. The magnetic field B produced in a ferromagnetic material by an applied field ${B}_{0}$ depends on the magnetic history of the material. This effect is called hysteresis, and the curve of Figure 12.26 is called a hysteresis loop. Notice that B does not disappear when ${B}_{0}=0$ (i.e., when the current in the solenoid is turned off). The iron stays magnetized, which means that it has become a permanent magnet.

Like the paramagnetic sample of Figure 12.23, the partial alignment of the domains in a ferromagnet is equivalent to a current flowing around the surface. A bar magnet can therefore be pictured as a tightly wound solenoid with a large current circulating through its coils (the surface current). You can see in Figure 12.27 that this model fits quite well. The fields of the bar magnet and the finite solenoid are strikingly similar. The figure also shows how the poles of the bar magnet are identified. To form closed loops, the field lines outside the magnet leave the north (N) pole and enter the south (S) pole, whereas inside the magnet, they leave S and enter N.

Ferromagnetic materials are found in computer hard disk drives and permanent data storage devices (Figure 12.28). A material used in your hard disk drives is called a spin valve, which has alternating layers of ferromagnetic (aligning with the external magnetic field) and antiferromagnetic (each atom is aligned opposite to the next) metals. It was observed that a significant change in resistance was discovered based on whether an applied magnetic field was on the spin valve or not. This large change in resistance creates a quick and consistent way for recording or reading information by an applied current.

### Example

#### Iron Core in a Coil

A long coil is tightly wound around an iron cylinder whose magnetization curve is shown in Figure 12.25. (a) If $n=20$ turns per centimeter, what is the applied field ${B}_{0}$ when ${I}_{0}=0.20\phantom{\rule{0.2em}{0ex}}\text{A}?$ (b) What is the net magnetic field for this same current? (c) What is the magnetic susceptibility in this case?

#### Strategy

(a) The magnetic field of a solenoid is calculated using Equation 12.28. (b) The graph is read to determine the net magnetic field for this same current. (c) The magnetic susceptibility is calculated using Equation 12.37.

#### Solution

1. The applied field ${B}_{0}$ of the coil is

$\begin{array}{ccc}\hfill {B}_{0}& =\hfill & {\mu }_{0}n{I}_{0}=\left(4\pi \phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-7}\text{T}·\text{m/A}\right)\left(2000\phantom{\rule{0.1em}{0ex}}\text{/}\phantom{\rule{0.1em}{0ex}}\text{m}\right)\left(0.20\phantom{\rule{0.2em}{0ex}}\text{A}\right)\hfill \\ \hfill {B}_{0}& =\hfill & 5.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{T}.\hfill \end{array}$
2. From inspection of the magnetization curve of Figure 12.25, we see that, for this value of ${B}_{0},$ $B=1.4\phantom{\rule{0.2em}{0ex}}\text{T}.$ Notice that the internal field of the aligned atoms is much larger than the externally applied field.
3. The magnetic susceptibility is calculated to be

$\chi =\frac{B}{{B}_{0}}-1=\frac{1.4\phantom{\rule{0.2em}{0ex}}\text{T}}{5.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{T}}\text{−1}=2.8\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{3}.$

#### Significance

Ferromagnetic materials have susceptibilities in the range of ${10}^{3}$ which compares well to our results here. Paramagnetic materials have fractional susceptibilities, so their applied field of the coil is much greater than the magnetic field generated by the material.

### Check Your Understanding

Repeat the calculations from the previous example for ${I}_{0}=0.040\phantom{\rule{0.2em}{0ex}}\text{A}.$

Show Solution

a. $1.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{T}$; b. 0.60 T; c. $6.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{3}$

### Summary

• Materials are classified as paramagnetic, diamagnetic, or ferromagnetic, depending on how they behave in an applied magnetic field.
• Paramagnetic materials have partial alignment of their magnetic dipoles with an applied magnetic field. This is a positive magnetic susceptibility. Only a surface current remains, creating a solenoid-like magnetic field.
• Diamagnetic materials exhibit induced dipoles opposite to an applied magnetic field. This is a negative magnetic susceptibility.
• Ferromagnetic materials have groups of dipoles, called domains, which align with the applied magnetic field. However, when the field is removed, the ferromagnetic material remains magnetized, unlike paramagnetic materials. This magnetization of the material versus the applied field effect is called hysteresis.

### Key Equations

 Permeability of free space ${\mu }_{0}=4\pi \phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-7}\text{T}\cdot \text{m/A}$ Contribution to magnetic field from a current element $dB=\frac{{\mu }_{0}}{4\pi }\phantom{\rule{0.2em}{0ex}}\frac{I\phantom{\rule{0.2em}{0ex}}dl\phantom{\rule{0.2em}{0ex}}\text{sin}\phantom{\rule{0.1em}{0ex}}\theta }{{r}^{2}}$ Biot–Savart law $\stackrel{\to }{\textbf{B}}=\frac{{\mu }_{0}}{4\pi }\underset{\text{wire}}{\int }\frac{Id\stackrel{\to }{\textbf{l}}\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}\hat{\textbf{r}}}{{r}^{2}}$ Magnetic field due to a long straight wire $B=\frac{{\mu }_{0}I}{2\pi R}$ Force between two parallel currents $\frac{F}{l}=\frac{{\mu }_{0}{I}_{1}{I}_{2}}{2\pi r}$ Magnetic field of a current loop $B=\frac{{\mu }_{0}I}{2R}\phantom{\rule{0.2em}{0ex}}\text{(at center of loop)}$ Ampère’s law $\oint \stackrel{\to }{\textbf{B}}·d\stackrel{\to }{\textbf{l}}={\mu }_{0}I$ Magnetic field strength inside a solenoid $B={\mu }_{0}nI$ Magnetic field strength inside a toroid $B=\frac{{\mu }_{o}NI}{2\pi r}$ Magnetic permeability $\mu =\left(1+\chi \right){\mu }_{0}$ Magnetic field of a solenoid filled with paramagnetic material $B=\mu nI$

### Conceptual Questions

A diamagnetic material is brought close to a permanent magnet. What happens to the material?

If you cut a bar magnet into two pieces, will you end up with one magnet with an isolated north pole and another magnet with an isolated south pole? Explain your answer.

Show Solution

The bar magnet will then become two magnets, each with their own north and south poles. There are no magnetic monopoles or single pole magnets.

### Problems

The magnetic field in the core of an air-filled solenoid is 1.50 T. By how much will this magnetic field decrease if the air is pumped out of the core while the current is held constant?

A solenoid has a ferromagnetic core, n = 1000 turns per meter, and I = 5.0 A. If B inside the solenoid is 2.0 T, what is $\chi$ for the core material?

Show Solution

317.31

A 20-A current flows through a solenoid with 2000 turns per meter. What is the magnetic field inside the solenoid if its core is (a) a vacuum and (b) filled with liquid oxygen at 90 K?

The magnetic dipole moment of the iron atom is about $2.1\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-23}\text{A}·{\text{m}}^{2}.$ (a) Calculate the maximum magnetic dipole moment of a domain consisting of ${10}^{19}$ iron atoms. (b) What current would have to flow through a single circular loop of wire of diameter 1.0 cm to produce this magnetic dipole moment?

Show Solution

$2.1\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{A}·{\text{m}}^{2}$
$2.7\phantom{\rule{0.2em}{0ex}}\text{A}$

Suppose you wish to produce a 1.2-T magnetic field in a toroid with an iron core for which $\chi =4.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{3}.$ The toroid has a mean radius of 15 cm and is wound with 500 turns. What current is required?

A current of 1.5 A flows through the windings of a large, thin toroid with 200 turns per meter and a radius of 1 meter. If the toroid is filled with iron for which $\chi =3.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{3},$ what is the magnetic field within it?

Show Solution

0.18 T

A solenoid with an iron core is 25 cm long and is wrapped with 100 turns of wire. When the current through the solenoid is 10 A, the magnetic field inside it is 2.0 T. For this current, what is the permeability of the iron? If the current is turned off and then restored to 10 A, will the magnetic field necessarily return to 2.0 T?

Three long, straight, parallel wires, all carrying 20 A, are positioned as shown in the accompanying figure. What is the magnitude of the magnetic field at the point P?

Show Solution

$B=1.4\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-4}\text{T}$

A current I flows around a wire bent into the shape of a square of side a. What is the magnetic field at the point P that is a distance z above the center of the square (see the accompanying figure)?

The accompanying figure shows a long, straight wire carrying a current of 10 A. What is the magnetic force on an electron at the instant it is 20 cm from the wire, traveling parallel to the wire with a speed of $2.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{5}\text{m/s?}$ Describe qualitatively the subsequent motion of the electron.

Show Solution

$3.2\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{\text{−19}}N$ in an arc away from the wire

Current flows along a thin, infinite sheet as shown in the accompanying figure. The current per unit length along the sheet is J in amperes per meter. (a) Use the Biot-Savart law to show that $B={\mu }_{0}J/2$ on either side of the sheet. What is the direction of $\stackrel{\to }{\textbf{B}}$ on each side? (b) Now use Ampère’s law to calculate the field.

(a) Use the result of the previous problem to calculate the magnetic field between, above, and below the pair of infinite sheets shown in the accompanying figure. (b) Repeat your calculations if the direction of the current in the lower sheet is reversed.

Show Solution

a. above and below $B={\mu }_{0}j,$ in the middle $B=0;$ b. above and below $B=0,$ in the middle $B={\mu }_{0}j$

We often assume that the magnetic field is uniform in a region and zero everywhere else. Show that in reality it is impossible for a magnetic field to drop abruptly to zero, as illustrated in the accompanying figure. (Hint: Apply Ampère’s law over the path shown.)

How is the fractional change in the strength of the magnetic field across the face of the toroid related to the fractional change in the radial distance from the axis of the toroid?

Show Solution

$\frac{dB}{B}=-\phantom{\rule{0.05em}{0ex}}\frac{dr}{r}$

Show that the expression for the magnetic field of a toroid reduces to that for the field of an infinite solenoid in the limit that the central radius goes to infinity.

A toroid with an inner radius of 20 cm and an outer radius of 22 cm is tightly wound with one layer of wire that has a diameter of 0.25 mm. (a) How many turns are there on the toroid? (b) If the current through the toroid windings is 2.0 A, what is the strength of the magnetic field at the center of the toroid?

Show Solution

a. 5026 turns; b. 0.00957 T

A wire element has $d\stackrel{\to }{\textbf{l}},Id\stackrel{\to }{\textbf{l}}=JAdl=Jdv,$ where A and dv are the cross-sectional area and volume of the element, respectively. Use this, the Biot-Savart law, and $J=nev$ to show that the magnetic field of a moving point charge q is given by:
$\stackrel{\to }{\textbf{B}}=\frac{{\mu }_{0}}{4\pi }\phantom{\rule{0.2em}{0ex}}\frac{qv\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}\hat{\textbf{r}}}{{r}^{2}}$

A reasonably uniform magnetic field over a limited region of space can be produced with the Helmholtz coil, which consists of two parallel coils centered on the same axis. The coils are connected so that they carry the same current I. Each coil has N turns and radius R, which is also the distance between the coils. (a) Find the magnetic field at any point on the z-axis shown in the accompanying figure. (b) Show that dB/dz and $\frac{{d}^{2}B}{d{z}^{2}}$ are both zero at z = 0. (These vanishing derivatives demonstrate that the magnetic field varies only slightly near z = 0.)

Show Solution

${B}_{1}\left(x\right)=\frac{{\mu }_{0}I{R}^{2}}{2{\left({R}^{2}+{z}^{2}\right)}^{3\text{/}2}}$

A charge of $4.0\phantom{\rule{0.2em}{0ex}}\text{μC}$ is distributed uniformly around a thin ring of insulating material. The ring has a radius of 0.20 m and rotates at $2.0\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{4}\text{rev/min}$ around the axis that passes through its center and is perpendicular to the plane of the ring. What is the magnetic field at the center of the ring?

A thin, nonconducting disk of radius R is free to rotate around the axis that passes through its center and is perpendicular to the face of the disk. The disk is charged uniformly with a total charge q. If the disk rotates at a constant angular velocity $\omega ,$ what is the magnetic field at its center?

Show Solution

$B=\frac{{\mu }_{0}\sigma \omega }{2}R$

Consider the disk in the previous problem. Calculate the magnetic field at a point on its central axis that is a distance y above the disk.

Consider the axial magnetic field ${B}_{y}={\mu }_{0}I{R}^{2}\text{/}2{\left({y}^{2}+{R}^{2}\right)}^{3\text{/}2}$ of the circular current loop shown below. (a) Evaluate ${\int }_{\text{−}a}^{a}{B}_{y}dy.$ Also show that $\underset{a\to \infty }{\text{lim}}{\int }_{\text{−}a}^{a}{B}_{y}dy={\mu }_{0}I.$ (b) Can you deduce this limit without evaluating the integral? (Hint: See the accompanying figure.)

Show Solution

derivation

The current density in the long, cylindrical wire shown in the accompanying figure varies with distance r from the center of the wire according to $J=cr,$ where c is a constant. (a) What is the current through the wire? (b) What is the magnetic field produced by this current for $r\le R?$ For $r\ge R?$

A long, straight, cylindrical conductor contains a cylindrical cavity whose axis is displaced by a from the axis of the conductor, as shown in the accompanying figure. The current density in the conductor is given by $\stackrel{\to }{\textbf{J}}={J}_{0}\hat{\textbf{k}},$ where ${J}_{0}$ is a constant and $\hat{\textbf{k}}$ is along the axis of the conductor. Calculate the magnetic field at an arbitrary point P in the cavity by superimposing the field of a solid cylindrical conductor with radius ${R}_{1}$ and current density $\stackrel{\to }{\textbf{J}}$ onto the field of a solid cylindrical conductor with radius ${R}_{2}$ and current density $\text{−}\stackrel{\to }{\textbf{J}}.$ Then use the fact that the appropriate azimuthal unit vectors can be expressed as ${\hat{\pmb{\theta }}}_{1}=\hat{\textbf{k}}\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{\hat{\textbf{r}}}_{1}$ and ${\hat{\pmb{\theta }}}_{2}=\hat{\textbf{k}}\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{\hat{\textbf{r}}}_{2}$ to show that everywhere inside the cavity the magnetic field is given by the constant $\stackrel{\to }{\textbf{B}}=\frac{1}{2}{\mu }_{0}{J}_{0}k\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}a,$ where $a={r}_{1}-{r}_{2}$ and ${r}_{1}={r}_{1}{\hat{\textbf{r}}}_{1}$ is the position of P relative to the center of the conductor and ${r}_{2}={r}_{2}{\hat{\textbf{r}}}_{2}$ is the position of P relative to the center of the cavity.

Show Solution

derivation

Between the two ends of a horseshoe magnet the field is uniform as shown in the diagram. As you move out to outside edges, the field bends. Show by Ampère’s law that the field must bend and thereby the field weakens due to these bends.

Show that the magnetic field of a thin wire and that of a current loop are zero if you are infinitely far away.

Show Solution

As the radial distance goes to infinity, the magnetic fields of each of these formulae go to zero.

An Ampère loop is chosen as shown by dashed lines for a parallel constant magnetic field as shown by solid arrows. Calculate $\stackrel{\to }{\textbf{B}}·d\stackrel{\to }{\textbf{l}}$ for each side of the loop then find the entire $\oint \stackrel{\to }{\textbf{B}}·d\stackrel{\to }{\textbf{l}}.$ Can you think of an Ampère loop that would make the problem easier? Do those results match these?

A very long, thick cylindrical wire of radius R carries a current density J that varies across its cross-section. The magnitude of the current density at a point a distance r from the center of the wire is given by $J={J}_{0}\frac{r}{R},$ where ${J}_{0}$ is a constant. Find the magnetic field (a) at a point outside the wire and (b) at a point inside the wire. Write your answer in terms of the net current I through the wire.

Show Solution

a. $B=\frac{{\mu }_{0}I}{2\pi r}$; b. $B=\frac{{\mu }_{0}{J}_{0}{r}^{2}}{3R}$

A very long, cylindrical wire of radius a has a circular hole of radius b in it at a distance d from the center. The wire carries a uniform current of magnitude I through it. The direction of the current in the figure is out of the paper. Find the magnetic field (a) at a point at the edge of the hole closest to the center of the thick wire, (b) at an arbitrary point inside the hole, and (c) at an arbitrary point outside the wire. (Hint: Think of the hole as a sum of two wires carrying current in the opposite directions.)

Magnetic field inside a torus. Consider a torus of rectangular cross-section with inner radius a and outer radius b. N turns of an insulated thin wire are wound evenly on the torus tightly all around the torus and connected to a battery producing a steady current I in the wire. Assume that the current on the top and bottom surfaces in the figure is radial, and the current on the inner and outer radii surfaces is vertical. Find the magnetic field inside the torus as a function of radial distance r from the axis.

Show Solution

$B\left(r\right)={\mu }_{0}NI\text{/}2\pi r$

Two long coaxial copper tubes, each of length L, are connected to a battery of voltage V. The inner tube has inner radius a and outer radius b, and the outer tube has inner radius c and outer radius d. The tubes are then disconnected from the battery and rotated in the same direction at angular speed of $\omega$ radians per second about their common axis. Find the magnetic field (a) at a point inside the space enclosed by the inner tube $r< a,$ and (b) at a point between the tubes $b< r< c,$ and (c) at a point outside the tubes $r>d.$ (Hint: Think of copper tubes as a capacitor and find the charge density based on the voltage applied, $Q=VC,$ $C=\frac{2\pi {\epsilon }_{0}L}{\text{ln}\left(c\phantom{\rule{0.1em}{0ex}}\text{/}\phantom{\rule{0.1em}{0ex}}b\right)}\text{.)}$

### Challenge Problems

The accompanying figure shows a flat, infinitely long sheet of width a that carries a current I uniformly distributed across it. Find the magnetic field at the point P, which is in the plane of the sheet and at a distance x from one edge. Test your result for the limit $a\to 0.$

Show Solution

$B=\frac{{\mu }_{0}I}{2\pi a}\text{ln}\frac{x+a}{x}.$

A hypothetical current flowing in the z-direction creates the field $\stackrel{\to }{\textbf{B}}=C\left[\left(x\text{/}{y}^{2}\right)\hat{\textbf{i}}+\left(1\text{/}y\right)\hat{\textbf{j}}\right]$ in the rectangular region of the xy-plane shown in the accompanying figure. Use Ampère’s law to find the current through the rectangle.

A nonconducting hard rubber circular disk of radius R is painted with a uniform surface charge density $\sigma .$ It is rotated about its axis with angular speed $\omega .$ (a) Find the magnetic field produced at a point on the axis a distance h meters from the center of the disk. (b) Find the numerical value of magnitude of the magnetic field when $\sigma =1{\text{C/m}}^{2},$ $R=\text{20 cm},\phantom{\rule{0.2em}{0ex}}h=\text{2 cm},$ and $\omega =400\phantom{\rule{0.2em}{0ex}}\text{rad/sec},$ and compare it with the magnitude of magnetic field of Earth, which is about 1/2 Gauss.

Show Solution

a. $B=\frac{{\mu }_{0}\sigma \omega }{2}\left[\frac{2{h}^{2}+{R}^{2}}{\sqrt{{R}^{2}+{h}^{2}}}\text{−2}h\right]$; b. $B=4.09\phantom{\rule{0.2em}{0ex}}×\phantom{\rule{0.2em}{0ex}}{10}^{-5}\text{T},$ 82% of Earth’s magnetic field

### Glossary

diamagnetic materials
their magnetic dipoles align oppositely to an applied magnetic field; when the field is removed, the material is unmagnetized
ferromagnetic materials
contain groups of dipoles, called domains, that align with the applied magnetic field; when this field is removed, the material is still magnetized
hysteresis
property of ferromagnets that is seen when a material’s magnetic field is examined versus the applied magnetic field; a loop is created resulting from sweeping the applied field forward and reverse
magnetic susceptibility
ratio of the magnetic field in the material over the applied field at that time; positive susceptibilities are either paramagnetic or ferromagnetic (aligned with the field) and negative susceptibilities are diamagnetic (aligned oppositely with the field)
magnetic domains
groups of magnetic dipoles that are all aligned in the same direction and are coupled together quantum mechanically
paramagnetic materials
their magnetic dipoles align partially in the same direction as the applied magnetic field; when this field is removed, the material is unmagnetized


text:
# –Def: A language L is in BPP c,s ( 0  s(n)  c(n)  1,  n  N) if there exists a probabilistic poly-time TM M s.t. : 1.  w  L, Pr[M accepts w]  c(|w|),

## Presentation on theme: "–Def: A language L is in BPP c,s ( 0  s(n)  c(n)  1,  n  N) if there exists a probabilistic poly-time TM M s.t. : 1.  w  L, Pr[M accepts w]  c(|w|),"— Presentation transcript:

–Def: A language L is in BPP c,s ( 0  s(n)  c(n)  1,  n  N) if there exists a probabilistic poly-time TM M s.t. : 1.  w  L, Pr[M accepts w]  c(|w|), 2.  w  L, Pr[M(x) accepts]  s(|w|). Thm: (Amplification of BPP) For all choices of poly. computable functions c(n) and s(n) : {0,1} n  {0,1}, such that there exists a poly. Q(n) s.t.  n c(n)-s(n)  1/Q(n) and m=O(1), More on Randomized Class

Pf: Given a BPP machine M with c(n), s(n). We construct a BPP machine for the same language with for any m=O(1). –Define M’: 1. Run M on k times independently. 2. Accept if the number of time M accepted is  k ‧ (c(n)+s(n))/2. X i : indicator random variable for the event that M accepts w.

By the definition of BPP c,s we have: w  L  E[X i ]  c(n), w  L  E[X i ]  s(n).

Chernoff bound: For any k independent identically distributed random variable X 1,… X k with values in {0,1}, and with expected values E[X i ]=p, for any  (0,1), –

Using Chernoff bounds, choose  with Setting

So ■

P/poly and circuit complexity –Def: P/poly={ L |  A  P, a sequence of strings {S i } i  N and a constant k s.t. |S i |=O(i k ) and x  L  (x,S |x| )  A } –Def: A language L has poly circuit complexity if there exists a constant k such that for all n, the function f n that is 1 iff its input (of length n) is in L, has circuit complexity O(n k ).

Prop: L  P/poly iff L has poly. circuit complexity. Pf:  : If L has poly circuit complexity, then for each n, there is a circuit of size poly in n that decides membership in L for all words of length n. Encode this circuit on a string, S n ~ poly size. Construct a poly time TM taking x and S |x| and simulate S |x| on input x.

 : Assume L  P/poly. If M decides L in TIME(O(n k )), then we can construct a circuit c k of size O(n 2k ) that simulates M running on input strings of length n. Hardwired in each machine will be the advice strings S n, which is constant for each input size n and which grows polynomial in n. ■

Thm: BPP  P/poly. Pf: Let L be an arbitrary language in BPP. –By amplification of BPP, we have a TM M  that decides L. Classify all possible random string R as follows: R is bad for an input x if M(x,R) is wrong. R is bad if there exists an input w for which R is bad. R is good otherwise. Fix w, Pr[R is bad for w] 

Pr[R is bad]  Pr[R is bad for w]  Therefore, Pr[R is good] = 1-Pr[R is bad] > 0 Thus, there exists a poly size advice string for any input of length n. ■

Thm: BPP   2 P(Sipser,Lautemann) Pf: Suppose L  BPP. –Goal: Show that there is a  2 P Machine that decides L. –I.e. show that  a deterministic poly time TM M(x,y,z) s.t. x  L   y s.t.  z M(x,y,z)=1 x  L   y  z s.t. M(x,y,z)=0.

Let A be a BPP machine that uses Q(n) random bits with c(n)= ½ and s(n)=1/3Q(n) where n is the input length and Q(n) is poly. Let R be the set of all random string of length Q(n) used on A’s random tape. |R|=2 Q(n). –Define F s (y)=y  s, s  R, y  R. F s (y) is random if s is chosen uniformly. Imagine a new machine, A ’ (x,y,S), where S is a sequence random bits (s 1,s 2,…,s k ), y  R, x is the input to test if x  L A A ’ is a deterministic TM s.t.: A ’ (x,y,S)=1   s i  S, A accepts x with y  s i on its random tape.

If x  L A, and a specific S is chosen at random, then I.e. if x  L A, then for any S  R k,  y  R s.t. A ’ (x,y,S)=0. let k  2Q(n)

If x  L A, and a specific y is chosen at random

Let k=2Q(n) I.e. if x  L A, then  an S  R k, s.t.  y  R, A ’ (x,y,S)=1 Therefore, x  L A   S  R k, s.t.  y  R, A ’ (x,y,S)=1. So a  2 P machine decides L A by guessing S, guessing all y and checking A ’ (x,y,S)=1.

USAT:  is USAT if  is satisfied by exactly one truth assignment. –Suppose  is satisfiable by at most one truth assignment. We want to decide if  USAT. It turns out to decide  USAT is as difficult as to decide  SAT.

Randomized reduction from SAT to USAT. M: randomized poly-time TM M s.t. –  SAT  M(  )  SAT (  USAT) –  SAT  Prob[M(  )  USAT]  1/8. Universal Hashing: Given sets S and T, a family H of functions from S to T is a universal family of hash functions from S to T if –1)  x  S,  w  T, Pr h  H [h(x)=w]=1/|T| –2)  x  y  S,  w,z  T, Pr h  H [(h(x)=w) ∧ (h(y)=z)]=1/|T| 2

eg. Let S={0,1} n, T={0,1} k and for x  {0,1} n, let h M,b (x)=Mx+b, where M is a k  n Boolean matrix, b is a column vector is {0,1} k. –H={ h M,b : for all possible M and b }. Prop: The above H is a family of universal hash functions from {0,1} n to {0,1} k.

Pf: –1) For any fixed x  {0,1} n - and y  {0,1} k Pr[x+y+1=1]=?

–2) For x  y  {0,1} n and w,z  {0,1} k.

Prop:  x  y  {0,1} n - and  w,z  {0,1} k, we have Pr M [Mx=w ∧ My=z]=1/2 2k. Pf: If x and y are e 1 =(1,0,…,0) and e 2 =(0,1,0,…,0), respectively, then it is true. Since neither x nor y is, they’re linear independent. Thus, there exists rank n matrix A s.t. Ax=e 1, and Ay=e 2. ∵ rank(A)=n,  MA is random if M is chosen randomly. So, the truth of the proposition is clear.

M x (a 1,…,a n )  (b 1,…,b n )=c fixed Pr[a 1 b 1 +a 2 b 2 +…+a n b n =c]=? a 1,a 2,…,a n  {0,1} are selected randomly, c  {0,1}.

Prop: Let S  {0,1} n, with 2 k-2  |S|  2 k-1,Then Pr[  ! s  S s.t. Ms= 0 ]  1/8, where the probability is taken over the uniform choice of M from the set of all k x n Boolean matrices. Pf: –

Successive restrictions: Given a CNF formula  on n variables, choose n+1 random vectors and create  I for 1  i  n+1 as follows:

Lemma: If  is not satisfiable, then none of the  i ’s are satisfiable. Lemma: If  is satisfiable, then with probability at least 1/8, at least one of the  i ’s has a unique satisfying assignment. Pf: Let S be the set of satisfying assignments of  : by hypothesis |S|  1. Let k be such that 2 k-2  |S|<2 k-1. By the previous prop.,  k has a probability  1/8 of having exactly one satisfying assignment.

Thus, detecting unique solutions is an hard as NP. –UP:the class of promise problems where instances are promised to whose either zero or one solution. Thm: NP  RP UP. Thm: If UP  RP, then NP=RP.

Download ppt "–Def: A language L is in BPP c,s ( 0  s(n)  c(n)  1,  n  N) if there exists a probabilistic poly-time TM M s.t. : 1.  w  L, Pr[M accepts w]  c(|w|),"

Similar presentations

format: plain


text:
# compact set of real numbers whose limit points form a countable set

I came up with the following example of a set that I believe is compact and whose limit points form a countable set.

Let $E_k=\cup_{n=2}^\infty \{\frac{1}{n}+k\}\cup \{k\}.$ Note that for each $k$, $E_k$ is a compact set and the set of limit points of $E_k$ is precisely $\{k\}$.

Then $E=\cup_{k=0} ^\infty E_k$ is a compact set (I want to say this is definitely true) whose limit points are the set of nonnegative integers, which is a countable set.

Does this example work?? Thank you!!

• $E$ is not compact: it’s unbounded. – Brian M. Scott Oct 3 '16 at 23:14

Your set $E$ is not compact, because it’s unbounded. However, a modification of it will work. For $k\ge 2$ let
$$E_k=\left\{\frac1k\right\}\cup\left\{\frac1k+\frac1m:m>k(k-1)\right\}\;,$$
and let $E=\{0\}\cup\bigcup_{k\ge 2}E_k$; I’ll leave it to you to show that this works.
• Ahh, yes, my set is unbounded. Thank you. Quick (and probably silly) question. WHy do you require that $m>k(k-1)$? – Michael Oct 3 '16 at 23:54
• @Michael: You’re welcome. That restriction isn’t actually necessary, but it makes it easier to see why the example works: if you work it out, you’ll see that it’s exactly what’s needed to ensure that $\frac1k+\frac1m<\frac1{k-1}$. This means that the sets $E_k$ really do line up end to end instead of overlapping in any way. – Brian M. Scott Oct 3 '16 at 23:56


text:
# eigenvalue check

I have a question regarding operator theory and would be glad if someone could help. I have a linear operator $A$ that is non-self-adjoint, unbounded and is densely defined in a Hilbert space $H$. I know how the spectrum of this operator looks like. However, not all points of the spectrum are eigenvalues. Given a point in the spectrum $\lambda_j$ (in my case $\lambda_j \in \mathbb{R}$), is there a way to check, if this point is an eigenvalue in the mathematical meaning of this word, i.e., that there exist a function $\varphi_j \in H$ such that $A\varphi_j = \lambda_j\varphi_j$?

Of course, the operator $A$ is given explicitly, i.e., I know how the corresponding linear prescription looks like.

-


text:
#### Vol. 12, No. 4, 2019

 Recent Issues
 The Journal About the Journal Subscriptions Editorial Board Editors’ Interests Scientific Advantages Submission Guidelines Submission Form Ethics Statement Editorial Login Author Index Coming Soon Contacts ISSN: 1944-4184 (e-only) ISSN: 1944-4176 (print) Other MSP Journals
Irreducible character restrictions to maximal subgroups of low-rank classical groups of types $B$ and $C$

### Kempton Albee, Mike Barnes, Aaron Parker, Eric Roon and A. A. Schaeffer Fry

Vol. 12 (2019), No. 4, 607–631
DOI: 10.2140/involve.2019.12.607
##### Abstract

Representations are special functions on groups that give us a way to study abstract groups using matrices, which are often easier to understand. In particular, we are often interested in irreducible representations, which can be thought of as the building blocks of all representations. Much of the information about these representations can then be understood by instead looking at the trace of the matrices, which we call the character of the representation. This paper will address restricting characters to subgroups by shrinking the domain of the original representation to just the subgroup. In particular, we will discuss the problem of determining when such restricted characters remain irreducible for certain low-rank classical groups.

##### Keywords
irreducible characters, classical groups
##### Mathematical Subject Classification 2010
Primary: 20C15, 20C33


text:
# Find r(X,Y) from the two regression equation 3x=y and 4y=3x.

Updated On: 17-04-2022

Get Answer to any question, just click a photo and upload the photo
and get the answer completely free,
UPLOAD PHOTO AND GET THE ANSWER NOW!

Watch 1000+ concepts & tricky questions explained!

Text Solution

r=(1)/(2)~~0.5
Solution :
N/A

Step by step solution by experts to help you in doubt clearance & scoring excellent marks in exams.

Transcript

hello everyone today we are going to discuss one more question the question is that find our xy from the two regression equation 3 X = 2y and 4x equals to put y equals to 3 X here so progression regression equations are first one is 3 X equal to Y and second equation is 4 y equals to 3 X here is our equation first and here is our equation second from equation first wrong equation first regression regression of from equation first regression of x on Y is be xy here

so from equation first three X equals to wise to this one is implying X equals to 1 by 3 into why so be xy = 213 here here is our equation third again from equations from equation from equation S regression regression of Y on X is be so scenes given second equation is 4 Y is equals to 3 X this can be written as y equal to 3 by 2 into X so as implying be by x is equal to 3 by 4 here is our equation for so are is equals to

our x y is equals to root of B xy into why exterior so from equation 3rd b x y is equals to 1 by 3 this one is 1 by 3 into B Y at equal to 3 by 4 year Subah simple define Kathi is cancelled out with three Sobi xy can b r = 2 can be written as 1 by 4 Near route of so we can write it as RX why is One by Two here I hope you understand the explanation thanks for watching


text:
Math Help - Integration

1. Integration

This is a table...

Concentration of Chemical A, x....|1 | 2| 3 |4 | 5 | 6 |7
Concentration of Chemical B, f(x)|12|16|18|21|24|27|32

Let me know if you need help figuring out that table.

So the 3 questions I am having trouble with are as follows.

a) Plot points and connect them with line segments (I can do this)
b) Use the trapezoidal rule to find the area bounded by the broken line of part a, the x-axis, the line x=1 and line x=7
c)Then approximate the area again using the Simp rule

Thanks!

2. You have to sum the areas of the 6 trapeziums below

For the second one that I have indicated in blue :
$A_2 = \frac{(18 + 16) \cdot 1}{2} = 17$

3. Originally Posted by running-gag
You have to sum the areas of the 6 trapeziums below

For the second one that I have indicated in blue :
$A_2 = \frac{(18 + 16) \cdot 1}{2} = 17$
where does the 2 come from in the numerator?

4. Originally Posted by HunkaMath
where does the 2 come from in the numerator?
There is no 2 in the numerator, but the one in the denominator comes from the formula for the area of a trapezoid (or trapezium, if you are British):

$A = \frac12h(b_1+b_2),$

where $b_1$ and $b_2$ are the lengths of the bases, and $h$ is the height.

Also, rather than find the areas of each trapezoid directly, you can apply the Trapezoidal Rule,

$\int_a^b f(x)\,dx \approx \frac{b-a}{2n} \left(f(x_0) + 2f(x_1) + 2f(x_2)+\cdots+2f(x_{n-1}) + f(x_n) \right),$

as specified in the problem's instructions. For reference, Simpson's Rule is

$\int_a^bf(x)\,dx$

$\approx\frac{b-a}{3n}\left[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+\cdots+4f(x _{n-1})+f(x_n)\right].$

You can easily find derivations of these with a quick search.

5. Originally Posted by Reckoner
There is no 2 in the numerator, but the one in the denominator comes from the formula for the area of a trapezoid (or trapezium, if you are British):

$A = \frac12h(b_1+b_2),$

where $b_1$ and $b_2$ are the lengths of the bases, and $h$ is the height.

Also, rather than find the areas of each trapezoid directly, you can apply the Trapezoidal Rule,

$\int_a^b f(x)\,dx \approx \frac{b-a}{2n} \left(f(x_0) + 2f(x_1) + 2f(x_2)+\cdots+2f(x_{n-1}) + f(x_n) \right),$

as specified in the problem's instructions. For reference, Simpson's Rule is

$\int_a^bf(x)\,dx$

$\approx\frac{b-a}{3n}\left[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+\cdots+4f(x _{n-1})+f(x_n)\right].$

You can easily find derivations of these with a quick search.
do you know what the answers should be I am getting 132 and I am sure that is wrong. thanks

6. Originally Posted by HunkaMath
do you know what the answers should be I am getting 132 and I am sure that is wrong. thanks
You should be getting 128. Can you show your work?


text:
# Homework Help: Finding m in quadratic equation 12x^2 + 8mx + (4m-3) = 0

1. Apr 5, 2006

### danago

Hey. Today i had a test on quadratics and discriminants. I think i did fairly well, but i am a bit confused about one of the questions i had in it.

We were given the following quadratic equation:

$$12x^2 + 8mx + (4m-3) = 0$$

What we had to do was prove that for any integer value of m, the equation would have rational solutions.

What i did was first take the discriminant of the equation:
$$\Delta = (8m)^2 - 4(12)(4m-3)$$

simplified it:
$$\Delta = 64m^2 - 192m + 144$$

From that, i then created a table of values. I made a table of values for m (-5 to 5), the discriminant, then the square root of the discriminant. Since all of the square roots were whole numbers, i could have used that as a reason why all the solutions would be rational, but its not really proving that all values for m will follow the rule. It just shows that 10 of my chosen values work.

from here i wasnt really sure what to do. I noted that the discriminant of the original equation was a quadratic function itself, so i graphed it, and noticed that for every integer value of x, its corrosponding y value will be a perfect square number. I wrote about this observation, and am just hoping its close enough to what i should have done.

Thanks,
Dan.

2. Apr 5, 2006

### nocturnal

Try factoring the discriminant. Then use the quadratic formula to show that all answers are rational.

3. Apr 5, 2006

### VietDao29

So far so good.
Do you know what are rational numbers? They are numbers that can be expressed in a form of a fraction p / q, where p, and q are whole numbers (integers).
To prove that the solutions are rational for any integer value of m, you should prove that:
$$\frac{-8m \pm \sqrt{\Delta}}{24}$$ is a rational number, right?
Note that:
$$\Delta = 64m ^ 2 - 192m + 144 = (8m - 12) ^ 2$$.
Can you go from here? :)


text:
# Anamorphism

In functional programming, an anamorphism is a kind of generic function that can corecursively construct a result of a certain type and which is parameterized by functions that determine what the next single step of the construction is. The term is composed of the prefix ana (from Greek ἀνά = upwards) + the stem morphism (from Greek μορφή = form, shape).

The concept of anamorphism, which has its grounding in category theory, generalizes the list-producing unfold functions to arbitrary algebraic data types that can be described as final coalgebras. In fact, the terms 'anamorphism' and "unfold" (as a noun) are often used interchangeably. Anamorphisms, which are co-recursive, are dual to catamorphisms, which are recursive, just as unfolds are dual to folds.

## Examples

### Anamorphisms on lists

An unfold on lists would build a (potentially infinite) list from a seed value. Typically, the unfold takes a seed value x, a one-place operation unspool that yields a pairs of such items, and a predicate finished which determines when to finish the list (if ever). In the action of unfold, the first application of unspool, to the seed x, would yield unspool x = (y,z). The list defined by the unfold would then begin with y and be followed with the (potentially infinite) list that unfolds from the second term, z, with the same operations. So if unspool z = (u,v), then the list will begin y:u:..., where ... is the result of unfolding v with r, and so on.

A Haskell definition of an unfold, or anamorphism for lists, called ana, is as follows:

-- The type signature of 'ana':
ana :: (b -> (a, b)) -> (b -> Bool) -> b -> [a]
-- Its definition:
ana unspool finished x = if finished x
then []
else  a:ana unspool finished y
where (a,y) = unspool x

(Here finished and unspool are parameters of the function, like x.)

In the case where we're finished (finished x == True), we do not use unspool x. We can thus group together unspool and finished into one function f :: (b -> Maybe (a,b)), where f x = Just (a,y) means finished x == True and unspool x == (a,y), while f x == Nothing means we're done (finished x == True). We now have:

-- The type signature of 'ana':
ana :: (b -> Maybe (a,b)) -> b -> [a]
-- Its definition:
ana f x = case (f x) of
Nothing -> []
Just (a,y) ->  a:(ana f y)

We can now implement quite general functions using ana.

### Anamorphisms on other data structures

An anamorphism can be defined for any recursive type, according to a generic pattern, generalizing the second version of ana for lists.

For example, the unfold for the tree data structure

 data Tree a = Leaf a | Branch (Tree a) a (Tree a)

is as follows

 ana :: (b->Either a (b,a,b)) -> b -> Tree a
ana unspool x = case unspool x of
Left a -> Leaf a
Right (l,x,r) -> Branch (ana unspool l) x (ana unspool r)

To better see the relationship between the recursive type and its anamorphism, note that Tree and List can be defined thus:

 newtype List a = List {unCons :: Maybe (a, List a)}

newtype Tree a = Tree {unNode :: Either a (Tree a, a, Tree a))}

The analogy with ana appears by renaming b in its type:

 newtype List a = List {unCons :: Maybe (a, List a)}
anaList :: (     list_a       -> Maybe (a, list_a)) -> (list_a -> List a)

newtype Tree a = Tree {unNode :: Either a (Tree a, a, Tree a))}
anaTree ::       (tree_a ->      Either a (tree_a, a, tree_a)) -> (tree_a -> Tree a)

With these definitions, the argument to the constructor of the type has the same type as the return tye of the first argument of ana, with the recursive mentions of the type replaced with b.

## History

One of the first publications to introduce the notion of an anamorphism in the context of programming was the paper Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire,[1] by Erik Meijer et al., which was in the context of the Squiggol programming language.

## Applications

Functions like zip and iterate are examples of anamorphisms. zip takes a pair of lists, say ['a','b','c'] and [1,2,3] and returns a list of pairs [('a',1),('b',2),('c',3)]. Iterate takes a thing, x, and a function, f, from such things to such things, and returns the infinite list that comes from repeated application of f, i.e. the list [x, (f x), (f (f x)), (f (f (f x))), ...].

 zip (a:as) (b:bs) = if (as==[]) || (bs ==[])   -- || means 'or'
then [(a,b)]
else (a,b):(zip as bs)

iterate f x = x:(iterate f (f x))

To prove this, we can implement both using our generic unfold, ana, using a simple recursive routine:

 zip2 = ana g p
where
p (as,bs) = (as==[]) || (bs ==[])
g ((a:as), (b:bs)) = ((a,b),(as,bs))

iterate2 f = ana (\a->(a,f a)) (\x->False)

In a language like Haskell, even the abstract functions fold, unfold and ana are merely defined terms, as we have seen from the definitions given above.

## Anamorphisms in category theory

In category theory, anamorphisms are the categorical dual of catamorphisms (and catamorphisms are the categorical dual of anamorphisms).

That means the following. Suppose (A, fin) is a final F-coalgebra for some endofunctor F of some category into itself. Thus, fin is a morphism from A to FA, and since it is assumed to be final we know that whenever (X, f) is another F-coalgebra (a morphism f from X to FX), there will be a unique homomorphism h from (X, f) to (A, fin), that is a morphism h from X to A such that fin . h = Fh . f. Then for each such f we denote by ana f that uniquely specified morphism h.

In other words, we have the following defining relationship, given some fixed F, A, and fin as above:

• $h = \mathrm{ana}\ f$
• $fin\circ h = Fh \circ f$

### Notation

A notation for ana f found in the literature is $[\!(f)\!]$. The brackets used are known as lens brackets, after which anamorphisms are sometimes referred to as lenses.


text:
# Do Richardson varieties have rational singularities in arbitrary characteristic?

The title basically asks the question. I'll review the relevant terminology and explain what I have and haven't found in the literature.

Let $G$ be a reductive group. Let $v \leq w$ be elements of the Weyl group, with $X_v$ and $X^w$ the corresponding Schubert and opposite Schubert. Let $R_v^w = X_v \cap X^w$. This is called a Richardson variety. A variety $R$ is said to have rational singularities if there is a resolution of singularities $Z \to R$ which has certain nice cohomological properties.

I know of two references in the literature for the fact that Richardson varieties have rational singularities: Theorem 4.2.1 in Michel Brion's "Lectures on the Geometry of Flag Varieties" and Lemma 2 in his "Positivity in the Grothendieck Group of Flag Varieties". Both of these essentially give the same proof, though in different language. In the notation of "Lectures", they construct a variety $Z_{\underline{v}}^{\underline{w}}$ with a map to $R_v^w$ and proof that it has the correct cohomological properties. This part of the proof works in any characteristic.

However, in order to show that $Z_{\underline{v}}^{\underline{w}}$ is smooth, they appeal to Kleiman transversality, or to generic smoothness. These arguments only work in characteristic zero.

Does anyone know a reference which addresses this? (I have e-mailed Brion, and also Kumar, and am waiting to hear back, but I figured someone here might know this.)

• David, just curious, how do you define rational singularities in characteristic $p > 0$. Aug 18, 2011 at 21:04
• Ah, a good question, I recently got this wrong. The right definition (see for example Brion and Kumar's book, section 3.4) is that there is a proper birational map $f: X \to Y$, with $X$ nonsingular, $f_{\ast} \mathcal{O}_X =\mathcal{O}_Y$ and $R^i f_{\ast} \mathcal{O}_X = R^i f_{\ast} \omega_X=0$ for $i>0$. Aug 18, 2011 at 21:10
• Does Frobenius splitting say something about rational singularities? Aug 19, 2011 at 2:43
• It can be used to prove things like that, but for this particular question, I'm curious what Shrawan Kumar says. Certain Frobenius splittings (ie, global F-regularity) is enough to prove $f_* \omega_X = \omega_Y$ but it doesn't give you the higher $R^i f_* \omega_X = 0$ without knowing the existence of a resolution with a certain form. Perhaps I should point out that anything that is Frobenius split in char. $p > 0$ has something like Du Bois singularities (which can be viewed as a limit of rational singularities). Aug 19, 2011 at 14:30


text:
#### NAND CIRCUIT

A combination of a NOT function and an AND function in a binary circuit that has two or more inputs and one output. The output is logic 0 only if ALL inputs are logic 1; it is logic 1 if ANY input is logic 0 [13].


text:
# SKLearn - Understanding Discrepancy Between LogisticRegressionCV classification_report and scores_

Cross-posting from Stack Overflow:

I'm running into a weird situation where my sklearn LogisticRegressionCV model is apparently getting 100% accuracy (the lack of shuffling is intentional). However, when I ask the model to report its accuracy scores, the accuracy scores per inverse regularization are much lower than 100%. What am I doing wrong?

The model:

decoder = LogisticRegressionCV(
penalty='l1',                       # want sparse parameters
cv=KFold(n_splits=5, shuffle=False),
Cs=np.logspace(-1, 2, 3),
random_state=0,                     # reproducibility
dual=False,                         # Prefer dual=False when n_samples > n_features.
solver='liblinear',                 # for l1 penalty, must use liblinear or saga
max_iter=1e5,                       # give plenty of time to get good performance
fit_intercept=False,
class_weight='balanced',
).fit(X, y)

y_hat = decoder.predict(X)

y_hat_probs = decoder.predict_proba(X)

print(classification_report(y, y_hat))
print(confusion_matrix(y, y_hat))

outputs

              precision    recall  f1-score   support

0.0       1.00      1.00      1.00       374
1.0       1.00      1.00      1.00       105

accuracy                           1.00       479
macro avg       1.00      1.00      1.00       479
weighted avg       1.00      1.00      1.00       479

[[374   0]
[  0 105]]

Asking for decoder.scores_ yields values nowhere near 100%:

{1.0: array([[0.35416667, 0.60416667, 0.61458333],
[0.64583333, 0.64583333, 0.65625   ],
[0.59375   , 0.65625   , 0.64583333],
[0.54166667, 0.57291667, 0.59375   ],
[0.17894737, 0.61052632, 0.65263158]])}

Why is there this discrepancy?

• When making the kfold, the model have access not to all the data frame whereas when making the predictions, since you are training and evaluating in the same set, the model is just "remembering" the data – Julio Jesus Dec 10 '20 at 23:57

## 1 Answer

You are training and evaluate on the same data.

You should split data to train set(to train) and test set(to evaluate) to get proper results. Kinda:

decoder.fit(X_train, y_train)
y_hat = decoder.predict(X_test)

print(classification_report(y_test, y_hat))
print(confusion_matrix(y_test, y_hat))


text:
# Hands-on¶

## Spatial autocorrelation and Exploratory Spatial Data Analysis¶

Spatial autocorrelation has to do with the degree to which the similarity in values between observations in a dataset is related to the similarity in locations of such observations. Not completely unlike the traditional correlation between two variables -which informs us about how the values in one variable change as a function of those in the other- and analogous to its time-series counterpart -which relates the value of a variable at a given point in time with those in previous periods-, spatial autocorrelation relates the value of the variable of interest in a given location, with values of the same variable in surrounding locations.

A key idea in this context is that of spatial randomness: a situation in which the location of an observation gives no information whatsoever about its value. In other words, a variable is spatially random if it is distributed following no discernible pattern over space. Spatial autocorrelation can thus be formally defined as the “absence of spatial randomness”, which gives room for two main classes of autocorrelation, similar to the traditional case: positive spatial autocorrelation, when similar values tend to group together in similar locations; and negative spatial autocorrelation, in cases where similar values tend to be dispersed and further apart from each other.

In this session we will learn how to explore spatial autocorrelation in a given dataset, interrogating the data about its presence, nature, and strength. To do this, we will use a set of tools collectively known as Exploratory Spatial Data Analysis (ESDA), specifically designed for this purpose. The range of ESDA methods is very wide and spans from less sophisticated approaches like choropleths and general table querying, to more advanced and robust methodologies that include statistical inference and an explicit recognition of the geographical dimension of the data. The purpose of this session is to dip our toes into the latter group.

ESDA techniques are usually divided into two main groups: tools to analyze global, and local spatial autocorrelation. The former consider the overall trend that the location of values follows, and makes possible statements about the degree of clustering in the dataset. Do values generally follow a particular pattern in their geographical distribution? Are similar values closer to other similar values than we would expect from pure chance? These are some of the questions that tools for global spatial autocorrelation allow to answer. We will practice with global spatial autocorrelation by using Moran’s I statistic.

Tools for local spatial autocorrelation instead focus on spatial instability: the departure of parts of a map from the general trend. The idea here is that, even though there is a given trend for the data in terms of the nature and strength of spatial association, some particular areas can diverege quite substantially from the general pattern. Regardless of the overall degree of concentration in the values, we can observe pockets of unusually high (low) values close to other high (low) values, in what we will call hot(cold)spots. Additionally, it is also possible to observe some high (low) values surrounded by low (high) values, and we will name these “spatial outliers”. The main technique we will review in this session to explore local spatial autocorrelation is the Local Indicators of Spatial Association (LISA).

import seaborn as sns
import pandas as pd
import esda
from pysal.lib import weights
from splot.esda import (
moran_scatterplot, lisa_cluster, plot_local_autocorrelation
)
import geopandas as gpd
import numpy as np
import contextily as ctx
import matplotlib.pyplot as plt

## Data¶

For this session, we will use the results of the 2016 referendum vote to leave the EU, at the local authority level. In particular, we will focus on the spatial distribution of the vote to Leave, which ended up winning. From a technical point of view, you will be working with polygons which have a value (the percentage of the electorate that voted to Leave the EU) attached to them.

All the necessary data have been assembled for convenience in a single file that contains geographic information about each local authority in England, Wales and Scotland, as well as the vote attributes. The file is in the geospatial format GeoPackage, which presents several advantages over the more traditional shapefile (chief among them, the need of a single file instead of several). The file is available as a download from the course website.

"http://darribas.org/gds_course/content/data/brexit.gpkg"
)
/opt/conda/lib/python3.8/site-packages/geopandas/geodataframe.py:577: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance.
for feature in features_lst:

Alternative

2. Place the file on the same folder as the notebook where you intend to read it

3. Replace the code in the cell above by:

Now let’s index it on the local authority IDs, while keeping those as a column too:

# Index table on the LAD ID
# Display summary
br.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
Index: 380 entries, E06000001 to W06000024
Data columns (total 5 columns):
#   Column     Non-Null Count  Dtype
---  ------     --------------  -----
0   objectid   380 non-null    int64
3   Pct_Leave  380 non-null    float64
4   geometry   380 non-null    geometry
dtypes: float64(1), geometry(1), int64(1), object(2)
memory usage: 17.8+ KB

## Preparing the data¶

Let’s get a first view of the data:

# Plot polygons
ax = br.plot(alpha=0.5, color='red');
# Add background map, expressing target CRS so the basemap can be
# reprojected (warped)

### Spatial weights matrix¶

As discused before, a spatial weights matrix is the way geographical space is formally encoded into a numerical form so it is easy for a computer (or a statistical method) to understand. We have seen already many of the conceptual ways in which we can define a spatial weights matrix, such as contiguity, distance-based, or block.

For this example, we will show how to build a queen contiguity matrix, which considers two observations as neighbors if they share at least one point of their boundary. In other words, for a pair of local authorities in the dataset to be considered neighbours under this $$W$$, they will need to be sharing border or, in other words, “touching” each other to some degree.

Technically speaking, we will approach building the contiguity matrix in the same way we did in Lab 5. We will begin with a GeoDataFrame and pass it on to the queen contiguity weights builder in PySAL (ps.weights.Queen.from_dataframe). We will also make sure our table of data is previously indexed on the local authority code, so the $$W$$ is also indexed on that form.

# Create the spatial weights matrix
CPU times: user 2.6 s, sys: 76.4 ms, total: 2.68 s
Wall time: 2.68 s
/opt/conda/lib/python3.8/site-packages/libpysal/weights/weights.py:172: UserWarning: The weights matrix is not fully connected:
There are 7 disconnected components.
There are 6 islands with ids: E06000046, E06000053, S12000013, S12000023, S12000027, W06000001.
warnings.warn(message)

Now, the w object we have just is of the same type of any other one we have created in the past. As such, we can inspect it in the same way. For example, we can check who is a neighbor of observation E08000012:

w['E08000012']
{'E08000011': 1.0, 'E08000014': 1.0, 'E06000006': 1.0}

However, the cell where we computed $$W$$ returned a warning on “islands”. Remember these are islands not necessarily in the geographic sense (although some of them will be), but in the mathematical sense of the term: local authorities that are not sharing border with any other one and thus do not have any neighbors. We can inspect and map them to get a better sense of what we are dealing with:

ax = br.plot(color='k', figsize=(9, 9))
br.loc[w.islands, :].plot(color='red', ax=ax);

In this case, all the islands are indeed “real” islands. These cases can create issues in the analysis and distort the results. There are several solutions to this situation such as connecting the islands to other observations through a different criterium (e.g. nearest neighbor), and then combining both spatial weights matrices. For convenience, we will remove them from the dataset because they are a small sample and their removal is likely not to have a large impact in the calculations.

Technically, this amounts to a subsetting, very much like we saw in the first weeks of the course, although in this case we will use the drop command, which comes in very handy in these cases:

br = br.drop(w.islands)

Once we have the set of local authorities that are not an island, we need to re-calculate the weights matrix:

# Create the spatial weights matrix
# NOTE: this might take a few minutes as the geometries are
#       are very detailed
CPU times: user 2.08 s, sys: 58.4 ms, total: 2.14 s
Wall time: 2.15 s

And, finally, let us row-standardize it to make sure every row of the matrix sums up to one:

# Row standardize the matrix
w.transform = 'R'

Now, because we have row-standardize them, the weight given to each of the three neighbors is 0.33 which, all together, sum up to one.

w['E08000012']
{'E08000011': 0.3333333333333333,
'E08000014': 0.3333333333333333,
'E06000006': 0.3333333333333333}

### Spatial lag¶

Once we have the data and the spatial weights matrix ready, we can start by computing the spatial lag of the percentage of votes that went to leave the EU. Remember the spatial lag is the product of the spatial weights matrix and a given variable and that, if $$W$$ is row-standardized, the result amounts to the average value of the variable in the neighborhood of each observation.

We can calculate the spatial lag for the variable Pct_Leave and store it directly in the main table with the following line of code:

br['w_Pct_Leave'] = weights.lag_spatial(w, br['Pct_Leave'])

Let us have a quick look at the resulting variable, as compared to the original one:

E06000001 E06000001 69.57 59.640000
E06000002 E06000002 65.48 60.526667
E06000003 E06000003 66.19 60.376667
E06000004 E06000004 61.73 60.488000
E06000005 E06000005 56.18 57.430000

The way to interpret the spatial lag (w_Pct_Leave) for say the first observation is as follow: Hartlepool, where 69,6% of the electorate voted to leave is surrounded by neighbouring local authorities where, on average, almost 60% of the electorate also voted to leave the EU. For the purpose of illustration, we can in fact check this is correct by querying the spatial weights matrix to find out Hartepool’s neighbors:

w.neighbors['E06000001']
['E06000004', 'E06000047']

And then checking their values:

neis = br.loc[w.neighbors['E06000001'], 'Pct_Leave']
neis
E06000004    61.73
E06000047    57.55
Name: Pct_Leave, dtype: float64

And the average value, which we saw in the spatial lag is 61.8, can be calculated as follows:

neis.mean()
59.64

For some of the techniques we will be seeing below, it makes more sense to operate with the standardized version of a variable, rather than with the raw one. Standardizing means to substract the average value and divide by the standard deviation each observation of the column. This can be done easily with a bit of basic algebra in Python:

br['Pct_Leave_std'] = (
br['Pct_Leave'] - br['Pct_Leave'].mean()
) / br['Pct_Leave'].std()

Finally, to be able to explore the spatial patterns of the standardized values, also called sometimes $$z$$ values, we need to create its spatial lag:

br['w_Pct_Leave_std'] = weights.lag_spatial(w, br['Pct_Leave_std'])

## Global Spatial autocorrelation¶

Global spatial autocorrelation relates to the overall geographical pattern present in the data. Statistics designed to measure this trend thus characterize a map in terms of its degree of clustering and summarize it. This summary can be visual or numerical. In this section, we will walk through an example of each of them: the Moran Plot, and Moran’s I statistic of spatial autocorrelation.

### Moran Plot¶

The moran plot is a way of visualizing a spatial dataset to explore the nature and strength of spatial autocorrelation. It is essentially a traditional scatter plot in which the variable of interest is displayed against its spatial lag. In order to be able to interpret values as above or below the mean, and their quantities in terms of standard deviations, the variable of interest is usually standardized by substracting its mean and dividing it by its standard deviation.

Technically speaking, creating a Moran Plot is very similar to creating any other scatter plot in Python, provided we have standardized the variable and calculated its spatial lag beforehand:

# Setup the figure and axis
f, ax = plt.subplots(1, figsize=(9, 9))
# Plot values
sns.regplot(x='Pct_Leave_std', y='w_Pct_Leave_std', data=br, ci=None)
# Add vertical and horizontal lines
plt.axvline(0, c='k', alpha=0.5)
plt.axhline(0, c='k', alpha=0.5)
# Display
plt.show()

The figure above displays the relationship between the standardized percentage which voted to Leave the EU (Pct_Leave_std) and its spatial lag which, because the $$W$$ that was used is row-standardized, can be interpreted as the average percentage which voted to Leave in the surrounding areas of a given Local Authority. In order to guide the interpretation of the plot, a linear fit is also included in the post. This line represents the best linear fit to the scatter plot or, in other words, what is the best way to represent the relationship between the two variables as a straight line.

The plot displays a positive relationship between both variables. This is associated with the presence of positive spatial autocorrelation: similar values tend to be located close to each other. This means that the overall trend is for high values to be close to other high values, and for low values to be surrounded by other low values. This however does not mean that this is only situation in the dataset: there can of course be particular cases where high values are surrounded by low ones, and viceversa. But it means that, if we had to summarize the main pattern of the data in terms of how clustered similar values are, the best way would be to say they are positively correlated and, hence, clustered over space.

In the context of the example, this can be interpreted along the lines of: local authorities display positive spatial autocorrelation in the way they voted in the EU referendum. This means that local authorities with high percentage of Leave voters tend to be located nearby other local authorities where a significant share of the electorate also voted to Leave, and viceversa.

### Moran’s I¶

The Moran Plot is an excellent tool to explore the data and get a good sense of how much values are clustered over space. However, because it is a graphical device, it is sometimes hard to condense its insights into a more concise way. For these cases, a good approach is to come up with a statistical measure that summarizes the figure. This is exactly what Moran’s I is meant to do.

Very much in the same way the mean summarizes a crucial element of the distribution of values in a non-spatial setting, so does Moran’s I for a spatial dataset. Continuing the comparison, we can think of the mean as a single numerical value summarizing a histogram or a kernel density plot. Similarly, Moran’s I captures much of the essence of the Moran Plot. In fact, there is an even close connection between the two: the value of Moran’s I corresponds with the slope of the linear fit overlayed on top of the Moran Plot.

In order to calculate Moran’s I in our dataset, we can call a specific function in PySAL directly:

mi = esda.Moran(br['Pct_Leave'], w)

Note how we do not need to use the standardized version in this context as we will not represent it visually.

The method ps.Moran creates an object that contains much more information than the actual statistic. If we want to retrieve the value of the statistic, we can do it this way:

mi.I
0.6228641407137806

The other bit of information we will extract from Moran’s I relates to statistical inference: how likely is the pattern we observe in the map and Moran’s I captures in its value to be generated by an entirely random process? If we considered the same variable but shuffled its locations randomly, would we obtain a map with similar characteristics?

The specific details of the mechanism to calculate this are beyond the scope of the session, but it is important to know that a small enough p-value associated with the Moran’s I of a map allows to reject the hypothesis that the map is random. In other words, we can conclude that the map displays more spatial pattern that we would expect if the values had been randomly allocated to a particular location.

The most reliable p-value for Moran’s I can be found in the attribute p_sim:

mi.p_sim
0.001

That is just 0.1% and, by standard terms, it would be considered statistically significant. We can quickly ellaborate on its intuition. What that 0.001 (or 0.1%) means is that, if we generated a large number of maps with the same values but randomly allocated over space, and calculated the Moran’s I statistic for each of those maps, only 0.1% of them would display a larger (absolute) value than the one we obtain from the real data, and the other 99.9% of the random maps would receive a smaller (absolute) value of Moran’s I. If we remember again that the value of Moran’s I can also be interpreted as the slope of the Moran Plot, what we have is that, in this case, the particular spatial arrangement of values for the Leave votes is more concentrated than if the values had been allocated following a completely spatially random process, hence the statistical significance.

Once we have calculated Moran’s I and created an object like mi, we can use some of the functionality in splot to replicate the plot above more easily (remember, D.R.Y.):

moran_scatterplot(mi);

As a first step, the global autocorrelation analysis can teach us that observations do seem to be positively correlated over space. In terms of our initial goal to find spatial structure in the attitude towards Brexit, this view seems to align: if the vote had no such structure, it should not show a pattern over space -technically, it would show a random one.

## Local Spatial autocorrelation¶

Moran’s I is good tool to summarize a dataset into a single value that informs about its degree of clustering. However, it is not an appropriate measure to identify areas within the map where specific values are located. In other words, Moran’s I can tell us values are clustered overall, but it will not inform us about where the clusters are. For that purpose, we need to use a local measure of spatial autocorrelation. Local measures consider each single observation in a dataset and operate on them, as oposed to on the overall data, as global measures do. Because of that, they are not good a summarizing a map, but they allow to obtain further insight.

In this session, we will consider Local Indicators of Spatial Association (LISAs), a local counter-part of global measures like Moran’s I. At the core of these method is a classification of the observations in a dataset into four groups derived from the Moran Plot: high values surrounded by high values (HH), low values nearby other low values (LL), high values among low values (HL), and viceversa (LH). Each of these groups are typically called “quadrants”. An illustration of where each of these groups fall into the Moran Plot can be seen below:

# Setup the figure and axis
f, ax = plt.subplots(1, figsize=(9, 9))
# Plot values
sns.regplot(x='Pct_Leave_std', y='w_Pct_Leave_std', data=br, ci=None)
# Add vertical and horizontal lines
plt.axvline(0, c='k', alpha=0.5)
plt.axhline(0, c='k', alpha=0.5)
plt.text(1.75, 0.5, "HH", fontsize=25)
plt.text(1.5, -1.5, "HL", fontsize=25)
plt.text(-2, 1, "LH", fontsize=25)
plt.text(-1.5, -2.5, "LL", fontsize=25)
# Display
plt.show()

So far we have classified each observation in the dataset depending on its value and that of its neighbors. This is only half way into identifying areas of unusual concentration of values. To know whether each of the locations is a statistically significant cluster of a given kind, we again need to compare it with what we would expect if the data were allocated in a completely random way. After all, by definition, every observation will be of one kind of another, based on the comparison above. However, what we are interested in is whether the strength with which the values are concentrated is unusually high.

This is exactly what LISAs are designed to do. As before, a more detailed description of their statistical underpinnings is beyond the scope in this context, but we will try to shed some light into the intuition of how they go about it. The core idea is to identify cases in which the comparison between the value of an observation and the average of its neighbors is either more similar (HH, LL) or dissimilar (HL, LH) than we would expect from pure chance. The mechanism to do this is similar to the one in the global Moran’s I, but applied in this case to each observation, resulting then in as many statistics as original observations.

LISAs are widely used in many fields to identify clusters of values in space. They are a very useful tool that can quickly return areas in which values are concentrated and provide suggestive evidence about the processes that might be at work. For that, they have a prime place in the exploratory toolbox. Examples of contexts where LISAs can be useful include: identification of spatial clusters of poverty in regions, detection of ethnic enclaves, delineation of areas of particularly high/low activity of any phenomenon, etc.

In Python, we can calculate LISAs in a very streamlined way thanks to PySAL:

lisa = esda.Moran_Local(br['Pct_Leave'], w)

All we need to pass is the variable of interest -percentage of Leave votes- and the spatial weights that describes the neighborhood relations between the different observation that make up the dataset.

Because of their very nature, looking at the numerical result of LISAs is not always the most useful way to exploit all the information they can provide. Remember that we are calculating a statistic for every sigle observation in the data so, if we have many of them, it will be difficult to extract any meaningful pattern. Instead, what is typically done is to create a map, a cluster map as it is usually called, that extracts the significant observations (those that are highly unlikely to have come from pure chance) and plots them with a specific color depending on their quadrant category.

All of the needed pieces are contained inside the lisa object we have created above. But, to make the map making more straightforward, it is convenient to pull them out and insert them in the main data table, br:

# Break observations into significant or not
br['significant'] = lisa.p_sim < 0.05
# Store the quadrant they belong to

Let us stop for second on these two steps. First, the significant column. Similarly as with global Moran’s I, PySAL is automatically computing a p-value for each LISA. Because not every observation represents a statistically significant one, we want to identify those with a p-value small enough that rules out the possibility of obtaining a similar situation from pure chance. Following a similar reasoning as with global Moran’s I, we select 5% as the threshold for statistical significance. To identify these values, we create a variable, significant, that contains True if the p-value of the observation is satisfies the condition, and False otherwise. We can check this is the case:

E06000001    False
E06000002    False
E06000003    False
E06000004     True
E06000005    False
Name: significant, dtype: bool

And the first five p-values can be checked by:

lisa.p_sim[:5]
array([0.199, 0.107, 0.113, 0.046, 0.22 ])

Note how the third and fourth are smaller than 0.05, as the variable significant correctly identified.

Second, the quadrant each observation belongs to. This one is easier as it comes built into the lisa object directly:

E06000001    1
E06000002    1
E06000003    1
E06000004    1
E06000005    1

The correspondence between the numbers in the variable and the actual quadrants is as follows:

• 1: HH

• 2: LH

• 3: LL

• 4: HL

With these two elements, significant and quadrant, we can build a typical LISA cluster map combining the mapping skills with what we have learned about subsetting and querying tables:

We can create a quick LISA cluster map with splot:

lisa_cluster(lisa, br);

Or, if we want to have more control over what is being displayed, and how each component is presented, we can “cook” the plot ourselves:

# Setup the figure and axis
f, ax = plt.subplots(1, figsize=(9, 9))
# Plot insignificant clusters
ns = br.loc[br['significant']==False, 'geometry']
ns.plot(ax=ax, color='k')
# Plot HH clusters
hh = br.loc[(br['quadrant']==1) & (br['significant']==True), 'geometry']
hh.plot(ax=ax, color='red')
# Plot LL clusters
ll = br.loc[(br['quadrant']==3) & (br['significant']==True), 'geometry']
ll.plot(ax=ax, color='blue')
# Plot LH clusters
lh = br.loc[(br['quadrant']==2) & (br['significant']==True), 'geometry']
lh.plot(ax=ax, color='#83cef4')
# Plot HL clusters
hl = br.loc[(br['quadrant']==4) & (br['significant']==True), 'geometry']
hl.plot(ax=ax, color='#e59696')
# Style and draw
f.suptitle('LISA for Brexit vote', size=30)
f.set_facecolor('0.75')
ax.set_axis_off()
plt.show()

The map above displays the LISA results of the Brexit vote. In bright red, we find those local authorities with an unusual concentration of high Leave voters surrounded also by high levels of Leave vote. This corresponds with areas in the East of England, the Black Country, and East of London. In light red, we find the first type of spatial outliers. These are areas with high Leave vote but surrounded by areas with low support for leaving the EU (e.g. central London). Finally, in light blue we find the other type of spatial outlier: local authorities with low Leave support surrounded by other authorities with high support.

The substantive interpretation of a LISA map needs to relate its output to the original intention of the analyst who created the map. In this case, our original idea was to explore the spatial structure of support to leaving the EU. The LISA proves a fairly useful tool in this context. Comparing the LISA map above with the choropleth we started with, we can interpret the LISA as “simplification” of the detailed but perhaps too complicated picture in the choropleth that focuses the reader’s attention to the areas that display a particularly high concentration of (dis)similar values, helping the spatial structure of the vote emerge in a more explicit way. The result of this highlights the relevance that the East of England and the Midlands had in voting to Leave, as well as the regions of the map where there was a lot less excitement about Leaving.

The results from the LISA statistics can be connected to the Moran plot to visualise where in the scatter plot each type of polygon falls:

plot_local_autocorrelation(lisa, br, 'Pct_Leave');


text:
Workbook Quiz #1 Practice Test 3 Last Question

H-Atom ($E_{n}=-\frac{hR}{n^{2}}$)

Posts: 15
Joined: Fri Sep 26, 2014 2:02 pm

Workbook Quiz #1 Practice Test 3 Last Question

For this problem about finding the principal quantum number from a given frequency, I used the equation frequency=R(1/n(initial)^2-1/n(final)^2), but i got a decimal answer for my n value. Is this possible? Or am I doing something wrong?

Chem_Mod
Posts: 17501
Joined: Thu Aug 04, 2011 1:53 pm
Has upvoted: 393 times

Re: Workbook Quiz #1 Practice Test 3 Last Question

As things go when using real numbers, you very rarely get exact values. In cases like this, one should round off to the nearest integer. However, the answer should still be fairly close to an integer, like 1.999 or something on that order. Remember, atomic levels are discrete so there cannot be non-integer values for n - it must always be 1, 2, 3...


text:
# metrics¶

Additional metrics for evaluating a set of nodes

recursivenodes.metrics.mass_matrix_condition(d, n, nodes, domain='biunit')[source]

Compute the condition number of the mass matrix $$M_{ij} = \int_{\Delta^d} \varphi_i \varphi_j\ dx$$, where $$\{\varphi_i\}$$ is the set of shape functions associated with a set of nodes.

Parameters
• d (int) – The spatial dimension

• n (int) – The polynomial degree

• nodes (ndarray) – The set of polynomial nodes, with shape $$(\binom{n+d}{d}, d)$$ (unless domain=barycentric, then with shape $$(\binom{n+d}{d}, d+1))$$

• domain (str, optional) – The domain of the nodes. See “The domain optional argument”.

Returns

the condition number $$\kappa_2(M)$$.

Return type

float

recursivenodes.metrics.nodal_gradient_condition(d, n, nodes, domain='biunit')[source]

Compute the condition number of the nodal gradient matrix $$G_{(d i + k)j} = \nabla_k \varphi_j(x_i)$$, where $$\{\varphi_i\}$$ is the set of shape functions associated with a set of nodes.

Parameters
• d (int) – The spatial dimension

• n (int) – The polynomial degree

• nodes (ndarray) – The set of polynomial nodes, with shape $$(\binom{n+d}{d}, d)$$ (unless domain=barycentric, then with shape $$(\binom{n+d}{d}, d+1))$$

• domain (str, optional) – The domain of the nodes. See “The domain optional argument”. The condition number will be computed for the nodes mapped to the biunit simplex.

Returns

the condition number $$\kappa_2(G)$$ (with respect to the pseudoinverse).

Return type

float

recursivenodes.metrics.nodal_laplacian_condition(d, n, nodes, domain='biunit')[source]

Compute the condition number of the nodal strong-form Laplacian matrix $$L_{ij} = \Delta \varphi_j(x_i)$$, where $$\{\varphi_i\}$$ is the set of shape functions associated with a set of nodes.

Parameters
• d (int) – The spatial dimension

• n (int) – The polynomial degree

• nodes (ndarray) – The set of polynomial nodes, with shape $$(\binom{n+d}{d}, d)$$ (unless domain=barycentric, then with shape $$(\binom{n+d}{d}, d+1))$$

• domain (str, optional) – The domain of the nodes. See “The domain optional argument”. The condition number will be computed for the nodes mapped to the biunit simplex.

Returns

the condition number $$\kappa_2(L)$$ (with respect to the pseudoinverse).

Return type

float

recursivenodes.metrics.strong_laplacian_condition(d, n, nodes, domain='biunit')[source]

Compute the condition number of the strong-form Laplacian matrix $$L_{ij} = \int_{\Delta^d} \varphi_i \cdot \Delta \varphi_j\ dx$$, where $$\{\varphi_i\}$$ is the set of shape functions associated with a set of nodes.

Parameters
• d (int) – The spatial dimension

• n (int) – The polynomial degree

• nodes (ndarray) – The set of polynomial nodes, with shape $$(\binom{n+d}{d}, d)$$ (unless domain=barycentric, then with shape $$(\binom{n+d}{d}, d+1))$$

• domain (str, optional) – The domain of the nodes. See “The domain optional argument”. The condition number will be computed for the nodes mapped to the biunit simplex.

Returns

the condition number $$\kappa_2(L)$$ (with respect to the pseudoinverse).

Return type

float

recursivenodes.metrics.weak_laplacian_condition(d, n, nodes, domain='biunit')[source]

Compute the condition number of the weak-form Laplacian matrix $$K_{ij} = \int_{\Delta^d} \nabla \varphi_i \cdot \nabla \varphi_j\ dx$$, where $$\{\varphi_i\}$$ is the set of shape functions associated with a set of nodes.

Parameters
• d (int) – The spatial dimension

• n (int) – The polynomial degree

• nodes (ndarray) – The set of polynomial nodes, with shape $$(\binom{n+d}{d}, d)$$ (unless domain=barycentric, then with shape $$(\binom{n+d}{d}, d+1)$$)

• domain (str, optional) – The domain of the nodes. See “The domain optional argument”. The condition number will be computed for the nodes mapped to the biunit simplex.

Returns

the condition number $$\kappa_2(K)$$ (with respect to the pseudoinverse).

Return type

float


text:
Who can answer this? Department expenses

Overroad Cycle Shop has two service departments (advertising and administration) and two operating departments (cycles and clothing). During 2011, the departments had the following direct expenses and occupied the following amount of floor space. Department Direct Expenses Square Feet Advertising $15,000 1,086 Administrative 18,400 1,153 Cycles 101,600 6,336 Clothing 11,800 4,224 The advertising department developed and distributed 100 advertisements during the year. Of these, 76 promoted cycles and 24 promoted clothing. The store sold$300,000 of merchandise during the year. Of this amount, $224,000 is from the cycles department, and$76,000 is from the clothing department. The utilities expense of $62,000 is an indirect expense to all departments. Complete the departmental expense allocation spreadsheet for Overroad Cycle Shop. Assign (1) direct expenses to each of the four departments, (2) the$62,000 of utilities expense to the four departments on the basis of floor space occupied, (3) the advertising department’s expenses to the two operating departments on the basis of the number of ads placed that promoted a department’s products, and (4) the administrative department’s expenses to the two operating departments based on the amount of sales