text:
11,337
pages

Not to be confused with Buchholz's function.

The Buchholz hydra game is a one-player game played on trees labelled with any finite number or $$\omega$$. From the game arises a fast-growing function $$\text{BH}(n)$$ which eventually dominates all recursive functions provably total in $$\Pi_1^1-\textrm{CA}+\textrm{BI}$$, and is itself provably total in $$\Pi_1^1-\textrm{CA}+\textrm{BI}$$ + "transfinite induction with respect to TFB".[citation needed]

## Rules

The game is played on a finite labelled tree $$T$$ where the root is marked with a special label (call it +), and every child of root has label 0, and every other node is labeled by any ordinal $$\leq \omega$$. This tree is called a hydra.

At each step, we choose a leaf node $$a$$ to chop off. On the other hand, hydra chooses a nonnegative integer $$n$$ in some way (for example, it is determined as the number of current step, starting from 1). The hydra alters by the following rules:

1. If $$a$$ has label 0, we proceed as in Kirby-Paris' game. Call the node's parent $$b$$, and its grandparent $$c$$ (if it exists). First we delete $$a$$. If $$c$$ exists (i.e. $$b$$ is not the root), we make $$n$$ copies of $$b$$ and all its children and attach them to $$c$$.
2. If $$a$$ has label $$u + 1$$, we go down the tree looking for a node $$b$$ with label $$v \leq u$$ (which is guaranteed to exist, as every child of the root node has label 0). Consider the subtree rooted at $$b$$ — call it $$S$$. Create a copy of $$S$$, call it $$S'$$. Within $$S'$$, we relabel $$b$$ with $$u$$ and relabel $$a$$ with $$0$$. Back in the original tree, replace $$a$$ with $$S'$$.
3. If $$a$$ has label $$\omega$$, we simply relabel it with $$n + 1$$.

If $$a$$ is the hydra's rightmost leaf, we notate the transformed tree as $$T(n)$$.

As we go about altering the hydra, we pick leaves. The sequence of leaves is called a strategy. A strategy is a winning strategy if it eventually leaves us with only the root node, and a losing strategy otherwise.

## Hydra theorem

It was believed in this community that Wilfried Buchholz showed that there are no losing strategies for any hydra, but the source of this article does not include such a result. A similar made-up description is found in Kirby-Paris hydra#Hydra Theorem.

Call this statement the hydra theorem. What he actually showed is the canonical correspondence from a hydra to an infnitary well-founded tree (or the corresponding term in the notation system $$T$$ associated to Buchholz's function, which does not necessarily belong to the ordinal notation system $$OT \subset T$$), preserves fundamental sequences, i.e. the strategy to choose the rightmost leaves and the $$(n)$$ operation on an infinitary well-founded tree (or the $$[n]$$ operation on the corresponding term in $$T$$). Although it might fortunately imply the hydra theorem under some weak set theory, the statement that he showed the hydra theorem is wrong because he even does not state the hydra theorem. He only refered to the fact that the sequence of the rightmost leaves is a winning strategy. The hydra theorem is unprovable in $$\Pi_1^1-\textrm{CA}+\textrm{BI}$$, but for individual hydras it was believed to be provable in this community without a source.

## $$\text{BH}(n)$$ function

Suppose we make a tree with just one branch with $$x$$ nodes, labeled $$+,0,\omega,\omega,...,\omega$$. Call such a tree $$R^n$$. It cannot[citation needed] be proven in $$\Pi_1^1-\textrm{CA}+\textrm{BI}$$ that for all $$x$$, there exists $$k$$ such that $$R^x(1)(2)(3)...(k)$$ is root tree. (The latter expression means taking the tree $$R^x$$, then transforming it with $$n = 1$$, then $$n = 2$$, then $$n = 3$$, etc. up to $$n = k$$.)

Define $$\text{BH}(x)$$ as the smallest $$k$$ such that $$R^x(1)(2)(3)...(k)$$ as defined above is root tree. By the hydra theorem this function is well-defined, but its totality cannot be proven in $$\Pi_1^1-\textrm{CA}+\textrm{BI}$$. Its rate of growth is believed to be comparable to $$f_{\psi_0(\varepsilon_{\Omega_\omega + 1})}(x)$$ with respect to unspecified system of fundamental sequences without a proof. Here $$\psi$$ denotes Buchholz's function, and ($$\psi_0(\varepsilon_{\Omega_\omega + 1})$$ is the Takeuti-Feferman-Buchholz ordinal, which unsurprisingly measures the strength of $$\Pi_1^1-\textrm{CA}+\textrm{BI}$$.)

The first two values of the BH function are virtually degenerate: $$\text{BH}(1) = 0$$ and $$\text{BH}(2) = 1$$. $$\text{BH}(3)$$ is very large, but not extremely — Googology Wiki user Wythagoras provided a heuristic argument for $$\text{BH}(3) < f_{\varepsilon_0}(n)$$ for some reasonably small $$n$$.[citation needed]

The Buchholz hydra surpasses TREE(n) and SCG(n). It is likely weaker than loader.c as well as numbers from finite promise games.

## Analysis

It is possible to make one-to-one correspondence between some hydras and ordinals.

To convert a tree or subtree to an ordinal:

1. Inductively convert all the immediate children of the node to ordinals.
2. Add up those child ordinals. If there were no children, this will be 0.
3. If the label of the node is not +, apply $$\psi_\alpha$$, where $$\alpha$$ is the label of the node, and $$\psi$$ is Buchholz's function.

The resulting ordinal expression is only useful if it is in normal form.

Some examples are:

Hydra Ordinal
(+) 0
(+(0)) $$\psi_0(0) = 1$$
(+(0)(0)) $$\psi_0(0) + \psi_0(0) = 2$$
(+(0(0))) $$\psi_0(\psi_0(0)) = \omega$$
(+(0(0))(0)) $$\psi_0(\psi_0(0)) + \psi_0(0) = \omega + 1$$
(+(0(0))(0(0))) $$\psi_0(\psi_0(0)) + \psi_0(\psi_0(0)) = \omega 2$$
(+(0(0)(0))) $$\psi_0(\psi_0(0) + \psi_0(0)) = \omega^2$$
(+(0(0(0)))) $$\psi_0(\psi_0(\psi_0(0))) = \omega^\omega$$
(+(0(1))) $$\psi_0(\psi_1(0)) = \varepsilon_0$$
(+(0(1)(1))) $$\psi_0(\psi_1(0) + \psi_1(0)) = \varepsilon_1$$
(+(0(1(0)))) $$\psi_0(\psi_1(\psi_0(0))) = \varepsilon_\omega$$
(+(0(1(1)))) $$\psi_0(\psi_1(\psi_1(0))) = \zeta_0$$
(+(0(1(1(1))))) $$\psi_0(\psi_1(\psi_1(\psi_1(0)))) = \Gamma_0$$
(+(0(1(1(1(0)))))) $$\psi_0(\psi_1(\psi_1(\psi_1(\psi_0(0))))) =$$SVO
(+(0(1(1(1(1)))))) $$\psi_0(\psi_1(\psi_1(\psi_1(\psi_1(0))))) =$$LVO
(+(0(2))) $$\psi_0(\psi_2(0)) =$$BHO
(+(0($$\omega$$))) $$\psi_0(\psi_\omega(0))$$

## Komi Amiko's Extension (Amiko hydras) (Citation needed)

A natural question to ask when investigating ways to build faster growing functions than the one based on Buchholz hydras is "what if we used higher ordinals as labels?" Then, because hydras are ordinal-like, "what if we used nested hydras as labels?" We can ignore the details of adapting ordinal transformation rules for hydras for the time being, but these nested hydras are unquestionably more powerful than plain Buchholz hydras.

He then added a singleton, which he refers to as $$\lambda$$. When encountered, it would expand into a hydra involving labels that are hydras involving labels that are hydras involving labels that are hydras... $$N$$ layers deep, despite the absence of any mention of $$\lambda$$. In some ways, this is a fixed point ordinal of hydra nesting, or, more precisely, the first common fixed point of whatever ordinal operation nesting hydras corresponds to. I'm not sure what ordinal such a system corresponds to, but it's certainly stronger than without $$\lambda$$. Why should we stop there? We can rename $$\lambda$$ to $$\lambda_0$$ and then introduce $$\lambda_1$$, the second common fixed point of hydra nesting, which expands similarly to $$\lambda_0$$ but contains $$\lambda_0$$ in the nested hydras.

Why should we stop there? Subscript ordinals, and even hydra subscripts can be created. Then we can add another layer, say, $$\zeta_0$$, which expands into a stack of nested $$\lambda$$ hydras, and so on.

“Externalize” and “close” are two important basic transformation types in our toolbox of higher order hydra construction transformations. The term "externalise" refers to the process of shifting information from the labels (internal) to the children (external), with the ultimate goal of putting an upper bound on the labels without affecting the strength of the construction. “Close” means to take a construction with upper-bounded labels and extend it to support arbitrary hydras as labels, thereby taking the closure of the construction under using hydras as labels and making the construction stronger. These two go together like clockwork. These are called transformation types because there isn't just one way to externalise or close, and the strength of different possible transformations can vary.

Amiko hydras can be made from Buchholz hydras by taking a close step, a somewhat strong externalise step, and then another close step. The externalise step is the most intriguing here. Below is a comparison between the initial Buchholz hydra and its Amiko equivalent:

That's it, our first Amiko hydra! Whatever rules we use to define its evolution, it should evolve similarly to Buchholz hydras for hydras converted from Buchholz hydras.

Amiko hydras with only $$0 = (+:)$$ and $$1 = (+:((+:):))$$ labels correspond to nested Buchholz hydras. Amiko hydras with finite labels correspond to hyper-nested Buchholz hydras with a finite number of hyper-nesting dimensions, which we may collectively call $$\textrm{hyper}^\omega$$-nested Buchholz hydras. The full construction of Amiko hydras, obtained by applying a close transform after this externalize, is far more powerful, and its corresponding ordinal is the first common fixed point of “$$\alpha$$ maps to the ordinal of $$\textrm{hyper}^\alpha$$-nested Buchholz hydras.”

It’s useful to be able to show a Buchholz hydra can be converted into an equivalent Amiko hydra, since it shows that Amiko hydras are at least as strong as Buchholz hydras.

The root just becomes a root node. All its children are then recursively transformed with this procedure:

"Recursively transform its children. Let $$\alpha$$ be the label of the Buchholz hydra node. Change its label to $$(+:)$$. If $$\alpha$$ is finite, then insert $$\alpha$$ copies of $$((+:((+:):)):)$$ just before its leftmost child. Otherwise, insert $$((+:((+:):)):((+:):))$$ just before its leftmost child."

As you can see, the hydras converted this way are nowhere near the largest Amiko hydras allow. The converted Amiko hydra will not necessarily evolve in the same way as the Buchholz hydra, but they will correspond to the same ordinal and have the same growth rate if analogous fast growing functions are defined on them.

Comparison operators may include a filter, which refers to the labels of the nodes being compared and causes children who do not match the filter to be ignored. In recursive comparisons, the filter does not propagate. Writing $$A<>_{>C}B$$, for example, means comparing $$A$$ and $$B$$ as if all of their immediate children with labels $$\leq C$$ were removed.

Let $$S(A)$$ be the outer reduction function, which is what we mean by reducing a hydra that includes the root node. It is defined like so:

If we are reducing $$A$$, it is guaranteed that it has children. Let $$B$$ be $$A$$'s rightmost child, and $$C$$ be $$B$$'s label:

1. If $$C = (+:)$$, search for the rightmost leaf of $$A$$, but do not enter nodes with labels $$> (+:)$$. Let $$D$$ be this rightmost leaf (whose label is guaranteed to be $$(+:)$$). Then:
1. If $$D$$ has no children, let $$E$$ be the parent of $$D$$. Remove $$D$$ from $$E$$. If $$E$$ has a parent, append $$N$$ copies of $$E$$ as additional children to the parent of $$E$$, for some $$N$$. $$S(A)$$ is the modified $$A$$.
2. If $$D$$ has any children (all of which are guaranteed to have a label $$> (+:)$$), traverse up the parents of $$D$$, searching for a node $$E$$ satisfying $$E <_{>(+:)} D$$, but do not enter nodes with label $$> (+:)$$. If no suitable $$E$$ is found, take $$E$$ as the last candidate's parent (or $$A$$ if it was reached) but with all children removed except the rightmost. Let $$D'$$ be $$D$$ but with the label changed to $$+$$. Let $$E'$$ be $$S(D')$$ but without children whose label is $$(+:)$$, and with the children of $$E$$ whose labels are $$(+:)$$ appended, and with label $$D$$. Let $$F = ((+:):)$$. Then, repeat the following $$N$$ times, for some $$N$$: replace $$F$$ with $$E'$$ where $$D$$ is replaced with $$F$$. Then finally replace $$D$$ with $$F$$. $$S(A)$$ is the modified $$A$$.
2. If $$C > (+:)$$, go right in the tree, looking for the rightmost leaf. If $$C$$ has no children, the search just ends there. Otherwise:
1. If a node $$D$$ with label $$(+:)$$ is encountered, proceed as in rule 1.
2. If we reach a leaf without ever encountering a node with label $$(+:)$$, let $$D$$ be this rightmost leaf, and let $$E$$ be $$D$$'s label. Traverse up the parents of $$D$$ searching for a node $$F$$ with label $$G$$ satisfying $$G < E$$, which is always guaranteed to exist. Let $$H = S(E)$$. Let $$F'$$ be $$F$$ but with the label changed to $$H$$, and let $$I = ((+:):)$$. Then, repeat the following $$N$$ times, for some $$N$$: replace $$I$$ with $$F'$$ where $$D$$ is replaced with $$I$$. Then finally replace $$D$$ with $$I$$. $$S(A)$$ is the modified $$A$$.

He then defined a fast-growing function $$AH(k)$$ like so:

Begin with the smallest possible hydra, which is $$(+:)$$. Then repeat $$k$$ times: $$A \mapsto (+:(A:))$$. Begin with a global shared counter $$N$$, which will increment after every time it is called for (including additional mentions when reducing nested hydras), not on each outer evaluation of $$S$$. Reduce the hydra using $$S$$ until it is $$(+:)$$. The final value of $$N$$ is $$AH(k)$$. The fist few values:

• $$AH(0) = 1$$
• $$AH(1) = 1$$
• $$AH(2) = 3$$

$$AH(3)$$ already blows Buchholz hydras (and finitely hyper-nested Buchholz hydras) out of the water!

## Sources and References

• M. Hamano, M. Okada, A relationship among Gentzen's Proof-Reduction, Kirby-Paris' Hydra Game and Buchholz's Hydra Game, Math. Logic Quart. 43 (1997) 103-120.
• M. Hamano, M. Okada, A direct independence proof of Buchholz's Hydra Game on finite labeled trees, Arch. Math. Logic 37 (1998) 67-89.
• L. Kirby, J. Paris, Accessible independence results for Peano Arithmetic, Bull. Lon. Math. Soc. 14 (1982) 285-293.
• J. Ketonen, R. Solovay, Rapidly growing Ramsey functions, Ann. Math. 113 (1981) 267-314.
• G. Takeuti, Proof Theory, 2nd Edition, North-Holland, Amsterdam, 1987.
• K. Amiko, Amiko Hydras, 2020


text:
## Learning Objectives

• Extract values from vectors and data frames.
• Perform operations on columns in a data frame.
• Append columns to a data frame.
• Create subsets of a data frame.

In this lesson you will learn how to extract and manipulate data stored in data frames in R. We will work with the E. coli metadata file that we used previously. Be sure to read this file into a dataframe named metadata, if you haven’t already done so.

metadata <- read.csv('data/Ecoli_metadata.csv')

Because the columns of a data frame are vectors, we will first learn how to extract elements from vectors and then learn how to apply this concept to select rows and columns from a data frame.

# Extracting values with indexing and sequences

## Vectors

Let’s create a vector containing the first ten letters of the alphabet.

ten_letters <- c('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')

In order to extract one or several values from a vector, we must provide one or several indices in square brackets, just as we do in math. R indexes start at 1. Programming languages like Fortran, MATLAB, and R start counting at 1, because that’s what human beings typically do. Languages in the C family (including C++, Java, Perl, and Python) count from 0 because that’s simpler for computers to do.

So, to extract the 2nd element of ten_letters we type:

ten_letters[2]

We can extract multiple elements at a time by specifying mulitple indices inside the square brackets as a vector. Notice how you can use : to make a vector of all integers two numbers.

ten_letters[c(1,7)]

ten_letters[3:6]

ten_letters[10:1]

ten_letters[c(2, 8:10)]

Quick exercise / formative assessment: Select every other element in ten_letters.

What if we were dealing with a much longer vector? We can use the seq() function to quickly create sequences of numbers.

seq(1, 10, by = 2)
seq(20, 4, by = -3)

## Exercise

Fill in the blank to select the even elements of ten_letters using the seq() function.

ten_letters[____________]

## Solution

ten_letters[seq(2, 10, by = 2)] {: .solution} {: .challenge}

## Data frames

The metadata data frame has rows and columns (it has 2 dimensions), if we want to extract some specific data from it, we need to specify the “coordinates” we want from it. Row numbers come first, followed by column numbers (i.e. [row, column]).

metadata[1, 2]   # 1st element in the 2nd column
metadata[1, 6]   # 1st element in the 6th column
metadata[1:3, 7] # First three elements in the 7th column
metadata[3, ]    # 3rd element for all columns
metadata[, 7]    # Entire 7th column

## Challenge

The function nrow() on a data.frame returns the number of rows. For example, try typing nrow(metadata). Usenrow()andseq()to create a new data frame calledmeta_by_2that includes all even numbered rows ofmetadata.

## Solution

meta_data[seq(2, nrow(metadata), by = 2, ]

{: .solution} {: .challenge}

For larger datasets, it can be tricky to remember the column number that corresponds to a particular variable. Sometimes the column number for a particular variable can change if your analysis adds or removes columns. The best practice when working with columns in a data frame is to refer to them by name. This also makes your code easier to read and your intentions clearer.

There are two ways to select a column by name from a data frame:

• Using dataframe[ , "column_name"]
• Using dataframe$column_name You can do operations on a particular column, by selecting it using the $ sign. In this case, the entire column is a vector. You can use names(metadata) or colnames(metadata) to remind yourself of the column names. For instance, to extract all the strain information from our datasets:

# Select the strain column from metadata

# Alternatively...
metadata\$strain

The first method allows you to select multiple columns at once. Suppose we wanted strain and clade information:

metadata[, c("strain", "clade")]

You can even access columns by column name and select specific rows of interest. For example, if we wanted the strain and clade of just rows 4 through 7, we could do:

metadata[4:7, c("strain", "clade")]`

<!– Still need to address the following learning objectives: * Append columns to a data frame. * Create subsets of a data frame.

The following headings are just suggestions.

format: plain


text:
## 1. Holomorphic anomaly equation

Brief introduction to the holomorphic anomaly equation taken from Albrecht Klemm’s Slides on on Omega backgrounds and generalized holomorphic anomaly equation at STring-math in June 2011. http://www.math.upenn.edu/StringMath2011/notes/Klemm_StringMath2011_talk.pdf, See also the paper by Bershadski, Cecotti, Ooguri, and Vafa 1993.

The B-model definition of the $F^g(a)=F^{(0,g)}(a)$ is given by $F^g(a)=\int_{\bar{\mathcal{M}}_g} \langle \prod_{k=1}^{3g-3} \beta^k \bar{\beta}^k \rangle_g \cdot [dm \wedge d\bar{m}],$ The contraction of the coordinates $m_k, \ \bar{m}_k$ with the genus $g$worldsheet correlator of $\beta^k = \int_{\Sigma_g} G^- \mu^k, \ \ \ \bar{\beta^k}=\int_{\Sigma_g} G^- \bar{\mu}^k$ gives a real $6g-6$ form on the compactified moduli space $\bar{\mathcal{M}}_g$ of the $g$ Riemann surface $\Sigma_g$.

An infinitessimal anholomorphic perturbation $\S(t_i, \bar{t}_i) = S(t_i) + \bar(t)^i\int_{\Sigma_g} \bar{\mathcal{O}_i^{(2)}},$ with $\bar{\mathcal{O}_i^{(2)}} = \{ G_0^+, [\bar{G}_0^+, \bar{\mathcal{O}_i^{(0)}}]\}dz d\bar{z}$ corresponds to an insertion of exact forms. The deformation receives contributions from the boundaries. This leads to the Holomorphic Anomaly Equation ( Bershadski, Cecotti, Ooguri, and Vafa 1993) $\bar{\partial}_iF^g = \frac{1}{2}\bar{C}_i^{jk}(D_jD_kF^{g-1} + \sum_{h=0}^{g-1} D_jF^hD_kF^{g-h}), \ \ \ g>1$ Defining for $g\geq 1$ $F^{(n,g)}(t)=\int_{\bar{\mathcal{M}}_g} \langle \mathcal{O}^n \prod_{k=1}^{3g-3} \beta^k \bar{\beta}^k \rangle_g \cdot [dm \wedge d\bar{m}],$ and for $g=0$ $F^{(n+1,0)} = \langle \phi^{(0)}(0)\phi^{(0)}(1)\phi^{(0)}(\infty)\mathcal{O}^n \rangle_{g=0}$ where the field operator $\mathcal{O}$ should come from integration a 2-form over the Riemann surface, i.e. $\mathcal{O} = \int_{\Sigma_g}\phi^{(2)},$ and $\phi^{(2)}$ emerges as usual from the descending equation from $\phi^{(0)}$
1. #### Problem 1.1.

Does the holomorphic anomaly equation "integrate" over elliptic fibrations?
• ### Eta-products and root systems and holomorphic anomaly equation

As it turns out mock modular forms (such as eta-products) do not satisfy the holomorphic anaomaly equation.

#### Problem 1.2.

Do they satisfy other differential equations?
Also see problem hae-cy.
• #### Problem 1.3.

Investigate the Holomorphic anomaly equation (HAE) in fibered Calabi-Yau 3-folds and BPS counting.
For example, does the HAE “integrate” over elliptic fibrations or K3 fibers?

Cite this as: AimPL: Gromov-Witten invariants and number theory, available at http://aimpl.org/gromwitnumthry.


text:
zoerror

Joined Jun 8, 2008
3
i have a basic stamp board 2, and i want to know how to hook a transistor up to it. my goal is to hook it up and have a simple script for it somthing like this:
high 15
pause 250
low 15
high 15
pause 250
low 15
high 15
pause 250
low 15

i want the transistor to let current to go through and then stop the current.

to put it more simple, lets say, i wanted to hook a transitor to the basic stamp board and hook a LED to the transistor. and have a simple script like above and make the led flash.

I know i dont need a transistor for a led, and i know i need resistors but my main concer is how to wire it properly. im not sure what VDD or Vss means on the board. If someone could help me out a little i would appreciate it. Thanks

SgtWookie

Joined Jul 17, 2007
22,210
Vdd is the more positive supply. Vdd is the correct terminology for CMOS devices. Vcc is the terminology for BJT's, or bipolar junction transistors, like a 2n2222.
Vss is the more negative supply for CMOS devices. For BJT's, it's Vee.

In many circuits, Vss and Vee are equivalent to ground, abbreviated as GND. However, sometimes Vss/Vee have a value that is less than ground, such as when you are using op amps.

Your program as written may work, but there is no delay between setting pin 15 from low to high. To you, it will appear that the LED is constantly lit. You need something more like:

high 15
pause 250
low 15
pause 250
(repeat...)

If you want something a bit more exciting, try:
Rich (BB code):
Looper   VAR BYTE
MainLoop:
FOR Looper = 255 to 1 STEP -1
high 15
pause Looper
low 15
pause Looper
NEXT
FOR Looper = 1 to 255 STEP 1
high 15
pause Looper
low 15
pause Looper
NEXT
GOTO MainLoop
This will cause the LED to flash at varying speeds; starting off slow and getting faster and faster, then slowing back down, and repeating infinitely.
Note that since "Looper" is a byte variable, it's maximum value is 255.

Which exact model of Basic Stamp are you working with?

Do you have any NPN transistors around? Which part number? Do you have an LED around? If so, what is their rating? (Typical Vf @ current)

Last edited:

zoerror

Joined Jun 8, 2008
3
thanks for info

but i think i misslead you a little.

Im trying to ask how to wire it up. would i plug a wire into p15, then take that wire and place it on the E of the transistor? then take antoehr wire and place it next to p15 and have that running to the B on the transistor, Then what would i do with the other wire on the transistor "C" ,... Im not sure how the wiring goes. I looked at pics but i dont understand what thier saying. Thanks for the help.

SgtWookie

Joined Jul 17, 2007
22,210
OK.
The Basic Stamp is a CMOS device. It has limited ability to source or sink current.

I'm going to assume for now that you have an NPN transistor available, like a 2n2222 or 2n3904.

Connect the emitter of the NPN transistor to ground/Vss/Vee.
Connect pin 15 of the Basic Stamp to the base of the transistor using a resistor between 3.3k and 10k Ohms in value.

You should have the transistor's collector still dangling somewhere.

Now you need to determine the current limiting resistor for the LED.
Rlimit >= (Vsupply - Vf(LED)) / I(LED)
or, the value of the current limiting resistor is equal to or greater than the sum of (supply voltage less the forward voltage rating of the LED) divided by the rated current of the LED.
Let's just say you have a red LED that's rated for Vf(typ) 1.7v @20mA.
Let's also say that your supply voltage is 5v.
If anything's different, just plug in the values you have, and re-calculate.
Re-stating:
Rlimit >= (Vsupply - Vf(LED)) / I(LED)
Rlimit >= (5v - 1.7v) / 20mA
Rlimit >= 3.3 / 0.02
Rlimit >= 165
Looking at a standard value chart:
http://www.logwell.com/tech/components/resistor_values.html
you can see that 160 and 180 are close. Take 180; your LED will live longer.

So, connect one lead of the resistor to Vdd/Vcc/+v, and the other lead to the anode of the LED. Connect the cathode (the shorter lead) of the LED to the collector of the transistor, load up the program, and blink to your heart's content.


text:
# American Institute of Mathematical Sciences

September  2019, 18(5): 2693-2715. doi: 10.3934/cpaa.2019120

## Concentration of ground state solutions for quasilinear Schrödinger systems with critical exponents

 1 School of Mathematical Sciences, Beijing Normal University, Beijing, 100875, China 2 Department of Mathematics, Tsinghua University, Beijing, 100084, China

* Corresponding author: yguo@math.tsinghua.edu.cn

Received  September 2018 Revised  September 2018 Published  April 2019

Fund Project: The second author is supported by Supported by National Science Foundation of China (11571040, 11771235, 11331010).
The third author is supported by National Science Foundation of China (11571040).

This paper is concerned with the critical quasilinear Schrödinger systems in
 ${\Bbb R}^N:$
 $\left\{\begin{array}{ll}-\Delta w+(\lambda a(x)+1)w-(\Delta|w|^2)w = \frac{p}{p+q}|w|^{p-2}w|z|^q+\frac{\alpha}{\alpha+\beta}|w|^{\alpha-2}w|z|^\beta\\\ -\Delta z+(\lambda b(x)+1)z-(\Delta|z|^2)z = \frac{q}{p+q}|w|^p|z|^{q-2}z+\frac{\beta}{\alpha+\beta}|w|^\alpha|z|^{\beta-2}z, \ \end{array}\right.$
where
 $\lambda>0$
is a parameter,
 $p>2, q>2, \alpha>2, \beta>2,$
 $2\cdot(2^*-1) < p+q<2\cdot2^*$
and
 $\alpha+ \beta = 2\cdot2^*.$
By using variational method, we prove the existence of positive ground state solutions which localize near the set
 $\Omega = int \left\{a^{-1}(0)\right\}\cap int \left\{b^{-1}(0)\right\}$
for
 $\lambda$
large enough.
Citation: Yongpeng Chen, Yuxia Guo, Zhongwei Tang. Concentration of ground state solutions for quasilinear Schrödinger systems with critical exponents. Communications on Pure & Applied Analysis, 2019, 18 (5) : 2693-2715. doi: 10.3934/cpaa.2019120
##### References:

show all references

##### References:
 [1] Xiyou Cheng, Zhitao Zhang. Structure of positive solutions to a class of Schrödinger systems. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020461 [2] Qingfang Wang, Hua Yang. Solutions of nonlocal problem with critical exponent. Communications on Pure & Applied Analysis, 2020, 19 (12) : 5591-5608. doi: 10.3934/cpaa.2020253 [3] Denis Bonheure, Silvia Cingolani, Simone Secchi. Concentration phenomena for the Schrödinger-Poisson system in $\mathbb{R}^2$. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020447 [4] Shiqi Ma. On recent progress of single-realization recoveries of random Schrödinger systems. Electronic Research Archive, , () : -. doi: 10.3934/era.2020121 [5] Zedong Yang, Guotao Wang, Ravi P. Agarwal, Haiyong Xu. Existence and nonexistence of entire positive radial solutions for a class of Schrödinger elliptic systems involving a nonlinear operator. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020436 [6] Scipio Cuccagna, Masaya Maeda. A survey on asymptotic stability of ground states of nonlinear Schrödinger equations II. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020450 [7] Gongbao Li, Tao Yang. Improved Sobolev inequalities involving weighted Morrey norms and the existence of nontrivial solutions to doubly critical elliptic systems involving fractional Laplacian and Hardy terms. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020469 [8] Kihoon Seong. Low regularity a priori estimates for the fourth order cubic nonlinear Schrödinger equation. Communications on Pure & Applied Analysis, 2020, 19 (12) : 5437-5473. doi: 10.3934/cpaa.2020247 [9] José Luis López. A quantum approach to Keller-Segel dynamics via a dissipative nonlinear Schrödinger equation. Discrete & Continuous Dynamical Systems - A, 2020  doi: 10.3934/dcds.2020376 [10] Claudianor O. Alves, Rodrigo C. M. Nemer, Sergio H. Monari Soares. The use of the Morse theory to estimate the number of nontrivial solutions of a nonlinear Schrödinger equation with a magnetic field. Communications on Pure & Applied Analysis, , () : -. doi: 10.3934/cpaa.2020276 [11] Serge Dumont, Olivier Goubet, Youcef Mammeri. Decay of solutions to one dimensional nonlinear Schrödinger equations with white noise dispersion. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020456 [12] Justin Holmer, Chang Liu. Blow-up for the 1D nonlinear Schrödinger equation with point nonlinearity II: Supercritical blow-up profiles. Communications on Pure & Applied Analysis, , () : -. doi: 10.3934/cpaa.2020264 [13] Jiaquan Liu, Xiangqing Liu, Zhi-Qiang Wang. Sign-changing solutions for a parameter-dependent quasilinear equation. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020454 [14] Yongxiu Shi, Haitao Wan. Refined asymptotic behavior and uniqueness of large solutions to a quasilinear elliptic equation in a borderline case. Electronic Research Archive, , () : -. doi: 10.3934/era.2020119 [15] Youshan Tao, Michael Winkler. Critical mass for infinite-time blow-up in a haptotaxis system with nonlinear zero-order interaction. Discrete & Continuous Dynamical Systems - A, 2021, 41 (1) : 439-454. doi: 10.3934/dcds.2020216 [16] Zhilei Liang, Jiangyu Shuai. Existence of strong solution for the Cauchy problem of fully compressible Navier-Stokes equations in two dimensions. Discrete & Continuous Dynamical Systems - B, 2020  doi: 10.3934/dcdsb.2020348 [17] Thabet Abdeljawad, Mohammad Esmael Samei. Applying quantum calculus for the existence of solution of $q$-integro-differential equations with three criteria. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020440 [18] Hai-Feng Huo, Shi-Ke Hu, Hong Xiang. Traveling wave solution for a diffusion SEIR epidemic model with self-protection and treatment. Electronic Research Archive, , () : -. doi: 10.3934/era.2020118 [19] Ilyasse Lamrani, Imad El Harraki, Ali Boutoulout, Fatima-Zahrae El Alaoui. Feedback stabilization of bilinear coupled hyperbolic systems. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020434 [20] Felix Finster, Jürg Fröhlich, Marco Oppio, Claudio F. Paganini. Causal fermion systems and the ETH approach to quantum theory. Discrete & Continuous Dynamical Systems - S, 2020  doi: 10.3934/dcdss.2020451

2019 Impact Factor: 1.105


text:
Browse Questions

# Respiratory Volumes and Capacities : Residual Volume (RV): Volume of air ________________ . This averages from ______________ .

( A ) remaining in the lungs even after a forcible expiration , 1000 mL to 1500 mL
( B ) a person can expire by a forcible expiration , 1000 mL to 1500 mL
( C ) remaining in the lungs even after a forcible expiration , 1100 mL to 1200 mL
( D ) a person can inspire by a forcible inspiration , 1000 mL to 1200 mL

Respiratory Volumes and Capacities : Residual Volume (RV): Volume of air remaining in the lungs even after a forcible expiration. This averages 1100 mL to 1200 mL. By adding up a few respiratory volumes described above, one can derive various pulmonary capacities, which can be used in clinical diagnosis.


text:
# How do you solve  2 ln (x + 3) = 0 and find any extraneous solutions?

This equation means that $x + 3 = 1$ or more precisely $x + 3 = {e}^{2 i \frac{\pi}{n}}$. For x real $x + 3 = \pm 1$ thus $x = - 4 \mathmr{and} x = - 2$


text:
Random physics

Alberto Verga, research notebook

Lectures on statistical mechanics.

Solids: effective models

Solid is an ordered state of matter characterized by a crystal structure and electronic bands. Atoms are located on the sites of the crystal lattice, tightly bound to their neighbors, their vibrations give raise to phonons, the quantum of the acoustic modes; electrons, depending on the chemical properties of the atoms, can jump from one site to another, carry a magnetic moment (spin), or interact with the nucleus and crystal potentials through the spin-orbit coupling, giving rise to a wealth of different physical properties and effects, such thermal or electric conductivity, ferromagnetism, piezoelectric effects, quantum Hall conductance, giant magnetoresitence or topological effects. In spite of the complexity of the solid’s band structure, specific electronic properties can be described by relatively simple effective hamiltonians comprising a few parameters, in which the complex crystal structure is replaced by a regular lattice and the collective electron coulomb interactions, by short range neighbors interactions.

The simplest example is a free electron in a metal. The presence of the crystal periodic potential creates gaps in the continuum spectrum. A tight binding hamiltonian on a cubic lattice, in which the electron can jump from one site to one of its six neighbors, is enough to account for the band structure; the hoping energy $$t$$ is the only parameter of the model:

$$H = - t \sum_{(\boldsymbol x, \boldsymbol y)} \big[c^\dagger({\boldsymbol x}) c({\boldsymbol y}) + c^\dagger({\boldsymbol y}) c({\boldsymbol x})\big]$$

where $$\boldsymbol y = \{ (x \pm 1,y,z), (x,y\pm1,z), (x,y,z\pm1) \}$$, is a neighbor of the site $$\boldsymbol x \in \mathbb{Z}^3$$ of the cubic lattice. The operator $$c({\boldsymbol x})$$ annihilate the particle at site $$\boldsymbol x$$:

$$c^\dagger(x+1,y,z) c(x,y,z) \ket{x,y,z} = \ket{x+1,y,z}\,,$$

its hermitian conjugate $$c^\dagger({\boldsymbol x})$$, creates a particle at this site.

Many universal properties of magnetic systems are well described by the ising hamiltonian,

$$H = -J \sum_{(\boldsymbol x, \boldsymbol y)} s_{\boldsymbol x} s_{\boldsymbol y}\,,$$

where $$s_{\boldsymbol x} = \pm 1$$ is a classical spin variable, $$J$$ is the exchange energy constant, and $$(\boldsymbol x, \boldsymbol y)$$ are neighboring sites in a lattice. The ising model is a simplified version of the quantum heisenberg hamiltonian:

$$H = -J\sum_{(\boldsymbol x, \boldsymbol y)} \boldsymbol\sigma_{\boldsymbol x} \cdot \boldsymbol\sigma_{\boldsymbol y}\,,$$

where $$\sigma$$ is the vector of pauli matrices. The ising and heisenberg hamiltonians, describe a magnetic material as a set of spins (classical or quantum), attached to the sites of a lattice (linear, square or cubic, depending on the dimension, for example), interacting with their nearest neighbors via the $$J$$ exchange coupling (mimicking the overlap of electronic functions).

Ising model of a ferromagnetic material. Two dimensional lattice of interacting neighboring spins. The gray region defines a cluster of up spins.

More generally, lattice models are useful in a variety of domains, ranging from condensed matter to biology or social sciences. They can describe statistical equilibrium properties, like phase transitions, or nonequilibrium processes, like crystal growth,1 population dynamics in a living system,3 or opinion propagation in a social network.2

Free particles in a lattice

We consider a gas of noninteracting, spinless bosons in a cubic lattice of step size $$a=1$$, which we take as the length unit (fermions can be treated similarly). The system’s hamiltonian is,

$$H_N = \sum_{n=1}^N H_n\,, \quad H_n = - t \sum_{(\boldsymbol x, \boldsymbol y)} [a^\dagger_n({\boldsymbol x}) a_n({\boldsymbol y}) + a^\dagger_n({\boldsymbol y}) a_n({\boldsymbol x})]\,,$$

where $$N$$ is the number of particles and the operators create or annihilate particle $$n$$ at a lattice site $$\boldsymbol x \in \mathbb{Z}^3$$. In order to write the grand potential we diagonalize the hamiltonian using a change of the position basis $$\boldsymbol x$$, to the momentum $$\boldsymbol k$$ basis, through the fourier transformation,

$$a_n({\boldsymbol x}) = \frac{V}{(2\pi)^3} \int_{-\pi}^\pi \D \boldsymbol k \, \E^{-\I \boldsymbol k \cdot \boldsymbol x} a_n({\boldsymbol k})\,,$$

where $$V=L^3$$ is the number of sites in the cubic lattice of edge $$L$$, the integration is over the first “brillouin zone” (here, the cube $$\mathrm{BZ} = (-\pi,\pi)^3$$ in momentum space). Note that the inverse transformation gives,

$$c_n({\boldsymbol k}) = \frac{1}{V} \sum_{\boldsymbol x} \E^{\I \boldsymbol k \cdot \boldsymbol x} c_n({\boldsymbol x})\,,$$

and that,

$$\frac{V}{(2\pi)^3} \int_{-\pi}^\pi \D \boldsymbol k \, \E^{-\I \boldsymbol k \cdot (\boldsymbol x - \boldsymbol y)} = V \delta_{\boldsymbol x, \boldsymbol y}$$

is the kronecker delta. In the momentum basis the hamiltonian becomes EX,

$$H = \frac{V}{(2\pi)^3} \int_{-\pi}^\pi \D \boldsymbol k \, \epsilon(\boldsymbol k) a^\dagger(\boldsymbol k) a(\boldsymbol k)\,,$$

where

$$\epsilon(\boldsymbol k) = -2(\cos k_x + \cos k_y + \cos k_z)\,.$$

The grand potential $$\Phi(T,\mu,V)$$ of the noninteracting hamiltonian, writes:

$$\Phi(T,\mu,V) = \frac{TV}{(2\pi)^3} \int_{-\pi}^\pi \D \boldsymbol k \, \ln\left( 1 - \E^{\mu/T} \E^{-\epsilon(\boldsymbol k)/T} \right)\,,$$

where $$H$$ is the single particle hamiltonian. The number of particles and the energy are given by the integrals,

$$N = \frac{V}{(2\pi)^3} \int_{-\pi}^\pi \frac{\D \boldsymbol k} {\E^{\mu/T} \E^{\epsilon(\boldsymbol k)/T} - 1} \,,$$

and

$$E = \frac{V}{(2\pi)^3} \int_{-\pi}^\pi \D \boldsymbol k \, \frac{\epsilon(\boldsymbol k)}{\E^{\mu/T} \E^{\epsilon(\boldsymbol k)/T} - 1} \,.$$

To compare the behavior of the gas in a lattice with the ideal gas, we keep the first term in the fugacity (Boltzmann limit, which is similar for fermions and bosons). In this limit we have,

\begin{align*} \Phi & = - \frac{TV \E^{\mu/T}}{(2\pi)^3} \int_{-\pi}^\pi \D \boldsymbol k \,\E^{\epsilon(\boldsymbol k)/T} \\ & = - \frac{TV \E^{\mu/T}}{(2\pi)^3} \left[\int_{-\pi}^\pi \D k \, \E^{2t \cos k/T} \right]^3\\ & = - TV \E^{\mu/T} I_0(2t/T)^3\,, \end{align*}

where $$I_0$$ is the modified bessel function of the first kind,

$$I_0(z) = \frac{1}{\pi} \int_0^\pi \D t \, \E^{z \cos t}\,,$$

and the particle number,

$$N = \frac{V \E^{\mu/T}}{(2\pi)^3} \left[\int_{-\pi}^\pi \D k \, \E^{2t \cos k/T} \right]^3 = V \E^{\mu/T} I_0(2t/T)^3\,,$$

which combined with the expression of $$\Phi= -PV$$, one recovers

$$PV = NT$$

independent of the hoping energy $$t$$. However, the lattice gas energy differs to the one of the ideal gas.

Indeed, the energy is given by,

$$E = -2t\frac{V \E^{\mu/T}}{(2\pi)^3} \left[\int_{-\pi}^\pi \D k \, \cos k \, \E^{2t \cos k/T} \right]^3 = -2TV \E^{\mu/T} I_1(2t/T)^3\,,$$

or, eliminating the chemical potential,

$$E = -2tN \left[\frac{I_1(2t/T)}{I_0(2t/T)} \right]^3\,.$$

The ideal gas energy is found in the continuous limit ($$a \rightarrow 0$$), which corresponds to $$t \sim \hbar^2/2ma^2 \rightarrow \infty$$ EX,

$$E \approx -2tN \frac{1-9T/16t}{1+3T/t} = -2tN + \frac{3}{2}NT\,,$$

where, up to an irrelevant constant, gives the ideal gas result. We used the asymptotic expression,

$$I_n(z) \approx \frac{\E^z}{\sqrt{2\pi z}} \left( 1 - \frac{4n^2 - 1}{8 z} \right)\,.$$

In the opposite limit $$T \gg t$$, the energy grows slowly with the temperature:

$$E \approx -2tN \left( \frac{t}{T} \right)^3\,.$$

(The small $$z$$ limit of the $$I$$ bessel functions is $$I_n(z) = (z/2)^n/n!$$.)

One dimensional spin model

In the presence of an external field $$B$$, the one dimensional ising hamiltonian is,

$$H = -J\sum_{x=1}^N s_x s_{x+1} - \sum_{x=1}^N s_x B$$

where we assumed periodic boundary conditions $$s_1 = s_{N+1}$$. We choose units based on the lattice constant and the spin magnetic moment, $$a = g\mu_\text{B}=1$$ (we also put the permeability $$\mu_0=1$$); in such units the magnetic field $$B$$ has the dimensions of the energy.

The probability of a spin configuration $$s$$,

$$s = \{s_1=\pm1, s_2=\pm1, \ldots, s_N=\pm 1\}$$

is,

$$P[s] = \frac{1}{Z} \prod_x \exp\left[\frac{J}{T} s_x s_{x+1} + \frac{B}{2T}(s_x + s_{x+1}) \right]$$

and the partition function is given by,

$$Z(T,B) = \sum_s \prod_x \exp\left[K s_x s_{x+1} + \frac{B}{2T} (s_x + s_{x+1}) \right] \,,$$

where $$K = J/T$$. We observe that the thermodynamics of the present model depends on two nondimensional parameters, the interaction energy-temperature ratio $$K = J/T$$ and the external field-temperature ratio $$h = B/T$$. The idea to compute the partition function is to try (obviously this is not always possible) to factor it in a series of identical terms, like in the noninteracting case; we symmetrized the $$B$$ term to this goal. We note first that the product appearing in $$Z$$ can be written in the form,

$$\prod_x \exp\left[K s_x s_{x+1} + \frac{B}{2T} (s_x + s_{x+1})\right] = T_{s_1,s_2} T_{s_2,s_3}\ldots T_{s_N,s_1}\,,$$

where each term $$T_{s_x,s_{y}} = T_{s_y,s_x}$$ can take different values according to the values of $$s_x = \pm 1$$ and $$s_{y} = \pm 1$$:

$$T_{s_x,s_y} = \{\E^{K \pm h}, \E^{-K}\}\,.$$

Therefore, the partition function becomes,

$$Z = \sum_{s_1} \sum_{s_2} \ldots \sum_{s_N} T_{s_1,s_2} T_{s_2,s_3}\ldots T_{s_N,s_1}\,.$$

A generic factor is,

$$\sum_{s_x} T_{s_{x-1},s_x} T_{s_x,s_{x+1}} = T_{s_{x-1},s_{x+1}}\,,$$

corresponding to the product of two matrices,

$$T = \begin{pmatrix} \E^{K+h} & \E^{-K} \\ \E^{-K} & \E^{K-h} \\ \end{pmatrix} \,.$$

Using the transfer matrix $$T$$ to write the partition function,

$$Z = \mathrm{Tr}\, T^N\,.$$

Therefore, using the invariance of the trace under basis transformations EX,

$$Z = \lambda_+^N + \lambda_-^N$$

where $$\lambda_\pm$$ are the eigenvalues of the transfer matrix $$T$$:

$$\lambda_\pm = \E^K \cosh h \pm \sqrt{\E^{2K}\sinh^2h + \E^{-2K}}\,.$$

In the thermodynamic limit $$N\rightarrow\infty$$, only the larger eigenvalue of the transfer matrix survives in $$Z$$:

$$Z = \lambda_+^N+\lambda_-^N= \lambda_+^N \big[1 + (\lambda_-/\lambda_+)^N \big] \approx \lambda_+^N\,,$$

from which we compute the free energy,

$$F(T,B) = -N T \ln\left( \E^{J/T} \cosh(B/T) + \sqrt{\E^{2J/T}\sinh^2(B/T) + \E^{-2J/T}} \right)\,.$$

The mean magnetization per particle $$m=M/N \braket{s_x}$$, is given by EX,

$$m = -\frac{1}{N}\frac{\partial F}{\partial B} = \frac{\E^{2J/T}\sinh(B/T)}{\sqrt{\E^{4J/T}\sinh^2(B/T) + 1}}\,.$$

In the limit of small $$B$$ (and finite temperature), the magnetization is proportional to the field:

$$m \approx \chi B\,, \quad \chi = \frac{\E^{2J/T}}{T}\,,$$

a behavior of the paramagnetic type, with a susceptibility inversely proportional to the temperature, corrected with the factor $$\E^{J/T}$$ depending on the interaction energy. However, for $$T=0$$, te magnetization becomes,

$$m = \mathrm{sgn}(B)\,,$$

behavior reminiscent to a phase transition (at critical temperature $$T_c=0$$): indeed, at zero temperature the two values of the magnetization $$m=\pm1$$ correspond to an ordered state with all spins pointing up or down.

The correlation function (at $$B=0$$) between two spins separated by a distance $$r$$, is defined by,

$$C(r) = \langle s_x s_{x + r} \rangle = \sum_s s_x s_{x + r} P[s] = \frac{1}{Z} \sum_s s_x s_{x + r} \prod_y \E^{J s_y s_{y+1}/T}\,.$$

We introduce as before, the transfer matrix $$T$$,

$$\frac{1}{Z} \sum_s \prod_{y=1}^{x-1} T_{s_ys_{y+1}}s_x \prod_{y=x}^{x+r-1} T_{s_ys_{y+1}} s_{x+r} \prod_{y=x+y}^{N} T_{s_ys_{y+1}}\,,$$

which gives, using the matrix product formula,

$$C(r) = \mathrm{Tr\ } T^{x-1} \sigma_z T^{r} \sigma_z T^{N-r-x+1}\,.$$

Using now the unitary transformation,

$$U = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\,,$$

to diagonalize $$T$$, and the cyclic property of the trace $$\mathrm{Tr}\, ABC = \mathrm{Tr}\, (U^\dagger A U)( U^\dagger B U)( U^\dagger C U)$$, we obtain EX,

$$C(r) = \frac{1}{Z} \mathrm{Tr\ } \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} \lambda_+^{r} & 0 \\ 0 & \lambda_-^{r} \end{pmatrix} \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} \lambda_+^{N-r} & 0 \\ 0 & \lambda_-^{N-r} \end{pmatrix}\,.$$

Therefore the two spins correlation function of a Ising system with $$N$$ spins is given by the explicit formula,

$$C(r) = \langle s_{x}s_{x+r}\rangle = \frac{\lambda_+^{N-r}\lambda_-^{r} + \lambda_+^{r}\lambda_-^{N-r}}{ \lambda_+^N+\lambda_-^N}$$

In the thermodynamic limit $$N \rightarrow \infty$$, we finally get,

$$C(r) = \left(\frac{\lambda_-}{\lambda_+}\right)^r = \E^{-r/\xi},\; \xi = -\frac{1}{\ln \tanh J/T} \,,$$

where $$\xi$$ is the correlation length. The exponential decay of correlations indicates the absence of long range order. The 1D Ising model has not phase transitions for $$T>0$$.

Mean field spin model

Instead of considering the nearest neighbor interaction, we can investigate the case of long range interaction, where each spin on a lattice indexed by $$x=1,2,\ldots,N$$ ($$N$$ is the number of spins) can interact with all other spins:

$$H=-\frac{J}{2N} \sum_{x,y} s_x s_y - B \sum_x s_x\,,$$

where the factor two is to avoid counting twice each pair $$(x,y)$$, and the factor $$1/N$$ is to ensure that the energy is extensive (there are $$\sim N^2$$ terms of order one in the sum). This model is easily solved by noting that the hamiltonian corresponds to one spin in an effective field $$B_s$$ created by the other spins, in addition to the real applied field:

$$B_s = \frac{J}{N}\sum_x s_x + B = Jm + B = \frac{J}{2}m + B\,,$$

where

$$m = \frac{1}{N}\sum_x s_x,$$

is the magnetization per site, or, inserting this expression into $$H$$,

$$H = \frac{NJ}{2} m^2 - B_s\sum_x s_x\,,$$

The partition function is then,

$$Z = [\E^{Jm^2/2T} 2\cosh(B_s/T)]^N\,.$$

the free energy is,

$$F(T,B) = \frac{NJ}{2} m^2 -NT \ln\left( 2\cosh\frac{B_s}{T} \right)\,,$$

and the magnetization is given by the self-consistent equation,

$$m = \tanh\left( \frac{Jm/2 + B}{T} \right)\,.$$

At variance to the one dimensional case, the mean free model account for the existence of a non zero magnetization, even in the absence of an external magnetic field. Such a state is called ferromagnetic: it is a thermodynamic phase with ordered spins and spontaneous magnetization; it differs to the disordered paramagnetic phase, whose spontaneous magnetization vanishes. Therefore, the mean field model is able to describe a magnetic system undergoing, as a function of the temperature and magnetic field, a phase transition from a disordered state at high temperatures, to an ordered state at low temperatures. The critical temperature is given by $$T_c=J/2$$. For $$T > T_c$$, only the value $$m = m_P(T) = 0$$ is solution, while for $$T,T_c$$ two equilibrium values are found $$m = \pm m_F(T)$$, corresponding to the paramagnetic and ferromagnetic phases respectively.

Let us compute the heat capacity and the susceptibility in the present framework. Calculating the derivative of the free energy with respect to the temperature we find the energy EX,

$$\frac{E}{N} = -mB - \frac{Jm^2}{2}\,, \quad m = m_P,\pm m_F\,,$$

in the form of an implicit function of the temperature, through the equilibrium value of the magnetization ($$m_P$$ or $$\pm m_F$$). The derivative of $$E$$ with respect to $$T$$ gives the specific heat,

$$c_V = \frac{1}{T^2} \frac{\left(B + J m\right) \left(B + J m/2\right)}{ \cosh^{2}{\left (\frac{2 B + J m}{2 T} \right )} - \frac{J}{2T} }\,, \quad m = m_P,\pm m_F\,,$$

where we used the expression of the derivative,

$$\frac{\D m}{\D T} = -\frac{ \frac{\D g}{\D T} }{ \frac{\D g}{\D m} } \,,\quad g = m - \tanh\left( \frac{Jm/2 + B}{T} \right)\,.$$

The susceptibility is computed using also the derivative of the implicit function $$m=m(T)$$,

$$\chi = \frac{1}{T} \left[\cosh^{2}{\left (\frac{J m}{2 T} \right ) - \frac{J}{2T}}\right]^{-1}\,, \quad m = m_P,\pm m_F\,,$$

at $$B=0$$.

Magnetization and susceptibility as a function of the temperature ($$B=0$$). A phase transition occurs at $$T=T_c$$ between a height temperature disordered state $$m=0$$ (paramagnetic) and a low temperature ordered state $$m \ne 0$$ (ferromagnetic); at the transition temperature the susceptibility diverges.

The specific heat (at zero magnetic field),

$$C = \frac{\partial E}{\partial T} = -\frac{NJ}{2} \frac{\D m^2}{\D T}$$

presents a discontinuity at the critical temperature. This behavior is specific of the mean field approximation, more realistic models give a divergence of the form,

$$C \sim c_\pm |T-T_c|^{-\alpha}$$

characterized by the exponent $$\alpha$$.

Specific heat capacity of the ferromagnet as a function of the temperature; at the critical temperature it has a jump of $$3$$. In the paramagnetic state the specific heat of the magnet vanishes.

The two dimensional ising model

Second order phase transitions arise in magnetic materials, superfluids, superconductors, liquid crystals, and solid allows; although microscopically different, they are described by the same critical exponents: they are examples of order-disorder transitions.

The study of critical properties of physical systems near a phase transition relies, for a large part, on numerical simulation:

• Monte Carlo methods: allow the investigation of (classical and quantum) equilibrium systems.
• Kinetic Monte Carlo: suitable for nonequilibrium systems
• Molecular dynamics: used in soft matter (liquids, polymers)

Monte Carlo methods are based on a Markovian process, they reject or retain a given modification in the state of a system at each step, provided the change optimize some suitable functional (the energy, for a mechanical system; the Gibbs distribution, for a thermodynamic system)

The dynamics of weakly nonequilibrium systems, well approximated by a Markovian process, or systems relaxing towards the equilibrium, is described by a master equation. It gives the probability $$P$$ that a system $$S$$ be at state $$s$$ at time $$t+1$$ given its state at $$t$$ is the same $$s$$ or other possible configuration $$s'$$,

$$P(s,t + 1) - P(s,t) = \sum_{s'}\big[ T(s' \rightarrow s) P(s',t) - T(s \rightarrow s') P(s,t) \big]$$

where $$T$$ is the transition probability between states $$s$$ and $$s'$$, not necessarily equivalent in the two directions. The sum is over all possible configurations of the system, $$s' \ne s$$. At the stationary state the right hand side must vanish. A sufficient condition is,

$$T(s' \rightarrow s) P(s') = T(s \rightarrow s') P(s)\,,$$

which is called detailed balance

The Metropolis method, uses the thermodynamic equilibrium Gibbs distribution as the stationary probability distribution,

$$P(s) = \frac{ \E^{-\beta E(s)} }{Z}\,, \quad \beta = 1/T$$

($$\beta$$ is the usual notation of the inverse temperature). It is convenient to write the transition probability in the form $$T(s \rightarrow s') = w_s A_{ss'}$$, where:

• $$w$$ is the trial step probability, for the ising system this is the probability to choose a random site in the lattice and change its spin
• and $$A$$ is the acceptance probability
$$\frac{A_{ss'}}{A_{s's}} = \frac{P(s')}{P(s)} = \E^{\beta E(s) - \beta E(s')}$$
one has,
$$\frac{T(s \rightarrow s')}{T(s' \rightarrow s)} = \frac{w_{s}}{w_{s'}} \frac{A_{ss'}}{A_{s's}}= \frac{P(s')}{P(s)}$$
where we assumed symmetric trials $$w_{s}= w_{s'}$$.

The metropolis algorithm proceeds in two steps: given a configuration $$s$$

• we choose a new configuration $$s'$$ with probability $$w_{s}$$
• if the probability of this configuration satisfies $$P(s') > P(s)$$ then we accept the new configuration
$$A_{ss'} = 1,\ \text{if } P(s') \ge P(s)$$
otherwise, we put
$$A_{ss'} = \frac{P(s')}{P(s)} ,\ \text{if } P(s') < P(s)$$
and accepts $$s'$$ with probability $$A_{ss'}$$, in summary:
$$A_{ss'} = \min[1, P(s')/P(s)]$$

This algorithm ensures that the detailed balance condition is satisfied and that the asymptotic, stationary, probability distribution is the Gibbs distribution at the given temperature.

In the metropolis algorithm only one spin at each step is reversed; near the transition, where the spins are in large patches having the same orientation (clusters), the rejection probability is large. To remedy at this, simultaneous reversal of many spins is much more efficient. This is the idea of the Wolff cluster algorithm.

At variance to the metropolis algorithm which supposed the trial probability independent on the configuration, let us assume that $$w_s \ne w_{s'}$$. The condition of detailed balance becomes,

$$w_s A_{ss'}P(s) = w_{s'} A_{s's}P(s')$$

For the construction of the cluster we must specify in addition to the Gibbs weights, the rules of accepting or rejecting the configuration.

Let us consider a $$s=1$$ cluster $$C$$; there are $$n_1$$ pairs $$(1,1)$$ and $$n_2$$ pairs $$(1,-1)$$ at its border $$\partial C$$. The contribution of the border to the energy is

$$E_{\partial C} = n_1 - n_2$$

(in units of the exchange constant $$J=1$$). The gibbs probability of the $$s$$ spin configuration, is then

$$P(s) \sim \E^{-\beta(n_1-n_2)}$$

If $$p$$ is the probability to add a site to the cluster, we can assume the form trial probability associated to $$s$$, to be

$$w_{s} \sim (1-p)^{n_2}$$

which gives the a priori probability to stop growing the cluster $$s$$ whose spins will be reversed (leading to a new configuration $$s'$$). Therefore, using similar rules to go back to the configuration $$s$$ from $$s'$$, the acceptance probability is given by the rule,

$$A_{ss'} = \min{ \left[1, \frac{\E^{-\beta(n_2-n_1)}}{\E^{-\beta(n_1-n_2)}} \frac{(1-p)^{n_1}}{(1-p)^{n_2}} \right] } = 1,\ \text{if } p=1-\E^{2\beta}$$

this means that with this special value of $$p$$, once the cluster is formed, we reverse it with probability $$1$$. It is the existence of this special value of $$p$$, leading to full acceptance, that makes the algorithm particularly performant.

Numerical computation

The ising model in a square lattice of size $$L$$,

$$H=-\sum_{\langle x,y \rangle} s_x s_y\,, x,y = 0,1,\ldots, (L-1)^2$$

(with $$J=1$$ the energy unit) was exactly solved by Onsager (1944). It undergoes a ferromagnetic transition at the temperature $$T_c = 2/\log(1+\sqrt{2})$$. The magnetization per site $$m=\sum_x s_x/L^2$$ is near $$1$$ in the low temperature ferromagnetic state, and near $$0$$ in the high temperature paramagnetic state. At the transition point the heat capacity

$$c_V\approx \log|1-T/T_c|$$

has a logarithmic cusp and the susceptibility

$$\chi \sim |1-T/T_c|^{-\gamma}$$

diverges as a power law with a characteristic exponent $$\gamma = 7/4$$. The magnetization is given by the formula,

$$m(T) = \left[1 - \sinh^{-4}\frac{2}{T} \right]^{1/8}$$

which gives, near the transition, also a power law with characteristic exponent $$\beta=1/8$$ (the mean field gives $$\beta=1/2$$).

We use the monte carlo method to investigate the statistical properties of the ising system; here we gives, as an example, the two dimensional routines of the metropolis and cluster algorithms.

#
# Metropolis algorithm
#
# Output:
#   s:  spin lattice configuration
#   M:  total magnetization
#   E:  total energy
def metropolis(s, beta, M, E):
L = shape(s)[0]
it = 1
while it < L**2:
i = choice(L)
j = choice(L)
# compute energy required to flip spin
dE = s[(i+1)%L,j] + s[(i-1)%L,j] + \
s[i,(j+1)%L] + s[i,(j-1)%L]
dE *= 2.0*s[i,j]
# Metropolis algorithm to see if we should accept trial
if (dE <= 0.0) or (random.random() <= exp(-beta*dE)):
# accept trial: reverse spin; return dE and dM
s[i,j] *= -1
M += 2.0*s[i,j]
E += dE
it += 1
return (s, M, E)

#
# Cluster algorithm
#
def wolff(s, kT):
"""
W. Krauth, Statistical Mechanics: Algorthms and methods
http://www.smac.lps.ens.fr/index.php/Python_program
#
Input:
lattice s
temperature kT (in units of J)
Output:
s, N_cluster
"""
p = 1.0 - exp(-2/kT)
L = shape(s)[0]
(x, y) = (randint(0,L-1), randint(0,L-1))
Pocket = [(x, y)]
Cluster = [(x, y)]
while Pocket != []:
(x, y) = Pocket[choice(range(len(Pocket)))]
neighbors = [(x, (y+1)%L), ((x+1)%L, y),
(x, (y-1+L)%L), ((x-1+L)%L, y)]
for site in neighbors:
if s[site] == s[(x,y)] and site not in Cluster \
and uniform(0,1) < p:
Pocket.append(site)
Cluster.append(site)
Pocket.remove((x,y))
for site in Cluster: s[site] = - s[site]
return s

The figures below show magnetization snapshots of the two phases and at the transition.

Magnetization distribution of a 2D ising lattice below, at, and above the critical temperature, $$T_c \approx 2.269$$ (or $$\beta_c=0.4407$$). The critical states characterizes by the existence of large clusters of ferromagnetic domains, randomly distributed on the lattice.

We can also compute the thermodynamic quantities, and observe their singular behavior at the transition. A quantitative comparison with the Onsager formulas can be made. In addition, the method can of course be generalized to take into account an external field, or to go to larger dimensions. In the three dimensional lattice (cubic lattice), the exponent characterizing the vanishing of the magnetization in the paramagnetic state is $$\beta \approx 0.326$$.

Magnetization, energy and heat capacity as a function of the temperature for the 2D ising model, from cluster monte carlo simulations. The heat capacity is shown in the region of the phase transition in a logarithmic scale. The three set of data correspond to $$L=20$$ (red), $$L=64$$ (gray), and $$L=128$$ (black), to emphasize the finite size effect on the singularities present at the thermodynamic limit. The vertical line shows the critical temperature $$T_c=2.269$$.

Notes

1. Barabási, A. L. and Stanley, H. E., Fractal Concepts in Surface Growth (Cambridge, 1995)

2. Barrat, A., Barthélemy, M., and Vespignani, A., Dynamical Processes in Complex Networks (Cambridge, 2008)

3. Krapivsky, P., Redner, S., and Ben-Naim, E., A Kinetic View of Statistical Physics (Cambridge, 2010)


text:
# Effect of adding two per share quantities

1. Nov 10, 2010

### musicgold

Hi,

Please see the attached document.
In a simple calculation, I am trying to add the cash flow per share of two companies. I think I am doing something wrong as I am not able to reconcile the results of this calculation to the actual results. Can you please take a look?

Thanks,

MG.

#### Attached Files:

• ###### Scan001.PDF
File size:
23.4 KB
Views:
35
2. Nov 11, 2010

### HallsofIvy

Staff Emeritus
"Per shares" is an average, the total cash flow divided by the number of shares. In general adding two averages is only sensible if they are averaged over the same thing. Without knowing the total number of shares in each case, addin "per share" information does not give you any useful quantity.

3. Nov 11, 2010

### musicgold

HallsofIvy,

Thanks a lot. That is a great catch. So my mechanics was right but the logic was wrong.

1. I think I can get rid of that problem by adding gross amounts first and then calculating the per share amount. Is that correct?

2.
I understand what you mean here. The same problem occurs when we try to calculate the average of speed by simply averaging two speeds.
However I don't really understand what you mean by "over the same thing". Do you mean to say that both average calculations should have the same denominator? Can you give an example?

4. Nov 16, 2010

### HallsofIvy

Staff Emeritus
By "averaged over the same thing", I mean with the same denominator.

Suppose company A "per share cash flow" is $5 per share and company B's is$7 per share. IF they are both based on, say, n shares, that is saying that company A's total cash flow was 5n dollars and B's is 7n dollars. They have a total of 5n+ 7n= 12n cash flow based on 2n dollars- the average is 12n/2n= 6 which is the average of 5 and 7.

But suppose A's is based on 1000 shares while B's is based on 2000 shares. Then A's total cash flow is $5000 and B's is$14000 for a total of \$19000 based on 3000 shares- the average cash flow of both together is 19000/3000= 6.333, closer to B since B has the larger number of shares and carries more "weight" in the calculation.

(That is, in fact, a "weighted" average.)

5. Nov 16, 2010

### musicgold

HallsofIvy,

Thanks a lot.


text:
# What does \/ do?

I've seen this in some tex file where a word is set in italics, but its ending is in regular font. Trying it out I don't see it making any difference, so I must be missing something. What does the \/ do?

a mwe:

\documentclass{article}
\begin{document}

so many \textit{test}\/s

so many \textit{test}s

\end{document}

• \textit already inserts the \/. You should compare the output with {\itshape test}s to see the difference. – Ulrike Fischer Mar 3 '15 at 11:29

The primitive command \/ adds the italic correction, that's necessary when two “clashing” fonts are used, separated by a space or not. The clashing may be due from the first font being italic or boldface and the second font being upright (but also in other cases).
High level commands such as \textit and \textbf automatically add the italic correction, so your explicit \/ does nothing.


text:
Chapter 6, Problem 45AT

### Contemporary Mathematics for Busin...

8th Edition
Robert Brechner + 1 other
ISBN: 9781305585447

Chapter
Section

### Contemporary Mathematics for Busin...

8th Edition
Robert Brechner + 1 other
ISBN: 9781305585447
Textbook Problem

# An insurance adjuster for UPS found that 12% of a shipment was damaged in transit. If the damaged goods amounted to $4,870, what was the total value of the shipment? To determine To calculate: The total value of shipment, if there was 12% defects found in transit of a shipment by an insurance adjuster for UPS and if the total amount of defected goods was$4,870.

Explanation

Given Information:

There was 12% defects found in transit of a shipment by an insurance adjuster for UPS and if the total amount of defected goods was $4,870. Formula used: Step1: Recognize the two known values and the unknown value. Step2: Pick the formula that solves the unknown value. Step3: Solve the equation by putting the known values for the letters in the formula. Calculation: Value of rate is R=12% as rate is the term having % sign and the value of portion is P=$4,870 as it is the part of the whole and the unique characteristic of portion is that the amount of “defected goods” was \$4,870.

Here the missing value is base as base is the whole amount and here the total value of shipment is unknown.

The formula to compute the base is P=R×B

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started


text:
HomeEnglishClass 12MathsChapterReal Functions

The function f(x) = 3^(sin^(2)...

# The function f(x) = 3^(sin^(2)pi + sin^(4) pi x + x-[x]) where [x] denotes the greatest interger less than or equal to x, is

Updated On: 17-04-2022

Get Answer to any question, just click a photo and upload the photo
and get the answer completely free,

Text Solution

a periodic function with period 1 a periodic function with period 2 a periodic function with period  (1)/(2) not a periodic function

We have
 sin^(2) pi x + sin^(4) pi x
 =(1)/(2) {1-cos 2 pi x} +(1)/(8) {3-4 cos 2 pi x + cos 4 pi x}
 =(7)/(8) - cos 2 pi x +(1)/(8) cos 4 pi x
 Clearly, it is a peridic function equal to LCMof
 (2pi)/(2pi) and (2pi)/(4) i.e., 1.
 Also, x - [x] is periodic with period 1.
 Hence, f(x) is periodic with period 1.


text:
1. ## Bernoulli parameter expectation

I think I'm missing something simple, but how do you get from equation 24 to 25?

Thanks!

2. Yes, it looks a little... nonobvious.

The easiest thing is to immediately apply the Binomial theorem: $\displaystyle \displaystyle p\sum_{n=0}^N{N\choose n}p^n(1-p)^{N-n}=p(p+1-p)^N=p$. Maybe they factored $\displaystyle (1-p)^N$ first: $\displaystyle \displaystyle\sum_{n=0}^N{N\choose n}p^n(1-p)^{N-n}=(1-p)^N\sum{N\choose n}\left(\frac{p}{1-p}\right)^n=(1-p)^N\left(1+\frac{p}{1-p}\right)^N=$$\displaystyle \displaystyle(1-p)^N\frac{1}{(1-p)^N}=1$.

3. yes, just pull out the p, the rest sums to one.

4. Thanks!

Since it's an expectation of p-hat, shouldn't the first p (or all the p's) be a p-hat term?

5. P is a constant, usually unknow, that's why we estimate it with a random variable... p-hat

$\displaystyle E(\hat p)=p$ and we like that p-hat is unbiased for p.


text:
# Movie Recommendations (Part 1)

Posted by Christopher Mertin on January 15, 2017 in Project • 8 min read

The user ratings for this project were downloaded from the MovieLens Dataset, and the older MovieLens 100K Dataset was chosen. This data set consists of 100,000 ratings from 1,000 users on 1,700 movies.

This code can be used on the larger 1 million data set, though computational costs would be much larger, and running on Amazon’s Elastic MapReduce (EMR) would be more expensive and take longer. However, the results should be more accurate.

## Building the Recommendation System

For using MapReduce, we can use the module mrjob, and we need to import the sqrt function for the distance calculation that we’re using for calculating similarities. Therefore, our software requires the following

 1 2 3 4 from mrjob.job import MRJob from mrjob.step import MRStep from math import sqrt from itertools import combinations

In order to calculate the similarities, we need to have a multi-step MapReduce system. itertools.combinations is useful to get all the possible combinations of users that have rated Movie 1 and Movie 2.

We also need a class for our program, which starts as the Following

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 class MovieRecommendation(MRJob): def configure_options(self): super(MovieRecommendation, self).configure_options() self.add_file_option("--items", help="Path to u.item") def load_movie_names(self): self.movieNames = {} with open("u.item", encoding="ascii", errors="ignore") as f: for line in f: fields = line.split('|') self.movieNames[int(fields[0])] = fields[1] def cosine_similarity(self, ratingPairs): numPairs = 0 sum_xx = sum_yy = sum_xy = 0 for ratingX, ratingY in ratingPairs: sum_xx += ratingX * ratingX sum_yy += ratingY * ratingY sum_xy += ratingX * ratingY numPairs += 1 numerator = sum_xy denominator = sqrt(sum_xx) * sqrt(sum_yy) score = 0 if (denominator): score = (numerator / (float(denominator))) return (score, numPairs)

The function configure_options reads in the configuration settings, as the file u.item stores all the movies such that it has the movie ID and the movie name. This will be useful later as the u.data holds the user ID, movie ID, and the corresponding rating the user gave for that movie. These files are pipe delimited.

load_movie_names creates a dictionary on each hadoop system where it translates the movie IDs to the movie names. This is used to make the output more human readable at the end of the computation.

Finally, the cosine similarity is defined as

$$\cos(\theta) = \frac{\mathbf{A}\cdot\mathbf{B}}{\left|\left|\mathbf{A}\right|\right|_{2}\left|\left|\mathbf{B}\right|\right|_{2}}$$

The reason the cosine similarity was used is that it is very resistant to noise. While there’s no way to add a bias to offset people who are known for rating movies as more positive or negative than the average user, this cosine distance will help somewhat. However, we are able to take care of this bias in the later implementation with a Recurrent Neural Network (RNN) in Part 2.

The cosine similarity maps the similarity into the domain $$[0,1]$$, where “$$0$$” is for a combination not very similar, and “$$1$$” is for a more similar relationship.

In order to build our recommendation system, we need a mutli-step MapReduce. We can do it in 3 steps, which are defined as

1. Step 1
• Map: Maps the input of the user ratings into a pair such as UserID, (MovieID, rating) for each user
• Reduce: Reduces the previous mapper function into a list such that it’s in the form of UserID, [(movie-1, rating-1), (movie-2, rating-2), ..., (movie-N, rating-N)] for all $$N$$ movies rated by each user.
2. Step 2
• Map: Find every pair of movies each user has seen and create all possible combinations for each of the users.
• Reduce: Compute cosine similarity for each pair, yielding moviePair, (score, numPairs).
3. Step 3
• Map: Shuffle the results so we have the key-value pair being (movie1, score), (movie2, n) using the actual movie names, allowing for better sorting, where n is the number of overlapped ratings between movie1 and movie2.
• Reduce: Output the results in the form movie1, (movie2, score, n).

The code for each of these steps can be found below with a more thorough description of each step.

  1 2 3 4 5 6 7 8 9 10 11 # Step 1 def mapper_parse_input(self, key, line): (userID, movieID, rating, timestamp) = line.split('\t') yield userID, (movieID, float(rating)) def reducer_ratings_by_user(self, user_id, itemRatings): ratings = [] for movieID, rating in itemRatings: ratings.append((movieID, rating)) yield user_id, ratings

In step 1, the mapper function just removes the timestamp from the input and maps it so that the key is the UserID. The reducer simply takes the value in the key-value pair and makes it a list of values. This list is useful so that we can know all the movies that the user rated, which is important for finding all the combinations in Step 2.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # Step 2 def mapper_create_item_pairs(self, user_id, itemRatings): for itemRating1, itemRating2 in combinations(itemRatings, 2): movieID1 = itemRating1[0] rating1 = itemRating1[1] movieID2 = itemRating2[0] rating2 = itemRating2[1] yield (movieID1, movieID2), (rating1, rating2) yield (movieID2, movieID1), (rating2, rating1) def reducer_compute_similarity(self, moviePair, ratingPairs): score, numPairs = self.cosine_similarity(ratingPairs) if (numPairs > 50 && score > 0.95): yield moviePair, (score, numPairs)

Step 2 is where the actual similarity computation takes place. The mapper function creates the key-value pair of each combination of each movie that a user rated. This is the largest computational bottleneck in the entire process as not only is the communication large but it is also computationally $$\mathcal{O}(n^2)$$.

The reducer computes the similarity between all the pairs of movie ratings, though it bounds the output by the if statement. The if statement bounds it such that the similarity score has to be greater than $$0.95$$ and there had to have been more than 50 combinations of the ratings between the movie pairs. This is to reduce the amount of the output and to ensure that there is some “minimum” quality bounding the output. Only outputting the most similar computed movies.

  1 2 3 4 5 6 7 8 9 10 11 12 # Step 3 def mapper_sort_similarities(self, moviePair, scores): score, n = scores movie1, movie2 = moviePair yield (self.movieNames[int(movie1)], score), \ (self.movieNames[int(movie2)], n) def reducer_output_similarities(self, movieScore, similarN): movie1, score = movieScore for movie2, n in similarN: yield movie1, (movie2, score, n)

Step 3 is not very intensive as it is mostly the “cleanup step.” The mapper function simply shuffles the data around so it is in the key-value pair (movie1, score), (movie2, n), where n is the number of users that rated both movie1 and movie2.

The reason this is done is so that in the reducer we can simply output all of the combinations of movie1 and movie2 sequentially over all values of movie2 for movie1.

It’s important to note that this is symmetric so all ratings for a combination between the pair (movie1, movie2) are the same as for (movie2, movie1). This is done to make lookup easier by just looking at the first value.

  1 2 3 4 5 6 7 8 9 10 def steps(self): return [ MRStep(mapper=self.mapper_parse_input, reducer=self.reducer_ratings_by_user), MRStep(mapper=self.mapper_create_item_pairs, reducer=self.reducer_compute_similarity), MRStep(mapper=self.mapper_sort_similarities, mapper_init=self.load_movie_names, reducer=self.reducer_output_similarities) ]

Finally, we need to tell mrjob the order to run the steps which is done with the function above. Finally, in our main, we can run the above class by having the code MovieRecommendation.run().

To run our program, we can run it in a few configurations. For example, to use it with Amazon’s Elastic MapReduce we need to setup the configuration file as defined here. Below is how to run our program for each configuration.

1. Run Locally:
• python MovieRecommendation.py --items=ml-100k/u.item ml-100k/u.data > movie_rec.txt
2. Run on single EMR Node:
• python MovieRecommendation.py -r emr --items=ml-100k/u.item ml-100k/u.data
3. Run on 4 EMR Nodes:
• python MovieRecommendation.py -r emr --num-ec2-instances=4 --items=ml-100k/uitem ml-100k/u.data

The output on this dataset can be found here. We can look at some of the results to compare our recommendation system to see if it makes sense. I decided to pull out 3 examples to check if their similarity makes sense. This can be seen in the table below.

Movie 1 Movie 2 Score n
Star Wars (1977) Empire Strikes Back, The (1980) 0.990 345
Star Wars (1977) Aliens (1986) 0.967 259
Top Gun (1986) Apollo 13 (1995) 0.962 204

The above groupings and similarity scores make a lot of sense in the movies being similar to each other. From this we can see that the movie recommendation system seems to be quite accurate.

Finally, we can take the output movie_rec.txt and convert it into a sorted json file for ease of reading. The first key is sorted alphabetically, while the second key is sorted by the Score.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 import ast import json import collections def ReadFile(filename): data = {} lines = [line.rstrip('\n') for line in open(filename)] for idx, line in enumerate(lines): mov1 = ast.literal_eval(line.split('\t')[0]) data[mov1] = {} for idx, line in enumerate(lines): mov1 = ast.literal_eval(line.split('\t')[0]) mov2 = ast.literal_eval(line.split('\t')[1]) data[mov1][mov2[0]] = {} for idx, line in enumerate(lines): mov1 = ast.literal_eval(line.split('\t')[0]) mov2 = ast.literal_eval(line.split('\t')[1]) data[mov1][mov2[0]]["Score"] = mov2[1] data[mov1][mov2[0]]["N"] = mov2[2] data = collections.OrderedDict( [(k, collections.OrderedDict( sorted(v.items(), key=lambda pair: pair[1]["Score"], reverse=True))) for k, v in sorted(data.items())]) return data file_in = "movie_rec.txt" movie_scores = ReadFile(file_in) with open("movies.json", 'w') as fp: json.dump(movie_scores, fp, indent=4)

This will save it as a sorted json file. With the help of a little bit of javascript, I wrote a small webapp where you can select one of the movies in the list and get a list of movies that are the most similar.

Note: It’s important to notice that this was done with the small dataset with a very simple heuristic. Therefore, some of the movie similarities will be off, for example 101 Dalmatians being similar to The Hunt for Red October. However, there is a verifiable structure in this, for example if you look up for Star Wars, other films from the same franchise are recommended.

Even though there are some irregularities, and this could be made better with the larger data set, one factor that should be realized is the larger value of $$n$$, the more likely the movies are to be similar to one another. If this code was used with the larger dataset, it would be important to tweak the threshold in the reducer in Step 2 playing with factors such as the threshold for the Cosine Distance, and also - but most importantly, the threshold for $$n$$.

Choose Movie:

MovieScoren


text:
# Fun with Integration

$\int_0^1 \left(1-x^2\right)^9 x^9 \, dx$

Let $I$ denote the value of the integral above. What is the sum of digits of $I^{-1}?$

×


text:
# Search by Topic

#### Resources tagged with Working systematically similar to Squayles:

Filter by: Content type:
Age range:
Challenge level:

### There are 127 results

Broad Topics > Using, Applying and Reasoning about Mathematics > Working systematically

### Twinkle Twinkle

##### Age 7 to 14 Challenge Level:

A game for 2 people. Take turns placing a counter on the star. You win when you have completed a line of 3 in your colour.

### Weights

##### Age 11 to 14 Challenge Level:

Different combinations of the weights available allow you to make different totals. Which totals can you make?

### Colour Islands Sudoku

##### Age 11 to 14 Challenge Level:

An extra constraint means this Sudoku requires you to think in diagonals as well as horizontal and vertical lines and boxes of nine.

### Magic Potting Sheds

##### Age 11 to 14 Challenge Level:

Mr McGregor has a magic potting shed. Overnight, the number of plants in it doubles. He'd like to put the same number of plants in each of three gardens, planting one garden each day. Can he do it?

### More Magic Potting Sheds

##### Age 11 to 14 Challenge Level:

The number of plants in Mr McGregor's magic potting shed increases overnight. He'd like to put the same number of plants in each of his gardens, planting one garden each day. How can he do it?

### First Connect Three

##### Age 7 to 14 Challenge Level:

Add or subtract the two numbers on the spinners and try to complete a row of three. Are there some numbers that are good to aim for?

### Number Sandwiches

##### Age 7 to 14 Challenge Level:

Can you arrange the digits 1, 1, 2, 2, 3 and 3 to make a Number Sandwich?

##### Age 11 to 14 Challenge Level:

A few extra challenges set by some young NRICH members.

### Number Daisy

##### Age 11 to 14 Challenge Level:

Can you find six numbers to go in the Daisy from which you can make all the numbers from 1 to a number bigger than 25?

##### Age 11 to 14 Challenge Level:

Rather than using the numbers 1-9, this sudoku uses the nine different letters used to make the words "Advent Calendar".

### Window Frames

##### Age 5 to 14 Challenge Level:

This task encourages you to investigate the number of edging pieces and panes in different sized windows.

##### Age 11 to 14 Challenge Level:

You need to find the values of the stars before you can apply normal Sudoku rules.

### American Billions

##### Age 11 to 14 Challenge Level:

Play the divisibility game to create numbers in which the first two digits make a number divisible by 2, the first three digits make a number divisible by 3...

### Twin Corresponding Sudokus II

##### Age 11 to 16 Challenge Level:

Two sudokus in one. Challenge yourself to make the necessary connections.

### Pole Star Sudoku

##### Age 14 to 18 Challenge Level:

A Sudoku based on clues that give the differences between adjacent cells.

##### Age 11 to 16 Challenge Level:

Four numbers on an intersection that need to be placed in the surrounding cells. That is all you need to know to solve this sudoku.

### Summing Consecutive Numbers

##### Age 11 to 14 Challenge Level:

15 = 7 + 8 and 10 = 1 + 2 + 3 + 4. Can you say which numbers can be expressed as the sum of two or more consecutive integers?

### Games Related to Nim

##### Age 5 to 16

This article for teachers describes several games, found on the site, all of which have a related structure that can be used to develop the skills of strategic planning.

### Factor Lines

##### Age 7 to 14 Challenge Level:

Arrange the four number cards on the grid, according to the rules, to make a diagonal, vertical or horizontal line.

### More on Mazes

##### Age 7 to 14

There is a long tradition of creating mazes throughout history and across the world. This article gives details of mazes you can visit and those that you can tackle on paper.

### Product Sudoku

##### Age 11 to 14 Challenge Level:

The clues for this Sudoku are the product of the numbers in adjacent squares.

### Isosceles Triangles

##### Age 11 to 14 Challenge Level:

Draw some isosceles triangles with an area of $9$cm$^2$ and a vertex at (20,20). If all the vertices must have whole number coordinates, how many is it possible to draw?

### Diagonal Product Sudoku

##### Age 11 to 16 Challenge Level:

Given the products of diagonally opposite cells - can you complete this Sudoku?

### Cuboids

##### Age 11 to 14 Challenge Level:

Find a cuboid (with edges of integer values) that has a surface area of exactly 100 square units. Is there more than one? Can you find them all?

### Corresponding Sudokus

##### Age 11 to 18

This second Sudoku article discusses "Corresponding Sudokus" which are pairs of Sudokus with terms that can be matched using a substitution rule.

### Wallpaper Sudoku

##### Age 11 to 16 Challenge Level:

A Sudoku that uses transformations as supporting clues.

### Intersection Sudoku 1

##### Age 11 to 16 Challenge Level:

A Sudoku with a twist.

### Seasonal Twin Sudokus

##### Age 11 to 16 Challenge Level:

This pair of linked Sudokus matches letters with numbers and hides a seasonal greeting. Can you find it?

### Counting on Letters

##### Age 11 to 14 Challenge Level:

The letters of the word ABACUS have been arranged in the shape of a triangle. How many different ways can you find to read the word ABACUS from this triangular pattern?

### Ratio Sudoku 3

##### Age 11 to 16 Challenge Level:

A Sudoku with clues as ratios or fractions.

### Oranges and Lemons, Say the Bells of St Clement's

##### Age 11 to 14 Challenge Level:

Bellringers have a special way to write down the patterns they ring. Learn about these patterns and draw some of your own.

### Teddy Town

##### Age 5 to 14 Challenge Level:

There are nine teddies in Teddy Town - three red, three blue and three yellow. There are also nine houses, three of each colour. Can you put them on the map of Teddy Town according to the rules?

### Intersection Sudoku 2

##### Age 11 to 16 Challenge Level:

A Sudoku with a twist.

##### Age 11 to 14 Challenge Level:

How many different symmetrical shapes can you make by shading triangles or squares?

### Sociable Cards

##### Age 11 to 14 Challenge Level:

Move your counters through this snake of cards and see how far you can go. Are you surprised by where you end up?

### Inky Cube

##### Age 7 to 14 Challenge Level:

This cube has ink on each face which leaves marks on paper as it is rolled. Can you work out what is on each face and the route it has taken?

##### Age 11 to 14 Challenge Level:

If you take a three by three square on a 1-10 addition square and multiply the diagonally opposite numbers together, what is the difference between these products. Why?

### Pair Sums

##### Age 11 to 14 Challenge Level:

Five numbers added together in pairs produce: 0, 2, 4, 4, 6, 8, 9, 11, 13, 15 What are the five numbers?

### Twin Corresponding Sudoku III

##### Age 11 to 16 Challenge Level:

Two sudokus in one. Challenge yourself to make the necessary connections.

### Multiples Sudoku

##### Age 11 to 14 Challenge Level:

Each clue in this Sudoku is the product of the two numbers in adjacent cells.

### 9 Weights

##### Age 11 to 14 Challenge Level:

You have been given nine weights, one of which is slightly heavier than the rest. Can you work out which weight is heavier in just two weighings of the balance?

### Football Sum

##### Age 11 to 14 Challenge Level:

Find the values of the nine letters in the sum: FOOT + BALL = GAME

### Twin Corresponding Sudoku

##### Age 11 to 18 Challenge Level:

This sudoku requires you to have "double vision" - two Sudoku's for the price of one

### Medal Muddle

##### Age 11 to 14 Challenge Level:

Countries from across the world competed in a sports tournament. Can you devise an efficient strategy to work out the order in which they finished?

### Diagonal Sums Sudoku

##### Age 7 to 16 Challenge Level:

Solve this Sudoku puzzle whose clues are in the form of sums of the numbers which should appear in diagonal opposite cells.

### Latin Lilies

##### Age 7 to 16 Challenge Level:

Have a go at this game which has been inspired by the Big Internet Math-Off 2019. Can you gain more columns of lily pads than your opponent?

### Ones Only

##### Age 11 to 14 Challenge Level:

Find the smallest whole number which, when mutiplied by 7, gives a product consisting entirely of ones.

### Cayley

##### Age 11 to 14 Challenge Level:

The letters in the following addition sum represent the digits 1 ... 9. If A=3 and D=2, what number is represented by "CAYLEY"?

### Tetrahedra Tester

##### Age 11 to 14 Challenge Level:

An irregular tetrahedron is composed of four different triangles. Can such a tetrahedron be constructed where the side lengths are 4, 5, 6, 7, 8 and 9 units of length?

### Two and Two

##### Age 11 to 14 Challenge Level:

How many solutions can you find to this sum? Each of the different letters stands for a different number.


text:
## Exponential Decay of Radioactive and other substances

In this first chart, we have a radioactive substance with a half life of 5 years. As you can see, the substance initially has 100% of its atoms, but after its first half life (5 years) only 50% of the radioactive atoms are left.

That's what 'half life' means. Literally, half of the substance is gone every five years (the half life of this particular substance).

So, in our example , after the second life is over (that's 10 years since each half life is 5 years), there will be $$\frac 1 2$$ of $$50\%$$ of the substance left, which, of course is $$25 \%$$.

And the pattern continues, every 5 years another half life reduces the substance by $$\frac 1 2$$, so after the the third life is over ( the 15 year mark), there will be $$\frac 1 2$$ of $$25\%$$ of the substance left , which is $$12.5 \%$$.

### General Formula of Half Life

As you can might be able to tell from Graph 1,Half life is a particular case of exponential decay. One in which 'b' is $$\frac 1 2$$.

So, generally speaking, half life has all of the properties of exponential decay.

### Specific, Real, Examplesof Half Life

Example 1

Iodine-131 is a radioactive substance and has a pretty short half life of only 8 days. Graph 3, below, represents the graph of its half life.

If 30 grams is given to a patient, then, how much of the substance is left after 8 days?

Since 8 days is 1 half life, we just multiply the starting amount by $$\frac 1 2$$

$$\text{30 grams} \cdot \frac 1 2 = \text{ 15 grams }$$

You can see, on Graph 3, that 1 half life is the point (1,15).

How much is left after 16 days

Since 16 days is 2 half lives, we just mulitply, the last value of 15 by $$\frac 1 2$$ to get 7.5

### What does half life mean on a graph?

Well, if the half life is '3 years' how does that relate to the graph?

What if the half life is '4 minutes' ?

In short, the half life tells us the scale of the graph.

If the half life is '3 years', then each tick mark on the graph represents 3 years.

On the other hand, if the half life is '4 minutes', then each tick mark on the graph represents 4 minutes .

### Ultimate Math Solver (Free)

Free Algebra Solver ... type anything in there!


text:
# [texhax] fancyhdr.sty

mr at xosoftware.dk mr at xosoftware.dk
Fri Jan 16 18:45:24 CET 2004

First, thank you to Fairbairns and everyone
else for quick response and valuable advice.
It is very much appreciated.
Now, I am trying to alter the pagenumbering
using fancyhdr.sty. I do the following:

\usepackage{fancyhdr}

\pagestyle{fancy}
..
\textwidth=103mm
\textheight=177mm
\fancyfoot[LE,RO]{\bfseries\thepage}

put get two indices of the page number on
every page. That is, I get one in the middle
and on the right/left. Also, the fancy head
is a line wider than the text. In the docs
this is described as a feature, but is it
poosible to change it to the width of the
text?
Maybe, I ought to use a different package to
get the page numbering to "the side" instead
of in the middle. I don't know.
Thank you
Martin