text:
# What Are Numbers? Pt. 3: The Rational Numbers

Welcome to a four part series on ‘What Are Numbers?’. In the previous part, we constructed the Integers by using the equivalence classes of Natural Number ordered pairs that represent equations in the form $$x + b = a$$. For example, the Integer we write down in the usual way as $$-2$$ describes the set $$\{(0,2), (1,3), (2,4),\ldots\}$$, which correspond to the equations $$x+2=0, x+3=1, x+4=2,\ldots$$ respectively.

In this part, we aim to extend the Integers even further to the set of Rational Numbers.

## Solving More Equations

We learn about Rational Numbers in high school as numbers we can write as fractions, i.e. in the from $$\frac{a}{b}$$ where the numerator $$a$$ and denominator $$b$$ are integers, separated by a bar (called a vinculum). Of course, we can’t divide by zero so the denominator cannot be $$0$$.

We are familiar with this concept by the time we hit high school because we learn about fractions in primary school, and we’ve always been taught to notate it as $$\frac{a}{b}$$. We are taught from a young age that this means $$a$$ lots of $$b$$ parts of the whole. However, why does it have to be like that? Why can’t we just write it as an ordered pair $$(a,b)$$?

In fact, that is what we will do in this part as we examine solutions to the equations in the form:

$bx = a$

The Integers can solve equations such as $$2x = 6$$, but there is no $$x \in \mathbb{Z}$$ that solves $$2x = 5$$.

We can encode all equations of the form $$bx = a$$ as ordered pairs $$(a,b)$$ where $$a$$ and $$b$$ are Integers. However, the equation $$0x = a$$ where $$a \not = 0$$ never yields any solutions as $$0$$ multiplied onto another integer is always $$0$$ (sets with this property are called Integral Domains). Moreover, the equation $$0x = 0$$ will always be true for any value of $$x\in\mathbb{Z}$$ and is therefore indeterminate. We thus avoid these equations with $$b = 0$$.

## Forming The Rational Numbers

We now wish to form equivalence classes on the set of ordered pairs of Integers $$(a,b)$$ where $$b \not = 0$$ (i.e. the set $$\mathbb{Z} \times \mathbb{Z}\backslash \{0\}$$) that each represent an equation in the form $$bx = a$$.

To do this, we are really asking what rule needs to be applied to two equations $$bx = a$$ and $$dx = c$$ so they are described to have the same solution.

We identify two equations having the same solution with the equivalence relation:

$(a,b) \sim (c,d) \mbox{ if and only if } ad = bc$

To show that this is an equivalence relation:

1. Reflexivity: $$(a,b) \sim (a,b)$$ if and only if $$ab = ba$$ which is true. Hence it is reflexive.
2. Symmetry: $$(a,b) \sim (c,d)$$ if and only if $$ad = bc$$ if and only if $$bc = ad$$ if and only if $$(c,d) \sim (a,b)$$. Hence it is symmetric.
3. Transitivity: $$(a,b) \sim (c,d)$$ and $$(c,d) \sim (e,f)$$ if and only if $$ad = bc$$ and $$cf = de$$. Multiplying these equations together, we get $$adcf = bcde$$. We can cancel $$d$$ and $$c$$ from both sides to get $$af = be$$. Hence $$(a,b) \sim (e,f)$$.

Hence, we have successfully formed the set of rational numbers when we factor out the equivalence classes!

$\mathbb{Q} = \frac{\mathbb{Z} \times \mathbb{Z}\backslash\{0\}}{\sim}$

Let’s now take a look at what members of $$\mathbb{Q}$$ look like, say for the equation $$2x = 3$$. This equation is represented by the ordered pair $$(3,2)$$. Equivalent equations represented by $$(c,d)$$ as per the equivalence relation are such that $$3d = 2c$$. Just listing a few out that satisfy this, we see that $$(3,2), (-3,-2), (6,4), (-6,-4), (9,6), (-9,6), (12,8), \ldots$$ are equivalent. Hence:

$[(3,2)] = \{(3,2), (-3,-2), (6,4), (-6,-4), (9,6), (-9,6), (12,8), \ldots\}$

If we want a visual representation of what this looks like, we can look at the lines that pass through the origin that also pass through integer coordinates. Each line represents an equivalence class, i.e. one rational number.

In the diagram above, we can see that between any two lines (rational numbers), the gap between them increases as they splay out more towards infinity. These gaps eventually widen enough so that an integer coordinate appears. Hence, between any two rational numbers, is another rational number!

There’s a kind of indescribable beauty in the symmetry of all this!

## Simplest Fractions

Notice that each equivalence class has a member $$(a, b)$$ such that the greatest common factor (also known as the highest common factor and notated $$\gcd$$) of $$a$$ and $$b$$ is $$1$$. This is what we know in our elementary/secondary study of fractions to be the ‘simplest fraction’. We now choose this ordered pair $$(a, b)$$ and notate it as $$\frac{a}{b}$$ to represent its equivalence class.

In the example above, the equivalence class of $$[(3,2)]$$ would therefore be represented by $$\frac{3}{2}$$. The equivalence class of $$[(4,8)]$$ would be represented by $$\frac{1}{2}$$.

This then leads to the usual way Rational Numbers are presented:

$\mathbb{Q} = \left\{ \left. \frac{a}{b} \right| a, b \in \mathbb{Z}\mbox{ and } b \not = 0\mbox{ and } \gcd (a, b) = 1 \right\}$

If we left out the $$\gcd (a, b) = 1$$ condition out, it would imply the following:

• Equivalent fractions are not equivalent. In listing the set of Rational Numbers, we would eventually write down: $$\{\ldots, \frac{1}{2}, \frac{2}{4}, \ldots\}$$. These two fractions will therefore represent different equivalence classes, i.e. it will mean that the solution to $$2x = 1$$ and $$4x=2$$ are not the same. By our construction, this is a contradiction.

Of course in our use of Algebra in a standard context, we always use unsimplified fractions. For example, we can most certainly write $$\frac{4}{8}$$ and use it, especially when adding two fractions we’ve been taught to change them to the same common denominator.

What we really mean when we write down an unsimplified fraction such as $$\frac{4}{8}$$ is its equivalence class $$[(4,8)]$$ which is represented by the simplest fraction $$\frac{1}{2}$$, but no one does this as there isn’t any real benefit using the notation $$[(4,8)]$$ over $$\frac{4}{8}$$ outside the context of understanding the algebraic science behind the Rational Numbers – in fact, we use notation such as the fraction to make working with them easier than if we were to write them as ordered pairs.

## Algebraic Properties

For the following, we should prove the operations are well-defined, i.e. the result of addition and multiplication always ends up in the same equivalence class regardless of which ordered pair of the equivalence class we choose. I’ll leave that as an exercise for the reader.

Addition is defined in $$\mathbb{Q}$$ by the following:

$[(a, b)] + [(c, d)] = [(ad + bc,bd)]$

Here, the $$+$$ to the left of the equality sign is the addition we are defining between two rational numbers. The use of addition and multiplication on the right are the operations defined in the previous part for Integers, which were themselves defined depending on the addition and multiplication of Natural Numbers.

### Multiplication

Multiplication is defined in $$\mathbb{Q}$$ by the following:

$[(a, b)] \times [(c, d)] = [(ac, bd)]$

Here, the $$\times$$ symbol on the left of the equality sign is the multiplication we are defining between two rational numbers and the multiplications on the right are between two integers.

We see that the structure of rational numbers depend on the structure of the integers, and the structure of integers depend on the structure of the natural numbers.

## Monoids, Groups, Rings and Fields

So far, I haven’t really discussed the operations of addition and multiplication in the contexts of the sets they’re defined in. Here is a good time to do so before moving onto the next part about Real Numbers.

### Monoids

A Monoid is a set such that:

• it has a binary operation that is associative, i.e. if $$M$$ was a set of elements and an operation $$*$$ was defined on it, then $$m_1 * (m_2 * m_3) = (m_1 * m_2) * m_3$$ for every $$m_1, m_2, m_3 \in M$$.
• there exists an identity element, i.e. there exists $$e \in M$$ such that $$e * m = m * e = m$$ for every $$m \in M$$.

A commutative operation $$*$$ is such that $$a*b = b*a$$.

We can see that the set of Natural Numbers $$\mathbb{N}$$ is a monoid under addition with $$0$$ as the identity, and a monoid under multiplication with $$1$$ as the identity. We also note that addition and multiplication are commutative.

### Groups

A Group is a Monoid such that every element has an inverse, i.e. there exists $$m^{-1}$$ such that $$m * m^{-1} = e$$.

If the operation $$*$$ is commutative, we call the group an abelian group.

Essentially, an inverse of an element brings back that element to the identity. For example, the additive inverse of $$5$$ is $$-5$$. We can see that the set of Natural Numbers is not a Group, but the set of Integers are a Group under addition.

The study of Group Theory runs deep and is often labelled the study of symmetry. Applications of Groups permeate deep into many parts of the sciences: Physics such as Quantum Mechanics (see work done by Hermann Weyl), Chemistry such as counting number of isomers of a molecular formula, just to name a few. We will not go too deep into their theory in this post.

### Rings

A Ring is a set equipped with two operations, namely Addition ($$+$$) and Multiplication ($$\times$$) such that it is an abelian group under addition, a monoid under multiplication, and multiplication distributes over addition, i.e. $$a \times (b+c) = a\times b + a\times c$$.

A commutative ring is one where multiplication is also commutative.

We see that the set of Integers is a commutative ring as it is an abelian group under addition, a monoid under multiplication which is commutative and multiplication distributes over addition. Hence, we often call it the Ring of Integers.

### Fields

A Field is a commutative ring with $$1 \not = 0$$ (this is saying the additive and multiplicative identities are not the same element) such that all non-zero elements have a multiplicative inverse.

We see that the set of Integers are not a Field as take for example the integer $$3$$. There is no other integer that multiplies $$3$$ to get a result of $$1$$. However, the set of Rational numbers are a field:

$\frac{a}{b} \times \frac{b}{a} = \frac{ab}{ab} = \frac{1}{1}$

This brings us to a close of this post. In the next part, we focus on constructing the real numbers.

Part 4: The Real Numbers


text:
Maclaurin series for f(x)= ((1-x^2)/(1+x^2))

1. Jan 15, 2014

christian0710

Hi I'm studying for an upcoming exam and I have to find the Maclaurin series for f(x)= ((1-x^2)/(1+x^2))
And I gotta admit i feel stuck.

I know i need to find the terms f(0) +f'(0) +f''(0)/2 etc.

Frist of all I can't find the first derivative f´(x) because my TI89 calculater comes up with a Dimension error.
Sexond: As an alternative I really can't see which other known function/series i could use to substitute the function into.

2. Jan 15, 2014

Office_Shredder

Staff Emeritus
Are you not expected to be able to calculate the derivative of that function by hand? Because it's a simple application of the quotient rule.

As far as calculating the Maclaurin series, can you calculate the series for
$$\frac{1}{1+x^2} ?$$
Because this is a good place to start.

3. Jan 15, 2014

Staff: Mentor

Are you saying that you don't know how to determine the derivative of this function by hand? Have you learned how to take the derivative of a quotient?

4. Jan 15, 2014

christian0710

#2 That is like the geometric series 1/(1-x) which is SUM(1*x^n)
So the sereis for 1/(1+x^2) would be an alternating series and if you substitue x^2 the series would be:
SUM(-1)^n*X^(n +1) Right'?

It's the top part of the fraction which confuses me :(

5. Jan 15, 2014

christian0710

Yes It's (f/g`= ((1-x^2)'(1+x^2) -(1+x^2)'(a-x^2))/(1+x^2)^2 But i doubt i'd have to do all that in my head and differentiate it multiple times like that in an exam situation? seems to take a long time.

6. Jan 15, 2014

Office_Shredder

Staff Emeritus
You have the right idea, but you substituted x2 incorrectly.

Once you have that result correctly, notice that you are multiplying a Taylor series that you know by a polynomial, 1-x2. If someone asked you to calculate the Taylor series for xcos(x) you should be able to do it very quickly from the Taylor series of cos(x), the same principle applies here.

As for the derivative, you aren't expected to calculate it for this problem but it seemed odd that you felt you were stuck because you couldn't do it on your calculator.

7. Jan 15, 2014

christian0710

Okay i'll try again :)
The geometric series is 1+x+(1/2)x^2 +(1/3!)*x^3 so if we substitute in x^2 we get 1+x^2 + (1/2)x^4 +(1/3!)*x^6 Right?

The sum should be SUM; M(-1)^n*X^(n +1) Right'?
Except i did the signs wrong :)

8. Jan 15, 2014

Staff: Mentor

What's the big deal? Do it (on paper) and collect terms. See what you get. Then do it for f''. See if a pattern develops. Maybe you have to do only a few terms before you see the pattern. The suggestion of office shredder is also very good. His approach is related to the sum of a certain geometric progression. Can you guess the geometric progression involved?

Chet

9. Jan 15, 2014

ehild

$$\frac{1-x^2}{1+x^2}=-\frac{(x^2+1)-2}{x^2+1}=1-2\frac{1}{1+x^2}$$

1/(1+x2) is the sum of a geometric series. What is the quotient ?
ehild

Last edited: Jan 15, 2014
10. Jan 15, 2014

christian0710

So we get 1-2*SUM(0-infinity)(1*x^n+2) but if we subtract the series from 1 then the first term 1-1= 0 so instead of going from 0 to infinity it goes n goes from 1 to infinity?
Gosh, I don't know how I'm going to do those mathmatical manipulations as well as you for the exam.

I think i might be a bit unsure of what you mean by "what's the quotient"?

11. Jan 15, 2014

ehild

The sum of an infinite series with quotient q is

$$\sum _0 ^{\infty}{q^n}=\frac{1}{1-q}$$

when |q<1|.

Compare $\frac{1}{1-q}$ to $\frac{1}{1+x^2}$. It can be written as $\frac{1}{1-(-x^2)}$. So what corresponds to q?

ehild

12. Jan 16, 2014

jk22

You can also make a polynomial division :

1-x^2/1+x^2 gives 1 remains
-2x^2/1+x^2 gives -2x^2 remains
2x^4/1+x^2 gives 2x^4 remains
-2x^6 aso...

hence 1-x^2/1+x^2=1-2x^2+2x^4-2x^6+....

13. Jan 16, 2014

ehild

Use parentheses. What you wrote 1-x^2/1 + x^2 = 1-x^2+x^2=1.

ehild

format: plain


text:
A common feature of animal locomotion is its organization into gaits with distinct patterns of movement and propulsor use for specific speeds. In terrestrial vertebrates, limb gaits have been extensively studied in diverse taxa and gait transitions have been shown to provide efficient locomotion across a wide range of speeds. In contrast, examination of gaits in fishes has focused on axial gaits and the transition between synchronous paired fin locomotion and axial propulsion. Because many fishes use their pectoral fins as their primary propulsors, we aimed to examine more broadly the use of pectoral fin gaits in locomotion. We used juvenile reef fishes in these experiments because their swimming could be recorded readily across a wide range of Reynolds numbers, which we thought would promote gait diversity. Based on previous work in larval fishes, we hypothesized that juveniles have alternating pectoral fin movements rather than the synchronous, or in-phase,coordination pattern of adults. In flow tank swim studies, we found that juvenile sapphire damselfish Pomacentrus pavo used two fin gaits during steady swimming. Below approximately 3 BL s-1, P. pavo primarily swam with alternating fin strokes 180° out of phase with one another. At speeds in the range of 3-4 BLs-1, they performed a gait transition to synchronous fin coordination. Between approximately 4 and 8 BL s-1, P. pavo primarily beat their fins synchronously. At around 8 BLs-1 there was another gait transition to body-caudal fin swimming,in which the pectoral fins were tucked against the body. We suggest that the transition from alternating to synchronous fin coordination occurs due to mechanical limits of gait performance rather than to energy efficiency,stability or transitions in hydrodynamic regime. To determine whether this gait transition was species-specific, we surveyed pectoral fin locomotion in juveniles from 11 species in three reef fish families (Pomacentridae, Labridae and Scaridae). We found that this gait transition occurred in every species examined, suggesting that it may be a common behavior of juvenile reef fishes. Greater inclusion of early life history stages in the study of fin-based locomotion should significantly enhance and inform the growing body of work on these behaviors.

Locomotion is classified into gaits based on discontinuous transitions in characteristics of movement (reviewed by Alexander, 1989). Most often these characteristics are patterns of movement such as the order of limb support during terrestrial locomotion (reviewed by Biewener, 2004), although discrete differences in control of locomotion, such as use of red muscle or white muscle to generate movement (e.g. Webb, 1994; Alexander, 1989), can also define gaits even without distinct changes in movement pattern. Animals often make transitions through several gaits before reaching their peak speed. They are thought to change gaits in order “to minimize the energy cost of traveling at their chosen speed”(Alexander, 2003) or due to biomechanical and physiological limitations on movement patterns(Drucker and Jensen, 1996b; Korsmeyer et al., 2002).

In terrestrial vertebrates, common gaits include walking, running/trotting and galloping. Limbed gaits can be classified as symmetrical and asymmetrical. During symmetrical gaits, paired limbs are either actuated synchronously, in phase with one another, or alternate 180° out of phase. Asymmetrical gaits encompass all other limb relationships. The speeds at which gait transitions occur are related to aspects of body size. For terrestrial limb-based locomotion, the body dimension used is hip height, which is expressed as a component of the Froude number, a dimensionless number which“ normalizes the forward velocity of a moving animal to its limb length and gravitational acceleration”(Biewener, 2004). Gait transitions tend to occur at about the same Froude number across species(Alexander and Jayes, 1983; Alexander, 1989; Griffin et al., 2004).

In contrast to terrestrial locomotion, in which multiple gaits have been well studied, the research on gaits during swimming has largely focused on axial propulsion. During swimming, fishes often go through the following series of gaits with increasing swimming speed (reviewed by Alexander, 1989; Alexander, 2003; Webb, 1994): (1) fin propulsion, (2) burst and coast axial locomotion powered by red muscle, (3)steady swimming with red muscle, (4) burst and coast axial locomotion powered by white muscle, (5) steady swimming with white muscle. However, the studied fish from which these gait transitions were proposed, including carp(Rome et al., 1990), milkfish(Katz et al., 1999), cod and saithe (Videler and Weihs,1982), tend to rely heavily on the axis and caudal fin as their primary propulsors, rather than the pectoral fins.

Many fish species use the pectoral fins as the primary propulsors, using axial propulsion only near peak speeds(Westneat, 1996). Pectoral fin, or labriform, locomotion is particularly common among reef fishes. In this form of swimming the pectoral fins are generally actuated synchronously with one another in forward swimming(Webb, 1973; Archer and Johnston, 1989; Gibb et al., 1994; Drucker and Jensen, 1996a; Westneat, 1996; Walker and Westneat, 1997; Mussi et al., 2002). Speed can be increased gradually by increasing fin beat amplitude and/or frequency. Labriform swimmers change to body-caudal fin swimming near their peak speed. Recent work (Korsmeyer et al.,2002) suggested that at least some of these species are not able to swim steadily at low speeds, below approximately 1.5 Ls-1, due to decreased stability.

While synchronous pectoral fin actuation is the most common fin coordination pattern, symmetrical alternating fin movements have also been described. Alternating pectoral fin movements have been shown to function during station holding, maneuvering and other nonlinear swimming events(Drucker and Lauder, 2003; Hove et al., 2001), and several studies have described alternating fin movements associated with steady forward locomotion. Burrfish (Chilomycterus shoepfi) maintain pectoral fin strokes that are approximately 180° out of phase through a wide range of speeds (Arreola and Westneat,1996). As with synchronous fin movement, burrfish fin beat frequency increased with increasing swimming speed. Larval plaice(Batty, 1981) and zebrafish(Müller and van Leeuwen,2004; Thorsen et al.,2004) have been shown to alternate their pectoral fins during slow locomotion. In the zebrafish, this behavior is generally lost during the juvenile stage of development (Thorsen et al., 2004). In several cases, fishes have been shown to perform a gait transition from alternating pectoral fin locomotion to axial/caudal locomotion with an increase in swimming speed(Müller and van Leeuwen,2004; Thorsen et al.,2004) or type of movement(Drucker and Lauder, 2003). Sub-adult fish swimming has received little attention compared to that of adults but data from larval fishes indicate that, in at least some species such as zebrafish (Thorsen et al.,2004), fin movement patterns are distinct from ones observed in adults and that these patterns change markedly through ontogeny.

In this study, we investigated pectoral fin gait transitions of fishes by examining swimming through a range of speeds in juveniles of the sapphire damselfish Pomacentrus pavo and an additional 11 reef species from three families. By examining a range of juveniles from species that are pectoral fin specialists, we aimed to explore the patterns and performance of fin swimming in sub-adult fishes and to examine the use of synchronous and alternating pectoral fin coordination in swimming. We found a discrete transition from alternating to synchronous fin beats at intermediate speeds,prior to the pectoral fin to body-caudal fin transition. Informed by studies of the synchronous fin coordination to body-caudal fin gait transition, we investigated the alternating to synchronous gait transition and hypotheses for the cause of the transition, including energy efficiency across speeds,stability within specific speed ranges(Korsmeyer et al., 2002; Arreola and Westneat, 1996) and mechanical or physiological limits of the observed gait(Drucker and Jensen, 1996b; Korsmeyer et al., 2002). We propose that alternating pectoral fin beats may be a common swim propulsion mechanism early in development and that the transition from alternating to synchronous pectoral fin gaits is a common feature of juvenile fish locomotion in coral reef species that use their pectoral fins as a primary mode of propulsion as adults.

Fishes were collected on shallow coral reefs in the Tuvalu and Kiribati islands of the South Pacific with small hand nets, according to IACUC approved protocols (FMNH99-03) and with local collecting permits. We focused our analysis on Pomacentrus pavo Bloch 1787; however, we opportunistically filmed all species for which we could collect appropriately sized specimens. This resulted in data from a total of 33 individuals from 11 species in three families. Fishes were maintained and kinematics recorded on board the research vessel Turmoil within 48 h of capture

To record kinematics at a range of steady swimming speeds, we filmed the animals in a small flow tank (working section 3.5 cm×3.5 cm×12.5 cm) in flow that ranged from 1.12-11.13 cm s. Ventral views provided the clearest images of bilateral fin movement. Because filming directly from ventral view was not possible due to the flow tank structure, a first surface mirror was positioned at a 45° angle under the tank to reflect ventral views so that images could be collected by a camera positioned to the side of the tank. We monitored each fish visually to determine its dorsoventral position in the tank. We used small fish (<4 cm) in our experiments and only analyzed video in which the fishes swam in the center of the tank, in order to minimize wall effects. Fishes were filmed using a Sony digital video camera de-interlacing frames to achieve a frame rate of 60 Hz. This frame rate is too low to capture fine details of fin movements at most of the fin beat frequencies recorded and we focused instead on describing patterns of pectoral fin coordination. After we recorded locomotor kinematics, fish were euthanized and preserved for subsequent morphological analysis and to confirm species identifications.

Video clips were viewed with an Apple Macintosh G4 using Adobe Premiere 6.5. The videos of Pomacentrus pavo were analyzed and cut into clips featuring the fish performing steady swimming for approximately 5 fin beats against a steady current. Clips were then de-interlaced for field-by-field analysis with QuickImage, a NIH Image based program written by Dr Jeff Walker,University of Southern Maine, ME, USA. Coordinate points were digitized on physical landmarks along the central midline of the fish, the base and tip of both pectoral fins, the caudal peduncle, and the tip of the caudal fin, and for each frame of a sequence. Based on the movement of these landmarks,kinematic variables were calculated using a series of algorithms in a custom-written kinematics program (CodeWarrior Pascal, Metrowerks Corporation,Austin, TX, USA) on an Apple Macintosh G5. Variables included pectoral fin frequency, fin angle to the body (amplitude), pectoral fin chord length in ventral projection, axial bending angle at midbody and at the tail base,change in fore-aft (thrust) and left-right (yaw) position of the nose tip,phase lag, advance ratio and reduced frequency.

### Kinematic analysis for Pomacentrus pavo

We analyzed trials from three fish at 5-6 swimming speeds per fish. The number of trials varied among animals: 15, 25 and 19, respectively for fish 1-3 for a total of 59 trials. Of these trials, 21 were of alternate pectoral fin swimming, 27 of synchronous and 11 included the transition between gaits. Phase lag between fins during swimming was calculated to identify left-right oscillation patterns. If two oscillatory waves have the same frequency, then their phase relations can range from 0° (synchrony) to 180° out of phase (asynchrony) up to 360° (back to synchrony)(Denny, 1988). The relative position of the right and left fins during each fin beat was used to calculate phase lag by determining the position of the left fin at the time of maximum right pectoral fin abduction (maximum angle away from the body). Phase lag thus ranged from 0° (perfectly in phase, with both fins reaching maximum abducted position synchronously) to 180° (perfectly out of phase,indicating alternate fin beats, with left fin maximally adducted at the time of peak right fin abduction). Intermediate values of phase lag(0>phase>180) were computed by the equation(abs(Trmax-Tlmax)/Tcycle)×360,where Trmax=time of peak right angle, Tlmax=time of peak left angle, and Tcycle=total fin cycle time. Taking the absolute (abs)value of timing between right and left peaks ensured that phase lag ranged from 0 to 180°.

We examined fin beat amplitude and frequency to determine whether, as in adult fishes, these parameters vary with swimming speed and whether there is a discontinuity in either parameter at the transition from asynchronous to synchronous fin beats. The angle of each pectoral fin leading edge to the body was computed and used to determine angular displacement of each fin for each video frame and the time of maximum and minimum fin position. Fin beat frequency (Hz) was computed for each video clip by dividing the number of fin beats by total time of the video sequence. In addition, we determined the speed of the transition from pectoral fin swimming to body and caudal fin swimming (Upc). Caudal fin amplitude was calculated as the angular movement of the tip of the caudal fin relative to the axis of the body rostral to the caudal peduncle.

To examine the efficiency of fin propulsion during alternating and synchronous forms of pectoral fin locomotion we calculated the advance ratio(J). The advance ratio is a dimensionless number that relates the velocity of the body to the velocity of the fin. Thus, higher advance ratios indicate higher fin beat efficiency. Advance ratio is calculated as:
$\ J=U{/}2L_{\mathrm{p}}{\phi}F_{\mathrm{p}},$
(1)

where φ=fin angle/180°, U=forward speed (m s), Lp=pectoral fin length (m), and Fp=pectoral fin beat frequency (Hz)(Drucker and Jensen,1996a).

Oscillating fins accelerate water, particularly at the start and end of a stroke. A force called the acceleration reaction resists these changes in velocity of the fluid surrounding the fin. Daniel summarized the importance of acceleration reaction nicely: “while drag is the resistance to motion through a fluid, the acceleration reaction is resistance to changes in velocity of that motion” (Daniel, 1984). The reduced frequency parameter is a dimensionless number that characterizes the importance of acceleration reaction in the thrust obtained from an oscillating appendage(Daniel, 1988; Vogel, 1994). Reduced frequencies were calculated for each fin by the following equation:
$\ f_{\mathrm{a}}=2{\pi}F_{\mathrm{p}}c{/}U,$
(2)

where n=fin beat frequency (Hz), c=maximum chord of the fin perpendicular to the fin rays (in cm), and U=forward velocity (in cm s-1) (Vogel,1994). Typically acceleration reaction forces dominate at reduced frequency numbers above 0.5.

We calculated Reynolds number (Re) to examine whether the change in pectoral fin gait is associated with changes in the fluid regime experienced by the fish. Reynolds number is a dimensionless number calculated as:
$\ \mathrm{Re}={\rho}UL{/}{\mu},$
(3)

where ρ=water density (kg m-3), U=swimming speed (m s-1), L=characteristic length (m), and μ=dynamic viscosity (kg ms). We used fish body length (BL) as the characteristic length in our calculations. Although studies differ, frequently locomotion at Re values <100 is considered to be dominated by viscous(resistive) forces and >1000 to be dominated by inertial (reactive)forces.

We assessed the pattern of thrust by tracking the oscillatory motion of the tip of the snout, our most reliable single point that served as a proxy for the center of mass of the fish. Increased snout tip oscillation from left to right (increased yaw) was predicted for alternate fin strokes. In order to estimate thrust oscillations, we calculated the mean excursion of the point digitized at the tip of the snout in the direction flow through each trial. To determine yaw, we calculated the mean excursion of the tip of the snout perpendicular to the direction of flow through each trial.

Fig. 1.

Kinematics of (A) alternating and (B) synchronous pectoral fin propulsion in ventral view during steady swimming in the blue damselfish Pomacentrus pavo. (A) At 2 BL s-1, the fish swims by alternating its pectoral fins at approximately 180° out of phase from one another. At 0 ms the left (upper) pectoral fin is protracted (abducted) and at 17 ms the left is retracted (adducted) while the right (lower) fin begins protraction. At 50 ms the left fin is seen during protraction and right during retraction.(B) At higher speeds (7 BL s-1), damselfish switch gaits to an in phase fin beat pattern with simultaneous protraction (frame 17 ms and 67 ms) and retraction (0 and 50 ms). At 33 ms the fins are shown in mid-retraction phase.

Fig. 1.

Kinematics of (A) alternating and (B) synchronous pectoral fin propulsion in ventral view during steady swimming in the blue damselfish Pomacentrus pavo. (A) At 2 BL s-1, the fish swims by alternating its pectoral fins at approximately 180° out of phase from one another. At 0 ms the left (upper) pectoral fin is protracted (abducted) and at 17 ms the left is retracted (adducted) while the right (lower) fin begins protraction. At 50 ms the left fin is seen during protraction and right during retraction.(B) At higher speeds (7 BL s-1), damselfish switch gaits to an in phase fin beat pattern with simultaneous protraction (frame 17 ms and 67 ms) and retraction (0 and 50 ms). At 33 ms the fins are shown in mid-retraction phase.

### Comparative data

For our survey of pectoral fin gaits, we found that all species followed the same general pattern as P. pavo: the pectoral fins alternated at low speeds and moved synchronously at high speeds. We scored the observations for whether the fins were alternating or synchronous and examined that transition relative to swimming speed and Reynolds number.

### Statistics

We used regression analysis to test the significance of the relationship between swimming velocity and kinematic variables. To test whether variables such as frequency, amplitude, advance ratio, phase lag, Reynolds number and thrust oscillation were significantly different when the fish were performing synchronous versus alternating gaits, we performed simple two-way analyses of variance (ANOVA) with gait and individual as main effects. All variables were tested for homogeneity of variance, and for two variables in which the variance was significantly different between gaits, we report Welch ANOVA values corrected for unequal variance. Sequential Bonferroni correction(Rice, 1989) was used to determine significance of F ratios due to the use of eight ANOVAs on the data set. For those variables that had a significant overall regression with swimming speed (such as frequency, amplitude and advance ratio), we asked whether the relationship with speed was significantly different during use of the two pectoral fin gaits. For this we applied analyses of covariance(ANCOVA) to determine whether the slopes or intercept of the velocity regression were significantly different, using synchronous versusasynchronous gait as the main effect. All analyses were performed using the JMP version 3.16 statistical package (SAS Institute, Cary, NC, USA).

### Patterns of locomotor gaits and gait transition in Pomacentrus pavo

We observed three distinct gaits performed by Pomacentrus pavoduring steady swimming: alternating pectoral fin(Fig. 1A), synchronous pectoral fin (Fig. 1B), and axial-caudal fin propulsion. At most swimming speeds, propulsion was driven by pectoral fin beats while the caudal fin remained relatively stable. Alternating fin strokes occurred from the lowest steady swimming speeds up to the gait transition to synchronous pectoral fin coordination at 3-4 BL s-1 (Figs 2, 3). The pectoral fins retained a consistent phase relationship while alternating(Fig. 4) of nearly 180° out of phase. From speeds of about 4 BL s-1 to about 8 BL s-1, P. pavo generally swam with a synchronous pattern of fin movement, adducting and abducting right and left fins together during the fin cycle (Fig. 1B, Fig. 3C). The transition between alternating and synchronous fin beat patterns occurred rapidly,usually in 1-2 fin strokes (Fig. 2, Fig. 3B), and no intermediate sustained patterns were observed. The fish often switched between these gaits several times during a trial at a constant flow tank speed(Fig. 3). For example, Fig. 3B illustrates a sequence in which the early coordination pattern was synchronous fin strokes. The fish switched to alternating strokes between 0.15 and 0.25 s and then back to synchronous fin movements between 0.34 and 0.40 s.

The gait transition from alternate to synchronous pectoral fin motion is most evident when viewing the phase lag between the oscillating fins(Fig. 4). At low speeds, the fins were alternating and phase lag values were high, generally at or near 180° (perfect asynchrony). At 3-4 BL s-1, the phase lag dropped to near zero and remained at this level until speeds were reached that required caudal fin propulsion.

Fig. 2.

The transition between alternating and synchronous pectoral fin coordination during steady swimming in the blue damselfish Pomacentrus pavo at a critical swimming speed of approximately 4 BLs-1. This gait transition occurs rapidly, within 1-2 fin strokes. Asynchronous swimming (left panels) is seen from 0-33 ms, then is partially out of phase during the transition (33-67 ms). Mostly synchronous locomotion is seen from 83-150 ms (right panels).

Fig. 2.

The transition between alternating and synchronous pectoral fin coordination during steady swimming in the blue damselfish Pomacentrus pavo at a critical swimming speed of approximately 4 BLs-1. This gait transition occurs rapidly, within 1-2 fin strokes. Asynchronous swimming (left panels) is seen from 0-33 ms, then is partially out of phase during the transition (33-67 ms). Mostly synchronous locomotion is seen from 83-150 ms (right panels).

The pectoral fin to axial-caudal fin transition occurred at approximately 8 BL s-1 (Fig. 5). As at the alternating to synchronous pectoral fin transition,fish often switched back and forth between these locomotor gaits at the transition speed. Fig. 5Billustrates a transition from pectoral fin swimming before 0.17 s to axial locomotion and then back to pectoral fin locomotion at approximately 0.25 s. We did not record sustained axial steady swimming in any species examined due to constraints on the maximum flow speeds produced in our tank and rapid fatigue of the fish at the highest speeds recorded.

### Swimming performance and locomotor gaits in P. pavo

Amplitude and frequency of the fin beats both increased with increasing swimming speed (Fig. 6). There was no significant difference in regressions of frequency by speed through alternating and synchronous gaits so data were combined for analysis. The overall linear regression had a slope of 1.3, different from zero(P<0.0001, R2=0.44), and an intercept of 12.9. Frequency ranged from 10.9-25.0 beats s-1 (mean ± s.e.m.:17.9±0.5Hz) (Fig. 6A). Frequency was significantly higher for the synchronous than for the alternating gait (P<0.0001, F=40.05), with synchronous beats ranging from 12.5-25 Hz (mean: 20.1±0.55 Hz) and alternating beats from 10.9-20.0 Hz (mean: 15.0±0.59 Hz). There were no significant differences in either slope or intercept between the regressions fitted to data for alternating and synchronous fin coordination (ANCOVA; Table 1).

Table 1.

Results of analysis of variance and covariance on kinematic parameters of juvenile pectoral fin locomotion of Pomacentrus pavo, comparing synchronous and alternating gaits

F ratio
SynchronousAlternatingANOVAANCOVA
Frequency (Hz) 20.0±0.5 15.0±0.6 40.0** 0.5
Amplitude (degrees) 112.3±2.9 79.7±3.2 56.7** 4.5*
Phase lag (degrees) 16.2±6.1 150.0±6.9 208.4**
Reduced frequency (Hz) 5.0±1.0 10.3±1.1 12.4*
Advance ratio 1.2±0.06 0.93±0.06 9.3* 7.5*
Reynolds number 1368±134 1084±152 2.0
Forward displacement (cm) 0.05±0.002 0.03±0.002 57.4** 0.5
Yaw (cm) 0.02±0.001 0.02±0.001 2.4
F ratio
SynchronousAlternatingANOVAANCOVA
Frequency (Hz) 20.0±0.5 15.0±0.6 40.0** 0.5
Amplitude (degrees) 112.3±2.9 79.7±3.2 56.7** 4.5*
Phase lag (degrees) 16.2±6.1 150.0±6.9 208.4**
Reduced frequency (Hz) 5.0±1.0 10.3±1.1 12.4*
Advance ratio 1.2±0.06 0.93±0.06 9.3* 7.5*
Reynolds number 1368±134 1084±152 2.0
Forward displacement (cm) 0.05±0.002 0.03±0.002 57.4** 0.5
Yaw (cm) 0.02±0.001 0.02±0.001 2.4

Values are means ± s.e.m., N=3 fish, 48 trials (11 trials that included the gait transition were excluded from these comparisons).

a An ANCOVA was not computed because regression analysis is not valid for the distribution of the data or regression was not significant.

*

Significant P value by sequential Bonferroni criterion. Significant ANCOVA results were significant differences in slope of regression against speed.

**

P<0.0001.

Amplitude (Fig. 6B) ranged from 50° to 142° across gaits (mean 98±3.0°), 50-113°(mean: 79.7±3.2°) for alternating fin beats, 87-142° (mean:112.3±2.9°) for synchronous and was significantly different(P<0.0001, F=56.7) between the two gaits. Across alternating and synchronous gaits there was an overall increase in amplitude with length-specific swimming speed (R2=0.70) with a slope significantly different from zero (P<0.0001)(Table 1). There was a significant difference in the slopes of amplitude with swimming speed for the two gaits (ANCOVA; P<0.038, F=4.52) with amplitude increasing more rapidly with increasing swimming speed during the alternating fin gait (Table 1).

The reduced frequency parameter showed that acceleration reaction was a dominant force at all speeds for the juvenile fishes(Fig. 7A). Acceleration reaction forces dominate at reduced frequencies of greater than 0.5(Webb, 1988), and all values for P. pavo were greater than 1.0. Reduced frequency was particularly high at low swimming velocities where, despite low speeds, the fins were oscillating rapidly. Values dropped off quickly to below 10 as swimming speed increases to 2 BL s-1. There was no apparent discontinuity in reduced frequency at the gait transition speeds(Fig. 7A).

Across all swimming trials, advance ratio varied from 0.23 to 1.72 (mean:1.08±0.04) (Fig. 7B). The advance ratio for the two fin gaits overlapped considerably. For alternating fin swimming trials it ranged from 0.23 to 1.63 (mean:0.93±0.06) and for synchronous fin swimming trials it ranged from 0.80 to 1.72 (mean: 1.19±0.05); however, overall, the advance ratio was significantly greater for the synchronous fin gait (P<0.005). The advance ratio increased with swimming speed through both alternating and synchronous gaits. For alternating fins, the R2 value for linear regression was 0.51 and for the synchronous fin beats R2 was 0.57 (Table 1). The slopes of the regressions differed significantly (ANCOVA; P<0.01). At the transition between alternating and synchronous fin coordination gaits (Fig. 7B),the advance ratio decreased with the initiation of synchronous fin beats and then it rose again as swimming speed increased to reach nearly the same peak levels.

Oscillation of the position of the head in the direction of forward movement provided an indicator of thrust oscillations during the fin stroke cycles (Fig. 8). Head oscillation increased linearly with swimming speed(R2=0.64) from a minimum of 0.017 cm to a maximum of 0.076 cm (Fig. 8, Table 1). Overall, oscillations were lower during the alternating fin gait (range: 0.017-0.056 cm, mean:0.028±0.002 cm) than during the synchronous fin gait (range:0.031-0.076 cm, mean: 0.0528±0.002 cm) and there was no discrete transition in forward oscillation between the two gaits.

Yaw, or the amount of side-to-side oscillation(Fig. 8B), showed no trend with increasing swimming speed for each gait independently (for alternating: R2=0.027, P<0.43; for synchronous: R2=0.072, P<0.14), and R2is very low for the combined data (R2=0.096), although significantly different from zero (P<0.024) with a positive slope(Fig. 8, Table 1). There was no overall difference in yaw between gaits (t-test, P=0.088, F=3.032). Yaw during alternating fin coordination ranged from 0.0089-0.041 cm (mean: 0.0192±0.00014 cm) and yaw during synchronous fin coordination ranged from 0.012-0.038 cm (mean: 0.022±0.00123 cm).

Fig. 3.

Representative kinematic data for angular rotation of left and right pectoral fins of juvenile Pomacentrus pavo during (A) slow,alternating fin strokes, (B) a transition from synchronous to alternating fin coordination and back again, and (C) synchronous fin strokes at higher speed.

Fig. 3.

Representative kinematic data for angular rotation of left and right pectoral fins of juvenile Pomacentrus pavo during (A) slow,alternating fin strokes, (B) a transition from synchronous to alternating fin coordination and back again, and (C) synchronous fin strokes at higher speed.

Fig. 4.

Phase lag of left and right pectoral fins with increasing swimming velocity. Points are the mean of 5-8 fin beats in a swimming sequence. Note the sharp gait transition from alternate to synchronous fin motions between 3 and 4 BL s-1.

Fig. 4.

Phase lag of left and right pectoral fins with increasing swimming velocity. Points are the mean of 5-8 fin beats in a swimming sequence. Note the sharp gait transition from alternate to synchronous fin motions between 3 and 4 BL s-1.

Reynolds number ranged from 118-3543 (mean: 1243±101), an interval in which fluid conditions are shifting from being dominated by viscous forces to being dominated by inertial forces. Individual fishes showed clear (by definition) trends of increasing Re with increasing speed, but there was no significant correlation between Reynolds number and the transition point between alternating and synchronous fin gaits across individuals(Table 1).

### Pectoral fin gaits in juveniles of multiple species

In order to determine whether the alternating to synchronous fin gait transition observed in P. pavo is a more general phenomenon, we surveyed gaits in 33 individuals from 10 other coral reef species(Table 2). Because of the difficulties in collection and performance of these experiments on small subadult fishes under field conditions, we had to be opportunistic when collecting and the numbers of specimens per species varies. In these species we saw the same pattern of alternating fin beats at low speeds switching to synchronous fin beats at higher speeds that we observed in P. pavo.

Table 2.

Morphometrics and results of pectoral fin gait survey (alternating to synchronous transition speed and Reynolds number range) for 12 juvenile coral reef fish species swimming steadily in a flow tank

SpeciesNBody length (cm)Fin length (cm)A-S transition (BL s−1)Re range
Chromis weberi 1.82±0.05 0.35±0.04 4.50 618-2498
Cirrhilabrus punctatus 1.97±0.32 0.33±0.05 2.16 569-3845
Dascyllus aruanus 2.75±0.28 0.55±0.06 3.73 805-4263
Halichoeres biocellatus 2.82±0.33 0.53±0.06 3.51 865-3204
Halichoeres chrysus 1.83±0.29 0.29±0.06 4.95 523-2092
Halichoeres trimaculatus 2.58±0.36 0.42±0.06 4.48 703-4237
Labroides dimidiatus 3.04±0.21 0.49±0.32 1.87 929-4394
Pseudochelinus hexataenia 2.6 0.28 4.28 918-3400
Pomacentrus pavo 1.81±0.45 0.37±0.12 4.14 118-3544
Scarus sp. 2.76±0.56 0.42±0.11 3.20 900-4995
Thalassoma amblycephalum 1.78±0.02 0.28±0.01 4.07 523-2354
SpeciesNBody length (cm)Fin length (cm)A-S transition (BL s−1)Re range
Chromis weberi 1.82±0.05 0.35±0.04 4.50 618-2498
Cirrhilabrus punctatus 1.97±0.32 0.33±0.05 2.16 569-3845
Dascyllus aruanus 2.75±0.28 0.55±0.06 3.73 805-4263
Halichoeres biocellatus 2.82±0.33 0.53±0.06 3.51 865-3204
Halichoeres chrysus 1.83±0.29 0.29±0.06 4.95 523-2092
Halichoeres trimaculatus 2.58±0.36 0.42±0.06 4.48 703-4237
Labroides dimidiatus 3.04±0.21 0.49±0.32 1.87 929-4394
Pseudochelinus hexataenia 2.6 0.28 4.28 918-3400
Pomacentrus pavo 1.81±0.45 0.37±0.12 4.14 118-3544
Scarus sp. 2.76±0.56 0.42±0.11 3.20 900-4995
Thalassoma amblycephalum 1.78±0.02 0.28±0.01 4.07 523-2354

A-S, alternating to synchronous; Re, Reynolds number.

Values are means ± s.e.m.

Across all species and trials recorded, synchronous fin coordination occurred at a significantly higher length-specific speed than alternating fin coordination [alternating: 2.57±0.12; synchronous: 3.43±0.18(P<0.0001)]. However, the transition did not occur at a particular length-specific speed. That point is demonstrated by the range of swimming speeds recorded for each gait, which show considerable overlap. Alternating fin coordination occurred at 0.79-7.52 BL s-1 and synchronous fin coordination was observed at 0.89-8.50 BLs-1.

We found that pectoral fin gaits of juvenile reef fishes are more complex than previously thought. Our central result is that many labriform swimmers use both alternating and synchronous pectoral fin gaits to swim steadily through a range of speeds. Alternating fin beats are used at lower speeds;synchronous fin beats at higher speeds. Unlike previous pectoral fin gait transitions recorded (Hove et al.,2001), these two gaits were distinct with a rapid transition between fin coordination patterns.

The gait pattern reported here in fishes is similar to that observed in tetrapod taxa. For example, frogs and toads have been shown to use alternating hindlimb movements for slow walking but transition to synchronous fin coordination during faster hopping (e.g. Anderson et al., 1991; Nauwelaerts and Aerts, 2002). A similar transition as been demonstrated for frog swimming, a switch from alternating to synchronous hindlimb movement with increasing speed(Nauwelaerts and Aerts,2002).

Steady pectoral fin swimming in fishes has generally been described as either synchronous (e.g. Drucker and Jensen, 1996a; Walker and Westneat, 1997; Mussi et al.,2002) or alternating (Arreola and Westneat, 1996). Fin beat amplitude and frequency increase with increasing swimming speeds until the fish either switch to an axial gait or reach peak swimming speed. In the unusual case of the boxfish, alternating and synchronous pectoral fin coordination patterns are both used(Hove et al., 2001). The use of these gaits by boxfish differed strikingly from the patterns we describe in P. pavo, the other juvenile fishes studied here and terrestrial vertebrates. First, the use of synchronous fin beats by boxfish occurred at slow speeds and transitioned to alternating at higher speeds of 1.3-4.5 BL s-1 (Hove et al.,2001). Second, the transition was not discrete, as observed here or in other vertebrates. Instead, boxfish appear to combine the movement of the two pectoral fins asymmetrically and smoothly transition between synchronous and alternating patterns. Due to this gradual transition,alternating and synchronous pectoral fin patterns do not fall into typical definitions of gaits that specify a discontinuity in movement during transition. Because of the unusual swimming pattern and the extensive use of unpaired fins during boxfish locomotion, it is not surprising that these animals may use the pectoral fins in uncommon coordination patterns.

Fig. 5.

Transitions between synchronous pectoral propulsion and axial propulsion.(A) Video images showing axial propulsion (0.167-0.217 s) followed by synchronous pectoral swimming with body held straight (0.267-0.3 s). (B)Kinematics of synchronous pectoral rotation (blue and green), ceasing at about 0.15 s accompanied by two strokes of the caudal fin (red) and then pectoral propulsion resuming at 0.25 s.

Fig. 5.

Transitions between synchronous pectoral propulsion and axial propulsion.(A) Video images showing axial propulsion (0.167-0.217 s) followed by synchronous pectoral swimming with body held straight (0.267-0.3 s). (B)Kinematics of synchronous pectoral rotation (blue and green), ceasing at about 0.15 s accompanied by two strokes of the caudal fin (red) and then pectoral propulsion resuming at 0.25 s.

Fig. 6.

Frequency (A) and amplitude (B) of pectoral fin beats during increasing swimming velocity trials in Pomacentrus pavo. Both frequency and amplitude increase with speed, smoothly across the transition to synchronous fin beats at 3-4 BL s-1. Transition points include a range of behaviors in which switching between modes was observed.

Fig. 6.

Frequency (A) and amplitude (B) of pectoral fin beats during increasing swimming velocity trials in Pomacentrus pavo. Both frequency and amplitude increase with speed, smoothly across the transition to synchronous fin beats at 3-4 BL s-1. Transition points include a range of behaviors in which switching between modes was observed.

### Why a pectoral fin gait transition?

The presence of two distinct pectoral fin gaits raises questions of why fish use multiple pectoral fin gaits and what determines the transition between them. More broadly, the diverse representation of taxa that use alternating fin/limb movement at slow speeds and transition to synchronous coordination at higher speeds suggests there may be common constraints or benefits of the use of these fin movement patterns. Based on previous studies,we raise several possibilities for why fish may use multiple gait transitions. First, above a given speed, synchronous fin beats may be more efficient than alternating propulsive strokes. Studies on oxygen consumption of terrestrial vertebrates, particularly horses, show that animals use the locomotor gait that is most energy efficient for a particular speed range (e.g. Hoyt and Taylor, 1981; Griffin et al., 2004). Second,particular gaits may be more or less stable at a given speed and fish may transition between gaits to maintain stability(Arreola and Westneat, 1996; Hove et al., 2001). Energy efficiency and stability of a gait at specific speeds are related to the hydrodynamics of movement at those speeds, thus we might expect changes in indicators of locomotor hydrodynamics such as reduced frequency or Reynolds number at gait transitions. Third, there may be mechanical constraints on the speed range in which a particular gait can operate(Drucker and Jensen,1996b).

Work on the median and paired fin (MPF) to body and caudal fin (BCF)transition may provide insight into these issues. Examination of oxygen consumption at the transition between slow MPF swimming and fast BCF swimming(Korsmeyer et al., 2002) found that transitioning to the faster gait did not decrease energy costs. In fact,energy expenditure was greater for BCF swimming than was predicted for MPF swimming at the same speed. Instead, they believe that the MPF to BCF transition appears to be due to physical constraints, so that the switch to axial propulsion occurs when the fin-based mode of locomotion has reached the limit of thrust production (Korsmeyer et al., 2002).

Fig. 7.

Reduced frequency (A) and advance ratio (B) of juvenile pectoral fin locomotion in Pomacentrus pavo.

Fig. 7.

Reduced frequency (A) and advance ratio (B) of juvenile pectoral fin locomotion in Pomacentrus pavo.

Fig. 8.

Distance traveled by the tip of the snout each frame illustrating (A)fore-aft excursion due to forward thrust and (B) lateral motion (yaw) during pectoral fin locomotion in Pomacentrus pavo.

Fig. 8.

Distance traveled by the tip of the snout each frame illustrating (A)fore-aft excursion due to forward thrust and (B) lateral motion (yaw) during pectoral fin locomotion in Pomacentrus pavo.

The transition from alternating to synchronous fin movement in the juvenile fish we examined differs from the MPF to BCF transition in that the same propulsors are used but in a different pattern of coordination. The most comparable previous study of gait transitions in vertebrates is the switch from alternating to synchronous limb movement in swimming frogs(Nauwelaerts and Aerts, 2002). At slow swimming speeds the frog Rana esculenta used alternating left and right limb strokes for propulsion. At faster swimming speeds, frogs switched to a simultaneous hindlimb movement while tucking the forelimbs against the body. Nauwelaerts and Aerts calculated the work required for these two gaits and found that the energy requirements for swimming out of phase are lower than those for in-phase swimming. Thus, as with the MPF to BCF transition in fishes, the gait transition is likely due to mechanical constraints on thrust generation.

The difference in efficiency may be due to the relative steadiness of these locomotor modes (Nauwelaerts and Aerts,2002). Simultaneous limb movements result in greater accelerations during a swim bout and thus greater loss of inertial energy at slow speeds(Nauwelaerts and Aerts, 2002). At higher swimming speeds, the simultaneous strokes of the hindlimbs may generate jetting that does not occur at lower speeds and this overcomes the energy disadvantage of using the in-phase locomotor mode at lower speeds. Similarly, it has been suggested that the alternating fins of burrfish may allow more steady thrust and efficient locomotion than synchronous fin beats(Arreola and Westneat, 1996). In our study of P. pavo, forward oscillation was considerably lower for alternating pectoral fin locomotion than for synchronous, supporting the steadiness hypothesis (Fig. 8). However, we would expect that if alternating movements reduced these oscillations at low speeds then the oscillations during synchronous fin coordination would be highest immediately following the gait transition and either decrease or remain level with increasing speed. This was not the case and suggests that, if steadiness is a factor in the gait transition, it is not the only one or, possibly, that gait transitions are coupled with fine fin control to prevent fluctuations in thrust excursion after the transition.

Related to the issue of steadiness is that of stability. Reduced stability has also been suggested as a disadvantage of synchronous pectoral fin beats of MPF swimmers at low speeds for parrotfish(Korsmeyer et al., 2002) and wrasses (Walker and Westneat,1997). These species would not swim steadily at speeds below approximately 1.5 BL s-1 and 1.2 BLs-1, respectively. Flow visualization studies find that fish swimming steadily with synchronous fin beats at low speeds (0.5 and 1.0 BL s-1) generate unusually high laterally oriented forces(Drucker and Lauder, 2000) and suggest that orientation of force may provide increased stability at low speeds.

There was no significant trend in yaw magnitude with swimming speed(Fig. 8), indicating that either yaw is not a factor in asynchronous fin propulsion or that the fishes are able to compensate for yaw with other fins. As the symmetrical in-phase movements of synchronous fin activity would not be expected to generate yaw,this control would be more important during asymmetric movements. Observation of dorsal, anal and caudal fin coordination during the two pectoral fin gaits may provide insight into this issue, and flow visualization studies to determine the forces generated by these gaits and through the pectoral fin gait transition would help to address some of these issues.

Both energy efficiency and steadiness/stability might be linked closely to changes in the hydrodynamic environment, in particular, reduced frequency and Reynolds number. Reduced frequency values were high at low speeds(Fig. 7) and, although they decreased with speed, did not shift below about 3.0, indicating that acceleration reaction forces dominate throughout the trials examined. Reynolds number ranged from about 200 up to about 2000 for the P. pavoswimming trials we analyzed (Table 2). We found no significant relationship between gait and Re across the individuals examined. Additional testing of fish larvae and juveniles across a broader size range and Re span may clarify the effect of hydrodynamic regime on fin gait.

Mechanical and physiological limits of fin muscle believed to explain the MPF to BCF transition in fishes may also explain the alternating to synchronous fin coordination gait transition. We predicted that amplitude and/or frequency of the fins during alternating strokes would peak immediately before the transition to synchronous fin coordination and be lower for synchronous strokes. While this was not the case in our data, the advance ratio, which reflects both amplitude and frequency(Fig. 7) exhibits the predicted trend. Advance ratio increases with swimming speed through both gaits with the highest ratios calculated for each speed being relatively similar. We suggest that P. pavo reaches a peak in advance ratio for alternating fin swimming then transitions to synchronous swimming, with which the same speed can be achieved with a lower advance ratio, possibly at lower energetic costs. Advance ratio of synchronous fin swimming increases with speed again until it reaches a peak, at which point the fish transitions to BCF swimming. Because fin length does not change across speeds, frequency and amplitude variability determine the denominator of the advance ratio. This suggests that it is a peak in combined amplitude and frequency that provides the upper speed limits of pectoral fin gait use for an individual animal.

### Ontogenetic differences in gait use

It is interesting to consider why the gait transition pattern we observed only seems to occur in young fish. None of the labriform swimmers previously studied, including several from the same families that we examined (e.g. Walker and Westneat, 1997; Walker and Westneat, 2000),have been shown to use alternating fin beats for steady swimming at adult life history stages. Our original hypothesis was that the use of alternating fin strokes was an effect of size and that at low Reynolds numbers or at low reduced frequency, alternating fin strokes may be advantageous for steady locomotion. Indeed, the Reynolds numbers for the fish we examined were low relative to those of adults, suggesting that flow regime is a critical factor in the fin gaits used by developing fishes. However, the limited range of our analysis of Reynolds number and reduced frequency across juvenile swimming emerged with no significant trends with locomotor gait transitions within juveniles, indicating that other factors may be important.

Comparisons of the swimming speed ranges we recorded to those reported for adults of other species suggest that younger fish can swim with paired fins at a considerably greater range of length-specific body speeds than adults. In fact, the transition between pectoral fin gaits in juveniles of P. pavo and other species occurs at the same length-specific speed or a higher speed than the MPF to BCF transition in adults (e.g. Drucker and Jensen, 1996b; Mussi et al., 2002). Juvenile fishes appear to have a high performance capability for sustained swimming. This has been shown previously for fish larvae(Stobutzki and Bellwood, 1994)and with small sized adults as compared to larger ones(Mussi et al., 2002) and may be due to changes in size and shape of body and fins or changes in locomotor physiology.

In this study we have demonstrated that juvenile fishes from a number of species across several major clades exhibit an alternating to synchronous gait transition in pectoral locomotion. This dramatic phase shift in the pattern of propulsive appendages has not been documented widely in aquatic locomotion,but has been observed in a number of tetrapods. It is possible that the low reported occurrence of this transition in fishes is due to the fact that the locomotion of sub-adult fishes has been largely overlooked due to technical issues of acquiring, maintaining and recording these sensitive animals. We suggest that, through the dynamic transition from larval to adult, much locomotor complexity will be evident that is not observed in adults since,during this period, fish often move between environments and alter diets,change in shape, size and physiology, and face new demands of reproduction.

List of symbols

• φ

fin angle

•
• BL

body length

•
• c

maximum chord of the fin perpendicular to the fin rays

•
• Fp

pectoral fin beat frequency

•
• J

•
• L

characteristic length

•
• Lp

pectoral fin length

•
• Re

Reynolds number

•
• Tcycle

total fin cycle time

•
• Tlmax

time of peak left angle

•
• Trmax

time of peak right angle

•
• U

forward speed

•
• Upc

speed of the transition from pectoral fin swimming to body and caudal fin swimming

•
• μ

dynamic viscosity

•
• ρ

water density

We thank the Comer family and the crew of the research vessel Turmoil for hospitality and ship time that enabled this research. We appreciate the input of two anonymous reviewers and discussions with the University of Chicago-Field Museum biomechanics group. This work was funded by the Comer Science and Education Foundation and by grants NSF 0236384 to M.E.H., NSF 0235307 and ONR N00014-99-1-0184 to M.W.W. and an NSF graduate fellowship to D.H.T.

Alexander, R. McN. (
1989
). Optimization and gaits in the locomotion of vertebrates.
Physiol. Rev.
69
,
1199
-1227.
Alexander, R. McN. (
2003
).
Principles of Animal Locomotion.
Princeton: Princeton University Press.
Alexander, R. McN. and Jayes, A. S. (
1983
). A dynamic similarity hypothesis for the gaits of quadrupedal mammals.
J. Zool.
201
,
135
-152.
Anderson, B. D., Feder, M. E. and Full, R. J.(
1991
). Consequences of a gait change during locomotion in toads(Bufo woodhousii fowleri).
J. Exp. Biol.
158
,
133
-148.
Archer, S. D. and Johnston, I. A. (
1989
). Kinematics of labriform and subcarangifom swimming in the Antarctic fish Notothenia neglecta.
J. Exp. Biol.
143
,
195
-210.
Arreola, V. I. and Westneat, M. W. (
1996
). Mechanics of propulsion by multiple fins: kinematics of aquatic locomotion in the burrfish (Chilomycterus schoepfi).
Proc. R. Soc. Lond. B Biol. Sci.
263
,
1689
-1696.
Batty, R. S. (
1981
). Locomotion of plaice larvae.
Symp. Zool. Soc. Zool
.
48
,
53
-69.
Biewener, A. A. (
2004
).
Animal Locomotion
. Oxford: Oxford University Press.
Daniel, T. L. (
1988
). Flapping flight from flexible fins.
Can. J. Zool.
66
,
630
-638.
Denny, M. W. (
1988
).
Biology and the Mechanics of the Wave Swept Environment
. Princeton: Princeton University Press.
Drucker, E. G. and Jensen, J. S. (
1996a
). Pectoral fin locomotion in the striped surfperch. I. Kinematics effects of swimming speed and body size.
J. Exp. Biol.
199
,
2235
-2242.
Drucker, E. G. and Jensen, J. S. (
1996b
). Pectoral fin locomotion in the striped surfperch. II. Scaling swimming kinematics and performance at a gait transition.
J. Exp. Biol.
199
,
2243
-2252.
Drucker, E. G. and Lauder, G. V. (
2000
). A hydrodynamic analysis of fish swimming speed: wake structure and locomotor force in slow and fast labriform swimmers.
J. Exp. Biol.
203
,
2379
-2393.
Drucker, E. G. and Lauder, G. V. (
2003
). Function of pectoral fins in rainbow trout: behavioral repertoire and hydrodynamic forces.
J. Exp. Biol.
206
,
813
-826.
Gibb, A. C., Jayne, B. C. and Lauder, G. V.(
1994
). Kinematics of pectoral fin locomotion in the bluegill Sunfish Lepomis macrochirus.
J. Exp. Biol.
189
,
133
-161.
Griffin, T. M., Kram, R., Wickler, S. J. and Hoyt, D. F.(
2004
). Biomechanical and energetic determinants of the walk-trot transition in horses.
J. Exp. Biol.
207
,
4115
-4223.
Hove, J. R., O'Bryan, L. M., Gordon, M. S., Webb, P. W. and Weihs, D. (
2001
). Boxfishes (Teleostei: Ostraciidae) as a model system for fishes swimming with many fins: kinematics.
J. Exp. Biol.
204
,
1459
-1471.
Hoyt, D. F. and Taylor, C. R. (
1981
). Gait and energetics of locomotion in horses.
Nature
292
,
239
-240.
Katz, S. L., Shadwick, R. E. and Rapoport, H. S.(
1999
). Muscle strain histories in swimming milkfish in steady and sprinting gaits.
J. Exp. Biol.
202
,
529
-541.
Korsmeyer, K. E., Steffensen, J. F. and Herskin, J.(
2002
). Energetics of median and paired fin swimming, body and caudal fin swimming, and gait transition in parrotfish (Scarus schlegeli) and triggerfish (Rhinecanthus aculeatus).
J. Exp. Biol.
205
,
1253
-1263.
Müller, U. K. and van Leeuwen, J. L.(
2004
). Swimming of larval zebrafish: ontogeny of body waves and implications for locomotory development.
J. Exp. Biol.
207
,
853
-868.
Mussi, M., Summers, A. P. and Domenici, P.(
2002
). Gait transition speed, pectoral fin-beat frequency and mplitude in Cymatogaster aggregata, Embiotoca lateralis and Damalichthys vacca.
J. Fish Biol.
61
,
1282
-1293.
Nauwelaerts, S. and Aerts, P. (
2002
). Two distinct gait types in swimming frogs.
J. Zool. Lond.
258
,
183
-188.
Rice, W. R. (
1989
). Analyzing tables of statistical tests.
Evolution
43
,
223
-225.
Rome, L. C., Funke, R. P. and Alexander, R. M.(
1990
). The influence of temperature on muscle velocity and sustained performance in swimming carp.
J. Exp. Biol.
154
,
163
-178.
Stobutzki, I. C. and Bellwood, D. R. (
1994
). An analysis of the sustained swimming abilities of pre- and post-settlement coral reef fishes.
J. Exp. Mar. Biol.
175
,
275
-286.
Thorsen, D. H., Cassidy, J. J. and Hale, M. E.(
2004
). Development of pectoral fin morphology and locomotion in the zebrafish Danio rerio.
Am. Zool
.
43
,
903
.
Videler, J. J. and Weihs, D. (
1982
). Energetic advantages of burst and coast swimming of fish at high speeds.
J. Exp. Biol.
97
,
169
-178.
Vogel, S. J. (
1994
).
Life in Moving Fluids: The Physical Biology of Flow.
Princeton: Princeton University Press.
Walker, J. A. and Westneat, M. W. (
1997
). Labriform propulsion in fishes: kinematics of flapping aquatic flight in the bird wrasse Gomphosus varius (Labridae).
J. Exp. Biol.
200
,
1549
-1569.
Walker, J. A. and Westneat, M. W. (
2000
). Performance limits of labriform propulsion and correlates with fin shape and motion.
J. Exp. Biol.
205
,
177
-187.
Webb, P. W. (
1973
). Kinematics of pectoral fin propulsion of Cymatogaster aggregata.
J. Exp. Biol.
59
,
697
-710.
Webb, P. W. (
1988
). Simple physical principles of vertebrate aquatic locomotion.
Am. Zool.
28
,
709
-725.
Webb, P. W. (
1994
). The biology of fish swimming. In
Mechanics and Physiology of Animal Swimming
(ed. L. Maddock, Q. Bone and J. M. V. Rayner), pp.
45
-62. Cambridge: Cambridge University Press.
Westneat, M. W. (
1996
). Functional morphology of aquatic flight in fishes: kinematics, electromyography, and mechanical modeling of labriform locomotion.
Am. Zool.
36
,
582
-598.


text:
# Math Help - Calculus I: integral

1. ## Calculus I: integral

Evaluate $\int \frac{x^2 + 2}{(x \cos x + \sin x)^2} \ dx.$

2. Try the substitution $u=x-\arctan\frac1x$. Then $\tan u=\frac{\tan x-\frac1x}{1+\frac{\tan x}x} =\frac{x\sin x-\cos x}{x\cos x+\sin x}$. Furthermore $1+\tan^2 u=\frac{x^2+1}{(x\cos x+\sin x)^2}$. Also $\mathrm{d}u=\frac{x^2+2}{x^2+1}\mathrm{d}x$. Therefore $\displaystyle\int\dfrac{x^2+2}{(x\cos x+\sin x)^2}\mathrm{d}x=\int(1+\tan^2 u)\mathrm{d}u=\tan u+c=\frac{x\sin x-\cos x}{x\cos x+\sin x}+c$.

3. Originally Posted by halbard

Try the substitution $u=x-\arctan\frac1x$. Then $\tan u=\frac{\tan x-\frac1x}{1+\frac{\tan x}x} =\frac{x\sin x-\cos x}{x\cos x+\sin x}$. Furthermore $1+\tan^2 u=\frac{x^2+1}{(x\cos x+\sin x)^2}$. Also $\mathrm{d}u=\frac{x^2+2}{x^2+1}\mathrm{d}x$. Therefore $\displaystyle\int\dfrac{x^2+2}{(x\cos x+\sin x)^2}\mathrm{d}x=\int(1+\tan^2 u)\mathrm{d}u=\tan u+c=\frac{x\sin x-\cos x}{x\cos x+\sin x}+c$.
correct! well-done!


text:
# Graphics¶

With R you can make beautiful plots. You have a lot of control over what you want your plots to look like. But all the control is via code, and this does make things pretty complicated at times.

Moreover, there are entirely different approaches to make plots. Here we only discuss scatter-plots with the “base” package. The next chapter shows other basic plot types. The chapter thereafter shows how you can make plots with additional packages levelplot and ggplot. It is very useful to learn about “base” plotting first before you get into the more complicated (and sometimes, but not always more fancy) approaches. There are many websites with cool examples.

Here we use the cars, InsectSprays and iris data sets that come with R.

cars has two variables: the speed of cars and the distances taken to stop (data recorded in the 1920s), see ?cars

## Scatter plots¶

data(cars)
##   speed dist
## 1     4    2
## 2     4   10
## 3     7    4
## 4     7   22
## 5     8   16
## 6     9   10

As we only have two variables, we can simply do

plot(cars)

But to be more explicit:

plot(cars[,1], cars[,2])

And now to embellish, add axes labels.

plot(cars[,1], cars[,2], xlab='Speed of car (miles/hr)', ylab='Stopping distance (feet)')

Different symbols (pch is the symbol type, cex is the size).

plot(cars, xlab='Speed of car (miles/hr)', ylab='Stopping distances (feet)', pch=20, cex=2, col='red')

cex is the magnification factor. The default value is 1.

Let’s change some things about the axes. Use xlim and ylim to set the start and end of an axis. las=1 changes the orientation of the y-axis labels to horizontal.

plot(cars, xlab='Speed', ylab='Time', pch=20, cex=2, col='red', xlim = c(0,25), las=1)

Here we do not draw axes at first, and then add the lower (1) and left (2) axis, to avoid drawing the clutter from the unnecessary “upper” and “right” axis. Arguments xaxs="i" and yaxs="i" force the axis to touch at (0,0).

plot(cars, xlab='Speed', ylab='', pch=20, cex=2, col='red', xlim = c(0,27), ylim=c(0,125), axes=FALSE, xaxs="i", yaxs="i")
axis(1)
axis(2, las=1)
text(5, 100, 'Cars!', cex=2, col='blue')
par(xpd=NA)
text(-1, 133, 'Distance\n(feet)')

We can change the symbols using another variable. Let’s say we have three car brands and that we want to vary the symbol type, color, and size by brand (typically one of these changes should suffice to distinguish them!).

set.seed(0)
brands <- c('Buick', 'Chevrolet', 'Ford')
b <- sample(brands, nrow(cars), replace=TRUE)
i <- match(b, brands)
plot(cars, pch=i+1, cex=i, col=rainbow(3)[i])
j <- 1:length(brands)
legend(5, 120, brands, pch=(j+1), pt.cex=j, col=rainbow(3), cex=1.5)

The important step is the use of match, that creates for each character string a matching number that can be used to set the character type desired.

As you have seen above, plot takes many variables. Several other parameters influencing your plot, can be set with par. See ?par for details. Here I use it to create 4 subplots (mfrow=c(2,2) with non-default margins (mar=c(2,3,1.5,1.5)).

par(mfrow=c(2,2), mar=c(2,3,1.5,1.5))
for (i in 1:4) {
plot(sample(cars[,1]), sample(cars[,2]), xlab='', ylab='', las=1)
}

## Some other base plots¶

Now consider the InsectSprays dataset

head(InsectSprays)
##   count spray
## 1    10     A
## 2     7     A
## 3    20     A
## 4    14     A
## 5    14     A
## 6    12     A

hist(InsectSprays[,1])

x <- aggregate(InsectSprays[,1,drop=F], InsectSprays[,2,drop=F], sum)
barplot(x[,2], names=x[,1], horiz=T, las=1)

boxplot(count ~ spray, data = InsectSprays, col = "lightgray")

## Exploring the iris data set¶

Now let’s have a look at the ‘iris’ dataset. It has 150 observations of 5 variables for 3 species of iris.

data(iris)
str(iris)
## 'data.frame':    150 obs. of  5 variables:
##  $Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... ##$ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
##  $Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... ##$ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
##  $Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...  Default plot characteristics are not satisfactory most of the time. You may want different heading, labels of x and y axis or different color of lines/points/bars. There is a large number of graphical parameters to set these. Here are some examples. ### Scatter plot¶ Note how the scatter plot type is controlled by type parameter. plot(iris$Sepal.Length, type = 'l')

plot(iris$Sepal.Length, type = 'p')  plot(iris$Sepal.Length, type = 'o')

plot(iris$Sepal.Length, iris$Sepal.Width, type = 'p')

### Titles and axis labels¶

plot(iris$Petal.Length, iris$Petal.Width, main = "Edgar Anderson's Iris Data",
xlab = "Petal Length", ylab = "Petal Width")

The font size can be changed by cex.main and cex.lab argument. Try setting cex.lab = 2 to increase the font size of the axes. cex.axis controls the size of axis tick values.

### Plotting characters¶

You can use lty to change the line type, and pch to choose a point type.

plot(iris$Sepal.Length, type = 'l', lty = 2, lwd = 2, main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width")  plot(iris$Petal.Length, iris$Petal.Width, pch = 8, main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width")  There are many choices for pch. You can use example("pch"), or do plot(1:25, pch=1:25) to see the some plotting characters. Instead of a code, you can also specify the character like in pch="&". The size of a point character (pch) can be controlled with cex argument. ### Colors¶ plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = 'red', main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width")  We can link a color to a value. mycolor <- c("red","green3","blue")[as.factor(iris$Species)]
plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = mycolor,
main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width")

Note that the length of col vector should be equal to the number of items you are plotting.

You can use colors() to see a list of named colors.

### Axes¶

To change the range of an axis you can use xlim and/or ylim argument(s).

plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = mycolor,
main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width",
xlim = c(0,10), ylim= c(0,10))

You can also set xlim and ylim with range. Try xlim = range(iris$Petal.Length). Use axis function to change the tick position and annotations (axes labels). First you need to turn off the default axes. plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = mycolor, main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width", xlim = c(0,10), ylim= c(0,10), axes = FALSE) axis(1, at = 1:10, lab = c(1:10)) axis(2, at = 1:10, lab = c(1:10))  ### Interacting with plots¶ You can use identify() to identify a particular point in the plot. Try identify(iris$Petal.Length, iris$Petal.Width). You can left click with the mouse to identify multiple points. Once complete use ESC to end the process. You can use locator() to find out the coordinates at a particular position on a graph. Try locator() . You can left click with the mouse any number of times within the axes and use ESC to end the process. A list of X and Y coordinates of the positions clicked will be returned. You can retain this information by assigning a variable to locator before starting it: loc <- locator(). The coordinates will be stored as loc$x and loc$y. locator is particularly useful to add additional information to the graph. See the following example. ### Legend¶ We use a different color to represent each species of iris. We can create a legend for this information using legend function. plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = mycolor, main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width", xlim = c(0,10), ylim= c(0,10)) legend('topright', legend = unique(iris$Species), col = c("red","green3","blue"), pch = 8)

To make a legend with no border use bty = 'n'.

Often we want include additional text in the plot. locator can be used to find the approximate x and y coordinates where you want to place the text. Use loc <- locator().

loc <- list()
loc$x <- 2.75 loc$y <- 4.94
plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = mycolor,
main = "Edgar Anderson's Iris Data", xlab = "Petal Length", ylab = "Petal Width",
xlim = c(0,10), ylim= c(0,10))
legend('topright', legend = unique(iris$Species), col = c("red","green3","blue"), pch = 8, bty = 'n') text(loc$x, loc$y, labels = "Hello! this is a Scatter Plot")  ## Multiple plots¶ To combine multiple plots in one image you can use layout() or par(). For example, 4 plots can be combined with layout(matrix(1:4, 2, 2)) or par(mfrow=c(2,2)). par(mfrow=c(2,2)) boxplot(iris$Sepal.Length~iris$Species, main = "Boxplot of Sepal Length", xlab = "Species", ylab = "Sepal Length", col = c("red","green3","blue"), cex.lab = 1.25) hist(iris$Sepal.Length, main = "Histogram of Sepal Length",
xlab = "Sepal Length", ylab = "Frequency", col = c("grey"), cex.lab = 1.25)
plot(iris$Sepal.Length, type = 'l', lty = 2, lwd = 2, col = 'red', main = "Variation with of Petal Width and Petal Length", xlab = "Petal Length", ylab = "Petal Width", cex.lab = 1.25) plot(iris$Petal.Length, iris$Petal.Width, pch = 8, col = mycolor, main = "Scatter plot of Petal Width and Petal Length", xlab = "Petal Length", ylab = "Petal Width", cex.lab = 1.25)  ## Saving plots¶ You can directly write a plot to a file such as pdf of png. To save any of the above plots in a pdf file called theplot.pdf you first open the pdf device, then do the plotting and use dev.off() when done. pdf("theplot.pdf") boxplot(iris$Sepal.Length~Species, main = "Boxplot of Sepal Length",
xlab = "Species", ylab = "Sepal Length", col = c("red","green3","blue"))
dev.off()

For plotting to an image file, you can use png and other formats. To set the device size (dimensions and resolution), you can use a few parameters

png(filename = "myplot.png", width = 200, height = 300, units = "cm", res = 300)
boxplot(iris$Sepal.Length~iris$Species, main = "Boxplot of Sepal Length",
xlab = "Species", ylab = "Sepal Length", col = c("red","green3","blue"))
dev.off()

You should now have a file called “myplot.png” in your working directory.

## Summary¶

Some different plot types

+ plot( )                Scatter plot, and general plotting
+ hist( )                Histogram
+ stem( )                Stem-and-leaf
+ boxplot( )             Boxplot
+ qqnorm( )              Normal probability plot
+ mosaicplot( )          Mosaic plot

Add elements to a plot

+ points( )              Add points
+ lines( )               Add lines
+ text( )                Add text
+ abline( )              Add lines
+ legend( )              Add legend

Important graphical parameters

+ par( )                 Set parameters for plotting
+ cex                    Font size
+ col                    Color of plotting symbols
+ lty                    Line type
+ lwd                    Line width
+ mar                    Inner margins
+ mfrow                  Multiple figures per image
+ oma                    Outer margins
+ pch                    Plotting symbol
+ xlim                   Min and max of X axis range
+ ylim                   Min and max of Y axis range

### Resources¶

Additional resources you may want to consult are the R demo for different types of plots: demo("graphics") and the help for plot (?plot).

There is also a comprehensive gallery of plots


text:
# How can I solve this Equation?

Let $\Omega\subset\mathbb{R}^n$ be a bounded domain and $K:\Omega\times\Omega\rightarrow\mathbb{R}$ with $\|K\|_{L^2(\Omega\times\Omega)}<1.$ How can I show that the following equation has only the zero solution? $$u(x)=\int_\Omega K(x,y)u(y)dy$$

Thanks

-

## 1 Answer

Take the $L^2$ norm of both sides and estimate the right hand side, using the Cauchy-Schwarz Inequality.

Look for an inequality of the form $z \ge 0, z \le cz$ with $c <1$. Then you can conclude $z = 0$.

-
Thank you HansEngler! –  Tomás Dec 4 '12 at 13:32


text:
# Conditional Probability against Combinatorics

Consider a lot consisting of 3 blue balls and 1 red ball.

Suppose I pick 2 balls one after another without replacement, now the probability of 2 balls being blue:

$$\frac{3\choose 2}{4 \choose 2}$$

Now taking different approach using conditional probability, the solution is also:

$$\frac34\times\frac23$$

Now it turns out that both of them evaluate to $1/2$.

Why this happens and does it happen always?

Is solving the problem using combinations an efficient approach always?

Or am I missing something basic out here!

• Without replacement is the keyword here. The combinations approach results in an arrangement without replacement. Hence the answer matches. Try to solve the same problem with replacement=True. – Sriharsha Madala Sep 23 '15 at 18:28

We are talking of drawing without replacement.

For the particular case you have given, the two approaches match, but beware

If the question were probability of getting 1 red, 1 blue

$(a) \dfrac{{3\choose1}{1\choose1}}{4\choose2} = \dfrac12$ , but

$(b) \dfrac34\cdot\dfrac13 = \dfrac14$ and you need to multiply by $2!$ to take into account different orders in which the events can occur.

On the other hand, if the problem asked the probability of a red followed by a blue,

$(b) \dfrac34\cdot\dfrac13 = \dfrac14$ is correct,

and for $(a)$, you need to divide $\dfrac{\binom{3}{1}\binom{1}{1}}{\binom{4}{2}}= \dfrac12$ by $2!$ to get the specified order

Adopting the KISS approach, I use combinations when order is unspecified, and direct multiplication of probabilities when order is specified.

Both approaches are correct. Both methods can be viewed as combinatorial.

In your first approach, your sample space consists of ${4 \choose 2} = 6$ unordered samples, each with probability $1/6.$ Three of the six outcomes correspond to choosing two blue balls, for a probability of $1/2.$ It is OK to use unordered samples because we are interested in the number of balls chosen of each color, not the order in which choices were made.

Maybe the balls are numbered 1, 2, 3, 4, with the first three being blue. Then outcomes that satisfy your event are $\{12, 13, 23\}$. (I use $numerical$ order in this listing because the $actual$ order of listing is irrelevant.

In your second approach, you can consider that you have a sample space consisting of $12$ ordered outcomes, each with probability $1/12.$ Six of the twelve ordered outcomes have two blue balls, so the probability is $1/2.$

This second approach would be necessary if you wanted to answer a question such as "What is the probability I choose a blue ball first and then the red one?"

Numbering the balls as before, the six outcomes out of twelve that satisfy the event $\{\text{Two Blue}\}$ are $\{12, 13, 23, 21, 31, 32\}.$ Here I am not free to use numerical order in making my list because the actual order of selection does matter.

This is one more method to solve this problem:
Consider a Lot consists of {B1,B2,B3,R} B:Blue ball R:Red ball.

Now list out all the combinations we get when we choose 2 balls from the Lot, one after another(without replacement).Let the event be S.

S={(B1,B2),(B1,B3),(B1,R),(B2,B1),(B2,B3),(B2,R),(B3,B2),(B3,B1),(B3,R),(R,B1),(R,B2),(R,B3)}.

Now our event E is getting 2 Blue balls,

E={(B1,B2),(B1,B3),(B2,B1),(B2,B3),(B3,B2),(B3,B1)}.

Now probability of getting event E is,
P(E)=n(S)/n(E);which is 6/12=1/2. n:cardinality of a set(ie.number of elements).

Inference: There is hell a lot of way to get solution to a probability question,all the answers match provided the approach is right.Everyone chooses their own approach,so there is no "efficient" approach. This is also a reason why I(Most of us) love it.