OpenLLM-France/wikimedia huggingface dataset:
# Haskell/Solutions/Control structures

← Back to Control structures

## case expressions

* Exercises
* Use a case statement to implement a fakeIf function which might be used as a replacement to the familiar if expressions.

## Controlling actions, revisited

* Exercises
* Redo the "Haskell greeting" exercise in Simple input and output/Controlling actions, this time using a case statement.
* What does the following program print out? And why?
* main =
* do x <- getX
* putStrLn x
* getX =
* do return "My Shangri-La"
* return "beneath"
* return "the summer moon"
* return "I will"
* return "return"
* return "again"
1.
2. Executing main will print "again". Remember that the value of a sequence of IO actions is the same as the value of the last action in the sequence. getX can also be written as:
or even shorter, as:
As a result, x in the main function has the value "again", which will then be written to the screen.
# Super Mario 64/Rainbow Ride

Location: Upper floor of castle. On the right side in a hole in the wall as you face course 14.
Description: A sky level with rainbows, magic carpets, and a flying boat.
Bob-omb Buddy: Go below the red coins (see star 4), and wall jump above the blue coin box all the way to the top. The bob-omb buddy is there.
ShortCut!!! When you start, turn around and long jump to the pole behind you. This way, you skip one hard part of the course Just For Fun: Go to the Bob-omb Buddy's right, and long jump straight out. You will land far, far below on another platform.

## Original stars
### Star 1: Cruiser Crossing The Rainbow

Ride the magic carpets up to the floating ship. You have to take the left fork when the path splits. The star is on it. FUN!

### Star 2: The Big House In The Sky

Do the same as star 1 except take the right fork. Ride all the way to the top.

### Star 3: Coins Amassed in a maze

Get all 8 red coins. Go straight from the four spinning platforms and wall jump and backflip for all the red coins.

### Star 4: Swingin' in the breeze

Go left from the four spinning platforms and follow it up to the wood slope. Climb up the slope and swing across to the star.

### Star 5: Tricky Triangles!

Go left at the four spinning platforms and go past the wood slope. Hit the flat ! switch to turn the triangles upside down. Do a triple jump on the first two to skip two of the triangles. The star is at the top.

### Star 6: Somewhere Over The Rainbow

Get to the floating ship (see star 1) and shoot out of the cannon through the rainbow ring. The star is on that island.

### Star 7: 100 Coins

Be sure to get all the blue coins where the Bob-omb buddy is. Also get the red coins. Don't even bother going up towards star 1 and 2. Go towards star 4 and 5 for the rest of the coins.
# Slav Defence
### 3.Nf3

With the most common move in the Slav, 3.Nf3, White develops their knight and exerts more control over the e5-square. Similar to 3.Nc3, black should avoid 3...Bf5 as 4. cxd5 cxd5 5. Qb3 effectively wins a pawn. However, unlike 3.Nc3, 3...dxc4 should also be avoided as white is better after 4. e3 and 5. a4 since white will win back the pawn as the Knight on f3 is not vulnerable to a b5-b4 pawn push. As such, black only has 2 main responses.
3...Nf6 is Black's by far Black's most common reply, and play from white typically transposes into a semi-slav with 4. Nc3, although some unique lines exist such as 4. e3 ("Slow Slav") where Nc3 is delayed or not played at all.
3...e6 is occasionally seen, and play typically transposes back to 3...Nf6 variations, with some exceptions.
3...a6 is also a solid option for black, albeit rarely seen. Play typically transposes to the main line of the Chebanenko variation of the slav, although white can opt for a catalan-style setup with 4. g3 instead.

## Theory table

For explanation of theory tables, see theory table and for notation, see algebraic notation. .
1. d4 d5 2. c4 c6 3. Nf3
| | 3 | 4 | 5 | 6 | 7 | Eval |
| Semi-Slav Defence | ... e6 | Nc3 Nf6 | e3 Nbd7 | Bd3 dxc4 | Bxc4 b5 | ∞ |
| | ... Nf6 | Nc3 e6 | | | | See above line |
| Slav Accepted | ... ... | ... dxc4 | a4 Bf5 | e3 e6 | Bxc4 Bb4 | +/= |
| | ... dxc4 | e3 b5 | a4 e6 | axb5 cxb5 | b3 Bb4+ | +/− |
| | ... Bf5 | cxd5 cxd5 | Qb3 Nc6 | e4 dxe4 | Ne5 Nxe5 | +/− |
| Slav, Chebanenko | ... a6 | Nc3 Nf6 | c5 Nbd7 | Bf4 Nh5 | Bd2 Nhf6 | +/= |
When contributing to this Wikibook, please follow the Conventions for organization.

## References

* Kasparov, Garry, & Keene, Raymond 1989 Batsford chess openings 2. ISBN 0-8050-3409-9.
# Slav Defence
### 3...Nf6

Black develops a knight to f6, and puts pressure on the e4-square. From here white has multiple good responses, although 4...Bf4 and 4...Bg5 should be avoided as black can play 4...dxc4! and retain the pawn without giving white compensation.
4.Nf3 develops the White's knight to f3, increasing control over the d4 and e5 squares. Play transposes to the main line of the slav, and it is up to black to decide how to continue with many options avaliable.
4.e3 is White's most common move. It is similar in intent to 4.Nf3, as e3 usually played at one point or another in the slav, and 5. Nf3 is the next logical development move. Play typically transposes to main line slav variations with 5.Nf3, although occasionally Nf3 is delayed in favour of other developing moves such as Qc2.
4.cxd5 is occasionally played, relieving tension in the center, and play transposes to exchange slav variations.

## Theory table

For explanation of theory tables, see theory table and for notation, see algebraic notation. .
1. d4 d5 2. c4 c6 3. Nc3 Nf6
| | 3 | 4 | 5 | 6 |
| Semi-Slav Defence | Nf3 e6 | = to 3. Nf3 Nf6 4. Nc3 |
| | e3 e6 | = |
When contributing to this Wikibook, please follow the Conventions for organization.

## References

* This Chess related article is a stub. Please assist Wikibooks by expanding it.
# OpenSCAD User Manual/First Steps/Creating a simple model

For our first model, we create a simple 2×3×4 cuboid.
To get started, launch OpenSCAD. You should have a preview window, toolbar, console and editor windows open. If one is hidden you can turn it on by going to the View menu and unselect the hidden items.
To create our cuboid we use the openSCAD editor window to type a one-line command:

### Compiling and rendering our first model

The cuboid can now be compiled and rendered by pressing F5 or F6 Function key on your keyboard while the OpenSCAD editor has focus. You should now see your object in the preview window as shown above.

### See also

Next: Positioning an object
# Super Mario 64/Controls
## Nintendo 64
### Move

    Control Stick

### Jump

    Press the A button.

### Crouch

    Hold the Z button.

### Punch

    Press the B button.

### Double jump

    Press the jump button twice in a row Mario will go higher than a regular jump.

### Triple jump

    While running, press the jump button three times in a row. Mario will do a flip in the air. With the wing cap, the triple jump is used to start flying.

### Wall jump

    Running into the wall while in the air, press Jump again to kick off the wall. Can be done multiple times in succession.

### Crawl

    Move while crouching.

### Backflip

    Jump while crouching.

### Somersault

    Run in one direction, then push the Control Stick in the opposite direction and jump simultaneously.

### Ground pound

    Jump and press the crouch button.

### Dive

    Run and press punch to dive forward, hitting enemies and grabbing rabbits.

### Kick

    Press the punch button while jumping.

### Slide kick

    While running, press the crouch button to slide and then punch.

### Long Jump

    While running, press the crouch button to slide and then jump.
# Algebra/Chapter 1/Glossary

* digit:
* integer:
* number:
* number system:
* quantity:
# Ninety-nine Problems, Solved in Elm
## Who is this book for?

Elm is an easy to use pure functional programming language. These exercises give you a path to learn and practice functional idioms. The techniques demonstrated in this book apply to any functional programming language.
This book makes it easy to jump into programming, no installs required. You can code and test your solutions on https://ellie-app.com/new. Every problem has a unit test and a full program to test your solution. Many problems have multiple solutions, demonstrating different approaches to solving a problem.

## Who isn’t this book for?

Elm is an easy to use web development language. The problems posed in this book do not cover web specific topics. If you are comfortable with functional programming and are looking to learn how to use Elm to develop web apps and web pages, then this book is NOT for you. Try instead Evan Czaplicki’s Introduction to Elm. However there are two problems that use the Elm Architecture to handle randomness (Problem 23) and time (Problem 38).

## Where to begin

If you’re new to functional programming, start with the Learning Track. This will introduce you to the basic techniques of functional programming in a progression to help you learn through practice. If you just want to jump into the problems, start at Problems by Category.

## History of the 99 Problems

These problems are adaptations for Elm from Ninety-Nine Haskell Problems, which are adaptations of Ninety-Nine Prolog Problems developed by Werner Hett. The title is more figurative than literal. There weren’t 99 problems in the original Prolog collection. A few of the original Prolog problems don’t apply to Elm. The numbering of the problems is consistent with the other collections to ease comparisons. Other adaptations include Lisp, Scala, OCaml, Python and R.

## Testing your work

You can compile and execute the examples online at https://ellie-app.com/new.

## Learning Track

The Learning Track presents the problems in an order designed to learn functional programming building from the most basic idioms to more complex. These problems let you practice your skills before moving on to the next concept. Each step of the Learning Track presents a new technique and problems that you can solve with that technique.
Begin the Learning Track

## Problems by Category

Problems by Category

## All Problems

The problems are numbered to match the original 99 Problems in Prolog.
1 to 99

## Authors and contributors

This Wikibook has been written by:
* John Crane
# A-level Geography
## Table of Contents
### AS

AS CCEA Geography
AS AQA Geography
AS OCR Geography
AS Edexcel Geography

### A2

A2 AQA Geography
A2 OCR Geography
A2 Edexcel Geography
# A-level Philosophy

This book is for GCE Philosophy Courses.

## Board

* AQA
* AQA - Updated Specification
# Advanced Inorganic Chemistry
## Contents

* Symmetry Elements (1.1)
* Molecular Point Groups (1.2)
* Matrices (1.3)
* Representations (1.4)
* Character Tables (1.5)
* SALCs and the projection operator technique (2.1)
* Diatomic Molecular Orbitals (2.2)
* NH3 Molecular Orbitals (2.3)
* Td Molecular Orbitals (2.4)
* D4h Molecular Orbitals (2.5)
* Pi Donor and Acceptor Ligands (2.6)
* Normal Modes of Vibration (3.1)
* Selection Rules for IR and Raman Spectroscopy (3.2)
* Stretching Frequencies and Structure Determination (3.3)
* Vibrational Spectroscopy of Linear Molecules (3.4)
* Fundamentals of Electron Absorption Spectroscopy (3.5)
* Jahn-Teller Distortions (3.6)
* Definition, Importance and History of Organometallics (4.1)
* Electron Counting and the 18 Electron Rule (4.2)
* Dative ligands: CO and phosphines (4.3)
* Pi-Ligands (4.4)
* Metal-Alkyl Complexes (4.5)
* Kinetics Overview (4.6)
* Dissociative Mechanism (4.6.1)
* Associative Mechanism (4.6.2)
* Electron Transfer Reactions (4.7)
* Oxidative Addition and Reductive Elimination (4.8)
* Migratory Insertions (4.9)
* Ziegler-Natta Polymerization (4.10)
* C=M Complexes (4.11)
* Olefin Metathesis (4.12)
# Advanced Microeconomics/Utility Functions
## Utility functions

Formal analysis of choice relies upon a conception of well-being known as utility. This notion provides a real valued space in which each member of the choice set corresponds to a numerical value. A mapping from the choice set X to the real line is known as a utility function.
Utility Function: a function $u:X\rightarrow \mathbb {R}$ is a utility function representing the preference relation $\succeq$ if: $\forall x,y\in \mathbf {X} ,\quad u(x)\geq u(y)\iff x\succsim y$.
The utility function plays a foundational role in economics. However, as used in economics, the concept of utility has no measurable counterpart in the real world. Utility functions provide ordinal rankings of choices, thus the numerical value assigned to each utility level is completely arbitrary. To explicate, consider the set of possible choices $\mathbf {X} ={x,y,z}$ with preferences ${x\succ y,y\succ z,x\succ z}$ Now consider two candidate utility functions
$u_{1}(c)={\begin{cases}100&{\mbox{if }}c=x\\50&{\mbox{if }}c=y\\10&{\mbox{if }}c=z\\\end{cases}}u_{2}(c)={\begin{cases}3&{\mbox{if }}c=x\\2&{\mbox{if }}c=y\\1&{\mbox{if }}c=z\\\end{cases}}$
Notice, the functions $u_{1}(c),\quad u_{2}(c)$ each provide valid representations of the preferences defined over the choice set. However, a mental-state interpretation of utility may interpret the two functions differently. Using some crude notion of 'happiness' or 'satisfaction', $u_{1}$ suggests choice x leaves our decision maker 'twice as happy' as choice y, an interpretation $u_{2}(c)$ fails to support. In fact, any monotone transform of $u_{1},\quad g(u_{1}(c))$ represents the original preference relation but may not (usually will not) preserve cardinal relationships between utility levels. Thus, attaching a psychological interpretation to utility creates information not present in the underlying preference relation.

### Properties of Utility Functions

* Monotonicity: Utility functions exhibit weak monotonicity iff $x\geq y\Rightarrow x\succsim y$ and strong monotonicity iff $x\geq y\land x\neq y\Rightarrow x\succ y$
# Advanced Microeconomics/Demand Correspondence
## Demand Correspondence

The demand correspondence vector $x(p,w)={\begin{bmatrix}x_{1}(p,w)\\x_{2}(p,w)\\\vdots \\x_{L}(p,w)\end{bmatrix}}$ assigns a set of consumption bundles to each pair $(p,w)$. A single valued demand correspondence is a demand function.

### Assumptions on demand correspondences

* Homogeneity of degree zero: $x(\alpha p,\alpha w)=x(p,w)\;\forall p,w,\alpha >0$
* Walras's law: $p\cdot x=w\;\forall x\in x(p,w),\;p>>0,\;w>0$
Notice, the homogeneity assumption allows one argument of $x(p,w)$ to be normalized.

### Comparative Statics
#### The Engel Function

Holding the price vector constant, the demand correspondence $x(p={\bar {p}},w)$ is the Engel function. In $\mathbb {R} ^{L}$ the Engel function is known as the wealth expansion path, illustrating changes in the demand correspondence at various levels of wealth. The first derivative of the Engel function with respect to wealth for good $l$ ${\frac {\partial x_{l}({\bar {p}})}{\partial w}}$ is the wealth effect.
* for normal goods the wealth effect is nonnegative, ${\frac {\partial x_{l}({\bar {p}},w)}{\partial w}}\geq 0$
* for inferior goods the wealth effect is negative, ${\frac {\partial x_{l}({\bar {p}},w)}{\partial w}}<0$

#### Price Effects

For any two goods $l,k$ the representation of $x_{l}(p_{k},{\bar {w}})$ across all prices $p_{k}$ is the offer curve. Define the price effect of good $k$ on good $l$, ${\frac {\partial x_{l}(p_{k},{\bar {w}})}{\partial p_{k}}}$
# Advanced Microeconomics/Revealed Preferences
## Weak Axiom of Revealed Preferences

The demand function $x(p,w)$ satisfies the weak axiom of revealed preference if: $\forall (p,w),(p^{\prime },w^{\prime }){\mbox{ if }}px(p^{\prime },w^{\prime })\leq w{\mbox{ and }}x(p^{\prime },w^{\prime })\neq x({p},{w}){\mbox{ then }}p^{\prime }x({p},{w})>w^{\prime }$
In words: The consumer faced with $(p,w)$ could have chosen $\funcd{x}{p^{\prime},w^{\prime}}$ but chose $x(p,w)$, assuming the consumer chooses consistently, if $\funcd{x}{p^{\prime},\primd{w}}$ is ever chosen, $x(p,w)$ must not be affordable. Hence, $p^{\prime }\cdot x(p,w)>w^{\prime }$
# Advanced Microeconomics/Decision Making Under Uncertainty
## Decision Making Under Uncertainty
### Lotteries

A simple lottery is a tuple $(p_{1},\dots ,p_{N})$ assigning probabilities to N outcomes such that $\sum _{n=1}^{N}p_{k}=1$.
A compound lottery assigns probabilities $(\alpha _{1},\dots ,\alpha _{K})$ to one or more simple lotteries $L_{1},\dots ,L_{K}$
A reduced lottery may be calculated for any compound lottery, yielding a simple lottery which is outcome equivalent (produces the same probability distribution over outcomes) to the original compound lottery.
Consider a compound lottery over the lotteries $L_{1},\dots ,L_{K}$ each of which assigns probabilities $p_{1},\dots ,p_{N}$ to N outcomes. The compound lottery implies a probability distribution over the N outcomes which, for any outcome n, may be calculated as $\sum _{k=1}^{K}\alpha _{k}\cdot p_{n}^{k}$ In words, the probability of event n implied by a compound lottery is the probability of event n assigned by each lottery, weighted by the probability of a given lottery being chosen.

#### Example

Consider an outcome space $\{1,2,3,4,5,6,7,8,9,10\}$. A (fair) six sided dice replicates the simple lottery $\left({\frac {1}{6}},{\frac {1}{6}},{\frac {1}{6}},{\frac {1}{6}},{\frac {1}{6}},{\frac {1}{6}},0,0,0,0\right)$ and a (fair) ten sided dice replicates the simple lottery $\left({\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}},{\frac {1}{10}}\right)$
Now imagine a person randomly draws a dice from an urn known to contain nine six sided dice and one ten sided dice. This draw represents a compound lottery defined over the outcome space. The probability of any outcome $\in [1,6]={\frac {9}{10}}\cdot {\frac {1}{6}}+{\frac {1}{10}}\cdot {\frac {1}{10}}={\frac {16}{100}}$ and the probability of an outcome $\in [7,10]={\frac {9}{10}}\cdot 0+{\frac {1}{10}}\cdot {\frac {1}{10}}={\frac {1}{100}}$. Producing a reduced lottery, $\left({\frac {4}{25}},{\frac {4}{25}},{\frac {4}{25}},{\frac {4}{25}},{\frac {4}{25}},{\frac {4}{25}},{\frac {1}{100}},{\frac {1}{100}},{\frac {1}{100}},{\frac {1}{100}}\right)$

### Preferences and Uncertain Outcomes

Let $\mathbf {\mathcal {Z}}$ represent a set of possible outcomes (consumption bundles, monetary payments, et cetera) with a space of compound lotteries $\Delta \mathbf {\mathcal {Z}}$.
# Advanced Microeconomics/Monopoly Pricing

A monopolist produces a good with the demand function $q(p)$ which (by assumption) has an inverse $p(q)$ and costs given by $c(q)$. Since it supplies the entire market, the monopolist simultaneously chooses output and price. Thus, the profit maximization problem may be written two ways;
$\max _{q}q\cdot p(q)-c(q)$ $\max _{p}p\cdot q(p)-c(q(p))$
# Advanced Microeconomics/Dominance and Iterative Deletion
## Dominance

* A strategy $s_{i}$ is strictly dominant iff: $\forall s_{j}\neq s_{i}\in \mathbb {\mathcal {S}} :\quad U(s_{i},s_{-i})>U(s_{j},s_{-i})$
* A strategy $s_{i}$ is weakly dominant iff: $\forall s_{j}\neq s_{i}\in \mathbb {\mathcal {S}} :\quad U(s_{i},s_{-i})\geq U(s_{j},s_{-i})$
# Advanced Microeconomics/Repeated Games
## Repeated Games

In a repeated game players $(I=\{1,2,\dots ,n\})$ interact over $T\leq \infty$ periods. Each period represents a single iteration of the (simultaneous-move) stage game $\Gamma$ in which each player selects a strategy $s_{i}\in S_{i}=\{s_{i}^{1},s_{i}^{2}\dots \}$.

### Folk (general feasibility) Theorems

The multiplicity of strategy profiles made possible by repeated interaction translates to a wide variety of
# Advanced Microeconomics/Linear Algebra
## Cramer's Rule

For a three by three system:
${\begin{array}{c}ax+by+cz=j\\dx+ey+fz=k\\gx+hy+iz=l\\\end{array}}$ In matrix form:
${\begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}}{\begin{bmatrix}x\\y\\z\end{bmatrix}}={\begin{bmatrix}j\\k\\l\end{bmatrix}}$
$x={\frac {\begin{vmatrix}j&b&c\\k&e&f\\l&h&i\end{vmatrix}}{\begin{vmatrix}a&b&c\\d&e&f\\g&h&i\end{vmatrix}}}$ $y={\frac {\begin{vmatrix}a&j&c\\d&k&f\\g&l&i\end{vmatrix}}{\begin{vmatrix}a&b&c\\d&e&f\\g&h&i\end{vmatrix}}}$ $z={\frac {\begin{vmatrix}a&b&j\\d&e&k\\g&h&l\end{vmatrix}}{\begin{vmatrix}a&b&c\\d&e&f\\g&h&i\end{vmatrix}}}$
In general: $Ax=b$ $x_{i}={\frac {|A_{i}|}{|A|}}\;\forall i=\{1,\dots ,n\}$ Where $A_{i}$ is formed by replacing the vector associated with $x_{i}$ by the column vector b.
# Advanced Microeconomics/Homogeneous and Homothetic Functions
## Homogeneous & Homothetic Functions

For any scalar $k$ a function is homogenous if $f(tx_{1},tx_{2},\dots ,tx_{n})=t^{k}f(x_{1},x_{2},\dots ,x_{n})$ A homothetic function is a monotonic transformation of a homogeneous function, if there is a monotonic transformation $g(z)$ and a homogenous function $h(x)$ such that f can be expressed as $g(h)$
* A function is monotone where $\forall \;x,y\in \mathbb {R} ^{n}\;x\geq y\rightarrow f(x)\geq f(y)$
* Assumption of homotheticity simplifies computation,
* Derived functions have homogeneous properties, doubling prices and income doesn't change demand, demand functions are homogenous of degree 0
* The slope of the MRS is the same along rays through the origin

### Example

${\begin{aligned}Q&=x^{\frac {1}{2}}y^{\frac {1}{2}}+x^{2}y^{2}\\&{\mbox{Q is not homogeneous, but represent Q as}}\\&g(f(x,y)),\;f(x,y)=xy\\g(z)&=z^{\frac {1}{2}}+z^{2}\\g(z)&=(xy)^{\frac {1}{2}}+(xy)^{2}\\&{\mbox{Calculate MRS,}}\\{\frac {\frac {\partial Q}{\partial x}}{\frac {\partial Q}{\partial y}}}&={\frac {{\frac {\partial Q}{\partial z}}{\frac {\partial f}{\partial x}}}{{\frac {\partial Q}{\partial z}}{\frac {\partial f}{\partial y}}}}={\frac {\frac {\partial f}{\partial x}}{\frac {\partial f}{\partial y}}}\\&{\mbox{the MRS is a function of the underlying homogenous function}}\end{aligned}}$
# Algebra/Chapter 2/Solutions

b. Real, Rational, Integer c. Real, Rational, Integer, Whole d. Real, Rational e. Real, Rational f. Real, Rational g. Real, Rational h. Real, Irrational i. Real, Rational, Integer, Whole, Natural j. Real, Rational k. Real, Rational l. Real, Rational m. Real, Irrational n. None o. Real, Irrational p. Real, Rational, Integer, Whole, Natural q. Real, Rational r. Real, Rational, Integer s. Real, Rational, Integer t. Real, Irrational u. Real, Rational, Integer, Whole v. Real, Irrational w. Real, Rational x. Real, Rational
b. Real, Rational, Integer c. Real, Rational, Integer, Whole d. Real, Rational e. Real, Rational f. Real, Rational g. Real, Rational h. Real, Irrational i. Real, Rational, Integer, Whole, Natural j. Real, Rational k. Real, Rational l. Real, Rational m. Real, Irrational n. None o. Real, Irrational p. Real, Rational, Integer, Whole, Natural q. Real, Rational r. Real, Rational, Integer s. Real, Rational, Integer t. Real, Irrational u. Real, Rational, Integer, Whole v. Real, Irrational w. Real, Rational x. Real, Rational
${\frac {1}{2}}$
${\frac {1}{2}}$
${\frac {1}{4}}$
${\frac {1}{2}}$
${\frac {3}{4}}$
${\frac {1}{2}}$
${\frac {1}{2}}$
${\frac {1}{4}}$
${\frac {1}{2}}$
${\frac {3}{4}}$