text:
<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />

# 10.8: Problem-Solving Strategies: Choose a Function Model

Difficulty Level: At Grade Created by: CK-12

As you learn more and more mathematical methods and skills, it is important to think about the purpose of mathematics and how it works as part of a bigger picture. Mathematics is used to solve problems that often arise from real-life situations. Mathematical modeling is a process by which we start with a real-life situation and arrive at a quantitative solution.

Modeling involves creating a set of mathematical equations that describes a situation, solving those equations, and using them to understand the real-life problem.

Often the model needs to be adjusted because it does not describe the situation as well as we wish.

A mathematical model can be used to gain understanding of a real-life situation by learning how the system works, which variables are important in the system, and how they are related to each other. Models can also be used to predict and forecast what a system will do in the future or for different values of a parameter. Lastly, a model can be used to estimate quantities that are difficult to evaluate exactly.

Mathematical models are like other types of models. The goal is not to produce an exact copy of the “real” object but rather to give a representation of some aspect of the real thing. The modeling process can be summarized as a flow chart:

Notice that the modeling process is very similar to the problem-solving format we have been using throughout this book. One of the most difficult parts of the modeling process is determining which function best describes a situation. We often find that the function we choose is not appropriate. Then we must choose a different one.

Consider an experiment regarding the elasticity of a spring.

Example: A spring is stretched as you attach more weight at its bottom. The following table shows the length of the spring in inches for different weights in ounces.

\begin{align*}& \text{Weight (oz)} && 0 && 2 && 4 && 6 && 8 && 10 && 12 && 14 && 16 && 18 && 20\\ & \text{Length (in)} && 2 && 2.4 && 2.8 && 3.2 && 3.5 && 3.9 && 4.1 && 4.4 && 4.6 && 4.7 && 4.8\end{align*}

a) Find the length of the spring as a function of the weight attached to it.

b) Find the length of the spring when you attach 5 ounces.

c) Find the length of the spring when you attach 19 ounces.

Solution: Begin by graphing the data to get a visual of what the model may look like.

• This data clearly does not fit a linear equation. It has a distinct curve that will not be modeled well by a straight line.
• Nor does this graph seem to fit a parabolic shape; thus it is not modeled by a quadratic equation.
• The curve does not fit the exponential curves studied in Chapter 8.
• By taking the third set of differences, the value is approximately equal. Use the methods learned in the previous lesson to find a cubic regression equation. Check by graphing to see if this model is a good fit.

Example: A golf ball is hit down a straight fairway. The following table shows the height of the ball with respect to time. The ball is hit at an angle of \begin{align*}70^\circ\end{align*} with the horizontal with a speed of 40 meters/sec.

\begin{align*}& \text{Time (sec)} && 0 && 0.5 && 1.0 && 1.5 && 2.0 && 2.5 && 3.0 && 3.5 && 4.0 && 4.5 && 5.0 && 5.5 && 6.0 && 6.5 && 7.0\\ & \text{Height (meters)} && 0 && 17.2 && 31.5 && 42.9 && 51.6 && 57.7 && 61.2 && 62.3 && 61.0 && 57.2 && 51.0 && 42.6 && 31.9 && 19.0 && 4.1\end{align*}

a) Find the height of the ball as a function of time.

b) Find the height of the ball when \begin{align*}t=2.4 \ \text{seconds}\end{align*}.

c) Find the height of the ball when \begin{align*}t=6.2 \ \text{seconds}\end{align*}.

Solution: Begin by graphing the data to visualize the model.

This data fits a parabolic curve quite well. We can therefore conclude the best model for this data is a quadratic equation.

To solve part a), use the graphing calculator to determine the quadratic regression line.

\begin{align*}y=-4.92 x^2+34.7 x+1.2\end{align*}

b) The height of the ball when \begin{align*}t=2.4 \ seconds\end{align*} is:

\begin{align*}y=-4.92(2.4)^2+34.7(2.4)+1.2=56.1 \ meters\end{align*}

c) The height of the ball when \begin{align*}t=6.2 \ seconds\end{align*} is

\begin{align*}y=-4.92(6.2)^2+34.7(6.2)+1.2=27.2 \ meters\end{align*}

## Practice Set

Sample explanations for some of the practice exercises below are available by viewing the following videos. Note that there is not always a match between the number of the practice exercise in the videos and the number of the practice exercise listed in the following exercise set.  However, the practice exercise is the same in both.

1. A thin cylinder is filled with water to a height of 50 centimeters. The cylinder has a hole at the bottom that is covered with a stopper. The stopper is released at time \begin{align*}t=0 \ \text{seconds}\end{align*} and allowed to empty. The following data shows the height of the water in the cylinder at different times. \begin{align*}& \text{Time (sec)} && 0 && 2 && 4 && 6 && 8 && 10 && 12 && 14 && 16 && 18 && 20 && 22 && 24\\ & \text{Height (cm)} && 50 && 42.5 && 35.7 && 29.5 && 23.8 && 18.8 && 14.3 && 10.5 && 7.2 && 4.6 && 2.5 && 1.1 && 0.2\end{align*}
1. What seems to be the best model for this situation?
2. Find the linear regression line and determine the height of the water at 4.2 seconds.
3. Find a quadratic equation and determine the height of the water at 4.2 seconds.
4. Find a cubic regression line and determine the height of the water at 4.2 seconds.
5. Which of these seems to be the best fit?
6. Using the function of best fit, find the height of the water when \begin{align*}t=5 \ \text{seconds}\end{align*}.
7. Using the function of best fit, find the height of the water when \begin{align*}t=13 \ \text{seconds}\end{align*}.
2. A scientist counts 2,000 fish in a lake. The fish population increases at a rate of 1.5 fish per generation but the lake has space and food for only 2,000,000 fish. The following table gives the number of fish (in thousands) in each generation. \begin{align*}& \text{Generation} && 0 && 4 && 8 && 12 && 16 && 20 && 24 && 28\\ & \text{Number (thousands)} && 2 && 15 && 75 && 343 && 1139 && 1864 && 1990 && 1999\end{align*}
1. Which function seems to best fit the data linear, quadratic, or exponential?
2. Find the model for the function of best fit.
3. Find the number of fish as a function of generation.
4. Find the number of fish in generation 10.
5. Find the number of fish in generation 25.
3. Using the golf ball example, find the maximum height the ball reaches.
4. Using the golf ball example, evaluate the height of the ball at 5.2 seconds.

Mixed Review

1. Evaluate \begin{align*}2 \div 6 \cdot 5+3^2-11 \cdot 9^{\frac{1}{2}}\end{align*}.
2. 60 shirts cost $812.00 to screen print. 115 shirts cost$1,126.00 to screen print. Assuming the relationship between the number of shirts and the total cost is linear, write an equation in point-slope form.
1. What is the start-up cost (the cost to set up the screen)?
2. What is the slope? What does it represent?
3. Solve by graphing: \begin{align*}y=x^2+3x-1\end{align*}.
4. Simplify \begin{align*}\frac{\frac{6}{7}}{\frac{1}{2}}\end{align*}.
5. Newton’s Second Law states \begin{align*}F=m \cdot a\end{align*}. Rewrite this equation to solve for \begin{align*}m\end{align*}. Use it to determine the mass if the force is 300 Newtons and the acceleration is \begin{align*}70 m/s^2.\end{align*}
6. The area of a square game board is 256 square inches. What is the length of one side?
7. Write as a percent: \begin{align*}\frac{3}{1000}\end{align*}.

### Notes/Highlights Having trouble? Report an issue.

Color Highlighted Text Notes

Show Hide Details
Description
Tags:
Subjects:


text:
Lemma 6.30.5. Let $X$ be a topological space. Let $\mathcal{B}$ be a basis for the topology on $X$. Let $U \in \mathcal{B}$. Let $\mathcal{F}$ be a sheaf of sets on $\mathcal{B}$. The map

$\mathcal{F}(U) \to \prod \nolimits _{x \in U} \mathcal{F}_ x$

identifies $\mathcal{F}(U)$ with the elements $(s_ x)_{x\in U}$ with the property

• For any $x \in U$ there exists a $V \in \mathcal{B}$, with $x \in V \subset U$ and a section $\sigma \in \mathcal{F}(V)$ such that for all $y \in V$ we have $s_ y = (V, \sigma )$ in $\mathcal{F}_ y$.

Proof. First note that the map $\mathcal{F}(U) \to \prod \nolimits _{x \in U} \mathcal{F}_ x$ is injective by the uniqueness in the sheaf condition of Definition 6.30.2. Let $(s_ x)$ be any element on the right hand side which satisfies $(*)$. Clearly this means we can find a covering $U = \bigcup U_ i$, $U_ i \in \mathcal{B}$ such that $(s_ x)_{x \in U_ i}$ comes from certain $\sigma _ i \in \mathcal{F}(U_ i)$. For every $y \in U_ i \cap U_ j$ the sections $\sigma _ i$ and $\sigma _ j$ agree in the stalk $\mathcal{F}_ y$. Hence there exists an element $V_{ijy} \in \mathcal{B}$, $y \in V_{ijy}$ such that $\sigma _ i|_{V_{ijy}} = \sigma _ j|_{V_{ijy}}$. Thus the sheaf condition $(**)$ of Definition 6.30.2 applies to the system of $\sigma _ i$ and we obtain a section $s \in \mathcal{F}(U)$ with the desired property. $\square$

Comment #3233 by on

Xena says "Maybe forall y in U intersect V'' would be better in (*)".

Comment #3332 by on

OK, I think the more natural change is to require $V \subset U$ which I clearly just forgot to type. Thanks Xena! Fix is here.

There are also:

• 6 comment(s) on Section 6.30: Bases and sheaves

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).

format: plain


text:
Initial state $$\left| \alpha_0 \right\rangle + \left| \beta_0 \right\rangle$$.

$$\alpha_0 = -\beta_0 = 2$$.

Driven with $$F=(\hat{a}-\alpha(t))(\hat{a}-\beta(t))$$.

$$\alpha(t) = \alpha_0 + R(1-\cos( \frac{t}{T}2\pi)) - iR\sin( \frac{t}{T}2\pi)$$.

$$\beta(t) = \beta_0 - R(1-\cos(-\frac{t}{T}2\pi)) + iR\sin(-\frac{t}{T}2\pi)$$.

Total time $$T = 200$$.

Radius span $$R \in [-.5,1]$$.

# Summary of final state wrt radius parameter.

 Final state Bloch coordinates wrt area: Angle wrt area: Final state purity wrt radius parameter:

# For a given radius detailed time evolution.

 The qubit in the time dependent basis $$\{\left| \alpha(t) \right\rangle, \left| \beta(t) \right\rangle \}$$: First frame: Last frame:
Code to simulate the system and generate the plots.


text:
## Moving towards most halite - Halite III (2018) AI Coding Competition p.3

Halite III part 3

Now, let's learn some things about our choices. We can only move once in the north, south, east or west direction, so we can have a pretty basic bot that just checks these. Code for doing this has already been made for us, and we can do something like:

So one option we have is, on a per-ship basis, check all surrounding squares, and then move towards the square with the most halite, remembering to also check our current position as well (holding there if it's the most ideal spot). To do this, let's first recognize that we must differentiate between a direction and a position. A position is a set of coordinates. We can use this position to learn information about things at those coordinates or around them, but, in order to actually move to a new position, we have to specify a direction. What are our directional choices?

    # specify the order we know this all to be
direction_order = [Direction.North, Direction.South, Direction.East, Direction.West, Direction.Still]

This is the same for all ships, so we should define this right before our for loop for the ships. Next, on a per-ship basis, we want to collect all of the possible future positions that we could take. There's already a method for this, which can be applied to any Postion object: .get_surrounding_cardinals(). Keep this in mind. What we're going to do is very rudimentary, but you could...and should... probably get a LOT more fancy with this. I would likely instead weight, probably, all of the possible paths, at least for the next few steps, per ship, at every single step. Right now, our pathing is still going to be very stupid, but it will at least begin to resemble something slightly intelligent!

Let's begin doing this with:

    for ship in me.get_ships():
# cardinals get surrounding cardinals using get_all_cardinals in positionals.py.
# reading this file, I can see they will be in order of:
# [Direction.North, Direction.South, Direction.East, Direction.West]
# maps with position orders, but also gives us all the surrounding possitions
position_options = ship.position.get_surrounding_cardinals() + [ship.position]

As the comments note, I went and read the positionals.py file to determine the order here. I did this to make sure that direction_order and position_options would map correctly to eachother. Next, let's make a couple of dictionaries:

        # position_dict = {(0, -1): Position(8, 15), (0, 1): Position(8, 17), (1, 0): Position(9, 16), (-1, 0): Position(7, 16), (0, 0): Position(8, 16)}
position_dict = {}

# maps the direction choice with halite
# halite_dict = {(0, -1): 708, (0, 1): 492, (1, 0): 727, (-1, 0): 472, (0, 0): 0}
halite_dict = {}

The idea here is that we want to map directions to both a position, and directions to halite amounts. This is by no means the most efficient method of doing this, because now we're going to use two loops to populate them:

        for n, direction in enumerate(direction_order):
position_dict[direction] = position_options[n]

for direction in position_dict:
position = position_dict[direction]
halite_amount = game_map[position].halite_amount
halite_dict[direction] = halite_amount

Sorry mom.

No matter though, we have the information we need now.

...so why do we actually care about the position dict? Why not just use the halite dict? All we need to do is find the max square and move to it, so really we just need to do the simple task of finding the key with the highest value. That's pretty easy: max(halite_dict, key=halite_dict.get)

Well, let's try that, here's the full code:

# Python 3.6
import hlt  #main halite stuff
from hlt import constants  # halite constants
from hlt.positionals import Direction  # helper for moving
import random  # randomly picking a choice for now.
import logging  # logging stuff to console

game = hlt.Game()  # game object
# Initializes the game

while True:
# This loop handles each turn of the game. The game object changes every turn, and you refresh that state by
game.update_frame()
# You extract player metadata and the updated map metadata here for convenience.
me = game.me

'''comes from game, game comes from before the loop, hlt.Game points to networking, which is where you will
find the actual Game class (hlt/networking.py). From here, GameMap is imported from hlt/game_map.py.

open that file to seee all the things we do with game map.'''
game_map = game.game_map  # game map data. Recall game is

# A command queue holds all the commands you will run this turn. You build this list up and submit it at the
#   end of the turn.
command_queue = []

# specify the order we know this all to be
direction_order = [Direction.North, Direction.South, Direction.East, Direction.West, Direction.Still]
for ship in me.get_ships():
# cardinals get surrounding cardinals using get_all_cardinals in positionals.py.
# reading this file, I can see they will be in order of:
# [Direction.North, Direction.South, Direction.East, Direction.West]

# maps with position orders, but also gives us all the surrounding possitions
position_options = ship.position.get_surrounding_cardinals() + [ship.position]

# we will be mapping the "direction" to the actual position

# position_dict = {(0, -1): Position(8, 15), (0, 1): Position(8, 17), (1, 0): Position(9, 16), (-1, 0): Position(7, 16), (0, 0): Position(8, 16)}
position_dict = {}

# maps the direction choice with halite
# halite_dict = {(0, -1): 708, (0, 1): 492, (1, 0): 727, (-1, 0): 472, (0, 0): 0}
halite_dict = {}

for n, direction in enumerate(direction_order):
position_dict[direction] = position_options[n]

for direction in position_dict:
position = position_dict[direction]
halite_amount = game_map[position].halite_amount
halite_dict[direction] = halite_amount

if game.turn_number == 15:
logging.info(position_dict)
logging.info(halite_dict)
logging.info(max(halite_dict, key=halite_dict.get))

command_queue.append(
ship.move(max(halite_dict, key=halite_dict.get)))

# ship costs 1000, dont make a ship on a ship or they both sink
if me.halite_amount >= 1000 and not game_map[me.shipyard].is_occupied:
command_queue.append(me.shipyard.spawn())

# Send your moves back to the game environment, ending this turn.
game.end_turn(command_queue)

Well, very quickly all of our ships head towards the same spots! Oops. That's not really ideal!

... thus we need a way to make sure we dont have two ships that go to the same spot, which is what we're going to focus on starting in the next tutorial!

The next tutorial:

• Introduction - Halite III (2018) AI Coding Competition p.1

• Running Locally and getting surrounding halite - Halite III (2018) AI Coding Competition p.2

• Moving towards most halite - Halite III (2018) AI Coding Competition p.3
• Trying to not run into ourselves - Halite III (2018) AI Coding Competition p.4

• Moving to drop off halite - Halite III (2018) AI Coding Competition p.5

• Cleaning up a few things - Halite III (2018) AI Coding Competition p.6


text:
# 7 Feature Extraction from Short Temporal Sequences for Clustering

#### Brief Chapter Summary

Embedded mHealth devices continuously record vital functions. These temporal sequences arrive mostly as raw sensor measurements, requiring the extraction of meaningful features. We propose similarity measures for short temporal sequences to build representations of distinct subpopulations. We validate our approach by identifying characteristic plantar pressure profiles from recordings of a controlled experiment with diabetic foot syndrome patients and non-diabetic volunteers.

This chapter is partly based on:

• Uli Niemann, Myra Spiliopoulou, Fred Samland, Thorsten Szczepanski, Jens Grützner, Antao Ming, Juliane Kellersmann, Jan Malanowski, Silke Klose, and Peter R. Mertens. “Learning Pressure Patterns for Patients with Diabetic Foot Syndrome.” In: Computer-Based Medical Systems (CBMS). 2016, pp. 54-59. DOI: 10.1109/CBMS.2016.31.
• Uli Niemann, Myra Spiliopoulou, Thorsten Szczepanski, Fred Samland, Jens Grützner, Dominik Senk, Antao Ming, Juliane Kellersmann, Jan Malanowski, Silke Klose, and Peter R. Mertens. “Comparative Clustering of Plantar Pressure Distributions in Diabetics with Polyneuropathy May Be Applied to Reveal Inappropriate Biomechanical Stress.” In: PLOS ONE 11.8 (2016), pp. 1-12. DOI: 10.1371/journal.pone.0161326.
• Uli Niemann, Myra Spiliopoulou, Jan Malanowski, Juliane Kellersmann, Thorsten Szczepanski, Silke Klose, Eirini Dedonaki, Isabell Walter, Antao Ming, and Peter R. Mertens. “Plantar temperatures in stance position: A comparative study with healthy volunteers and diabetes patients diagnosed with sensoric neuropathy.” In: EBioMedicine 54.102712 (2020), pp. 1-11. DOI: 10.1016/j.ebiom.2020.102712.

Nowadays, mHealth devices, such as smart wearables, are ubiquitous in everyday life [194]. These embedded systems continuously record and process various vital functions and send feedback to the user, for example, via popup notifications or dashboard reports. Thus, they are designed to help live healthier by contributing to more effective exercise or a better diet. mHealth solutions are also increasingly being used in clinical settings. Pattern recognition in timestamped mHealth data is used to timely detect adverse health events.

For example, in diabetes patients with sensory neuropathy, repeated excessive pressure loads can aggravate plantar tissue destruction and ultimately lead to foot ulcers, in the worst case, even to amputation [195]. Since frequent clinical examinations would be too costly and bothersome for the patient [196], sensor-equipped systems for the patient’s shoe insoles are developed. These systems measure foot pressures and temperatures continuously and transmit recordings wirelessly to a smart device, which processes the data to send offloading instructions when potentially harmful pressures are detected [197] or temperature differences between left and right foot exceed pre-specified thresholds [196]. However, a universal pressure threshold with high sensitivity and specificity with respect to ulcer development has not yet been determined . Besides, when a significant difference in temperature between the left and right foot is noted, it is often already too late to warn the patient, as ulceration has already begun. Evidence suggests that there are subpopulations with distinct plantar pressure patterns requiring different preventive measures, for example, different peak pressure thresholds .

In the previous chapters, we presented methods for analyzing static data (Chapters 35) and timestamped data (Chapter 6) with a small number of time points. Raw mHealth data comprises hundreds or more time points, thus requiring the extraction of meaningful features before any actual data analysis. This chapter proposes similarity measures for short temporal sequences to create representations of distinct subpopulations from mHealth data. The DIAB data described in Section 2.2.3 serve as proof-of-concept validation.

This chapter is organized as follows. Section 7.1 describes the medical background of diabetic foot syndrome and reviews previous subtyping approaches to detect plantar pressure patterns. Section 7.2 presents our approaches for modeling regional plantar pressure similarity and identifying distinct foot profiles by clustering. We report on our results in Section 7.3 and compare them to similar studies in Section 7.4. We conclude the chapter in Section 7.5.

## 7.1 Medical Background

Diabetic foot syndrome (DFS) has a substantial negative impact on life quality [69]. Affected patients have higher mortality and are at higher risk of foot ulcerations [74]. More than 85% of foot amputations relate to foot ulcers .

Peripheral sensory neuropathy is most predisposing for foot problems in diabetes patients [195]. In sensory neuropathy, damaging events and injuries go unnoticed, and continued insults can exacerbate tissue destruction. However, understanding of the underlying pathomechanisms of tissue destruction in the absence of trauma is limited.

Lower extremity (micro)blood flow of diabetes patients was compared with healthy controls to establish a causal relationship between decreased blood flow and the occurrence of diabetic foot syndrome . Persistent elevated plantar pressure is a major risk factor for ulceration in diabetes patients . Custom-made footwear and orthopedic shoes are used for ulcer prevention and individual therapy . However, a pressure threshold with high sensitivity and specificity with respect to ulcer development has not yet been determined . Researchers also investigate how pressure is applied to each foot region. Bennetts et al. [202] suggested differences between foot types and biomechanics that result in differences in pressure distribution between regions of the same foot. Deschamps et al. [203] proposed a stratification of patients based on their plantar pressure pattern homogeneity. This approach may avoid the pitfall of smoothing away variations within a pathophysiological subgroup.

In the absence of a ground truth, clustering is often used to derive subgroups of patients who share similarities in pressure distribution, usually focusing on peak plantar pressure, i.e., the maximum observed pressure recorded for a single measurement, for example, the maximum pressure at a sensor during a step . Giacomozzi and Martelli [200] examined the plantar pressure curves of DFS patients and control subjects. They performed clustering based on the curves’ similarity in shape and amplitude. They juxtaposed the clusters to predefined subgroups: For example, all subjects in the group with increased peak pressure and muscle weakness or limited joint mobility were assigned to one cluster [200]. De Cock et al. [201] examined peak pressure measured at different foot regions during jogging and identified four pressure patterns with different pressure centers. For example, the “M2 pattern” is the cluster where the maximum of the mean total regional impulse is located at the second metatarsal bone. Bennetts et al. [202] considered seven plantar regions and formed subgroups of patients with similar peak pressure distributions in these regions. Deschamps et al. [203] focused only on plantar forefoot peak pressure distribution and studied both patients and controls. They formed clusters of patients with similar forefoot pressure distributions and identified a cluster consisting only of diabetes patients.

Similar to , we focus on patient stratification with clustering. As in , we consider all foot regions, not just the forefoot. In contrast to all the aforementioned methods that determined similarity in a single way and then used k-means for clustering, we present alternative ways of modeling similarity in terms of plantar pressure and we contrast the clusters formed by different clustering algorithms in terms of their quality. Besides, we provide visualization aids for inspecting the most representative instance (patient foot) in each cluster.

Initially, the study experiment was performed exclusively on patients. Volunteer data became available only gradually. Hence, this chapter is divided into two parts: In part A, we present alternative distance measures for regional plantar pressure load and evaluate them by clustering experiment data from diabetes patients. In part B, we use the best distance measure from part A to cluster the subgroups of diabetes patients, healthy volunteers, and a combined group separately.

## 7.2 Modeling Similarity of Regional Plantar Pressure

Our approach includes feature extraction (Section 7.2.1), plantar pressure distribution similarity modeling (Section 7.2.2), clustering of study participant feet (Section 7.2.3), clustering evaluation (Section 7.2.4), and visualization. We present these steps below.

### 7.2.1 Feature Extraction from Short Time Series

The pressure measurements for one foot of an example participant are shown in Figure 7.1. For each experiment, each foot, and each of the eight sensors, the pressure recordings result in a time series. Within each time series, stance episodes, i.e., phases in which the patient was standing, are indicated by dashed boxes. During these episodes, the example patient applied more pressure to the central sensors MTB-3 and Calcaneus than Digitus-1 and Lateral, suggesting a balanced pressure pattern.

For each session $$i$$, i.e., for each experiment, participant and foot separately, the minimum and maximum observed pressure values over all sensors were identified, $$r_{i}^{\text{min}}$$ and $$r_{i}^{\text{max}}$$, respectively. Then, within each session $$i$$ and for each sensor $$s$$ each observed pressure value $$r_{i,s}$$ was normalized into the relative plantar pressure (RPP) value

$$$r^*_{i,s}=(r_{i,s}-r_{i}^{\text{min}})/(r_{i}^{\text{max}}-r_{i}^{\text{min}}). \tag{7.1}$$$

### 7.2.2 Distance Measures

We consider three alternative ways of modeling plantar pressure similarity:

• similarity based on relative plantar pressure,
• similarity based on pressure distribution in pairs of sensors, and
• similarity based on centers of pressure.

Similarity based on relative plantar pressure. We define the distance $$d_{\text{RPP}}$$ between sessions $$i,j$$ as Euclidean distance between the mean RPP over the eight plantar regions:

$$$d_{\text{RPP}}(i,j) = \sqrt{\sum_{s} \left( \mu(r^*_{i,s}) - \mu(r^*_{j,s}) \right)^2}, \tag{7.2}$$$

where $$\mu(r^*_{i,s})$$ is the average RPP in session $$i$$ at region $$s$$.

Similarity based on pressure distribution in pairs of sensors. For each pair of regions $$s,t$$ of a session $$i$$, a simple linear regression model $$X_t = \beta_0+\beta_1X_s$$ is derived, capturing the linear relationship between the plantar pressure recordings at $$s$$ and those at $$t$$. Figure 7.2 shows an example of the MTB-3 and MTB-4 sensors with three feet. While a generally applied less pressure than b, the linear relationship between the recordings at MTB-3 and MTB-4 is similar, as indicated by the nearly parallel regression fit. Compared to a and b, the regression fit of c has a smaller slope, indicating an increase in pressure at MTB-3 is associated with a smaller increase in pressure at MTB-4. The regression lines also differ in the goodness of fit. For example, the residual values are, on average, smaller for b than for c.

Two feet are similar if the slopes of most of the $$\binom{8}{2}$$ regression lines are similar, taking into account the goodness of fit of each line. Let $$i$$ be a session, and let $$s,t$$ be two plantar regions. The regression line’s slope between $$s$$ and $$t$$ for session $$i$$ is denoted as $$m(i,s,t)$$ and the Pearson correlation coefficient as $$cor(i,s,t)$$, quantifying the goodness of fit of the regression lines. The dissimilarity between two sessions $$i,j$$ for these two regions is then defined as the difference between the slopes of the regression lines $$m(i,s,t)$$ and $$m(j,s,t)$$, given by

$$$\Theta(i,j,s,t) = \tan^{-1}\left(\frac{m(i,s,t)-m(j,s,t)}{1+m(i,s,t)\cdot m(j,s,t)}\right). \tag{7.3}$$$

We then sum the angular distances over all pairs of plantar regions to obtain a value expressing the distance between two feet $$d_{\text{pairs}}(i,j)$$, defined as

$$$d_{\text{pairs}}=1-\sum_{r}\sum_{s} \Theta(i,j,s,t)\cdot \frac{|cor(i,s,t)| + |cor(j,s,t)|}{2} \tag{7.4}$$$ (if $$i\neq j$$; otherwise 0), where $$cor(i,s,t)$$ is the Pearson correlation coefficient between the plantar pressure records of $$r$$ and $$s$$ for foot $$i$$. Because the angular distance depends on the goodness of fit of the regression, angular distances of more reliable regression lines were assigned a higher weight in the distance calculation.

Similarity based on centers of pressure. For the third variant of similarity, we cluster the average RPPs in each region. Two feet are similar when most of the k centroids are similar. For each region, we call k-means multiple times with different k and select the run with the optimal Silhouette coefficient. However, due to a possibly different number of clusters for the different regions, we consider that the distance between two centroids may be smaller for a clustering with many clusters than for a clustering with only a few clusters. Therefore, we add a weighting factor so that the $$d_{\text{centers}}(i,j)$$ is defined as:

$$$d_{\text{centers}}(i,j) = \sum_{s}{}\left|ctr(i,s) - ctr(j,s)\right| \cdot \log(|C(s)|)/\sum_{t}\log(|C(t)|) \tag{7.5}$$$ where $$ctr(i,r)$$ is the centroid of the cluster to which $$i$$ has been assigned with respect to clustering for sensor $$s$$ and $$|C(s)|$$ is the number of clusters for the clustering of $$s$$.

### 7.2.3 Identifying Foot Profiles by Clustering

To identify distinct pressure pattern subgroups, we carry out k-medoids [217], DBSCAN [185], and agglomerative hierarchical clustering.

k-medoids. Like k-means and X-means (recall Section 5.2.1), a k-medoids cluster is represented by an instance for which the sum of the distances to all observations of the same cluster is minimal. The difference between a k-means centroid and a k-medoids medoid is that the latter must be an actual observation. In contrast, a centroid is an artificial observation derived from mean values. Compared to k-means, k-medoids can be more robust to outliers [218] and has, at least for this application, an arguably more intuitive cluster representation: The medoid can be interpreted as the most representative foot in the cluster, whereas a centroid can be very different from the pressure distribution of any patient within the cluster. Thus, this notation allows us to use clustering to examine temporal patterns of plantar pressure by visualizing the cluster medoids’ RPP time curve.

DBSCAN. DBSCAN [185] partitions instances into clusters based on their estimated density distribution and builds clusters of arbitrary shape and size. Pressure distributions of feet that differ considerably from any cluster are declared as outliers, which may be abnormal pressure patterns of patients potentially requiring medical supervision. DBSCAN has two parameters: the radius $$eps$$ defining the “neighborhood” of an instance and the minimum number $$minPts$$ of neighbors for an instance to be a core point (recall Section 6.3.1).

Hierarchical clustering. In agglomerative hierarchical clustering, similar instances are iteratively merged into clusters in a bottom-up fashion. The order in which two clusters are merged depends on the linkage strategy: In complete linkage, the distance between two clusters is defined as the maximum distance between a pair of instances (one from each cluster). The two clusters that minimize this maximum distance are selected for merging. Using a dendrogram, it is possible to break down the “tree” of clusters to understand the progressive merging process. Optionally, a parameter $$k$$ can be specified to obtain a specific partitioning with $$k$$ clusters.

### 7.2.4 Evaluation Setup

Preprocessing. Some of the sensor recordings were identified as noisy or erroneous. To reduce the impact of such extreme recordings, these values were replaced with the median of all recordings for the sensor in that session. Following the inner fence outlier definition in boxplots [219], a value $$x$$ was flagged as extreme if it fell outside the range $$[Q_1 - 1. 5 \cdot (Q_3 - Q_1), Q_3 + 1.5 \cdot (Q_3 - Q_1)]$$, where $$Q_i$$ is the $$i$$th quartile and $$(Q_3 - Q_1)$$ is the interquartile range over all sensors in $$i$$. Then the time curves were smoothed using locally weighted scatterplot smoothing (LOWESS) [137] with a smoother span of 5%. Recordings from all stance episodes were used for distance calculation and clustering.

Experimental setup. For part A, we use the three distance measures from Section 7.2.2 to cluster the participant feet, using the algorithms k-medoids, DBSCAN, and hierarchical agglomerative clustering (Section 7.2.3). For DBSCAN, we estimate an appropriate value of $$eps$$ using the elbow method presented in Section 6.3.1, where $$k$$ is set to $$minPts$$. For hierarchical clustering, we cut the dendrogram to obtain $$k$$ clusters. Cluster quality was measured by the Silhouette coefficient (recall Section 4.2.1). For k-medoids, we vary k from 2 to 10. For DBSCAN, we set $$minPts$$ from 2 to 10 and automatically determine $$eps$$. For hierarchical clustering, we set the number of clusters from 2 to 10 and use single linkage, complete linkage, and average linkage, respectively. For part B, we restrict to the best performing combination of distance measure and clustering algorithm of part A.

Included datasets. In part A, foot insole sensor recordings of 20 patients (5 female, 15 male, 66.2 ± 8.4 years) with type 1 or type 2 diabetes and sensomotoric peripheral polyneuropathy were available. 19 participants performed the experiment twice, the remaining participant only once. For 34 of these 39 experiments, recordings of both feet were available, reaching a total of 73 experiment datasets.

For part B, data for 253 diabetes patients (6 females, 19 males, age 64.8 ± 9.8 years) and 18 non-diabetic healthy volunteers (10 females, 8 males, age 62.9 ± 7.6 years) were available. For all 43 sessions, both feet’ sensor recordings were available, which were used independently, reaching a total of 86 session datasets.

## 7.3 Validation on DIAB

### 7.3.1 Results on Part A

Table 7.1 shows the clustering results. The maximum Silhouette score is achieved by k-medoids with $$d_{\text{RPP}}$$ (k = 4; Silh = 0.78). The number of clusters found by the 3 clustering algorithms differs: while k-medoids finds 4 clusters for each distance measure, DBSCAN returns one large cluster and some outliers (i.e., noise points); for hierarchical clustering, the number of clusters varies the most, from 2 to 10. k-medoids outperforms DBSCAN and agglomerative hierarchical clustering for all three distance measures. Besides, $$d_{\text{RPP}}$$ outperforms all other distance measures with respect to the three algorithms.

Table 7.1: Clustering results (part A). Optimal number of clusters $$k_{opt}$$ and Silhouette coefficient $$Silh_{opt}$$ for each distance measure and algorithm.
Algorithm $$k_{opt}$$ $$Silh_{opt}$$
$$d_{\text{RPP}}$$
k-medoids 4 0.78
DBSCAN 1 + 14 noise points 0.57
Hierarchical (single linkage) 2 0.40
$$d_{\text{pairs}}$$
k-medoids 4 0.31
DBSCAN 1 + 2 noise points 0.13
Hierarchical (average linkage) 3 0.18
$$d_{\text{centers}}$$
k-medoids 4 0.45
DBSCAN 1 0.12
Hierarchical (average linkage) 10 0.18

For the best clustering ($$d_{\text{RPP}}$$, k-medoids), a boxplot-based visualization of the RPP distributions of the medoids for each sensor is shown in Figure 7.3. While the RPP distribution of medoid 1 is balanced, medoid 2 has a pressure focus on the centrally located MTB-3; medoid 3 has an overall higher pressure load, especially for Digitus-1, MTB-2, MTB-3, MTB-5, and Lateral, while medoid 4 represents a “skewed” pattern with increasing pressure from the medial to the lateral forefoot (as measured at MTB-5). The substantial differences in the RPP distribution of these medoids suggest high variability in how DFS patients apply pressure to their feet. Determining patient subpopulations serves as a basis for reducing the risk of DFS-related foot complications by supporting early detection, treatment, and prevention , for example, by personalized footwear tailored to patient needs [202].

The optimal clustering resulted in 4 subgroups. This number is consistent with the results of Deschamps et al. [203] (for the diabetes group) and De Cock et al. [201]. Furthermore, some of our findings are similar to the study of Bennetts et al. [202]. The RPP distribution of the second cluster’s medoid corresponds to the “central pattern” of De Cock et al. [201] and cluster 2 of Deschamps et al. [203]. Being the medoid of the largest of the four clusters (n = 25 out of 73 feet (ca. 34%)), it is characterized by low to medium RPP the with focal point of pressure on the central forefoot regions MTB-3. Our fourth medoid is similar to cluster 4 of Deschamps et al. [203]. However, while cluster 4 is the second largest in our study (n = 22 feet (ca. 30%)), the relative proportion in Deschamps et al. [203] is much smaller (n = 30 of 194 feet (ca. 15%)). While RPP pressure is rather low in the medial regions, median RPP gradually increases toward the lateral forefoot regions. The balanced, moderate pressure on all regions of the first medoid (n = 12 (ca. 16%)) represents a well-distributed pressure loading pattern. It is similar to the largest cluster (cluster 4) of Bennets et al. [202]. The overall high pressure loading of the third medoid may be an indicator of an adverse posture. Patients from cluster 3 (n = 14 (ca. 19%)) may be overloading their feet and should therefore be warned more urgently than the other subgroups.

### 7.3.2 Results on Part B

Figure 7.4 shows the Silhouette coefficient and the optimal number of clusters for each subgroup. Patients, controls, and the combination of both groups can be best described with four plantar pressure profiles. For the clustering with the optimum k of each group, a summary of the relative plantar pressure distribution for the session datasets of each cluster is provided in Figure 7.5.

Healthy volunteers. For cluster 1, representing 50% of the volunteer participants, the median RPP is high in all regions. Clusters 2 and 3 show some variability for pressure in the forefoot regions. Cluster 4, characterized by low median RPP at MTB-1 and MTB-5, describes only 2 of 36 feet in the volunteer group.

Diabetes patients. Cluster 1 is the largest subgroup and is characterized by high plantar pressure (median RPP above 80%). Cluster 2 represents an evenly balanced median RPP profile. Here, median relative plantar pressures for Digitus-1, MTB-1, and MTB-5 range from 30% to 50% of maximum, while median relative plantar pressures for the central forefoot (MTB-2, MTB-3, MTB-4), Lateral, and Calcaneus were recorded between 50% and 75%. For cluster 3, the median RPP is above 80% of all regions’ maximum values except for the medial regions Digitus-1 and MTB-1. The latter cluster has the highest variance of all four clusters, with a high difference between the first and third quartiles for several regions. For cluster 4, high median relative plantar pressures are perceived at all MTB sensors (RPP > 75%) and almost no pressure on Lateral (median RPP < 2%).

When we perform clustering on the combination of both groups, some clusters of the diabetes patients merge with the ones of controls. The optimal number of clusters to describe the pressure distribution best remains 4. Clusters 1-3 contain both patients and controls, but cluster 4 summarizes pressure distribution patterns only found in diabetes patients with severe polyneuropathy.

Table 7.2 summarizes the data for diabetes patients and healthy volunteers within the combined group’s four clusters. In clusters 1-3, the mean values of weight, height, and BMI for patients are higher than those for volunteers. Since cluster 4 has the highest values for height, weight, and BMI, it can be assumed that these anthropometric characteristics also influence the measured pressure values and that the class separation cannot be explained exclusively by pathology.

Table 7.2: Baseline characteristics. Characteristics of diabetes patients (P) and healthy volunteers (V) with respect to the clustering on the combined group.
Cluster 1
Cluster 2
Cluster 3
Cluster 4
Characteristic P V P V P V P V
n 9 19 9 13 10 4 8 0
Sex (f/m) 2/7 9/10 4/5 8/5 4/6 3/1 1/7
Age (years) 61 $$\pm$$ 9 64 $$\pm$$ 7 68 $$\pm$$ 5 60 $$\pm$$ 9 68 $$\pm$$ 8 67 $$\pm$$ 6 63 $$\pm$$ 10
Height (cm) 178 $$\pm$$ 5 172 $$\pm$$ 8 173 $$\pm$$ 5 169 $$\pm$$ 12 173 $$\pm$$ 6 166 $$\pm$$ 11 178 $$\pm$$ 6
Weight (kg) 97 $$\pm$$ 22 79 $$\pm$$ 13 85 $$\pm$$ 15 76 $$\pm$$ 11 92 $$\pm$$ 15 69 $$\pm$$ 18 100 $$\pm$$ 18
BMI 31 $$\pm$$ 6 27 $$\pm$$ 3 28 $$\pm$$ 4 27 $$\pm$$ 4 31 $$\pm$$ 5 25 $$\pm$$ 6 31 $$\pm$$ 4

## 7.4 Discussion of the Findings from the Medical Perspective

Four pressure clusters each were identified for healthy volunteers and diabetes patients. These clusters reflect the way the groups distribute pressure to foot regions vulnerable for ulceration. The ultimate goal of these profiles is to reduce ulcer risk: while clinical examination remains essential, pressure distribution analysis, as proposed here, can serve as the basis for preventive strategies , including the manufacturing of footwear tailored to patient needs [202]. An interesting finding is that an unsupervised procedure alone, i.e., without using the target variable (presence of diabetes), generated a cluster consisting exclusively of diabetes patients, see Figure 7.5 (c).

This result is remarkable because the study protocol, with its strict sequence of standing and sitting episodes, specifies exactly when and for how long pressure loads are to be applied. Furthermore, during the experiment, participants were instructed to adhere to the protocol, i.e., to apply pressure continuously during the standing episodes. It is possible that the diabetes patients adhered more strictly to the study protocol due to their neuropathy. It can also be assumed that a pain-related fatigue effect occurs more frequently during the second loading phase over 20 min (stance episode 6) compared to the first (stance episode 3), indicated by a larger percentage of recordings of pressure release. To quantify these changes, we calculated the percentage of recordings in which the participants released pressure during stance episodes 3 and 6 (Figure 7.6). No significant intra-group differences between stance episodes 3 and 6 were found. However, the mean percentage of pressure release recordings was significantly different (p < 0.01) between healthy volunteers and diabetes patients with sensoric polyneuropathy.

Comparing the clusters for healthy subjects and diabetes patients revealed a high overlap in the plantar pressure distribution. For example, cluster 1 and cluster 3 of healthy subjects and diabetes patients are characterized by almost identical pressure loading patterns. To investigate whether a group-specific pressure distribution could be identified, a cluster analysis was performed for the combination of both groups. A random sample of diabetes patients was selected to ensure a balanced distribution between the two groups. The observed pressure patterns in Figure 7.5 (c) support the assumption of common pressure patterns: clusters 1, 2, and 3 comprise the pressure distributions of both groups. However, cluster 4 was unique to diabetes patients. This pattern is characterized by the lowest median relative plantar pressure on the Lateral and Calcaneus.

Also, unlike other studies, we avoided k-means because it is sensitive to outliers and because cluster centroids are composite objects, not true feet; rather, we provide a cluster’s medoid, which is the most representative foot in the cluster, while a cluster centroid (under k-means) is a derived vector of averages that may be very different from any patient’s pressure distribution inside the cluster.

Some of the observed differences compared to related studies could be because of differences in study participants, population sizes, experimental protocols, and measurement devices . For example, neither the medial M1 pattern nor the M2 pattern of [201], which focuses on either MTB-1 or MTB-2, could be replicated. Besides, some of the results were not observed in previous studies, such as the pattern disparity between lateral and other regions in cluster 4 (diabetes patients).

Our main finding is that a group of patients (cluster 4) applies plantar pressure in a way that is not found in healthy volunteers. To draw conclusions from the other clusters, it is necessary to consider a larger sample of healthy individuals, which would allow reducing idiosyncrasies possibly found here and form homogeneous clusters of healthy individuals.

The study protocol’s simplicity makes it easily reproducible, but the protocol cannot capture the complexity of foot movement in everyday life. Thus, a limitation of the study is to only detect differences in pressure distribution that can be detected by changes in posture. When patients apply pressure in an uncontrolled environment, the variance between their pressure profiles will inevitably increase. Therefore, a study that considers more effortful activities of the patients (running, cycling, climbing stairs, etc.) is needed to complement the results.

Another limitation of the results is the small sample size, which prevented examining differences between female and male participants because the gender samples would have been too small for generalization.

Finally, a long-term follow-up would allow us to determine which patients eventually develop ulceration. This would provide a critical endpoint and evaluate whether certain clusters are associated with a higher risk of developing diabetic foot syndrome.

## 7.5 Conclusion

We have proposed three similarity measures for short temporal sequences extracted from raw mHealth data to create representations of distinct subpopulations via clustering. The DIAB data served for proof-of-concept validation. The similarity measures were based on (i) relative plantar pressure, (ii) pressure distribution in pairs of sensors, and (iii) centers of pressure. We found four distinct subpopulations of plantar pressure patterns.

Our approach needs to be validated on larger cohorts. The modeling of similarity can be transferred from pressure to temperature recordings in the plantar regions, possibly closing the gap in early detection of tissue damage and ulcer formation. The formation of a diabetes patient cluster emphasizes pathological differences, i.e., impaired sensation and microcirculatory defects leading to tissue damage. Our results may lay the groundwork for approaches to identify pressure (and temperature) patterns predictive for emerging foot problems with diabetes in the future.


text:
# Boltzmann's Entropy Unisex Tank Top

Regular price \$26.99

In statistical mechanics, Boltzmann's equation is a probability equation relating the entropy S of an ideal gas to the quantity W, the number of real microstates corresponding to the gas' macrostate.

where kB is the Boltzmann constant (also written as simply k) and equal to 1.38065 × 10−23 J/K.

In short, the Boltzmann formula shows the relationship between entropy and the number of ways the atoms or molecules of a thermodynamic system can be arranged.

• 100% combed and ringspun cotton
• Tri-blends are 50% polyester/25% combed/25% ringspun cotton/rayon
• Side-seamed, unisex sizing
• Sizes - XS-2XL

Size guide

 XS S M L XL 2XL Body Length (inches) 26 27 28 29 30 31 Body Width (inches) 16 ¼ 18 ¼ 20 ¼ 22 ¼ 24 ¼ 26 ¼


text:
It is currently 13 Dec 2017, 20:39

Decision(s) Day!:

CHAT Rooms | Ross R1 | Kellogg R1 | Darden R1 | Tepper R1

GMAT Club Daily Prep

Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

Events & Promotions

Events & Promotions in June
Open Detailed Calendar

M21-07

Author Message
TAGS:

Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [1], given: 12699

Show Tags

16 Sep 2014, 00:10
1
KUDOS
Expert's post
4
This post was
BOOKMARKED
00:00

Difficulty:

55% (hard)

Question Stats:

50% (00:56) correct 50% (00:59) wrong based on 129 sessions

HideShow timer Statistics

If $$x$$, $$y$$, and $$z$$ are even positive integers, each of the following must be an even integer EXCEPT:

A. $$\frac{xyx}{4}$$
B. $$x^{(y + z)}$$
C. $$(x+y)^{z-1}$$
D. $$x-y-z$$
E. $$y^{z-x}$$
[Reveal] Spoiler: OA

_________________

Kudos [?]: 135562 [1], given: 12699

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [1], given: 12699

Show Tags

16 Sep 2014, 00:10
1
KUDOS
Expert's post
Official Solution:

If $$x$$, $$y$$, and $$z$$ are even positive integers, each of the following must be an even integer EXCEPT:

A. $$\frac{xyx}{4}$$
B. $$x^{(y + z)}$$
C. $$(x+y)^{z-1}$$
D. $$x-y-z$$
E. $$y^{z-x}$$

If $$z=x$$, then option E gives: $$y^{z-x}=y^0=1=odd$$. All the other options are necessarily even.

_________________

Kudos [?]: 135562 [1], given: 12699

Intern
Joined: 28 Sep 2014
Posts: 24

Kudos [?]: 4 [0], given: 43

Schools: HBS '19

Show Tags

11 Apr 2015, 23:43
Bunuel wrote:
Official Solution:

If $$x$$, $$y$$, and $$z$$ are even positive integers, each of the following must be an even integer EXCEPT:

A. $$\frac{xyx}{4}$$
B. $$x^{(y + z)}$$
C. $$(x+y)^{z-1}$$
D. $$x-y-z$$
E. $$y^{z-x}$$

If $$z=x$$, then option E gives: $$y^{z-x}=y^0=1=odd$$. All the other options are necessarily even.

Sir Question says "Must be even integer". So either it can be odd or it can be 0 ( as it doesnt say the resultant will be positive)

If we take option D i.e. x-y-z (let x=4 y=2 and z=2), the resultant would be 0
this also satisfies the equation in my opinion.

Kudos [?]: 4 [0], given: 43

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [1], given: 12699

Show Tags

12 Apr 2015, 03:34
1
KUDOS
Expert's post
saharshbagaria wrote:
Bunuel wrote:
Official Solution:

If $$x$$, $$y$$, and $$z$$ are even positive integers, each of the following must be an even integer EXCEPT:

A. $$\frac{xyx}{4}$$
B. $$x^{(y + z)}$$
C. $$(x+y)^{z-1}$$
D. $$x-y-z$$
E. $$y^{z-x}$$

If $$z=x$$, then option E gives: $$y^{z-x}=y^0=1=odd$$. All the other options are necessarily even.

Sir Question says "Must be even integer". So either it can be odd or it can be 0 ( as it doesnt say the resultant will be positive)

If we take option D i.e. x-y-z (let x=4 y=2 and z=2), the resultant would be 0
this also satisfies the equation in my opinion.

ZERO:

1. 0 is an integer.

2. 0 is an even integer. An even number is an integer that is "evenly divisible" by 2, i.e., divisible by 2 without a remainder and as zero is evenly divisible by 2 then it must be even.

3. 0 is neither positive nor negative integer (the only one of this kind).

4. 0 is divisible by EVERY integer except 0 itself.

Check more here: tips-and-hints-for-specific-quant-topics-with-examples-172096.html#p1371030
_________________

Kudos [?]: 135562 [1], given: 12699

Manager
Joined: 02 Nov 2014
Posts: 215

Kudos [?]: 136 [0], given: 75

GMAT Date: 08-04-2015

Show Tags

08 Nov 2015, 19:30
Quote:
If $$x$$, $$y$$, and $$z$$ are even positive integers, each of the following must be an even integer EXCEPT:

A. $$\frac{xyx}{4}$$
B. $$x^{(y + z)}$$
C. $$(x+y)^{z-1}$$
D. $$x-y-z$$
E. $$y^{z-x}$$

Hi Bunuel,

I have a doubt about choice C. In case z=0, it turns out to be the reciprocal of (x+y), which may not be an even integer, isn't it? Pls clarify. I had this Q as my 1st Q in quant section in a GmatClub test. Spent 2 full minutes and got demotivated Pls help

Thanks,

Binit

Kudos [?]: 136 [0], given: 75

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [0], given: 12699

Show Tags

08 Nov 2015, 20:38
binit wrote:
Quote:
If $$x$$, $$y$$, and $$z$$ are even positive integers, each of the following must be an even integer EXCEPT:

A. $$\frac{xyx}{4}$$
B. $$x^{(y + z)}$$
C. $$(x+y)^{z-1}$$
D. $$x-y-z$$
E. $$y^{z-x}$$

Hi Bunuel,

I have a doubt about choice C. In case z=0, it turns out to be the reciprocal of (x+y), which may not be an even integer, isn't it? Pls clarify. I had this Q as my 1st Q in quant section in a GmatClub test. Spent 2 full minutes and got demotivated Pls help

Thanks,

Binit

You should read questions more carefully: If $$x$$, $$y$$, and $$z$$ are even POSITIVE integers... 0 is not positive.
_________________

Kudos [?]: 135562 [0], given: 12699

Manager
Joined: 02 Nov 2014
Posts: 215

Kudos [?]: 136 [0], given: 75

GMAT Date: 08-04-2015

Show Tags

08 Nov 2015, 21:33
Quote:
You should read questions more carefully: If x, y, and z are even POSITIVE integers... 0 is not positive.

Yes. I should be more careful in reading. I unnecessarily got nervous on the first Q and wasted time. Thanks so much for ur suggestion.

Binit.

Kudos [?]: 136 [0], given: 75

Intern
Joined: 13 Oct 2014
Posts: 2

Kudos [?]: 3 [0], given: 13

Show Tags

13 Dec 2015, 05:05
HI BUNUEL ! this is my 1st post in gmatclub !..
i also answered E ; my thought process was : if z>x then option E would not be an integer
is it ok ?

Kudos [?]: 3 [0], given: 13

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [0], given: 12699

Show Tags

13 Dec 2015, 05:16
priya1987 wrote:
HI BUNUEL ! this is my 1st post in gmatclub !..
i also answered E ; my thought process was : if z>x then option E would not be an integer
is it ok ?

______________
Yes, that;s correct.
_________________

Kudos [?]: 135562 [0], given: 12699

Intern
Joined: 18 Nov 2013
Posts: 28

Kudos [?]: 16 [0], given: 11

Location: India
WE: Engineering (Transportation)

Show Tags

14 Dec 2016, 05:03
Hi bunuel,

My question might be ridiculous but pls. reply. If x and z are same integers then why would the author name it differently? In questions like these, i should also consider the fact that all integers might be same?

Kudos [?]: 16 [0], given: 11

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [0], given: 12699

Show Tags

14 Dec 2016, 05:06
Klenex wrote:
Hi bunuel,

My question might be ridiculous but pls. reply. If x and z are same integers then why would the author name it differently? In questions like these, i should also consider the fact that all integers might be same?

Unless it is explicitly stated otherwise, different variables CAN represent the same number.
_________________

Kudos [?]: 135562 [0], given: 12699

Intern
Joined: 12 Nov 2017
Posts: 3

Kudos [?]: 0 [0], given: 0

Show Tags

13 Nov 2017, 08:55
...

Last edited by vrkr on 13 Nov 2017, 08:59, edited 1 time in total.

Kudos [?]: 0 [0], given: 0

Math Expert
Joined: 02 Sep 2009
Posts: 42597

Kudos [?]: 135562 [0], given: 12699

Show Tags

13 Nov 2017, 08:58
vrkr wrote:
I guess the answer is A. if x=2, y=6, z=10 (non-multiples of 4), then (x+y+z)/4 = 18/4 = 4.5 which is not an integer.

The correct answer is E, not A.

Option A is xyz/4, NOT (x+y+z)/4.
_________________

Kudos [?]: 135562 [0], given: 12699

Re: M21-07   [#permalink] 13 Nov 2017, 08:58
Display posts from previous: Sort by

M21-07

Moderators: chetan2u, Bunuel

 Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.


text:
You are Here: Home >< Maths

# TMUA Preparation

Announcements
1. Hi,

Is anyone else on here sitting the TMUA (Test for Mathematics Unviersity Admissions). Durham, Lancaster and LSE will all be using it for 2017 entry.

I quite like the style of the test, especially the second paper. How is everyone preparing for it? Anything besides working on the Specimen Paper?

‘Please do not discuss the test until the start of December. There are people still due to take it.’

Spoiler:
Show

Admissions Testing Service exams (used by the University of Oxford, Imperial College London and some Medical schools) are international exams. As a result, some candidates in one country may have already completed an exam that hasn't yet started elsewhere.

HAT (History Aptitude Test)[*]MAT (Mathematics Admissions Test)
OLAT (Oriental Languages Aptitude Test)
PAT (Physics Aptitude Test)
TSA (Thinking Skills Assessment)
TMUA (Test of Mathematics for University Admission) - No discussion until start of December

Test-takers should not post test questions or discuss answers, or post the test paper(s). These restrictions will extend to discussions about exams' tested content, specific questions or question numbers and provisional exam answers or mark schemes.

This, however, does not mean all discussion about these exams will be restricted: it's okay to talk about having just sat the exam, or whether or not you found it difficult.

What is not okay is giving away any information that might cause one student to have an unfair advantage over another. For example
"I found it hard"
"I found question 2 hard"
"I found question 2 about <insert subject> hard"

These restrictions will be in place from 09:00 GMT on Wednesday 2 November until 17:00 GMT on Thursday 3 November. In the interests of yourselves and your fellow students, and in the interest of maintaining the fairness of the exam, please avoid discussion as outlined above during this timeframe.

PLEASE NOTE: this rule applies to any form of discussion, including, but not limited to, PMs (Private Messages).

If you see anyone breaking these rules, please report them by using the report button. Good luck to everyone sitting these exams!

The Student Room Community Team on behalf of The Admissions Testing Service

2. (Original post by sammygmfc)
Hi,

Is anyone else on here sitting the TMUA (Test for Mathematics Unviersity Admissions). Durham, Lancaster and LSE will all be using it for 2017 entry.

I quite like the style of the test, especially the second paper. How is everyone preparing for it? Anything besides working on the Specimen Paper?
Tbh I am pretty chilled about it. I have done some MAT papers to prep for it and some maths challenge. I recently did the specimen papers and got 37/40 over the two papers so I am happy atm.

Posted from TSR Mobile
3. (Original post by Cryptokyo)
Tbh I am pretty chilled about it. I have done some MAT papers to prep for it and some maths challenge. I recently did the specimen papers and got 37/40 over the two papers so I am happy atm.

Posted from TSR Mobile
Was that in timed conditions? Dont mean to be rude haha just want to know where i stand compared to everyone else considering theres no grades or grade boundaries??
4. (Original post by Superdrift987)
Was that in timed conditions? Dont mean to be rude haha just want to know where i stand compared to everyone else considering theres no grades or grade boundaries??
Timed conditions. How did you do XD?
5. (Original post by Cryptokyo)
Timed conditions. How did you do XD?
Ive only done the first specimen paper and got 7 out of 20 but i ended spending more time on the earlier questions and wasting time tbf. I think though it tests to see if you can see shortcuts almost and your intuition.
6. (Original post by Superdrift987)
Ive only done the first specimen paper and got 7 out of 20 but i ended spending more time on the earlier questions and wasting time tbf. I think though it tests to see if you can see shortcuts almost and your intuition.
Have you looked at the enhanced specification? I found it particularly useful for paper 2.
7. (Original post by Cryptokyo)
Have you looked at the enhanced specification? I found it particularly useful for paper 2.
I have had a quick look but not had chance to properly read through it yet. What i did read though was interesting. What did you study at as and your grades too if thats alright??
8. (Original post by Superdrift987)
I have had a quick look but not had chance to properly read through it yet. What i did read though was interesting. What did you study at as and your grades too if thats alright??
Sorry for late reply - was doing maths .
AS Grades: AAAAA (Maths[98%], Further Maths[98%], Physics, Chemistry and Electronics[99%]) and did (M2, M3 and M4 on top of this)
Predicted at A2: A*A*A*A*A* (Maths, Further Maths, Additional Further Maths, Physics and Electronics)
9. (Original post by Cryptokyo)
Sorry for late reply - was doing maths .
AS Grades: AAAAA (Maths[98%], Further Maths[98%], Physics, Chemistry and Electronics[99%]) and did (M2, M3 and M4 on top of this)
Predicted at A2: A*A*A*A*A* (Maths, Further Maths, Additional Further Maths, Physics and Electronics)
Nice man thats awesome haha explains how you did so well!!
10. (Original post by Cryptokyo)
Have you looked at the enhanced specification? I found it particularly useful for paper 2.
crying with laughter
11. (Original post by richardhello)
crying with laughter
12. (Original post by Cryptokyo)
A zombie army of spec babies
13. (Original post by Cryptokyo)
Tbh I am pretty chilled about it. I have done some MAT papers to prep for it and some maths challenge. I recently did the specimen papers and got 37/40 over the two papers so I am happy atm.

Posted from TSR Mobile
Hey I was wondering if you could help me with q19 on paper 1? I can't get it and would appreciate any help
14. (Original post by cmckinley039)
Hey I was wondering if you could help me with q19 on paper 1? I can't get it and would appreciate any help
We know that . And that, as they form an arithmetic series, . Hence we obtain the equation .

Now, is a trivial solution to this cubic. Then we obtain

Solving for gives

Subbing this into gives .

Hope this helps
15. (Original post by Cryptokyo)
We know that . And that, as they form an arithmetic series, . Hence we obtain the equation .

Now, is a trivial solution to this cubic. Then we obtain

Solving for gives

Subbing this into gives .

Hope this helps
It really does Thank you so much!
16. (Original post by cmckinley039)
It really does Thank you so much!
No problem.
17. Hey I was just wondering if you could help with question 18 of paper 1.
Would be much appreciated.
Thanks
18. (Original post by wizard999)
Hey I was just wondering if you could help with question 18 of paper 1.
(Original post by wizard999)
Would be much appreciated.
Thanks

Hey
Hope this helps and it's not all gibberish

So first I looked at the tan equation $\large&space;-1\leq&space;tanx\leq&space;1$

I sketched a graph and found that this is satisfied when $-\pi&space;/4&space;\leq&space;x\leq&space;\pi&space;/4$

However as the range is $\large&space;0\leq&space;x\leq&space;\pi$
the interval where tanx is less than 1 is when $\large&space;0\leq&space;x\leq&space;\pi&space;/4$
so the length of that interval is simply $\pi&space;/4$

Then I looked at $sin2x\geq&space;0.5$

this occurs when $2x\geq&space;\pi&space;/6$ (30 degrees) therefore $x\geq&space;\pi&space;/12$

Now all you have to do is find the area where both of these equations are satisfied which will be the interval between $\pi&space;/4$ and $\pi&space;/12$
If it helps draw these points onto one of the sketched graphs like sine and you'll be able to see the interval you need to find.

And finally $\pi&space;/4&space;-\pi&space;/12&space;=2\pi&space;/12&space;=\pi&space;/6$
19. What about question 20 from paper 1?
20. (Original post by sammygmfc)
Hi,

Is anyone else on here sitting the TMUA (Test for Mathematics Unviersity Admissions). Durham, Lancaster and LSE will all be using it for 2017 entry.

I quite like the style of the test, especially the second paper. How is everyone preparing for it? Anything besides working on the Specimen Paper?
I haven't done no where near half as much as I have wanted to. Didn't know TSR peeps would be doing this since it's always MAT hype.
I'm using it for Durham but I prefer Lancaster now.

## Register

Thanks for posting! You just need to create an account in order to submit the post
1. this can't be left blank
2. this can't be left blank
3. this can't be left blank

6 characters or longer with both numbers and letters is safer

4. this can't be left empty
1. Oops, you need to agree to our Ts&Cs to register

Updated: December 13, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Today on TSR

### Is law a useless degree?

What do you think?

Poll
Useful resources


text:
# Relating Optical Depth and Extinction (τ(λ) and A(λ))

1. Feb 4, 2009

### Mike89

Hey guys sorry my first post is a help request and not an introduction or anything but I'd really appreciate a helping hand here

1. The problem statement, all variables and given/known data

Show that the extinction A(λ) and optical depth τ(λ) are related by the linear relationship A(λ)=1.086*τ(λ)

2. Relevant equations

m(λ)=M(λ) + 5Log(d)-5 + A(λ)
which I'd rearrage to
m(λ)-M(λ)-5Log(d)+5=A(λ)

Here in lies the problem, I have all the equations I can find in my notes and the slides but nothing that relates τ(λ) to anything other than:

exp(-τ) = (I/I0) (sorry wasn't sure how to subscript the 0 in I0)

and then nothing to relate intensities to magnitudes.

3. The attempt at a solution

I thought maybe I could use 2 stars where I new the apparent and absolute magnitudes ( the sun and vega, etc) and the distance obviously and then calculate how τ(λ) and A(λ) are related and show the 1.086 multiplier in both but I can't work out how to relate A(λ) to anything involving intensity.

I hope you guys can help me out here since I'm stumped :) thanks for anything you can

2. Feb 4, 2009

### AstroRoyale

Start with the definition of a difference in apparent magnitudes. . .

$$m_1 - m_2 = 2.5log(I_1/I_2)$$

extinction, A is defined as $$A = m^{'} - m$$

Now, how are I_1, I_2, and tau related. . .

3. Feb 4, 2009

### torehan

Souldn't it be $$m_1 - m_2 = 2.5log(I_2/I_1)$$ ?


text:
# Hands-on¶

## Spatial weights¶

In this session we will be learning the ins and outs of one of the key pieces in spatial analysis: spatial weights matrices. These are structured sets of numbers that formalize geographical relationships between the observations in a dataset. Essentially, a spatial weights matrix of a given geography is a positive definite matrix of dimensions $$N$$ by $$N$$, where $$N$$ is the total number of observations:

$\begin{split} W = \left(\begin{array}{cccc} 0 & w_{12} & \dots & w_{1N} \\ w_{21} & \ddots & w_{ij} & \vdots \\ \vdots & w_{ji} & 0 & \vdots \\ w_{N1} & \dots & \dots & 0 \end{array} \right) \end{split}$

where each cell $$w_{ij}$$ contains a value that represents the degree of spatial contact or interaction between observations $$i$$ and $$j$$. A fundamental concept in this context is that of neighbor and neighborhood. By convention, elements in the diagonal ($$w_{ii}$$) are set to zero. A neighbor of a given observation $$i$$ is another observation with which $$i$$ has some degree of connection. In terms of $$W$$, $$i$$ and $$j$$ are thus neighbors if $$w_{ij} > 0$$. Following this logic, the neighborhood of $$i$$ will be the set of observations in the system with which it has certain connection, or those observations with a weight greater than zero.

There are several ways to create such matrices, and many more to transform them so they contain an accurate representation that aligns with the way we understand spatial interactions between the elements of a system. In this session, we will introduce the most commonly used ones and will show how to compute them with PySAL.

%matplotlib inline

import seaborn as sns
import pandas as pd
from pysal.lib import weights
from libpysal.io import open as psopen
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as plt

## Data¶

For this tutorial, we will use a dataset of Liverpool small areas (or Lower layer Super Output Areas, LSOAs) for Liverpool. The table is available as part of this course, so can be accessed remotely through the web. If you want to see how the table was created, a notebook is available here.

To make things easier, we will read data from a file posted online so, for now, you do not need to download any dataset:

# Read the file in
"https://darribas.org/gds_course/content/data/liv_lsoas.gpkg"
)
# Index table on the LSOA ID
db = db.set_index("LSOA11CD", drop=False)
# Display summary
db.info()

<class 'geopandas.geodataframe.GeoDataFrame'>
Index: 298 entries, E01006512 to E01033768
Data columns (total 3 columns):
#   Column    Non-Null Count  Dtype
---  ------    --------------  -----
0   LSOA11CD  298 non-null    object
1   MSOA11CD  298 non-null    object
2   geometry  298 non-null    geometry
dtypes: geometry(1), object(2)
memory usage: 9.3+ KB

/opt/conda/lib/python3.8/site-packages/geopandas/geodataframe.py:577: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance.
for feature in features_lst:

Alternative

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

3. Replace the code in the cell above by:

db = gpd.read_file("liv_lsoas.gpkg")

## Building spatial weights in PySAL¶

### Contiguity¶

Contiguity weights matrices define spatial connections through the existence of common boundaries. This makes it directly suitable to use with polygons: if two polygons share boundaries to some degree, they will be labeled as neighbors under these kinds of weights. Exactly how much they need to share is what differenciates the two approaches we will learn: queen and rook.

• Queen

Under the queen criteria, two observations only need to share a vortex (a single point) of their boundaries to be considered neighbors. Constructing a weights matrix under these principles can be done by running:

w_queen = weights.Queen.from_dataframe(db, idVariable="LSOA11CD")
w_queen

<libpysal.weights.contiguity.Queen at 0x7fba3879f910>

The command above creates an object w_queen of the class W. This is the format in which spatial weights matrices are stored in PySAL. By default, the weights builder (Queen.from_dataframe) will use the index of the table, which is useful so we can keep everything in line easily.

A W object can be queried to find out about the contiguity relations it contains. For example, if we would like to know who is a neighbor of observation E01006690:

w_queen['E01006690']

{'E01006697': 1.0,
'E01006692': 1.0,
'E01033763': 1.0,
'E01006759': 1.0,
'E01006695': 1.0,
'E01006720': 1.0,
'E01006691': 1.0}

This returns a Python dictionary that contains the ID codes of each neighbor as keys, and the weights they are assigned as values. Since we are looking at a raw queen contiguity matrix, every neighbor gets a weight of one. If we want to access the weight of a specific neighbor, E01006691 for example, we can do recursive querying:

w_queen['E01006690']['E01006691']

1.0

W objects also have a direct way to provide a list of all the neighbors or their weights for a given observation. This is thanks to the neighbors and weights attributes:

w_queen.neighbors['E01006690']

['E01006697',
'E01006692',
'E01033763',
'E01006759',
'E01006695',
'E01006720',
'E01006691']

w_queen.weights['E01006690']

[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

Once created, W objects can provide much information about the matrix, beyond the basic attributes one would expect. We have direct access to the number of neighbors each observation has via the attribute cardinalities. For example, to find out how many neighbors observation E01006524 has:

w_queen.cardinalities['E01006524']

6

Since cardinalities is a dictionary, it is direct to convert it into a Series object:

queen_card = pd.Series(w_queen.cardinalities)

E01006512    6
E01006513    9
E01006514    5
E01006515    8
E01006518    5
dtype: int64

This allows, for example, to access quick plotting, which comes in very handy to get an overview of the size of neighborhoods in general:

sns.distplot(queen_card, bins=10)

/opt/conda/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: distplot is a deprecated function and will be removed in a future version. Please adapt your code to use either displot (a figure-level function with similar flexibility) or histplot (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)

<AxesSubplot:ylabel='Density'>

The figure above shows how most observations have around five neighbors, but there is some variation around it. The distribution also seems to follow a symmetric form, where deviations from the average occur both in higher and lower values almost evenly.

Some additional information about the spatial relationships contained in the matrix are also easily available from a W object. Let us tour over some of them:

# Number of observations
w_queen.n

298

# Average number of neighbors
w_queen.mean_neighbors

5.617449664429531

# Min number of neighbors
w_queen.min_neighbors

1

# Max number of neighbors
w_queen.max_neighbors

11

# Islands (observations disconnected)
w_queen.islands

[]

# Order of IDs (first five only in this case)
w_queen.id_order[:5]

['E01006512', 'E01006513', 'E01006514', 'E01006515', 'E01006518']

Spatial weight matrices can be explored visually in other ways. For example, we can pick an observation and visualize it in the context of its neighborhood. The following plot does exactly that by zooming into the surroundings of LSOA E01006690 and displaying its polygon as well as those of its neighbors:

# Setup figure
f, ax = plt.subplots(1, figsize=(6, 6))
# Plot base layer of polygons
db.plot(ax=ax, facecolor='k', linewidth=0.1)
# Select focal polygon
# NOTE we pass both the area code and the column name
#      (geometry) within brackets!!!
focus = db.loc[['E01006690'], ['geometry']]
# Plot focal polygon
focus.plot(facecolor='red', alpha=1, linewidth=0, ax=ax)
# Plot neighbors
neis = db.loc[w_queen['E01006690'], :]
neis.plot(ax=ax, facecolor='lime', linewidth=0)
# Title
f.suptitle("Queen neighbors of E01006690")
# Style and display on screen
ax.set_ylim(388000, 393500)
ax.set_xlim(336000, 339500)
plt.show()

Note how the figure is built gradually, from the base map (L. 4-5), to the focal point (L. 9), to its neighborhood (L. 11-13). Once the entire figure is plotted, we zoom into the area of interest (L. 19-20).

• Rook

Rook contiguity is similar to and, in many ways, superseded by queen contiguity. However, since it sometimes comes up in the literature, it is useful to know about it. The main idea is the same: two observations are neighbors if they share some of their boundary lines. However, in the rook case, it is not enough with sharing only one point, it needs to be at least a segment of their boundary. In most applied cases, these differences usually boil down to how the geocoding was done, but in some cases, such as when we use raster data or grids, this approach can differ more substantively and it thus makes more sense.

From a technical point of view, constructing a rook matrix is very similar:

w_rook = weights.Rook.from_dataframe(db)
w_rook

<libpysal.weights.contiguity.Rook at 0x7fba38676df0>

The output is of the same type as before, a W object that can be queried and used in very much the same way as any other one.

### Distance¶

Distance based matrices assign the weight to each pair of observations as a function of how far from each other they are. How this is translated into an actual weight varies across types and variants, but they all share that the ultimate reason why two observations are assigned some weight is due to the distance between them.

• K-Nearest Neighbors

One approach to define weights is to take the distances between a given observation and the rest of the set, rank them, and consider as neighbors the $$k$$ closest ones. That is exactly what the $$k$$-nearest neighbors (KNN) criterium does.

To calculate KNN weights, we can use a similar function as before and derive them from a shapefile:

knn5 = weights.KNN.from_dataframe(db, k=5)
knn5

<libpysal.weights.distance.KNN at 0x7fba34e3dfd0>

Note how we need to specify the number of nearest neighbors we want to consider with the argument k. Since it is a polygon shapefile that we are passing, the function will automatically compute the centroids to derive distances between observations. Alternatively, we can provide the points in the form of an array, skipping this way the dependency of a file on disk:

# Extract centroids
cents = db.centroid
# Extract coordinates into an array
pts = pd.DataFrame(
{"X": cents.x, "Y": cents.y}
).values
# Compute KNN weights
knn5_from_pts = weights.KNN.from_array(pts, k=5)
knn5_from_pts

<libpysal.weights.distance.KNN at 0x7fba386707f0>

• Distance band

Another approach to build distance-based spatial weights matrices is to draw a circle of certain radious and consider neighbor every observation that falls within the circle. The technique has two main variations: binary and continuous. In the former one, every neighbor is given a weight of one, while in the second one, the weights can be further tweaked by the distance to the observation of interest.

To compute binary distance matrices in PySAL, we can use the following command:

w_dist1kmB = weights.DistanceBand.from_dataframe(db, 1000)

/opt/conda/lib/python3.8/site-packages/libpysal/weights/weights.py:172: UserWarning: The weights matrix is not fully connected:
There are 2 disconnected components.
warnings.warn(message)

This creates a binary matrix that considers neighbors of an observation every polygon whose centroid is closer than 1,000 metres (1Km) of the centroid of such observation. Check, for example, the neighborhood of polygon E01006690:

w_dist1kmB['E01006690']

{'E01006691': 1.0,
'E01006692': 1.0,
'E01006695': 1.0,
'E01006697': 1.0,
'E01006720': 1.0,
'E01006725': 1.0,
'E01006726': 1.0,
'E01033763': 1.0}

Note that the units in which you specify the distance directly depend on the CRS in which the spatial data are projected, and this has nothing to do with the weights building but it can affect it significantly. Recall how you can check the CRS of a GeoDataFrame:

db.crs

<Projected CRS: PROJCS["Transverse_Mercator",GEOGCS["GCS_OSGB 1936 ...>
Name: Transverse_Mercator
Axis Info [cartesian]:
- [east]: Easting (metre)
- [north]: Northing (metre)
Area of Use:
- undefined
Coordinate Operation:
- name: unnamed
- method: Transverse Mercator
Datum: OSGB 1936
- Ellipsoid: Airy 1830
- Prime Meridian: Greenwich

In this case, you can see the unit is expressed in metres (m), hence we set the threshold to 1,000 for a circle of 1km of radious.

An extension of the weights above is to introduce further detail by assigning different weights to different neighbors within the radious circle based on how far they are from the observation of interest. For example, we could think of assigning the inverse of the distance between observations $$i$$ and $$j$$ as $$w_{ij}$$. This can be computed with the following command:

w_dist1kmC = weights.DistanceBand.from_dataframe(db, 1000, binary=False)

/opt/conda/lib/python3.8/site-packages/scipy/sparse/data.py:117: RuntimeWarning: divide by zero encountered in reciprocal
return self._with_data(data ** n)

In w_dist1kmC, every observation within the 1km circle is assigned a weight equal to the inverse distance between the two:

$w_{ij} = \dfrac{1}{d_{ij}}$

This way, the further apart $$i$$ and $$j$$ are from each other, the smaller the weight $$w_{ij}$$ will be.

Contrast the binary neighborhood with the continuous one for E01006690:

w_dist1kmC['E01006690']

{'E01006691': 0.001320115452290246,
'E01006692': 0.0016898106255168294,
'E01006695': 0.001120923796462639,
'E01006697': 0.001403469553911711,
'E01006720': 0.0013390451319917913,
'E01006725': 0.001009044334260805,
'E01006726': 0.0010528395831202145,
'E01033763': 0.0012983249272553688}

Following this logic of more detailed weights through distance, there is a temptation to take it further and consider everyone else in the dataset as a neighbor whose weight will then get modulated by the distance effect shown above. However, although conceptually correct, this approach is not always the most computationally or practical one. Because of the nature of spatial weights matrices, particularly because of the fact their size is $$N$$ by $$N$$, they can grow substantially large. A way to cope with this problem is by making sure they remain fairly sparse (with many zeros). Sparsity is typically ensured in the case of contiguity or KNN by construction but, with inverse distance, it needs to be imposed as, otherwise, the matrix could be potentially entirely dense (no zero values other than the diagonal). In practical terms, what is usually done is to impose a distance threshold beyond which no weight is assigned and interaction is assumed to be non-existent. Beyond being computationally feasible and scalable, results from this approach usually do not differ much from a fully “dense” one as the additional information that is included from further observations is almost ignored due to the small weight they receive. In this context, a commonly used threshold, although not always best, is that which makes every observation to have at least one neighbor.

Such a threshold can be calculated as follows:

min_thr = weights.min_threshold_distance(pts)
min_thr

939.7373992113434

Which can then be used to calculate an inverse distance weights matrix:

w_min_dist = weights.DistanceBand.from_dataframe(db, min_thr, binary=False)

### Block weights¶

Block weights connect every observation in a dataset that belongs to the same category in a list provided ex-ante. Usually, this list will have some relation to geography an the location of the observations but, technically speaking, all one needs to create block weights is a list of memberships. In this class of weights, neighboring observations, those in the same group, are assigned a weight of one, and the rest receive a weight of zero.

In this example, we will build a spatial weights matrix that connects every LSOA with all the other ones in the same MSOA. See how the MSOA code is expressed for every LSOA:

db.head()

LSOA11CD MSOA11CD geometry
LSOA11CD
E01006512 E01006512 E02001377 POLYGON ((336103.358 389628.580, 336103.416 38...
E01006513 E01006513 E02006932 POLYGON ((335173.781 389691.538, 335169.798 38...
E01006514 E01006514 E02001383 POLYGON ((335495.676 389697.267, 335495.444 38...
E01006515 E01006515 E02001383 POLYGON ((334953.001 389029.000, 334951.000 38...
E01006518 E01006518 E02001390 POLYGON ((335354.015 388601.947, 335354.000 38...

To build a block spatial weights matrix that connects as neighbors all the LSOAs in the same MSOA, we only require the mapping of codes. Using PySAL, this is a one-line task:

w_block = weights.block_weights(db['MSOA11CD'])

/opt/conda/lib/python3.8/site-packages/libpysal/weights/weights.py:172: UserWarning: The weights matrix is not fully connected:
There are 61 disconnected components.
warnings.warn(message)

In this case, PySAL does not allow to pass the argument idVariable as above. As a result, observations are named after the order the occupy in the list:

w_block[0]

{218: 1.0, 219: 1.0, 220: 1.0, 292: 1.0}

The first element is neighbor of observations 218, 129, 220, and 292, all of them with an assigned weight of 1. However, it is possible to correct this by using the additional method remap_ids:

w_block.remap_ids(db.index)

Now if you try w_bloc[0], it will return an error. But if you query for the neighbors of an observation by its LSOA id, it will work:

w_block['E01006512']

{'E01006747': 1.0, 'E01006748': 1.0, 'E01006751': 1.0, 'E01033763': 1.0}

## Standardizing W matrices¶

In the context of many spatial analysis techniques, a spatial weights matrix with raw values (e.g. ones and zeros for the binary case) is not always the best suiting one for analysis and some sort of transformation is required. This implies modifying each weight so they conform to certain rules. PySAL has transformations baked right into the W object, so it is possible to check the state of an object as well as to modify it.

Consider the original queen weights, for observation E01006690:

w_queen['E01006690']

{'E01006697': 1.0,
'E01006692': 1.0,
'E01033763': 1.0,
'E01006759': 1.0,
'E01006695': 1.0,
'E01006720': 1.0,
'E01006691': 1.0}

Since it is contiguity, every neighbor gets one, the rest zero weight. We can check if the object w_queen has been transformed or not by calling the argument transform:

w_queen.transform

'O'

where O stands for “original”, so no transformations have been applied yet. If we want to apply a row-based transformation, so every row of the matrix sums up to one, we modify the transform attribute as follows:

w_queen.transform = 'R'

Now we can check the weights of the same observation as above and find they have been modified:

w_queen['E01006690']

{'E01006697': 0.14285714285714285,
'E01006692': 0.14285714285714285,
'E01033763': 0.14285714285714285,
'E01006759': 0.14285714285714285,
'E01006695': 0.14285714285714285,
'E01006720': 0.14285714285714285,
'E01006691': 0.14285714285714285}

Save for precission issues, the sum of weights for all the neighbors is one:

pd.Series(w_queen['E01006690']).sum()

0.9999999999999998

Returning the object back to its original state involves assigning transform back to original:

w_queen.transform = 'O'

w_queen['E01006690']

{'E01006697': 1.0,
'E01006692': 1.0,
'E01033763': 1.0,
'E01006759': 1.0,
'E01006695': 1.0,
'E01006720': 1.0,
'E01006691': 1.0}

PySAL supports the following transformations:

• O: original, returning the object to the initial state.

• B: binary, with every neighbor having assigned a weight of one.

• R: row, with all the neighbors of a given observation adding up to one.

• V: variance stabilizing, with the sum of all the weights being constrained to the number of observations.

## Reading and Writing spatial weights in PySAL¶

Sometimes, if a dataset is very detailed or large, it can be costly to build the spatial weights matrix of a given geography and, despite the optimizations in the PySAL code, the computation time can quickly grow out of hand. In these contexts, it is useful to not have to re-build a matrix from scratch every time we need to re-run the analysis. A useful solution in this case is to build the matrix once, and save it to a file where it can be reloaded at a later stage if needed.

PySAL has a common way to write any kind of W object into a file using the command open. The only element we need to decide for ourselves beforehand is the format of the file. Although there are several formats in which spatial weight matrices can be stored, we will focused on the two most commonly used ones:

• .gal files for contiguity weights

Contiguity spatial weights can be saved into a .gal file with the following commands:

# Open file to write into
fo = psopen('imd_queen.gal', 'w')
# Write the matrix into the file
fo.write(w_queen)
# Close the file
fo.close()

The process is composed by the following three steps:

1. Open a target file for writing the matrix, hence the w argument. In this case, if a file imd_queen.gal already exists, it will be overwritten, so be careful.

2. Write the W object into the file.

3. Close the file. This is important as some additional information is written into the file at this stage, so failing to close the file might have unintended consequences.

Once we have the file written, it is possible to read it back into memory with the following command:

w_queen2 = psopen('imd_queen.gal', 'r').read()
w_queen2

<libpysal.weights.weights.W at 0x7fba351d76a0>

Note how we now use r instead of w because we are reading the file, and also notice how we open the file and, in the same line, we call read() directly.

• .gwt files for distance-based weights.

A very similar process to the one above can be used to read and write distance based weights. The only difference is specifying the right file format, .gwt in this case. So, if we want to write w_dist1km into a file, we will run:

# Open file
fo = psopen('imd_dist1km.gwt', 'w')
# Write matrix into the file
fo.write(w_dist1kmC)
# Close file
fo.close()

And if we want to read the file back in, all we need to do is:

w_dist1km2 = psopen('imd_dist1km.gwt', 'r').read()

/opt/conda/lib/python3.8/site-packages/libpysal/io/iohandlers/gwt.py:204: RuntimeWarning: DBF relating to GWT was not found, proceeding with unordered string IDs.
warn(msg, RuntimeWarning)
/opt/conda/lib/python3.8/site-packages/libpysal/weights/weights.py:172: UserWarning: The weights matrix is not fully connected:
There are 2 disconnected components.
warnings.warn(message)

Note how, in this case, you will probably receive a warning alerting you that there was not a DBF relating to the file. This is because, by default, PySAL takes the order of the observations in a .gwt from a shapefile. If this is not provided, PySAL cannot entirely determine all the elements and hence the resulting W might not be complete (islands, for example, can be missing). To fully complete the reading of the file, we can remap the ids as we have seen above:

w_dist1km2.remap_ids(db.index)

## Spatial Lag¶

One of the most direct applications of spatial weight matrices is the so-called spatial lag. The spatial lag of a given variable is the product of a spatial weight matrix and the variable itself:

$Y_{sl} = W Y$

where $$Y$$ is a Nx1 vector with the values of the variable. Recall that the product of a matrix and a vector equals the sum of a row by column element multiplication for the resulting value of a given row. In terms of the spatial lag:

$y_{sl-i} = \displaystyle \sum_j w_{ij} y_j$

If we are using row-standardized weights, $$w_{ij}$$ becomes a proportion between zero and one, and $$y_{sl-i}$$ can be seen as the average value of $$Y$$ in the neighborhood of $$i$$.

For this illustration, we will use the area of each polygon as the variable of interest. And to make things a bit nicer later on, we will keep the log of the area instead of the raw measurement. Hence, let’s create a column for it:

db["area"] = np.log(db.area)

The spatial lag is a key element of many spatial analysis techniques, as we will see later on and, as such, it is fully supported in PySAL. To compute the spatial lag of a given variable, area for example:

# Row-standardize the queen matrix
w_queen.transform = 'R'
# Compute spatial lag of area
w_queen_score = weights.lag_spatial(w_queen, db["area"])
# Print the first five elements
w_queen_score[:5]

array([12.40660189, 12.54225296, 12.28284814, 12.61675295, 12.55042815])

Line 4 contains the actual computation, which is highly optimized in PySAL. Note that, despite passing in a pd.Series object, the output is a numpy array. This however, can be added directly to the table db:

db['w_area'] = w_queen_score

## Moran Plot¶

The Moran Plot is a graphical way to start exploring the concept of spatial autocorrelation, and it is a good application of spatial weight matrices and the spatial lag. In essence, it is a standard scatter plot in which a given variable (area, for example) is plotted against its own spatial lag. Usually, a fitted line is added to include more information:

# Setup the figure and axis
f, ax = plt.subplots(1, figsize=(9, 9))
# Plot values
sns.regplot(x="area", y="w_area", data=db, ci=None)
# Display
plt.show()

In order to easily compare different scatter plots and spot outlier observations, it is common practice to standardize the values of the variable before computing its spatial lag and plotting it. This can be accomplished by substracting the average value and dividing the result by the standard deviation:

$z_i = \dfrac{y - \bar{y}}{\sigma_y}$

where $$z_i$$ is the standardized version of $$y_i$$, $$\bar{y}$$ is the average of the variable, and $$\sigma$$ its standard deviation.

Creating a standardized Moran Plot implies that average values are centered in the plot (as they are zero when standardized) and dispersion is expressed in standard deviations, with the rule of thumb of values greater or smaller than two standard deviations being outliers. A standardized Moran Plot also partitions the space into four quadrants that represent different situations:

1. High-High (HH): values above average surrounded by values above average.

2. Low-Low (LL): values below average surrounded by values below average.

3. High-Low (HL): values above average surrounded by values below average.

4. Low-High (LH): values below average surrounded by values above average.

These will be further explored once spatial autocorrelation has been properly introduced in subsequent blocks.

# Standardize the area
std_db = (db['area'] - db['area'].mean()) / db['area'].std()
# Compute the spatial lag of the standardized version and save is as a
# Series indexed as the original variable
std_w_db = pd.Series(
weights.lag_spatial(w_queen, std_db), index=std_db.index
)
# Setup the figure and axis
f, ax = plt.subplots(1, figsize=(9, 9))
# Plot values
sns.regplot(x=std_db, y=std_w_db, ci=None)
# Add vertical and horizontal lines
plt.axvline(0, c='k', alpha=0.5)
plt.axhline(0, c='k', alpha=0.5)
# Display
plt.show()


text:
# Extension of Ordinary Inequalities of Polynomial to Polar Derivative

Let p(z) be a polynomial of degree n and for a complex number α, let Dαp(z) = np(z)+(α-z)p′(z)
denote the polar derivative of the polynomial p(z) with respect to α.It is of interest to extend
ordinary inequality of polynomial into polar derivatives as the later versions have mathematical
aspects.

Author(s) Details

Dr. Barchand Chanam
Department of Mathematics, National Institute of Technology, Manipur, Imphal – 795004, India.


text:
## Tangents to a Parabola From Latus Rectum Meet at Right Angles

The latus rectum of the parabola
$y^2=2px$
is the vertical line passing through the focal point
$( \frac{p}{2}, 0)$
of the parabola, perpendicular to the
$x$
axis.
The latus rectum meets the parabola at the point
$( \frac{p}{2}, \sqrt{2p \frac{p}{2}} )=( \frac{p}{2}, \pm p)$
.
The gradient function of the parabola is
$2y \frac{dy}{dx} =2p \rightarrow \frac{dy}{dx}=\frac{p}{y}$
.
The tangents are given by
$y- \pm p= \frac{p}{ \pm p}(x- \frac{p}{2})$
which can be rearranged to give
$y= x+ \frac{p}{2}), \; y= - x - \frac{p}{2}$
.
The tangents meet at
$(- \frac{p}{2} , 0)$
at have gradients 1 and -1 respectively, so are perpendicular.


text:
Weird Expression

Algebra Level 5

$\large a^2+b^2+\dfrac{1}{a^2}+\dfrac{b}{a}$

Given $$a$$ and $$b$$ are non-zero real numbers, what is the minimum value of the above expression?