text:
# Is the word problem in the braid group quotient $B_{n}/N$ solvable where $N$ is the normal subgroup generated by conjugates of $\sigma_{i}^{2r}$?

Let $r\geq 2$. Let $N$ be the normal subgroup of $B_{n}$ generated by conjugates of $\sigma_{i}^{2r}$. Then is the word problem in the quotient group $B_{n}/N$ solvable (in polynomial time)? Furthermore, does there exist a normal form for the elements in $B_{n}/N$? I am mostly interested in this group where $r=3$, so $N$ is generated by the conjugates of $\sigma_{i}^{6}$.

• "normal subgroup generated by $x$" = "subgroup generated by conjugates of $x$" ("normal subgroup generated by conjugates of $x$" is redundant) – YCor Nov 22 '16 at 16:33
• This is known for small values of n and some ranges of $r$ but the general case is wide open as far as I know. My personal guess is that these groups are automatic for large (or even all) $r$. Derek Holt has software for verifying automaticity of groups, maybe you should ask him. – Misha Nov 22 '16 at 17:03
• I have tried these examples but without success. The braid groups are in any case difficult for my programs because you have to use the full set of $n!-1$ Garside generators to get a geodesic automatic structure. – Derek Holt Nov 22 '16 at 19:14
• Misha. Can you give a reference for your claim that it is known for certain values? – Joseph Van Name Nov 23 '16 at 0:01
• It will take a bit of work on my part. The examples I know stem from complex hyperbolic manifolds of small complex dimension and their ramified covers. – Misha Nov 23 '16 at 18:39


text:
# 4.4: Lights, Camera, Action

A scene in computer graphics can be a complex collection of objects, each with its own attributes. In Subsection 2.4.2, we saw how a scene graph can be used to organize all the objects in a 2D scene. Rendering a scene means traversing the scene graph, rendering each object in the graph as it is encountered. For 3D graphics, scene graphs must deal with a larger variety of objects, attributes, and transforms. For example, it is often useful to consider lights and cameras to be objects and to be able to include them in scene graphs. In this section, we consider scene graphs in 3D, and how to treat cameras and lights as objects.

When designing scene graphs, there are many options to consider. For example, should transforms be properties of object nodes, or should there be separate nodes to represent trans- forms? The same question can be asked about attributes. Another question is whether an attribute value should apply only to the node of which it is a property, or should it be inherited by the children of that node?

A fundamental choice is the shape of the graph. In general, a scene graph can be a directed acyclic graph, or “dag,” which is a tree-like structure except that a node can have several parents in the graph. The scene graphs in Subsection 2.4.2 were dags. This has the advantage that a single node in the graph can represent several objects in the scene, since in a dag, a node can be encountered several times as the graph is traversed. On the other hand, representing several objects with one scene graph node can lead to a lack of flexibility, since those objects will all have the same value for any property encoded in the node. So, in some applications, scene graphs are required to be trees. In a tree, each node has a unique parent, and the node will be encountered only once as the tree in traversed. The distinction between trees and dags will show up when we discuss camera nodes in scene graphs.

## Attribute Stack

We have seen how the functions glPushMatrix and glPopMatrix are used to manipulate the transform stack. These functions are useful when traversing a scene graph: When a node that contains a transform is encountered during a traversal of the graph, glPushMatrix can be called before applying the transform. Then, after the node and its descendants have been rendered, glPopMatrix is called to restore the previous modelview transformation.

Something similar can be done for attributes such as color and material, if it is assumed that an attribute value in a scene graph node should be inherited as the default value of that attribute for children of the node. OpenGL 1.1 maintains an attribute stack, which is manipulated using the functions glPushAttrib and glPopAttrib. In addition to object attributes like the current color, the attribute stack can store global attributes like the global ambient color and the enabled state of the depth test. Since there are so many possible attributes, glPushAttrib does not simply save the value of every attribute. Instead, it saves a subset of the possible attributes. The subset that is to be saved is specified as a parameter to the function. For example, the command

glPushAttrib(GL_ENABLED_BIT);

will save a copy of each of the OpenGL state variables that can be enabled or disabled. This in- cludes the current state of GL_DEPTH_TEST, GL_LIGHTING, GL_NORMALIZE, and others. Similarly,

glPushAttrib(GL_CURRENT_BIT);

saves a copy of the current color, normal vector, and texture coordinates. And

glPushAttrib(GL_LIGHTING_BIT);

saves attributes relevant to lighting such as the values of material properties and light properties, the global ambient color, color material settings, and the enabled state for lighting and each of the individual lights. Other constants can be used to save other sets of attributes; see the OpenGL documentation for details. It is possible to OR together several constants to combine sets of attributes. For example,

glPushAttrib(GL_LIGHTING_BIT | GL_ENABLED_BIT)

will save the attributes in both the GL_LIGHTING_BIT set and in the GL_ENABLED_BIT set.

Calling glPopAttrib() will restore all the values that were saved by the corresponding call to glPushAttrib. There is no need for a parameter to glPopAttrib, since the set of attributes that are restored is determined by the parameter that was passed to glPushAttrib.

It should be easy to see how glPushAttrib and glPopAttrib can be used while traversing a scene graph: When processing a node, before changing attribute values, call glPushAttrib to save a copy of the relevant set or sets of attributes. Render the node and its descendants. Then call glPopAttrib to restore the saved values. This limits the effect of the changes so that they apply only to the node and its descendants.

There is an alternative way to save and restore values. OpenGL has a variety of “get” functions for reading the values of various state variables. I will discuss just some of them here. For example,

glGetFloatv( GL_CURRENT_COLOR, floatArray );

retrieves the current color value, as set by glColor*. The floatArray parameter should be an array of float, whose length is at least four. The RGBA color components of the current color will be stored in the array. Note that, later, you can simply call glColor4fv(colorArray) to restore the color. The same function can be used with different first parameters to read the values of different floating-point state variables. To find the current value of the viewport, use

glGetIntegerv( GL_VIEWPORT, intArray );

This will set intArray[0] and intArray[1] to be the x and y coordinates of the lower left corner of the current viewport, intArray[2] to be its width, and intArray[3] to be its height. To read the current values of material properties, use

glGetMaterialfv( face, property, floatArray );

The face must be GL_FRONT or GL_BACK. The property must be GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION, or GL_SHININESS. The current value of the property will be stored in floatArray, which must be of length at least four for the color properties, or length at least one for GL_SHININESS. There is a similar command, glGetLightfv, for reading properties of lights.

Finally, I will mention glIsEnabled(name), which can be used to check the enabled/disabled status of state variables such as GL_LIGHTING and GL_DEPTH_TEST. The parameter should be the constant that identifies the state variable. The function returns 0 if the state variable is disabled and 1 if it is enabled. For example, glIsEnabled(GL_LIGHTING) tests whether lighting is enabled. Suppose that a node in a scene graph has an attribute lit to tell whether that node (and its descendants) should be rendered with lighting enabled. Then the code for rendering a node might include something like this:

int saveLit = glIsEnabled(GL_LIGHTING);
if (lit)
glEnable(GL_LIGHTING);
else
glDisable(GL_LIGHTING);
.
. // Render the node and its descendants
.
if (saveLit)
glEnable(GL_LIGHTING);
else
glDisable(GL_LIGHTING);

Since glPushAttrib can be used to push large groups of attribute values, you might think that it would be more efficient to use glIsEnabled and the glGet* family of commands to read the values of just those state variables that you are planning to modify. However, recall that OpenGL can queue a number of commands into a batch to be sent to the graphics card, and those commands can be executed by the GPU at the same time that your program continues to run. A glGet command can require your program to communicate with the graphics card and wait for the response. This means that any pending OpenGL commands will have to be sent to the graphics card and executed before the glGet command can complete. This is the kind of thing that can hurt performance. In contrast, calls to glPushAttrib and glPopAttrib can be queued with other OpenGL commands and sent to the graphics card in batches, where they can be executed efficiently by the graphics hardware. In fact, you should generally prefer using glPushAttrib/glPopAttrib instead of a glGet command when possible.

## Moving Camera

Let’s turn to another aspect of modeling. Suppose that we want to implement a viewer that can be moved around in the world like other objects. Sometimes, such a viewer is thought of as a moving camera. The camera is used to take pictures of the scene. We want to be able to apply transformations to a camera just as we apply transformations to other objects. The position and orientation of the camera determine what should be visible when the scene is rendered. And the “size” of the camera, which can be affected by a scaling transformation, determines how large a field of view it has. But a camera is not just another object. A camera really represents the viewing transformation that we want to use. Recall that modeling and viewing transformations have opposite effects: Moving objects to the right with a modeling transform is equivalent to moving the viewer to the left with a viewing transformation. (See Subsection 3.3.4.) To apply a modeling transformation to the camera, we really want to apply a viewing transformation to the scene as a whole, and that viewing transformation is the inverse of the camera’s modeling transformation.

The following illustration shows a scene viewed from a moving camera. The camera starts in the default viewing position, at the origin, looking in the direction of the negative z-axis. This corresponds to using the identity as the viewing transform. For the second image, the camera has moved forward by ten units. This would correspond to applying the modeling transformation glTranslatef(0,0,−10) to the camera (since it is moving in the negative z-direction). But to implement this movement as a change of view, we want to apply the inverse operation as a viewing transformation. So, the viewing transform that we actually apply is glTranslatef(0,0,10). This can be seen, if you like, as a modeling transformation that is applied to all the other objects in the scene: Moving the camera ten units in one direction is equivalent to moving all the other objects 10 units in the opposite direction.

For the third image, the camera has rotated in place by 21 degrees to the right — a 21-degree clockwise rotation about the y-axis — after it has been translated. This can be implemented by the transformation glRotatef(21,0,1,0) — a 21-degree counterclockwise rotation about the y-axis—applied before the translation. Remember that the inverse of a composition of transformations is the composition of their inverses, in the opposite order. Mathematically, using $$T^{-1}$$ to represent the inverse of a transformation T, we have that $$(RS)^{-1} = S^{-1} R^{-1}$$ for two transformations R and S.

The images in the illustration are from the demo c4/walkthrough.html, which you can try on-line. The demo lets you move around in a scene. More accurately, of course, it lets you change the viewing transformation to see the scene from different viewpoints.

When using scene graphs, it can be useful to include a camera object in the graph. That is, we want to be able to include a node in the graph that represents the camera, and we want to be able to use the camera to view the scene. It can even be useful to have several cameras in the scene, providing alternative points of view. To implement this, we need to be able to render a scene from the point of view of a given camera. From the previous discussion, we know that in order to do that, we need to use a viewing transformation that is the inverse of the modeling transformation that is applied to the camera object. The viewing transform must be applied before any of the objects in the scene are rendered.

When a scene graph is traversed, a modeling transformation can be applied at any node. The modeling transform that is in effect when a given node is encountered is the composition of all the transforms that were applied at nodes along the path that led to given node. However, if the node is a camera node, we don’t want to apply that modeling transform; we want to apply its inverse as a viewing transform. To get the inverse, we can start at the camera node and follow the path backwards, applying the inverse of the modeling transform at each node.

To easily implement this, we can add “parent pointers” to the scene graph data structure. A parent pointer for a node is a link to the parent of that node in the graph. Note that this only works if the graph is a tree; in a tree, each node has a unique parent, but that is not true in a general directed acyclic graph. It is possible to move up the tree by following parent pointers.

We this in mind, the algorithm for rendering the scene from the point of view of a camera goes as follows: Set the modelview transform to be the identity, by calling glLoadIdentity(). Start at the camera node, and follow parent pointers until you reach the root of the tree. At each node, apply the inverse of any modeling transformation in that node. (For example, if the modeling transform is translation by (a,b,c), call glTranslatef(−a,−b,−c).) Upon reaching the root, the viewing transform corresponding to the camera has been established. Now, traverse the scene graph to render the scene as usual. During this traversal, camera nodes should be ignored.

Note that a camera can be attached to an object, in the sense that the camera and the object are both subject to the same modeling transformation and so move together as a unit. In modeling terms, the camera and the object are sub-objects in a complex object. For example, a camera might be attached to a car to show the view through the windshield of that car. If the car moves, because its modeling transformation changes, the camera will move along with it.

## Moving Light

It can also be useful to think of lights as objects, even as part of a complex object. Suppose that a scene includes a model of a lamp. The lamp model would include some geometry to make it visible, but if it is going to cast light on other objects in the scene, it also has to include a source of light. This means that the lamp is a complex object made up of an OpenGL light source plus some geometric objects. Any modeling transformation that is applied to the lamp should affect the light source as well as the geometry. In terms of the scene graph, the light is represented by a node in the graph, and it is affected by modeling transformations in the same way as other objects in the scene graph. You can even have animated lights—or animated objects that include lights as sub-objects, such as the headlights on a car.

Recall from Subsection 4.2.3 that a light source is subject to the modelview transform that is in effect at the time the position of the light source is set by glLightfv. If the light is represented as a node in a scene graph, then the modelview transform that we need is the one that is in effect when that node is encountered during a traversal of the scene graph. So, it seems like we should just traverse the graph and set the position of the light when we encounter it during the traversal.

But there is a problem: Before any geometry is rendered, all the light sources that might affect that geometry must already be configured and enabled. In particular, the lights’ positions must be set before rendering any geometry. This means that you can’t simply set the position of light sources in the scene graph as you traverse the graph in the usual way. If you do that, objects that are drawn before the light is encountered won’t be properly illuminated by the light. Similarly, if the light node contains values for any other properties of the light, including the enabled/disabled state of the light, those properties must be set before rendering any geometry.

One solution is to do two traversals of the scene graph, the first to set up the lights and the second to draw the geometry. Since lights are affected by the modelview transformation, you have to set up the modeling transform during the first traversal in exactly the same way that you do in the second traversal. When you encounter the lights during the first traversal, you need to set the position of the light, since setting the position is what triggers the application of the current modelview transformation to the light. You also need to set any other properties of the light. During the first traversal, geometric objects in the scene graph are ignored. During the second traversal, when geometry is being rendered, light nodes can be ignored.

4.4: Lights, Camera, Action is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by David J. Eck via source content that was edited to conform to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

format: plain


text:
Full length article| Volume 442, 120407, November 15, 2022

# Modeling the effect of gravity on periodic alternating nystagmus

Open AccessPublished:September 04, 2022

## Highlights

• Previous studies have shown contradicting effects of gravity on PAN.
• Computational models of “rotation feedback”, critical in tilt translation disambiguation, can explain the contradictions.
• A very low gain of “rotation feedback” can suppress PAN in head down positions, but the effect takes a few minutes.
• Understanding the role of “rotational feedback” in patients with PAN may enhance neurological localization.

## Abstract

Periodic alternating nystagmus (PAN) is a rare oscillatory ocular motor disorder. The effects of gravity on the dynamic behavior of PAN can be studied by monitoring the nystagmus while changing head orientation. Previous studies of patients with PAN reached different conclusions about the effect of changing the orientation of the head relative to gravity on the ongoing PAN, either no effect or a damping of the nystagmus within several minutes. What neuronal circuits could account for the difference in the effects of gravity among PAN patients? We modeled how the brain resolves the tilt-translation ambiguity in normal individuals and added an unstable, oscillatory vestibular system generating PAN. PAN was suppressed in our patient in ear-down positions, in a similar pattern to that of a previously reported patient. This effect was simulated by reducing the gain of the projection of the “rotation feedback” loop to the velocity-storage integrator to approximately 5% of its normal value. With normal “rotation feedback” PAN is expected to dissipate quickly as soon as the head is rotated away from upright position. Moreover, by disconnecting the rotation feedback completely (gain = zero) the model simulated PAN that was reported to be unaffected by gravity. Thus, understanding the effect of this single parameter, the gain of the rotation feedback, can explain the observed variability among our own and previous studies.

## 1. Introduction

Periodic alternating nystagmus (PAN) is an ocular motor disorder characterized by spontaneous horizontal nystagmus that reverses direction approximately every 2 min [
• Leigh R.J.
• Robinson D.A.
• Zee D.S.
A hypothetical explanation for periodic alternating nystagmus: instability in the optokinetic-vestibular system.
]. Previous studies of patients with PAN reached different conclusions about the effect of changing the orientation of the head relative to gravity on the ongoing PAN. In four patients tested in supine and ear-down positions PAN was unaffected by gravity [
• Furman J.M.
• Wall C.
• Pang D.L.
Vestibular function in periodic alternating nystagmus.
]. In a single patient, Chung et al. found damping of the nystagmus within several minutes (approximately two periods of the PAN oscillation) in ear-down positions [
• Chung S.J.
• Park S.-H.
• Kim J.-S.
• et al.
Positional suppression of periodic alternating nystagmus.
]. Here we examined the effects of gravity on an additional patient with PAN to help resolve the different results from prior works. Our strategy was to combine a model of the interaction of gravity with other vestibular signals in normal individuals [
• Laurens J.
• Angelaki D.E.
The functional significance of velocity storage and its dependence on gravity.
] with a model of the mechanism underlying PAN [
• Leigh R.J.
• Robinson D.A.
• Zee D.S.
A hypothetical explanation for periodic alternating nystagmus: instability in the optokinetic-vestibular system.
]. We then used this combined model to simulate the effect of lesions in central vestibular circuits that might account for the different effects of changing the orientation of the head relative to gravity on the ongoing PAN. The example of PAN and its interaction with gravity highlights the value of these models in interpreting and localizing complex clinical findings in patients with central vestibular disorders.
The vestibular system – the vital sixth sense that ensures stable posture and clear vision when we move – apprises the brain of the motion and position of the head with respect to the external world [
]. Angular acceleration is detected by the semicircular canals (SCCs) and linear acceleration by the otolith organs. However, as Einstein's principle of equivalence states, any linear accelerometer (as the otolith organs) cannot distinguish changes in linear acceleration due to tilt of the head with respect to gravity from translation of the head in the environment [
• von Meyenn K.
Über das Relativitätsprinzip und die aus demselben gezogenen Folgerungen.
]. Instead, the otoliths sense the gravito-inertial acceleration (GIA) vector resulting from the sum of linear acceleration due to translation and that due to gravity. The brain must solve this ambiguity because, for example, in the case of vestibulo-ocular reflexes, the response to a lateral tilt of the head is a torsional eye movement while that to a lateral translation of the head is a horizontal eye movement. While no perfect mathematical solution exists to resolve this tilt-translation ambiguity in the otolith signal, under most natural conditions the brain can use context or existing beliefs to disambiguate the GIA into its two constituents. An example using context is to monitor activity in the semicircular canals to detect dynamic tilt before a change in GIA is attained. An existing belief, for example, could make the brain expect that any sustained change in GIA comes from a tilt, and not from a translation.
Unfortunately signals from the semicircular canals are not perfect representations of head rotation as they also include inherent biological noise, their response fades to head movements of long duration, and there are unwanted motion aftereffects when the head stops moving. Thus, the brain must use a sensor fusion approach to optimally combine these two ambiguous and imperfect signals to estimate tilt, translation, and rotation. Previous studies have developed powerful models implementing these ideas quantitatively and were able to simulate many common experimental findings ([
• Merfeld D.M.
Modeling the vestibulo-ocular reflex of the squirrel monkey during eccentric rotation and roll tilt.
,
• Merfeld D.M.
• Young L.R.
• Oman C.M.
• Shelhamer M.J.
A multidimensional model of the effect of gravity on the spatial orientation of the monkey.
,
• Merfeld D.M.
• Young L.R.
• Paige G.D.
• Tomko D.L.
Three dimensional eye movements of squirrel monkeys following postrotatory tilt.
,
• Merfeld D.M.
• Zupan L.
• Peterka R.J.
Humans use internal models to estimate gravity and linear acceleration.
]; [
• Merfeld D.M.
• Glasauer S.
Modelling three-dimensional vestibular responses during complex motion stimulation.
]; [
• Glasauer S.
• Dieterich M.
• Brandt T.
Computational neurology of gravity perception involving semicircular canal dysfunction in unilateral vestibular lesions.
,
• Laurens J.
• Angelaki D.E.
The functional significance of velocity storage and its dependence on gravity.
,
• Mergner T.
• Glasauer S.
A simple model of vestibular canal-otolith signal fusion.
]). Here we will extend these models to interpret the response of our patient and those previously reported from patients with PAN in whom the effects of changing the orientation of the head relative to gravity on the ongoing nystagmus were examined.
Fig. 1 shows a diagram of the main elements of the model we implemented. In this model there are four critical operators: tilt estimator, somatogravic feedback, rotation feedback and velocity storage.
• Merfeld D.M.
• Glasauer S.
Modelling three-dimensional vestibular responses during complex motion stimulation.
].
In long time periods, however, the integration operation becomes unreliable since the canal signals contain noise which accumulates over time. For this reason, the brain combines a tilt estimation from the otolith, commonly referred as the somatogravic feedback (Fig. 1), to the tilt estimation from the SCCs. The weighted combination of gravity estimates by SCCs (through integration of non-parallel head rotations with respect to gravity) and the otolith (through low-pass filtering of the GIA) usually generates a reliable estimate of gravity over both short and long time periods. In the case of sustained translation, however, the nature of the somatogravic feedback reflects the belief that any sustained change in GIA must come from a tilt, and not from an extended translation. This results in an erroneous interpretation of tilt, also known as the somatogravic illusion [
• Graybiel A.
Oculogravic illusion.
,
• Graybiel A.
Validity of the oculogravic illusion as a specific indicator of otolith function.
,
• Graybiel A.
• Johnson W.H.
• Money K.E.
• et al.
Oculogravic illusion in response to straight-ahead acceleration of CF-104 aircraft.
,
• Laurens J.
• Angelaki D.E.
The functional significance of velocity storage and its dependence on gravity.
,
• Paige G.D.
• Seidman S.H.
Characteristics of the VOR in response to linear acceleration.
].
To minimize the effect of these virtual head rotations the brain can use the context from the otolith signals and estimated gravity direction to verify that rotation inputs are consistent with the estimated change of gravity orientation. This context comes in the form of a rotation feedback (Fig. 1) signal that offsets the virtual head rotation velocity (the input) to adjust estimated gravity until it again matches the GIA (desired output). This type of problem is called an “inverse problem” because it begins with the effects (realigning estimated gravity towards GIA), then calculates the causes (the virtual head rotation that will produce this result). Mathematically, a solution of this “inverse problem” can be formulated as the cross-product between GIA and the current estimated gravity and is named the rotation feedback. The output of this rotation feedback is incorporated into the VOR through the velocity storage integrator [
• Angelaki D.E.
• Hess B.J.
Three-dimensional organization of otolith-ocular reflexes in rhesus monkeys. I. Linear acceleration responses during off-vertical axis rotation.
,
• Angelaki D.E.
• Merfeld D.M.
• Hess B.J.
Low-frequency otolith and semicircular canal interactions after canal inactivation.
,
• Cohen B.
• Suzuki J.I.
• Raphan T.
Role of the otolith organs in generation of horizontal nystagmus: effects of selective labyrinthine lesions.
,
• Kushiro K.
Compensatory and orienting eye movements induced by off-vertical Axis rotation (OVAR) in monkeys.
,
• Laurens J.
• Straumann D.
• Hess B.J.M.
Processing of angular motion and gravity information through an internal model.
,
• Merfeld D.M.
• Young L.R.
• Oman C.M.
• Shelhamer M.J.
A multidimensional model of the effect of gravity on the spatial orientation of the monkey.
,
• Mergner T.
• Glasauer S.
A simple model of vestibular canal-otolith signal fusion.
].
One method to probe the effect of rotation feedback is to measure the reduction in post-rotatory nystagmus caused by a head tilt, an effect known as “tilt-suppression” [
• Fushiki H.
• Maruyama M.
• Watanabe Y.
Efficacy of tilt-suppression in postrotatory nystagmus in cats.
,
• Hain T.C.
• Zee D.S.
• Maria B.L.
Tilt suppression of vestibulo-ocular reflex in patients with cerebellar lesions.
,
• Jeong S.-H.
• Kim J.-S.
Direction and magnitude of head tilt alter postrotatory nystagmus.
,
• Lee S.-U.
• Choi J.-Y.
• Kim H.-J.
• et al.
Impaired tilt suppression of post-rotatory nystagmus and cross-coupled head-shaking nystagmus in cerebellar lesions: image mapping study.
,
• Wiest G.
• Deecke L.
• Trattnig S.
• Mueller C.
Abolished tilt suppression of the vestibulo-ocular reflex caused by a selective uvulo-nodular lesion.
]. When the head is upright during the post-rotatory period, the axis of virtual head rotation is parallel to gravity and therefore has no destabilizing effect on the vestibular system (estimated gravity is not updated). If instead, the head is tilted during the post-rotatory nystagmus, the virtual rotation axis has an axis that is not parallel to gravity, leading to an erroneous estimation that the head has rotated relative to gravity. The resulting disparity between the orientation of the GIA and the erroneous estimated gravity would then activate the rotation feedback, and the output of which is incorporated into the velocity storage integrator to offset the post-rotatory nystagmus. The accelerated decay of post-rotatory nystagmus decay is called “tilt-suppression” or “dumping” of post-rotatory nystagmus.
How does this conceptual formulation apply to studying the effect of changing the orientation of the head relative to gravity on an ongoing PAN? PAN can also be interpreted as a virtual head rotation though periodically changing its direction. As such, similar considerations of the geometric relationship between the axis of virtual head rotation and gravity in the resolution of the tilt-translation ambiguity, apply to PAN.
We next turned to ablation studies of the nodulus and ventral uvula in monkeys, to look for the possible physiological and anatomical underpinnings of the mechanisms that implement these mathematical operations ([
• Angelaki D.E.
• Hess B.J.
Inertial representation of angular motion in the vestibular system of rhesus monkeys. II. Otolith-controlled transformation that depends on an intact cerebellar nodulus.
], [
• Angelaki D.E.
• Hess B.J.
Lesion of the nodulus and ventral uvula abolish steady-state off-vertical axis otolith response.
]; [
• Cohen B.
• John P.
• Yakushin S.B.
• et al.
The nodulus and uvula: source of cerebellar control of spatial orientation of the angular vestibulo-ocular reflex.
,
• Wearne S.
• Raphan T.
• Cohen B.
Nodulo-uvular control of central vestibular dynamics determines spatial orientation of the angular vestibulo-ocular reflex.
]). Ablation of these structures in monkeys not only causes PAN, but also impairs tilt suppression of post rotatory nystagmus, and eliminates the steady-state response during off-vertical axis (OVAR) rotation. These effects of gravity are thought to be generated through the vestibular velocity-storage integrator via the rotation feedback loop. Together with the results of the ablations studies, we hypothesized that pathological variations in the gain of rotation feedback account for the difference in the effects of gravity among PAN patients. A normal gain of rotation feedback would result in a quick suppression PAN with the head tilted down. A low gain of rotation feedback could lead to gradual (over a few minutes) suppression of PAN in head down positions. With no rotation feedback at all, PAN should be unaffected by head down positions. We used computational modeling of patient data to test our hypothesis.

## 2. Methods

### 2.1 Patient and eye movement recordings

Data was collected from the same patient and with the same methods as in our previous article [
• Shemesh A.A.
• Kocoglu K.
• Akdal G.
• et al.
Modeling the interaction among three cerebellar disorders of eye movements: periodic alternating, gaze-evoked and rebound nystagmus.
]. The patient was a 44-year-old woman who presented with imbalance and one month of blurred vision. Examination of eye movements showed PAN. Positive anti-YO antibodies with underlying breast cancer established the diagnosis of paraneoplastic cerebellar degeneration. The patient was treated with Baclofen 20 mg daily for the nystagmus. Horizontal eye movements were recorded using a head-mounted video-oculography system (ICS Impulse, GN Otometrics, Taastrup, Denmark) with a sampling rate of 220 Hz. The Dokuz Eylül University Review Board approved the experimental protocol and written informed consent was obtained from the patient. All testing was in the light and in the sitting position one meter away from the central target on a wall with the head unrestrained. For the experiments shown here the patient was quickly moved into different positions while recordings continued. Rightward slow-phase velocities (from the patient's point of view) are positive and leftward negative.

### 2.2 Modeling

We implemented a model using MATLAB and Simulink (The MathWorks, Natick, MA). The model was a modified version of the one previously developed by Glasauer and colleagues to simulate central positional nystagmus [
• Choi J.-Y.
• Glasauer S.
• Kim J.H.
• et al.
Characteristics and mechanism of apogeotropic central positional nystagmus.
]. This model is shown in a simplified diagram in Fig. 1 and simulates how signals coming from the otolith organs and the semicircular canals are combined in 3 dimensions to estimate the orientation of the head relative to gravity (or gravity relative to the head), the angular velocity of rotation of the head, and the linear acceleration of the head. We initially implemented the model to produce normal responses without any spontaneous nystagmus. First, we made the key modification of adding an adaptation operator to the rotational velocity processing component and modified the values of the velocity storage to produce PAN in a similar manner as in our previous study [
• Leigh R.J.
• Robinson D.A.
• Zee D.S.
A hypothetical explanation for periodic alternating nystagmus: instability in the optokinetic-vestibular system.
]. We also added a variable bias term to the angular velocity sensed by the canals to calibrate the amplitude of the PAN. Then, we studied the effect of changing the gain of the rotation feedback block on the effect of changes in orientation relative to gravity on PAN. All other elements of the model were kept intact, including the somatogravic feedback loop.

## 3. Results

The tilt-translation ambiguity 3D model predicts that if the estimated direction of gravity and axis of head rotation (real or virtual) are not parallel, the brain will update its current estimate of direction of gravity. In the case of virtual head rotation signals, however, this leads to erroneous information about orientation of gravity that is reflected in a misalignment of estimated gravity with GIA. This, in turn, activates the rotation feedback to minimize this misalignment. PAN may be considered as a virtual head rotation around a rostro-caudal axis with an intensity and direction that change periodically over time. As such, characterizing the dynamic behavior of PAN in ear-down and supine positions where the axis of PAN virtual rotations is 90 degrees with respect to gravity would enable one to explore the function of the rotation feedback in patients with this disorder.
Experiment 1 shows a recording of horizontal slow-phase velocity in a patient with PAN who quickly lies down from upright to right-ear down (Fig. 2), left-ear down (Fig. 3) or supine (Fig. 4) positions. A fast rotation feedback response would be essential to rapidly restoring an accurate estimate of gravity. The PAN in the ear-down position (Fig. 2, Fig. 3, Fig. 4, blue dots) in our patient, however, was suppressed much more slowly than if the rotation feedback was working normally. In other words, the tilt-suppression mechanism that is normally mediated by “rotation feedback”, was impaired. We assumed a much smaller rotation feedback gain to account for this slower decay and accordingly modified the model parameters by using a value of the rotation feedback gain approximately 5% of its normal value. The modified model simulation of yaw-axis angular velocity closely fits the patient's data (Fig. 2, Fig. 3 and Fig. 4, red line).
To completely characterize PAN dynamics with respect to gravity, we retested our model against data from previous studies. In a single patient, Chung et al. [
• Chung S.J.
• Park S.-H.
• Kim J.-S.
• et al.
Positional suppression of periodic alternating nystagmus.
] found that PAN was suppressed in ear-down positions within 7 min (approximately two periods of the PAN oscillation). As the PAN response was like that shown by our patient, we have assumed an analogous reduction in the rotation feedback gain. After extracting parameters that could describe the oscillatory behavior of the PAN shown in that paper, we adjusted the values of two model parameters, cycle duration and peak slow-phase of PAN. We simulated data from Chung et al. [
• Chung S.J.
• Park S.-H.
• Kim J.-S.
• et al.
Positional suppression of periodic alternating nystagmus.
] recording of a patient with PAN, who was brought promptly from sitting upright to a left-ear down position. Simulating a model that included a rotation feedback gain value corresponding to approximately 5% of its normal value, adequately fitted their data. The conditions of this simulations are like the ones shown in Fig. 3.
In contrast, Furman et al. [
• Furman J.M.
• Wall C.
• Pang D.L.
Vestibular function in periodic alternating nystagmus.
] reported that PAN was unaffected by gravity in four patients tested in supine and ear-down positions. This implies that the brain's ability to counteract the destabilizing effects of virtual head rotation signals on an estimation of gravity has been neutralized. The model predicts that the responsible neural circuit is the rotation feedback; as such we have disconnected this loop from the velocity storage circuit (gain was set to zero). Model simulation for yaw axis angular velocity is shown for left ear-down position in Fig. 5 (red line). The simulation shows that PAN was unchanged in the left-ear down position which agrees with Furman et al. report.

## 4. Discussion

### 4.1 Estimating gravity and its interaction with rotations of the head

To interpret the dynamic behavior of PAN in different positions with respect to gravity one must first consider how the brain normally estimates gravity, and how it uses that information to minimize the effects of vestibular signals that might lead to an erroneous estimate of gravity. The brain relies on a recursive approach to estimate gravity, by combining information about rotational motion from the semicircular canals and information about tilt and translational motion from the otoliths to keep updating its estimate of gravity direction. As described in the introduction, for inputs from the semicircular canals, the brain distinguishes between parallel and non-parallel axis head rotations with respect to gravity, because only the latter indicates a rotation that changes the orientation of the head relative to gravity. It then uses mathematical integration to update the estimated gravity orientation. A rotation feedback circuit, mediated through velocity storage mechanism (Fig. 1) helps to cancel any inappropriate vestibular responses.

### 4.2 The orientation of the head relative to gravity, rotation feedback and PAN

How do we use this formulation to analyze the effects of gravity on PAN? PAN is modeled as unstable velocity storage that in combination with a normal short-term (minutes) vestibular adaptation circuit that rebalances tonic activity in the vestibular nuclei yields oscillatory virtual head rotation signals. In ear-down and supine positions, the rotational axis of PAN becomes non-parallel with respect to gravity, which leads to erroneous estimates of gravity and linear acceleration. To counteract the effect of virtual head rotation induced by PAN on estimated gravity and linear acceleration, the brain must solve the inverse problem, by computing an offsetting virtual head rotation velocity signal to adjust estimated gravity, until it matches the GIA that is signaled from the otoliths. Normally, this correction is achieved through the rotation feedback circuit. As such, examining patients with PAN in the ear-down and supine positions is analogous to “tilt-suppression of, for example, postrotatory nystagmus, which tests the underlying function of the rotation feedback circuit.
Can the performance of rotation feedback in patients with PAN be determined from previous studies? Furman et al. reported PAN was unaffected by gravity in four patients tested in supine and ear-down positions, which implied the rotation feedback was not functioning [
• Furman J.M.
• Wall C.
• Pang D.L.
Vestibular function in periodic alternating nystagmus.
]. In contrast, Chung et al. described a single patient with PAN who needed a little more than two cycles (about 7 min) in ear-down positions to suppress the PAN [
• Chung S.J.
• Park S.-H.
• Kim J.-S.
• et al.
Positional suppression of periodic alternating nystagmus.
]. Our patient here, showed a pattern of suppression of PAN in supine and ear-down positions like that of Cheung et al. The pattern of suppression in these two patients, implies that in some patients with PAN, the “rotation feedback” circuit can still have some effect on the velocity storage circuit, albeit slower (over minutes) and less complete (some misalignment of the inferred gravity vector and the GIA remained) than normal.
Finally, the incorporation of unstable velocity storage proposed by Leigh et al. to the tilt-translation ambiguity resolution model allowed us to make quantitative predictions of the dynamic behavior of PAN in different head positions [
• Leigh R.J.
• Robinson D.A.
• Zee D.S.
A hypothetical explanation for periodic alternating nystagmus: instability in the optokinetic-vestibular system.
]. By lowering the rotation feedback gain by 95% of its normal value, the simulations of PAN in supine and ear-down positions fitted the data from our patient and that of the previous study by Chung et al., showing the same pattern of modulation of PAN [
• Chung S.J.
• Park S.-H.
• Kim J.-S.
• et al.
Positional suppression of periodic alternating nystagmus.
]. Remarkably, a very low gain of the rotation feedback was sufficient to suppress PAN within two cycle duration. On the other hand, simulations using a zero gain of rotation feedback produced no modulation of PAN in supine and ear-down positions, in line with Furman et al. report [
• Furman J.M.
• Wall C.
• Pang D.L.
Vestibular function in periodic alternating nystagmus.
].

### 4.3 Possible mechanisms underlying the effects of rotation feedback on PAN

Is the rotation feedback output being fed through a very low gain the only way to account for the positional observations in PAN? The rotation feedback has a strong geometric interpretation that reveals other possible computational threads to reduce the rotation feedback gain. The rotation feedback implements the vector cross product, which is the axis to rotate one vector, the estimated gravity, into the other, the GIA (Fig. 1). As the cross product is compatible with scalar multiplication (α) such that $α·GIA→×G→=GIA→×α·G→=GIA→×G→·α$, employing a similar reduction in gain to any rotation feedback input (GIA or G) would be computationally equivalent to our model configuration. Moreover, just like all vectors, the cross product vector can be represented by a unit vector which defines its direction and the magnitude or length of the vector. The formula for the rotation feedback output vector $GIA→×G→=∣∣GIA→‖·∣∣G→‖·sinθ·unit vector→$, provides an explicit expression of the cross product magnitude, $∣∣GIA→‖·∣∣G→‖·sinθ$ (the multiplication of the magnitudes of GIA $∣GIA→‖$, estimated gravity $∣G→‖$, and the sine of the angle between GIA and G). Therefore, the localization of apparent reduction to the gain of the rotation feedback can be more versatile. It can be due to (1) error in the magnitude of GIA, (2) error in the magnitude of gravity, (3) error in the estimation of the angle between GIA and gravity or (4) combination of the above. These computational threads bear relevance to the anatomic connections of the nodulus and ventral uvula with vestibular end organs. For example, the nodulus and ventral uvula receive ample primary projections from the otolith which sense the GIA [
• Laurens J.
The Otolith Vermis: A Systems Neuroscience Theory of the Nodulus and Uvula.
]. This anatomical relationship might explain the error associated with the magnitude of GIA which manifests as a lowering of the gain of the rotation feedback.
For the patients with PAN who show some residual effect of rotation feedback on the velocity storage circuit, the model can make a prediction of how to compensate for the lower gain by increasing the effect of the rotation feedback and therefore accelerate the suppression of PAN. To facilitate the interpretation of the cross product, one can express the rotation feedback cross product as a regular matrix product of a skew-symmetric matrix, with the GIA components and the G vector.
$GIA⨯G·α=0−GIAzGIAyGIAz0−GIAx−GIAyGIAx0·GxGyGz·α$

The rotation feedback for virtual yaw head rotations in the ear down positions, when GIAz and GIAx are both zero, is $00−GIAyGxα$, and for virtual yaw head rotations in the supine position when GIAz and GIAy are both zero is $00−GIAxGyα$. One can see that increasing the magnitude of GIA in the axis parallel to earth gravity (GIAy in ear down positions and GIAx in supine position) would have a similar effect on PAN suppression to an increase in the gain of the rotation feedback. A test for this hypothesis would be to accelerate a patient with PAN in an elevator to increase GIAy or decrease GIAy while keeping the head in the ear down position. The prediction would be a faster suppression of the PAN in the ear down position with increased GIAy, that is, accelerating upwards.

### 4.4 A summary of the analytical approach to the dynamic interaction of PAN with gravity

In summary, the approach to analyze the dynamic behavior of PAN with respect to gravity depends on considering: (1) how the brain resolves the tilt-translation ambiguity; (2) the brain interprets a virtual head rotation as an actual head rotation in its computations; (3) interactions between the PAN and gravity can produce variation in the period and amplitude of PAN; and (4) in patients with PAN due to central lesions, primarily involving the cerebellar nodulus and ventral uvula, the rotation feedback, functions inadequately, but in different levels of performance. Accordingly, the performance of rotation feedback can be qualitatively determined at the bedside, when the rotational axis of PAN becomes non-parallel with respect to gravity, such as in supine or ear-down positions. If the PAN varies by changes in head orientation with respect to gravity, it suggests the rotation feedback can still exert its effects on the velocity storage mechanism. For example, when there is some sparing of the ability of rotation feedback to modulate PAN with changes in the orientation of the head with respect to gravity, one can envision some patients being able to decrease their PAN and improve vision by, for example lying down or lying on one side, such as when trying to read a book. When PAN is unaffected by gravity, however, it implies that the ability of the brain to counteract the destabilizing effects of virtual head rotation signals on an estimation of gravity has been neutralized.

### 4.5 Limitations

One drawback of our model is that it ignores a potential contribution from impaired gaze-holding systems. When the eyes are held in an eccentric position in the orbit, an impaired gaze-holding system cannot maintain a constant position output to offset the orbital elastic forces that act like a spring to return the eye to its natural (null) position. This leads to centripetal drift that in turn, triggers a velocity command from the saccadic system to bring the eyes back to the desired eccentric position. A recurrent sequence of centripetal drift and a centrifugal saccade is the clinical signature of an impaired gaze-holding system, what is commonly called gaze-evoked nystagmus.
In patients with PAN who also have gaze-evoked nystagmus, slow-phase velocity is a linear combination of centripetal drift velocity (gaze-evoked nystagmus) and velocity signals arising from the unstable velocity-storage circuit [
• Shemesh A.A.
• Kocoglu K.
• Akdal G.
• et al.
Modeling the interaction among three cerebellar disorders of eye movements: periodic alternating, gaze-evoked and rebound nystagmus.
]. The model used here, however, is insensitive to the position of the eyes in the orbit and therefore attributes changes in slow-phase velocity of the eyes only to modulation of PAN. Nevertheless, the general implications on PAN of altering head orientation with respect to gravity still apply.
In our model all the elements are symmetric and “lumped” that is, the model does not attempt to mimic the segregated laterality of the brain where there may be two different “rotation feedback” systems, one on each side of the brain. However, it is unlikely that lesions are perfectly symmetric and as such to fit the data properly we had to add a bias to the overall velocity to make the responses asymmetric. We do not know the source of this bias, though it is not unreasonable to assume such pathological biases exist and they can often explain complicated patterns of positional nystagmus [
• Choi J.-Y.
• Glasauer S.
• Kim J.H.
• et al.
Characteristics and mechanism of apogeotropic central positional nystagmus.
].

## 5. Conclusions

What neuronal circuits could account for the rotation feedback gain effect on PAN in these patients? Our results could be consistent with known influences of the nodulus and ventral uvula of the cerebellum on vestibular function. Ablation of these structures in monkeys not only causes PAN, but also impairs tilt suppression of post-rotatory nystagmus, and eliminates the steady-state response during off-vertical axis rotation (OVAR). Together with the results of the ablations studies, we hypothesized that variations in the gain of rotation feedback account for the difference in the effects of gravity among PAN patients. In our patient, PAN was suppressed in our patient in ear-down positions, in a similar pattern to that of a previously reported patient. This effect was simulated by reducing the gain of the projection of the rotation feedback loop to the velocity-storage integrator to approximately 5% of its normal value. With normal rotation feedback PAN is expected to dissipate quickly as soon as the head is rotated away from upright position. Moreover, by disconnecting the rotation feedback completely (gain = zero) the model simulated PAN that was reported to be unaffected by gravity. We conclude
• (1)
The slowly oscillating “virtual” head rotation signals of PAN are mathematically integrated in supine and ear-down positions leading to an erroneous estimate of the orientation of the head to gravity since the head is stationary.
• (2)
In PAN, the rotation feedback loop, normally used to resolve the tilt-translation ambiguity, may malfunction.
• (3)
A very low gain of rotation feedback can lead to suppression of PAN in head down positions, but the effect takes a few minutes.
• (4)
Our model also predicts that a decrease in the amplitude of the GIA vector would have the same effect of gravity on PAN as a low gain of rotation feedback.
• (5)
With absent “rotation feedback” PAN is unaffected by head down positions.
• (6)
In patients with PAN, understanding how brain resolves the tilt-translation ambiguity and compensates for inherent imperfections of the ability to faithfully transduce the motion of the head, can enhance both the clinician's ability to localize neurological disorders and our knowledge of how the normal brain functions.
• (7)
The effects of changing the position of the head with respect to gravity on other forms of nystagmus due to a vestibular imbalance, allows one to interrogate the function of a normal or pathologically altered rotation feedback circuit.

## Acknowledgements

This study was supported by the David Robinson scholarship fund (Ari A Shemesh), the Betty and Paul Cinquegrana endowment (Ari A Shemesh, Jorge Otero-Millan and David S Zee), Leon Levy foundation (Jorge Otero-Millan) and NEI R00EY027846 (Jorge-Otero-Millan). We thank Jeon-Yoon Choi and colleagues for sharing their computational model implementation [
• Choi J.-Y.
• Glasauer S.
• Kim J.H.
• et al.
Characteristics and mechanism of apogeotropic central positional nystagmus.
].

## References

• Leigh R.J.
• Robinson D.A.
• Zee D.S.
A hypothetical explanation for periodic alternating nystagmus: instability in the optokinetic-vestibular system.
Ann. N. Y. Acad. Sci. 1981; 374: 619-635https://doi.org/10.1111/j.1749-6632.1981.tb30906.x
• Furman J.M.
• Wall C.
• Pang D.L.
Vestibular function in periodic alternating nystagmus.
Brain J. Neurol. 1990; 113: 1425-1439https://doi.org/10.1093/brain/113.5.1425
• Chung S.J.
• Park S.-H.
• Kim J.-S.
• et al.
Positional suppression of periodic alternating nystagmus.
J. Neuroophthalmol. 2014; 34: 162-164https://doi.org/10.1097/WNO.0000000000000098
• Laurens J.
• Angelaki D.E.
The functional significance of velocity storage and its dependence on gravity.
Exp. Brain Res. 2011; 210: 407-422https://doi.org/10.1007/s00221-011-2568-4
1. Goldberg J.M. The Vestibular System: A Sixth Sense. Oxford University Press, Oxford, New York2012
• von Meyenn K.
Über das Relativitätsprinzip und die aus demselben gezogenen Folgerungen.
Albert Einsteins Relativ. Grundleg. Arb. 1990; : 160-214
• Merfeld D.M.
Modeling the vestibulo-ocular reflex of the squirrel monkey during eccentric rotation and roll tilt.
Exp. Brain Res. 1995; 106: 123-134https://doi.org/10.1007/BF00241362
• Merfeld D.M.
• Young L.R.
• Oman C.M.
• Shelhamer M.J.
A multidimensional model of the effect of gravity on the spatial orientation of the monkey.
J. Vestib. Res. Equilib. Orientat. 1993; 3: 141-161
• Merfeld D.M.
• Young L.R.
• Paige G.D.
• Tomko D.L.
Three dimensional eye movements of squirrel monkeys following postrotatory tilt.
J. Vestib. Res. Equilib. Orientat. 1993; 3: 123-139
• Merfeld D.M.
• Zupan L.
• Peterka R.J.
Humans use internal models to estimate gravity and linear acceleration.
Nature. 1999; 398: 615-618
• Merfeld D.M.
• Glasauer S.
Modelling three-dimensional vestibular responses during complex motion stimulation.
in: Misslisch H.F.M. Three-Dimensional Kinematics of Eye Head and Limb Movements. Harwood academic, Amsterdam1997: 387-398
• Glasauer S.
• Dieterich M.
• Brandt T.
Computational neurology of gravity perception involving semicircular canal dysfunction in unilateral vestibular lesions.
Prog. Brain Res. 2019; 248: 303-317https://doi.org/10.1016/bs.pbr.2019.04.010
• Mergner T.
• Glasauer S.
A simple model of vestibular canal-otolith signal fusion.
Ann. N. Y. Acad. Sci. 1999; 871: 430-434https://doi.org/10.1111/j.1749-6632.1999.tb09211.x
• Choi J.-Y.
• Glasauer S.
• Kim J.H.
• et al.
Characteristics and mechanism of apogeotropic central positional nystagmus.
Brain J. Neurol. 2018; 141: 762-775https://doi.org/10.1093/brain/awx381
• Graybiel A.
Oculogravic illusion.
AMA Arch. Ophthalmol. 1952; 48: 605-615
• Graybiel A.
Validity of the oculogravic illusion as a specific indicator of otolith function.
Aerosp. Med. 1965; 36: 1173-1181
• Graybiel A.
• Johnson W.H.
• Money K.E.
• et al.
Oculogravic illusion in response to straight-ahead acceleration of CF-104 aircraft.
Aviat. Space Environ. Med. 1979; 50: 382-386
• Paige G.D.
• Seidman S.H.
Characteristics of the VOR in response to linear acceleration.
Ann. N. Y. Acad. Sci. 1999; 871: 123-135https://doi.org/10.1111/j.1749-6632.1999.tb09179.x
• Angelaki D.E.
• Hess B.J.
Three-dimensional organization of otolith-ocular reflexes in rhesus monkeys. I. Linear acceleration responses during off-vertical axis rotation.
J. Neurophysiol. 1996; 75: 2405-2424https://doi.org/10.1152/jn.1996.75.6.2405
• Angelaki D.E.
• Merfeld D.M.
• Hess B.J.
Low-frequency otolith and semicircular canal interactions after canal inactivation.
Exp. Brain Res. 2000; 132: 539-549https://doi.org/10.1007/s002210000364
• Cohen B.
• Suzuki J.I.
• Raphan T.
Role of the otolith organs in generation of horizontal nystagmus: effects of selective labyrinthine lesions.
Brain Res. 1983; 276: 159-164https://doi.org/10.1016/0006-8993(83)90558-9
• Kushiro K.
Compensatory and orienting eye movements induced by off-vertical Axis rotation (OVAR) in monkeys.
J. Neurophysiol. 2002; 88: 2445-2462https://doi.org/10.1152/jn.00197.222
• Laurens J.
• Straumann D.
• Hess B.J.M.
Processing of angular motion and gravity information through an internal model.
J. Neurophysiol. 2010; 104: 1370-1381https://doi.org/10.1152/jn.00143.2010
• Fushiki H.
• Maruyama M.
• Watanabe Y.
Efficacy of tilt-suppression in postrotatory nystagmus in cats.
Brain Res. 2006; 1108: 127-132https://doi.org/10.1016/j.brainres.2006.06.010
• Hain T.C.
• Zee D.S.
• Maria B.L.
Tilt suppression of vestibulo-ocular reflex in patients with cerebellar lesions.
Acta Otolaryngol. (Stockh.). 1988; 105: 13-20https://doi.org/10.3109/00016488809119440
• Jeong S.-H.
• Kim J.-S.
Direction and magnitude of head tilt alter postrotatory nystagmus.
J. Neurophysiol. 2016; 116: 2000https://doi.org/10.1152/jn.00639.2016
• Lee S.-U.
• Choi J.-Y.
• Kim H.-J.
• et al.
Impaired tilt suppression of post-rotatory nystagmus and cross-coupled head-shaking nystagmus in cerebellar lesions: image mapping study.
Cerebellum Lond. Engl. 2017; 16: 95-102https://doi.org/10.1007/s12311-016-0772-2
• Wiest G.
• Deecke L.
• Trattnig S.
• Mueller C.
Abolished tilt suppression of the vestibulo-ocular reflex caused by a selective uvulo-nodular lesion.
Neurology. 1999; 52: 417
• Angelaki D.E.
• Hess B.J.
Inertial representation of angular motion in the vestibular system of rhesus monkeys. II. Otolith-controlled transformation that depends on an intact cerebellar nodulus.
J. Neurophysiol. 1995; 73: 1729-1751
• Angelaki D.E.
• Hess B.J.
Lesion of the nodulus and ventral uvula abolish steady-state off-vertical axis otolith response.
J. Neurophysiol. 1995; 73: 1716-1720https://doi.org/10.1152/jn.1995.73.4.1716
• Cohen B.
• John P.
• Yakushin S.B.
• et al.
The nodulus and uvula: source of cerebellar control of spatial orientation of the angular vestibulo-ocular reflex.
Ann. N. Y. Acad. Sci. 2002; 978: 28-45https://doi.org/10.1111/j.1749-6632.2002.tb07553.x
• Wearne S.
• Raphan T.
• Cohen B.
Nodulo-uvular control of central vestibular dynamics determines spatial orientation of the angular vestibulo-ocular reflex.
Ann. N. Y. Acad. Sci. 1996; 781: 364-384https://doi.org/10.1111/j.1749-6632.1996.tb15713.x
• Shemesh A.A.
• Kocoglu K.
• Akdal G.
• et al.
Modeling the interaction among three cerebellar disorders of eye movements: periodic alternating, gaze-evoked and rebound nystagmus.
J. Comput. Neurosci. 2021; 49: 295-307https://doi.org/10.1007/s10827-021-00790-9
• Laurens J.
The Otolith Vermis: A Systems Neuroscience Theory of the Nodulus and Uvula.
Front. Syst. Neurosci. 2022; (in press)https://doi.org/10.3389/fnsys.2022.886284


text:
## Calculus: Early Transcendentals 8th Edition

Published by Cengage Learning

# Chapter 17 - Section 17.1 - Second-Order Linear Equations - 17.1 Exercise - Page 1160: 4

#### Answer

y = $C_1e^{3x}$ + $C_2e^{-4x}$

#### Work Step by Step

Question: y"+y'-12y=0 We know: y = $e^{rx}$ y' = $re^{rx}$ y" = $r^{2}e^{rx}$ This results in $(r^{2}+r-12)e^{rx}$=0 The corresponding characteristic equation is: $r^{2}+r-12=0$ Factoring gives: $(r-3)(r+4) = 0$ r=3 and r=-4 Adding the constants gives the following general solution: y = $C_1e^{3x}$ + $C_2e^{-4x}$

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.


text:
Tag Info

Indeed for computational purposes, best you can do is use a uniform distribution on another interval $[10^{-10},1-10^{-10}]$, or just discard all occurences of $Z=0,1$. Discarding $Z=0,1$ is justified, since for continuous distributions $P(Z=0)=P(Z=1)=0$.


text:
Brin Postdoctoral Fellow Agnieszka Zelerowicz took a chance by leaving Poland, and it set her on a challenging new path.

Brin Postdoctoral Fellow Agnieszka Zelerowicz was first drawn to mathematics in college when she discovered the theoretical side to math.

“I was always good at math, but it was just not very interesting to me until I took some advanced courses,” Zelerowicz recalled. “It was intro to topology or something, and it was so different from anything else. I think the abstraction of it is what drew me in.”

While others in her class struggled with the more abstract subjects, Zelerowicz found they came easily to her, and she began to recognize her strength in mathematics.

“Agnieszka has many original ideas and is not afraid to stand by them,” said Dmitry Dolgopyat, Zelerowicz’s mentor at the University of Maryland.

Zelerowicz is one of five Brin Postdoctoral Fellows who are supported by a generous gift from Mathematics Professor Emeritus Michael Brin. The Brin Postdoctoral program in UMD’s Department of Mathematics supports young mathematicians whose work shows remarkable promise in mathematical research.

“Agnieszka shows curiosity and fearlessness in attacking new problems, which has led in a short time to a remarkable breadth in her research,” said UMD Mathematics Professor Giovanni Forni. “She has great technical skills and the ability to work very hard, qualities that are important to succeed in mathematical research. Among the promising aspects of her work, she has pushed the boundaries of fundamental tools to study chaotic systems using tools of geometry.”

Zelerowicz works in the area of ergodic theory and thermodynamic formalism. Both are areas of mathematics that focus on understanding dynamical systems. In mathematics, these systems can be described by determining the location in space of a given point at a given moment in time. (Think of models that predict the motion of a pendulum or the diffusion of a particle of smoke into a room).

“This work is theoretical, and it deals with mathematical models, not physical objects,” Zelerowicz explained. “But it has very strong connections to physics, so it borders on being applied.”

One of the applications of the mathematics she works on can be useful in studying electricity and conductive metals. Imagine a billiard table where a tiny particle representing an electron bounces around between the billiard balls, which represent the atoms of metal. Although the electron’s behavior may look random, mathematics can describe the probability of the electron taking various paths depending on a variety of factors, such as where it originates, its velocity, the temperature in the room, among other things. Using these probabilities, mathematicians can build a model of the electron’s behavior under different conditions.

Applying this idea, Zelerowicz is collaborating with Assistant Professor of Mathematics Rodrigo Trevino on a new model for studying how electricity moves through materials with long-range structure, such as certain types of crystals.

“It is challenging to find this middle ground in mathematics—to find a problem that would be difficult enough so that it would be interesting, but still something that is not impossible to solve,” she said.

As Zelerowicz searches for her next problem to solve, she is also looking for her next career step after she completes her postdoctoral fellowship in summer 2022. She is investigating opportunities throughout the U.S., but also countries like Brazil. It’s a surprising twist for someone who never imagined living outside of Poland.

Zelerowicz grew up in Rutki-Kossaki, a small town in Poland where her parents ran a bakery and her entire extended family has lived for generations. After high school, she went to the University of Bialystok in Poland and earned a bachelor’s degree in financial mathematics, followed by a master’s degree in mathematics in engineering from the Warsaw University of Technology.

“I never really considered moving abroad, but when I was doing my master’s, I met a lot of people who were planning to study abroad or who already did study abroad,” Zelerowicz explained. “At first, I was almost startled by the whole idea, by the very thought of moving to a country where I was asked to speak a foreign language the whole time. I thought it would be very uncomfortable. But then over time I thought, ‘Wait, I'm just as smart as those other people.’”

When it came time to apply for her Ph.D., Zelerowicz threw just one arrow outside of Poland, aiming at The Pennsylvania State University.

“I didn't even view it as a realistic goal,” she remembered. “I think I had all the intentions of staying in Poland. Applying to Penn State was just an experiment to see what would happen.”

Her arrow hit a bullseye, and she packed her bags and moved to Pennsylvania in 2013. After earning her Ph.D. in mathematics, she came to UMD in 2019. New to Maryland, Zelerowicz had a tough time when the COVID-19 pandemic hit in 2020. She hadn’t built her social network here, and she was unable to visit her family in Poland. To combat the isolation, Zelerowicz leaned into the physical fitness and outdoor activities she had come to love at Penn State, especially rock climbing.

“Climbing is a lot like solving a math problem in the way that you position your body and solve a challenging route,” she said. “Sometimes when certain transitions or moves on a route seem very hard and almost impossible, but then you change the angle of your body a little bit and move your foot a very little bit to the side, and then suddenly it becomes easy.”

In climbing, as in mathematics, things become easy only through hard work, ample technical skills and a bit of fearlessness—qualities that should help Zelerowicz continue to succeed in the years ahead.

Written by Kimbra Cutlip

• #### Happy Birthday, Coach!

Celebrating 80 years with Distinguished University Professor Emeritus Jim Yorke, the “Father of Chaos.” James “Jim” Yorke has held many Read More
• #### Technique, Hard Work and Fearlessness

Brin Postdoctoral Fellow Agnieszka Zelerowicz took a chance by leaving Poland, and it set her on a challenging new path. Read More
• 1
• 2
• 3
• 4


text:
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

## You should all go watch Branagh’s Hamlet (1996)

Earlier this year I watched Kenneth Branagh’s Hamlet (1996) and wow, I cannot recommend this movie enough. Not only is it by far the best Hamlet I have ever seen (on stage or screen), it has a fair claim to being the best Shakespeare ‘full stop’ (or ‘period’ as our American cousins say), and makes it to my list of favourite films of any sort. Gorgeously filmed on 70 mm film (including the spectacular setting of Blenheim Palace), 242 minutes long, brilliant direction, amazing atmosphere and ability to surface all the subplots and character quirks. Despite knowing the story backwards – having seen so many renderings of it, and every second line feeling like a quotation built into my cultural DNA – this film moved me in a new ways and depths that I rarely get from any work of art.

And yes, it does have a star-studded cast (perhaps excessively star-studded – Robin Williams and Gerard Depardieu seem wasted, and imagine using John Gielgud and Judi Dench for walk-on non-speaking parts), but the most important thing is that these people can really act. Branagh himself is a faultless tour-de-force, Kate Winslet is perfect as Ophelia, Julie Christie a wonderful Gertrude, and Derek Jacobi’s Claudius is spot-on. (Well noticed, observers of quality theatrical film and TV – Derek Jacobi became famous for the title role in I Claudius – but this is unrelated). Richard Briers seems to be made to play Polonius, with the perfect combination of humour, pomposity and pathos.

Some of the greatness of the movie comes from seeing famous stars in what are sometimes seen as also-ran parts in ways that make you see both the greatness of both the role and the actor – Billy Crystal as a gravedigger, and Charlton Heston bringing dignity and depth to the leader of the players.

This movie’s interpretation of the story plays up the role and dark aspects of Hamlet senior, whose statue broods over Elsinore and whose relationship to ‘our’ Hamlet is mirrored in Fortinbras senior and junior… ok I don’t have time to explain that here, but well, it’s complicated, right? Which is the point.

Anyway, “do yourself a favour” as Molly Meldrum would have said, and see this movie.

Now, I need something data-related if I am going to justify having a blog on this. So I thought I would tie my refreshed enthusiasm for the full text of Hamlet with a familiarisation project that has been on my to-do list for months (understand biterm topic modelling). As it happened, events (in the form of a blog post on another topic) overtook the topic model focus. I think the biggest interest here turns out to actually be the start of a generalisable, efficient way of representing text from a play in a tidy data model. So let’s have a go.

## Tidying Hamlet

### Basic structure of the raw data

When I first download one of the five or more versions of Hamlet from the Gutenberg project, it looks like this:

  [1] "HAMLET, PRINCE OF DENMARK"
[2] ""
[3] "by William Shakespeare"
[4] ""
[5] ""
[6] ""
[7] ""
[8] "PERSONS REPRESENTED."
[9] ""
[10] "Claudius, King of Denmark."
[11] "Hamlet, Son to the former, and Nephew to the present King."
[12] "Polonius, Lord Chamberlain."
[13] "Horatio, Friend to Hamlet."
[14] "Laertes, Son to Polonius."
[15] "Voltimand, Courtier."
[16] "Cornelius, Courtier."
[17] "Rosencrantz, Courtier."
[18] "Guildenstern, Courtier."
[19] "Osric, Courtier."
[20] "A Gentleman, Courtier."
[21] "A Priest."
[22] "Marcellus, Officer."
[23] "Bernardo, Officer."
[24] "Francisco, a Soldier"
[25] "Reynaldo, Servant to Polonius."
[26] "Players."
[27] "Two Clowns, Grave-diggers."
[28] "Fortinbras, Prince of Norway."
[29] "A Captain."
[31] "Ghost of Hamlet's Father."
[32] ""
[33] "Gertrude, Queen of Denmark, and Mother of Hamlet."
[34] "Ophelia, Daughter to Polonius."
[35] ""
[36] "Lords, Ladies, Officers, Soldiers, Sailors, Messengers, and other"
[37] "Attendants."
[38] ""
[39] "SCENE. Elsinore."
[40] ""
[41] ""
[42] ""
[43] "ACT I."
[44] ""
[45] "Scene I. Elsinore. A platform before the Castle."
[46] ""
[47] "[Francisco at his post. Enter to him Bernardo.]"
[48] ""
[49] "Ber."
[50] "Who's there?"
[51] ""
[52] "Fran."
[53] "Nay, answer me: stand, and unfold yourself."
[54] ""
[55] "Ber."
[56] "Long live the king!"
[57] ""
[58] "Fran."
[59] "Bernardo?"
[60] ""
[61] "Ber."
[62] "He."
[63] ""
[64] "Fran."
[65] "You come most carefully upon your hour."
[66] ""
[67] "Ber."
[68] "'Tis now struck twelve. Get thee to bed, Francisco."
[69] ""
[70] "Fran."
[71] "For this relief much thanks: 'tis bitter cold,"
[72] "And I am sick at heart."
[73] ""
[74] "Ber."
[75] "Have you had quiet guard?"
[76] ""
[77] "Fran."
[78] "Not a mouse stirring."
[79] ""
[80] "Ber."
[81] "Well, good night."
[82] "If you do meet Horatio and Marcellus,"
[83] "The rivals of my watch, bid them make haste."
[84] ""
[85] "Fran."
[86] "I think I hear them.--Stand, ho! Who is there?"
[87] ""
[88] "[Enter Horatio and Marcellus.]"
[89] ""
[90] "Hor."
[91] "Friends to this ground."
[92] ""
[93] "Mar."
[94] "And liegemen to the Dane."
[95] ""
[96] "Fran."
[97] "Give you good-night."
[98] ""
[99] "Mar."
[100] "O, farewell, honest soldier;"

So this is interesting. Here are some things we need to take into account in putting this into a data model that loses no or minimal information from its structure and content:

• We have about 40 lines of preamble, then we are on to a combination of dialogue and stage directions.
• The play is structured into Acts and Scenes. Scenes have numbers and descriptions (eg Scene I. Elsinore. A platform before the Castle.) but Acts just have numbers. Scenes are strictly hierarchically ordered under Acts (ie there is no Scene that continues over the boundary between two Acts).
• The stage directions are in square brackets [Enter Horatio and Marcellus]. A stage direction can be seen as applying until it is countermanded (for example, once Francisco and Bernardo have entered, they should be considered as present on stage until we are told otherwise)
• A continuous line of speech can go over several lines, such as Francisco in lines 71 and 72 of the above. The line breaks may be significant (and sometimes certainly are when the line is in verse), or not.
• The character speaking is referred to be abbrevaition (eg Fran.), which needs decoding to be fully human-readable (an actor learning the play, or a reader familiar with it would know that Hor. is Horatio, but only by mental decoding – something that should be done in the data model)

Here is the R code that sets up my session, including preparation for things I haven’t talked about yet, downloads the play and gets us to this point of looking at the first 100 lines:

Post continues below R code

### Stage directions

With one annoying exception, the stage directions are all single lines so we can pick them up easily with a regular expression that looks for lines that begin and finish in square brackets.

> # Number of times each stage direction used
> hamlet %>%
+   filter(grepl("^\$.*\$$", text)) %>% + count(text, name = "times_used", sort = TRUE) # A tibble: 129 x 2 text times_used 1 [Exit.] 19 2 [Exeunt.] 13 3 [Sings.] 11 4 [Enter Polonius.] 5 5 [Exit Polonius.] 5 6 [Enter Hamlet.] 4 7 [Exeunt Rosencrantz and Guildenstern.] 4 8 [Dies.] 3 9 [Enter Rosencrantz and Guildenstern.] 3 10 [Exit Ghost.] 3  Here is the exception – it comes from near the end, when a whole bunch of people (too many to list in a single line) come in with weapons to be used in the duel between Hamlet and Laertes: ### Scenes and Acts Similarly, we can use regular expression to find with nearly 100% accuracy the beginnings of Scenes and Acts. Note that the capitalisation of Act is inconsistent: > # Scenes and acts. Sometimes upper case sometimes not > hamlet %>% + filter(grepl("^Scene\\s", text, ignore.case = TRUE) | grepl("^Act\\s", text, ignore.case = TRUE)) # A tibble: 26 x 2 text original_line_number 1 ACT I. 43 2 Scene I. Elsinore. A platform before the Castle. 45 3 Scene II. Elsinore. A room of state in the Castle. 378 4 Scene III. A room in Polonius's house. 822 5 Scene IV. The platform. 1029 6 Scene V. A more remote part of the Castle. 1211 7 Act II. 1560 8 Scene I. A room in Polonius's house. 1562 9 Scene II. A room in the Castle. 1779 10 ACT III. 2744 # ... with 16 more rows  ### Character names Generally, a line indicating a new speaker can be identified by the pattern of “capital letter – lower case letters – full stop – end of line”. So it is straightforward to pull out lines that meet this pattern with a regular expression and count them: > hamlet %>% + filter(grepl("^[A-Z][a-z]+\\.$", text)) %>%
+   count(text, name= "number_speeches", sort = TRUE) %>%
+   slice(1:20)
# A tibble: 20 x 2
text   number_speeches

1 Ham.               358
2 Hor.               108
3 King.              102
4 Pol.                86
5 Queen.              69
6 Laer.               62
7 Oph.                57
8 Ros.                45
9 Mar.                31
10 Guil.               29
11 Osr.                25
12 Ber.                19
13 Ghost.              14
14 Rey.                13
15 Fran.                8
16 Capt.                7
17 Fort.                4
18 All.                 3
19 Danes.               3
20 Gent.                3

358 distinct speeches to learn if you want to play Hamlet, versus (for example) 29 for Guildenstern. Basically that simple search-and-count works, although there are annoyingly some context-specific uses of Both. and All.; and there are a few spoken lines (Farewell. and Good.) that get mixed up into this pattern. It’s very difficult to identify an algorithm that can tell these apart, particularly because (for example) Good. is a plausible abbreviation of a character name. I think only a human could be sure of the difference in a specific context, so we will need a bit of careful manual coding of some parts.

To decode abbreviations into character names and add some useful metadata for later, I created by hand a vector of the eight main characters (using my human interpretation to decide on what constituted “main”), and table that relates the abbreviations (King., etc) to full names of the character (“Claudius, King of Denmark.”) and human-friendly abbreviations for plots and the like using the term more commonly used today (“Claudius”).

I also made a vector of words that looked like character names and feature as single word lines in the play but aren’t referring to characters: No., Dead., He., etc.

### A table of data with “spoken line” as grain

I use these lookup tables and vectors to create my first tidier version of the data, hamlet_lines. This object is shown below. In this version, each row of the table is a complete line of dialogue. Rows of the original data that are not dialogue but refer to the Act, Scene, stage direction or who is speaking have been pivoted wider to appear as columns such as speaker, last_stage_direction, act and scene.

Here is how that object looks:

> hamlet_lines
# A tibble: 3,945 x 11
text        original_line_nu~ speaker_abb speaker   speaker_sh main_character last_stage_direction act    scene      new_speaker_thi~ line_number_thi~

1 Who's ther~                50 Ber.        Bernardo~ Bernardo   FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
2 Nay, answe~                53 Fran.       Francisc~ Francisco  FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
3 Long live ~                56 Ber.        Bernardo~ Bernardo   FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
4 Bernardo?                  59 Fran.       Francisc~ Francisco  FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
5 He.                        62 Ber.        Bernardo~ Bernardo   FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
6 You come m~                65 Fran.       Francisc~ Francisco  FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
7 'Tis now s~                68 Ber.        Bernardo~ Bernardo   FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
8 For this r~                71 Fran.       Francisc~ Francisco  FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
9 And I am s~                72 Fran.       Francisc~ Francisco  FALSE          Francisco at his po~ ACT I. Scene I. ~ FALSE                           2
10 Have you h~                75 Ber.        Bernardo~ Bernardo   FALSE          Francisco at his po~ ACT I. Scene I. ~ TRUE                            1
# ... with 3,935 more rows

Note that we have kept the successive lines of text by a single character as per the original – for instance rows 71 and 72 of the original data, spoken by Fancisco, are now rows 8 and 9 but are still two separate rows. A logical flag new_speaker_this_line helps us identify such cases for future.

Here’s the chunk of code that creates this table, with “line” as its granularity, from the original messy data. Most of this code is dealing with various quirks in the data, such as 2 Clown (for “second clown”, or second gravedigger) having a different structure of character abbreviation from most of the roles.

This tidy table of data, at the granularity of line of dialogue, makes it easy to count lines per speaker, Act, Scene, etc. For example, we can see that Act II, Scene II has the most spoken lines (590):

> count(hamlet_lines, act, scene)
# A tibble: 20 x 3
act      scene                                                  n

1 ACT I.   Scene I. Elsinore. A platform before the castle.     190
2 ACT I.   Scene II. Elsinore. A room of state in the castle.   280
3 ACT I.   Scene III. A room in Polonius's house.               141
4 ACT I.   Scene IV. The platform.                              101
5 ACT I.   Scene V. A more remote part of the castle.           212
6 Act II.  Scene I. A room in Polonius's house.                 130
7 Act II.  Scene II. A room in the castle.                      590
8 ACT III. Scene I. A room in the castle.                       196
9 ACT III. Scene II. A hall in the castle.                      383
10 ACT III. Scene III. A room in the castle.                     102
11 ACT III. Scene IV. Another room in the castle.                236
12 ACT IV.  Scene I. A room in the castle.                        46
13 ACT IV.  Scene II. Another room in the castle.                 28
14 ACT IV.  Scene III. Another room in the castle.                71
15 ACT IV.  Scene IV. A plain in Denmark.                         68
16 ACT IV.  Scene V. Elsinore. A room in the castle.             228
17 ACT IV.  Scene VI. Another room in the castle.                 29
18 ACT IV.  Scene VII. Another room in the castle.               212
19 ACT V.   Scene I. A churchyard.                               283
20 ACT V.   Scene II. A hall in the castle.                      419

### A table of data with “spoken word” as grain

My next step is to make a table or data frame with spoken word as the grain. Here I want not just bags of words, but the original sequence preserved, and whether a word was originally at the beginning of a line, as well as who is speaking (and all the different abbreviations of their name and groups that person belongs to), the last stage direction, the Act and Scene, etc. For future use I also want a stemmed version of each word (eg so “answered”, “answering” and “answers” all reduce to their stem “answer”), and a flag of whether each word is a stop word or not.

Here’s how that table is going to look, capturing all 30,000 or so words spoken in the uncut version of Hamlet”

> hamlet_words %>% select(contains("word"), everything())
# A tibble: 30,022 x 20
word  stopword word_stem new_speaker_thi~ word_number_thi~ word_number word_number_thi~ word_number_thi~ original_line_n~ speaker_abb

1 who's TRUE     who'      TRUE                            1           1                1                1               50 Ber.
2 there TRUE     there     FALSE                           2           2                2                2               50 Ber.
3 nay   FALSE    nai       TRUE                            1           3                3                3               53 Fran.
4 answ~ FALSE    answer    FALSE                           2           4                4                4               53 Fran.
5 me    TRUE     me        FALSE                           3           5                5                5               53 Fran.
6 stand FALSE    stand     FALSE                           4           6                6                6               53 Fran.
7 and   TRUE     and       FALSE                           5           7                7                7               53 Fran.
8 unfo~ FALSE    unfold    FALSE                           6           8                8                8               53 Fran.
9 your~ TRUE     yourself  FALSE                           7           9                9                9               53 Fran.
10 long  FALSE    long      TRUE                            1          10               10               10               56 Ber.
# ... with 30,012 more rows, and 10 more variables: speaker , speaker_sh , main_character , last_stage_direction ,
#   act , scene , new_speaker_this_line , line_number_this_speech , speech_number , top_20_char

Note that the hamlet_words data frame has about 30,000 words – one for each word in Hamlet, excluding stage directions.

And here is how I made that table out of the hamlet_lines

## Analysis

### How many words each?

OK, it’s time to do something fun now that we have tidied the data. Let’s start with just counting words. Out of the 30,000 words in Hamlet, who says how many?

You might have noticed in the code that char_summary data frame I make along the way there. It has some summary information on each character such as the number of words and speeches, words per speech, stop words, proportion of words that aren’t stopwords, etc. Here’s what that looks like. We see that (of course), Hamlet himself has the most words to say; in fact, just over a third of all the words in Hamlet are spoken by the titular character:

speaker_sh words speeches words_per_speech stopwords prop_non_stop most_words_single_speech
Hamlet 11907 346 34.413295 6412 0.4614932 473
Claudius 4116 101 40.752475 2189 0.4681730 392
Polonius 3017 84 35.916667 1661 0.4494531 241
Horatio 2034 106 19.188679 1128 0.4454277 225
Laertes 1463 62 23.596774 764 0.4777854 274
Ophelia 1163 57 20.403509 661 0.4316423 125
Gertrude 1084 68 15.941176 561 0.4824723 137
First gravedigger 741 33 22.454545 421 0.4318489 76
Rosencrantz 695 45 15.444444 411 0.4086331 103
Ghost 682 14 48.714286 332 0.5131965 375
Marcellus 429 31 13.838710 228 0.4685315 80
Osric 358 25 14.320000 200 0.4413408 64
Player King 337 4 84.250000 154 0.5430267 233
Guildenstern 323 29 11.137931 206 0.3622291 43
Player Queen 238 5 47.600000 112 0.5294118 102
Fortinbras 222 6 37.000000 113 0.4909910 98
Bernardo 205 19 10.789474 109 0.4682927 35
Gentleman 192 3 64.000000 86 0.5520833 104
Voltimand 149 1 149.000000 73 0.5100671 149
Second gravedigger 98 12 8.166667 55 0.4387755 22
First Priest 91 2 45.500000 49 0.4615385 65
Captain 84 7 12.000000 48 0.4285714 53
Lord 67 3 22.333333 39 0.4179104 42
Reynaldo 65 13 5.000000 49 0.2461538 11
Francisco 55 8 6.875000 25 0.5454545 14
English Ambassador 40 1 40.000000 23 0.4250000 40
Lucianus 40 1 40.000000 8 0.8000000 40
Messenger 36 2 18.000000 25 0.3055556 23
Sailor 35 1 35.000000 23 0.3428571 35
Player prologue 16 1 16.000000 10 0.3750000 16
Danes 13 3 4.333333 9 0.3076923 5
All 9 3 3.000000 3 0.6666667 5
Marcellus and Bernardo 9 2 4.500000 6 0.3333333 6
Servant 9 1 9.000000 6 0.3333333 9

Hang on, didn’t we see earlier that Hamlet had 358 speeches, and now we find only 346? That’s an anomaly related to how the data tidying worked. The 358 came from counting likes that appeared as Ham.; the 346 is more complex and looks for when Hamlet starts speaking after someone else had. My first guess at the cause of the anomaly is scene breaks where Hamlet was the last person speaking in the previous scene, and also first in the new one. But this would need checking. I don’t have the inclination to fix that now, so let’s just note this as an example of the sort of detail that needs fixing.

### Distinctive words

It’s interesting to look at the most distinctive words spoken by each character. The plot below shows the proportion of each character’s words that are a particular wordstem, divided by that proportion for the whole play. Effectively, this is the term frequency – inverse document frequency (TFIDF).Some of this is interesting (Polonius talks about his ‘daughter’ Ophelia; the Ghost talks about ‘blood’, ‘foul’, and being ‘beneath’), some not so much (Hamlet’s distinctive words in particular seem to have little message for me).

Here’s the code to calculate those TFIDF values (I am using dplyr to do this explicitly so I can be sure of what is going on, rather than using specialist functions) and draw that chart of distinctive words:

### How long are characters’ speeches

Beyond simple counts and averages of words, lines and speeches, it might be interesting to see how the distribution of how long the various speeches different characters deliver. Here’s how that looks for nine of the main characters:

The main thing I spot here is that the Ghost of Hamlet’s father gets only a few speeches but they tend to be long and uninterrupted compared to the other characters. Gertrude, Ophelia and Horatio tend to have short speeches less than 100 words, acting as foils for their interlocutors (normally Hamlet himself). Hamlet of course has the full range – many short bits of snappy dialogue, but also three or four lengthy 400+ word speeches.

The longest speech is Hamlet’s in Act III Scene I. In this speech he reflects on the impromptu play just put on by the Players; contrasts their acted emotion and passion with his own indecision; considers he must still be unsure whether the Ghost is misleading him about the villainy of Caludius; and explains his plan to use a play (within a play) to get to test Caludius’ conscience (paragraph breaks added by hand):

“Ay, so, God b’ wi’ ye!

Now I am alone. O, what a rogue and peasant slave am I! Is it not monstrous that this player here, But in a fiction, in a dream of passion, Could force his soul so to his own conceit That from her working all his visage wan’d; Tears in his eyes, distraction in’s aspect, A broken voice, and his whole function suiting With forms to his conceit? And all for nothing! For Hecuba? What’s Hecuba to him, or he to Hecuba, That he should weep for her? What would he do, Had he the motive and the cue for passion That I have? He would drown the stage with tears And cleave the general ear with horrid speech; Make mad the guilty, and appal the free; Confound the ignorant, and amaze, indeed, The very faculties of eyes and ears.

“Yet I, A dull and muddy-mettled rascal, peak, Like John-a-dreams, unpregnant of my cause, And can say nothing; no, not for a king Upon whose property and most dear life A damn’d defeat was made. Am I a coward? Who calls me villain? breaks my pate across? Plucks off my beard and blows it in my face? Tweaks me by the nose? gives me the lie i’ the throat As deep as to the lungs? who does me this, ha? ‘Swounds, I should take it: for it cannot be But I am pigeon-liver’d, and lack gall To make oppression bitter; or ere this I should have fatted all the region kites With this slave’s offal: bloody, bawdy villain! Remorseless, treacherous, lecherous, kindless villain! O, vengeance!

“Why, what an ass am I! This is most brave, That I, the son of a dear father murder’d, Prompted to my revenge by heaven and hell, Must, like a whore, unpack my heart with words And fall a-cursing like a very drab, A scullion! Fie upon’t! foh!–About, my brain!

“I have heard That guilty creatures, sitting at a play, Have by the very cunning of the scene Been struck so to the soul that presently They have proclaim’d their malefactions; For murder, though it have no tongue, will speak With most miraculous organ, I’ll have these players Play something like the murder of my father Before mine uncle: I’ll observe his looks; I’ll tent him to the quick: if he but blench, I know my course.

“The spirit that I have seen May be the devil: and the devil hath power To assume a pleasing shape; yea, and perhaps Out of my weakness and my melancholy,– As he is very potent with such spirits,– Abuses me to damn me: I’ll have grounds More relative than this.–the play’s the thing Wherein I’ll catch the conscience of the king. [Enter King, Queen, Polonius, Ophelia, Rosencrantz, and Guildenstern.]”

Here’s the R code to plot the distribution of speech lengths, and extract in full an original speech that has been identified from our tidied row-grain data frame:

Incidentally, this exercise drew my attention to another problem – the final stage direction here [Enter King, Queen, Polonius, Ophelia, Rosencrantz, and Guildenstern.] had not been correctly identified as such in my tidying program. So another detail to fix (I count about four of these so far…).

### Who interacts with whom?

Something that’s of interest that we can find out with tidied, structured data that is difficult otherwise is the interactions between different characters. A play features (mostly) a single character talking at a time, and can be analysed as a series of hand-offs from one character to another. We can count each transition and turn it into a network chart. For illustrative purposes here, I am ignoring the direction of these transitions, and just counting the absolute number. This gives us a nice illustration of who interacts (either interrupting, or simply taking turns) with whom:

What I like about this graph is how it shows the relationship between Hamlet and his wingman Horatio as core to the play; while also making clear who are the other major speaking characters (Claudius, Polonius, Laertes, Gertrude, etc) and the relationhsips between them.

Here’s the code for that network graph, made simple by the wonder of Thomas Pedersen’s tidygraph and ggraph R packages.

### Topics of the play

Finally, some bi-term topic modelling. In the various short speeches (from 1 word to 500), which word stems tend to come together? Here’s a first look at this.

Does this help? Well, not so much. I probably need some more thinking, certainly about how many topics to use for starters.

I originally intended this topic modelling to be the main point of this blog, but in the six months that this post has sat in “it’s good, but it needs fixing” purgatory I have since used bi-term topic modelling elsewhere, and no longer feel great motivation to finish this idea off immediately. I do think there is big potential in using topic modelling to understand topics within a Shakespeare play (ie treating each speech as a document), not just between the plays (treating each play as a document). Most examples using Shakespeare for topic modelling are of the latter variety, probably because (as today’s post shows) there’s a fair bit of wrangling required before one can start analysing speeches as documents.

Anyway, here is the absurdly short code to fit the bi-term topic model.

## Conclusion

Well, that’s it. I’ve had a good go at tidying one Shakespeare play into a data model that loses minimal original information, and puts us in good shape to analyse words, topics, interactions between characters, how Acts and Scenes and stage directions work, etc. There are a handful of small details I haven’t fixed, but the overall project works. It wouldn’t be hard to extend this to work with other Shakespeare plays, and maybe for plays in general.

The process of doing this has produced one piece of analysis I like, which is the network graph of hand-offs (one character speaking after the other). I think that has potential, to show at a glance what the characters are doing in a play. I’d like to try that elsewhere.

In the meantime, that’s all folks. Take care out there, wear a mask, and don’t go out if you don’t have to. Unless you’re in New Zealand or Western Australia, in which case, sure, go out, see if the rest of us mind, just don’t rub it in.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


text:
Now showing items 1-6 of 8

• #### 0818 - Atomistic Models of Materials: Mathematical Challenges

[OWR-2008-21] (2008) - (27 Apr - 03 May 2008)
• #### 1545a - Mini-Workshop: Friezes

[OWR-2015-48] (2015) - (01 Nov - 07 Nov 2015)
Frieze patterns were introduced in the early 1970s by Coxeter. They are infinite arrays of numbers in which every four neighbouring entries always satisfy the same arithmetic relation. Amazingly, friezes appear in many ...
• #### 0518a - Mini-Workshop: Numerical Upscaling: Theory and Applications

[OWR-2005-20] (2005) - (01 May - 07 May 2005)
Numerical upscaling is often the only way in which various multiscale problems can be handled. Numerics related to solving auxiliary problems appearing in asymptotic homogenization, as well as numerical treatment of ...
• #### Non-stationary multivariate subdivision: joint spectral radius and asymptotic similarity

[OWP-2013-20] (Mathematisches Forschungsinstitut Oberwolfach, 2013-10-29)
In this paper we study scalar multivariate non-stationary subdivision schemes with a general integer dilation matrix. We present a new numerically efficient method for checking convergence and Hölder ...
• #### On periodic solutions and global dynamics in a periodic differential delay equation

[OWP-2014-08] (Mathematisches Forschungsinstitut Oberwolfach, 2014-05-13)
Several aspects of global dynamics and the existence of periodic solutions are studied for the scalar differential delay equation $x'(t) = a(t)f(x([t-K]))$, where $f(x)$ is a continuous negative feedback function, \$x \cdot ...
• #### 1006a - Optimal Constants in the Theory of Sobolev Spaces and PDEs

[OWR-2010-8] (2010) - (07 Feb - 13 Feb 2010)
Recent research activities on sharp constants and optimal inequalities have shown their impact on a deeper understanding of geometric, analytical and other phenomena in the context of partial differential equations and ...


text:
evaluate its limit

Determine whether the sequence is divergent or convergent. If it isconvergent, evaluate its limit. If it diverges to infinity, stateyour answer as "INF" (without the quotation marks). If it divergesto negative infinity, state your answer as "MINF". If it divergeswithout being infinity or negative infinity, state your answer as"DIV".