text:
# How Much Money Should Machines Earn?

Every inch of sky’s got a star
Every inch of skin’s got a scar

I think that a very good way to start with R is doing an interactive visualization of some open data because you will train many important skills of a data scientist: loading, cleaning, transforming and combinig data and performing a suitable visualization. Doing it interactive will give you an idea of the power of R as well, because you will also realise that you are able to handle indirectly other programing languages such as JavaScript.

That’s precisely what I’ve done today. I combined two interesting datasets:

• The probability of computerisation of 702 detailed occupations, obtained by Carl Benedikt Frey and Michael A. Osborne from the University of Oxford, using a Gaussian process classifier and published in this paper in 2013.
• Statistics of jobs from (employments, median annual wages and typical education needed for entry) from the US Bureau of Labor, available here.

Apart from using dplyr to manipulate data and highcharter to do the visualization, I used tabulizer package to extract the table of probabilities of computerisation from the pdf: it makes this task extremely easy.

This is the resulting plot:

If you want to examine it in depth, here you have a full size version.

These are some of my insights (its corresponding figures are obtained directly from the dataset):

• There is a moderate negative correlation between wages and probability of computerisation.
• Around 45% of US employments are threatened by machines (have a computerisation probability higher than 80%): half of them do not require formal education to entry.
• In fact, 78% of jobs which do not require formal education to entry are threatened by machines: 0% which require a master’s degree are.
• Teachers are absolutely irreplaceable (0% are threatened by machines) but they earn a 2.2% less then the average wage (unfortunately, I’m afraid this phenomenon occurs in many other countries as well).
• Don’t study for librarian or archivist: it seems a bad way to invest your time
• Mathematicians will survive to machines

The code of this experiment is available here.

# Coloring Sudokus

Someday you will find me
caught beneath the landslide
(Champagne Supernova, Oasis)

I recently read a book called Snowflake Seashell Star: Colouring Adventures in Numberland by Alex Bellos and Edmund Harris which is full of mathematical patterns to be coloured. All images are truly appealing and cause attraction to anyone who look at them, independently of their age, gender, education or political orientation. This book demonstrates how maths are an astonishing way to reach beauty.

One of my favourite patterns are tridokus, a sophisticated colored version of sudokus. Coloring a sudoku is simple: once that is solved it is enough to assign a color to each number (from 1 to 9).  If you superimpose three colored sudokus with no cells at the same position sharing the same color, and using again nine colors, the resulting image is a tridoku:

There is something attractive in a tridoku due to the balance of colors but also they seem a quite messy: they are a charmingly unbalanced.  I wrote a script to generalize the concept to n-dokus. The idea is the same: superimpose n sudokus without cells sharing color and position (I call them disjoint sudokus) using just nine different colors. I did’n’t prove it, but I think the maximum amount of sudokus can be overimposed with these constrains is 9. This is a complete series from 1-doku to 9-doku (click on any image to enlarge):

I am a big fan of colourlovers package. These tridokus are colored with some of my favourite palettes from there:

Just two technical things to highlight:

• There is a package called sudoku that generates sudokus (of course!). I use it to obtain the first solved sudoku which forms the base.
• Subsequent sudokus are obtained from this one doing two operations: interchanging groups of columns first (there are three groups: columns 1 to 3, 4 to 6 and 7 to 9) and interchanging columns within each group then.

You can find the code here: do you own colored n-dokus!

# The Pleasing Ratio Project

Music is a world within itself, with a language we all understand (Sir Duke, Stevie Wonder)

This serious man on the left is Gustav Theodor Fechner, a German philosopher, physicist and experimental psychologist who lived between 1801 and 1887. To be honest, I don’t know almost anything of his life or work exepct one thing: he did in the 1860s a thought-provoking experiment. It seems me interesting for two important reasons: he called into question something widely established and obtained experimental data by himself.

Fechner’s experiment was simple: he presented just ten rectangles to 82 students. Then he asked each of them to choose the most pleasing one and obtained revealing discoveries I will not explain here since would cause bias in my experiment. You can find more information about the original experiment here.

I have done a project inspired in Fechner’s one that I called The Pleasing Ratio Project. Once you enter in the App, you will see two rectangles. Both of them have the same area. They only vary in their length-to-width ratios. Then you will be asked to select the one that seems you most pleasing. You can do it as many times as you want (all responses are completely anonymous). Every game will confront a couple of ratios, which can vary from 1 to 3,5. In the Results section you will find the  percentage of winning games for each ratio. The one with the highest percentage will be named officially as The Most Pleasing Ratio of the World in the future by myself.

Although my experiment is absolutely inspired in Fechner’s one, there is a important difference: I can explore a bigger set of ratios doing an A/B test. This makes this one a bit richer.

The experiment has also some interesting technical features:

• the use of shinydashboard package to arrange the App
• the use of shinyjs package to add javaScript to refresh the page when use choose to play again
• to save votes in a text file
• to read it to visualize results

Will I obtain the same results as Fechner? This is a living project whose results will change over the time so you can check it regularly.

The code of the project is available in GitHub. Thanks a lot for your collaboration!

# Pencil Scribbles

Con las bombas que tiran los fanfarrones, se hacen las gaditanas tirabuzones (Palma y corona, Carmen Linares)

This time I draw Franky again using an algorithm to solve the Travelling Salesman Problem as I did in my last post. On this occasion, instead of doing just one single line drawing, I overlap many of them (250 concretely), each of them sampling 400 points on the original image (in my previous post I sampled 8.000 points). Last difference is that I don’t convert the image to pure black and white with threshold function: now I use the gray scale number of each pixel to weight the sample.

Once again, I use ggplot2 package, and its magical geom_path, to generate the image. The pencil effect is obtained giving a very high transparency to the lines. This is the result:

I love when someone else experiment with my experiments as Mara Averick did:

You can do it as well with this one, since you will find the code here. Please, let me know your own creations if you do. You can find me on twitter or by email.

P.S.: Although it may seems otherwise, I’m not obsessed with Frankenstein 🙂

# The Travelling Salesman Portrait

I have noticed even people who claim everything is predestined, and that we can do nothing to change it, look before they cross the road (Stephen Hawking)

Imagine a salesman and a set of cities. The salesman has to visit each one of the cities starting from a certain one and returning to the same city. The challenge is finding the route which minimizes the total length of the trip. This is the Travelling Salesman Problem (TSP): one of the most profoundly studied questions in computational mathematics. Since you can find a huge amount of articles about the TSP in the Internet, I will not give more details about it here.

In this experiment I apply an heuristic algorithm to solve the TSP to draw a portrait. The idea is pretty simple:

• Convert it to black and white
• Choose a sample of black points
• Solve the TSP to calculate a route among the points
• Plot the route

The result is a single line drawing of the image that you loaded. To solve the TSP I used the arbitrary insertion heuristic algorithm (Rosenkrantz et al. 1977), which is quite efficient.

To illustrate the idea, I have used again this image of Frankenstein (I used it before in this other experiment). This is the result:

You can find the code here.

# Mandalas Colored

Apriétame bien la mano, que un lucero se me escapa entre los dedos (Coda Flamenca, Extremoduro)

I have the privilege of being teacher at ESTALMAT, a project run by Spanish Royal Academy of Sciences that tries to detect, guide and stimulate in a continuous way, along two courses, the exceptional mathematical talent of students of 12-13 years old. Some weeks ago I gave a class there about the importance of programming. I tried to convince them that learning R or Python is a good investment that always pays off; It will make them enjoy more of mathematics as well as to see things with their own eyes. The main part of my class was a workshop about Voronoi tesselations in R. We started drawing points on a circle and we finished drawing mandalas like these ones. You can find the details of the workshop here (in Spanish). It was a wonderful experience to see the faces of the students while generating their own mandalas.

In that case all mandalas were empty, ready to be printed and coloured as my 7 years old daughter does. In this experiment I colour them. These are the changes I have done to my  previous code:

• Remove external segments which intersects the boundary of the enclosing
rectangle
• Convert the tesselation into a list of polygons with tile.list function
• Use colourlovers package to fill the polygons with beautiful colour palettes

This is an example of the result:

Changing three simple parameters (iter, points and radius) you can obtain completely different images (clicking on any image you can see its full size version):

You can find details of these parameters in my previous post. I cannot resist to place more examples:

You can find the code here. Enjoy.

# Mandalas

Mathematics is a place where you can do things which you can’t do in the real world (Marcus Du Sautoy, mathematician)

From time to time I have a look to some of my previous posts: it’s like seeing them through another’s eyes. One of my first posts was this one, where I draw fractals using the Multiple Reduction Copy Machine (MRCM) algorithm. That time I was not clever enough to write an efficient code able generate deep fractals. Now I am pretty sure I could do it using ggplot and I started to do it when I come across with the idea of mixing this kind of fractal patterns with Voronoi tessellations, that I have explored in some of my previous posts, like this one. Mixing both techniques, the mandalas appeared.

I will not explain in depth the mathematics behind this patterns. I will just give a brief explanation:

• I start obtaining n equidistant points in a unit circle centered in (0,0)
• I repeat the process with all these points, obtaining again n points around each of them; the radius is scaled by a factor
• I discard the previous (parent) n points

I repeat these steps iteratively. If I start with n points and iterate k times, at the end I obtain nk points. After that, I calculate the Voronoi tesselation of them, which I represent with ggplot.

This is an example:

Some others:

You can find the code here. Enjoy it.

# Fatal Journeys: Visualizing the Horror

In war, truth is the first casualty (Aeschylus)

I am not a pessimistic person. On the contrary, I always try to look at the bright side of life. I also believe that living conditions are now better than years ago as these plots show. But reducing the complexity of our world to just six graphs is riskily simplistic. Our world is quite far of being a fair place and one example is the immigration drama.

Last year there were 934 incidents around the world involving people looking for a better life where more than 5.300 people lost their life o gone missing, 60% of them in Mediterranean. Around 8 out of 100 were children.

The missing migrant project tracks deaths of migrants, including refugees and asylum-seekers, who have gone missing along mixed migration routes worldwide. You can find a huge amount of figures, plots and information about this scourge in their website. You can also download there a historical dataset with information of all these fatal journeys, including location, number of dead or missing people and information source from 2015 until today.

I this experiment I read the dataset and do some plots using highcharter; you can find a link to the R code at the end of the post.

This is the evolution of the amount of deaths or missing migrants in the process of migration towards an international destination from January 2015 to December 2017:

The Mediterranean is the zone with the most incidents. To see it more clearly, this plot compares Mediterranean with the rest of the world, grouping previous zones:

Is there any pattern in the time series of Mediterranean incidents? To see it, I have done a LOESS decomposition of the time series:

Good news: trend is decreasing for last 12 months. Regarding seasonal component, incidents increase in April and May. Why? I don’t know.

This is a map of the location of all incidents in 2017. Clicking on markers you will find information about each incident:

Every of us should try to make our world a better place. I don’t really know how to do it but I will try to make some experiments during this year to show that we have tons of work in front of us. Meanwhile, I hope this experiment is useful to give visibility to this humanitarian disaster. If someone wants to use the code, the complete project is available in GitHub.

# Tiny Art in Less Than 280 Characters

Now that Twitter allows 280 characters, the code of some drawings I have made can fit in a tweet. In this post I have compiled a few of them.

The first one is a cardioid inspired in string art (more info here):

library(ggplot2)
n=300
t1=1:n
t0=seq(3,2*n+1,2)%%n
t2=t0+(t0==0)*n
df=data.frame(x=cos((t1-1)*2*pi/n),
y=sin((t1-1)*2*pi/n),
x2=cos((t2-1)*2*pi/n),
y2=sin((t2-1)*2*pi/n))
ggplot(df,aes(x,y,xend=x2,yend=y2)) +
geom_segment(alpha=.1)+theme_void()

library(ggplot2)
library(dplyr)
t=seq(from=0, to=100*pi, length.out=500*100)
data.frame(x= t^(1/2)*cos(t), y= t^(1/2)*sin(t))%>%
rbind(-.)%>%ggplot(aes(x, y))+geom_polygon()+theme_void()

library(dplyr)
library(ggplot2)
library(pracma)
seq(-5*pi,5*pi,by=.1)%>%expand.grid(x=., y=.)%>%
ggplot(aes(x=x, y=y, fill=erf(sec(x)-sec(y))))+geom_tile()+
theme_void()+theme(legend.position="none")

A x-y scatter plot of a trigonometric function on R2 (more info here):

library(dplyr)
library(ggplot2)
seq(from=-10, to=10, by = 0.05) %>%
expand.grid(x=., y=.) %>%
ggplot(aes(x=(x+pi*sin(y)), y=(y+pi*sin(x)))) +
geom_point(alpha=.1, shape=20, size=1, color="black")+
theme_void()

library(TurtleGraphics)
turtle_init()
turtle_col("gray25")
turtle_do({
for (i in 1:150) {
turtle_forward(dist=1+0.5*i)
turtle_right(angle=89.5)}
})
turtle_hide()

t=seq(1, 100, by=.001)
plot(exp(-0.006*t)*sin(t*3.019+2.677)+
exp(-0.001*t)*sin(t*2.959+2.719),
exp(-0.009*t)*sin(t*2.964+0.229)+
exp(-0.008*t)*sin(t*2.984+1.284),
type="l", axes=FALSE, xlab="", ylab="")

library(circlize)
chordDiagram(matrix(1, 20, 20), symmetric = TRUE,
col="black", transparency = 0.85, annotationTrack = NULL)

Most of them are made with ggplot2 package. I love R and the sense of wonder of how just one or two lines of code can create beautiful and unexpected patterns.

I recently did this project for DataCamp to show how easy is to do art with R and ggplot. Starting from a extremely simple plot, and following a well guided path, you can end making beautiful images like this one:

Furthermore, you can learn also ggplot2 while you do art.

I have done the project together with Rasmus Bååth, instructor at DataCamp and the perfect mate to work with. He is looking for people to build more projects so if you are interested, here you can find more information. Do not hesitate to ask him for details.

All the best for 2018.

Merry Christmas.

# Drawing 10 Million Points With ggplot: Clifford Attractors

For me, mathematics cultivates a perpetual state of wonder about the nature of mind, the limits of thoughts, and our place in this vast cosmos (Clifford A. Pickover – The Math Book: From Pythagoras to the 57th Dimension, 250 Milestones in the History of Mathematics)

I am a big fan of Clifford Pickover and I find inspiration in his books very often. Thanks to him, I discovered the harmonograph and the Parrondo’s paradox, among many other mathematical treasures. Apart of being a great teacher, he also invented a family of strange attractors wearing his name. Clifford attractors are defined by these equations:

$x_{n+1}\, =\, sin(a\, y_{n})\, +\, c\, cos(a\, x_{n}) \\ y_{n+1}\, =\, sin(b\, x_{n})\, +\, d\, cos(b\, y_{n}) \\$

There are infinite attractors, since a, b, c and d are parameters. Given four values (one for each parameter) and a starting point (x0, y0), the previous equation defines the exact location of the point at step n, which is defined just by its location at n-1; an attractor can be thought as the trajectory described by a particle. This plot shows the evolution of a particle starting at (x0, y0)=(0, 0) with parameters a=-1.24458046630025, b=-1.25191834103316, c=-1.81590817030519 and d=-1.90866735205054 along 10 million of steps:

Changing parameters is really entertaining. Drawings have a sandy appearance:

From a technical point of view, the challenge is creating a data frame with all locations, since it must have 10 milion rows and must be populated sequentially. A very fast way to do it is using Rcpp package. To render the plot I use ggplot, which works quite well. Here you have the code to play with Clifford Attractors if you want:

library(Rcpp)
library(ggplot2)
library(dplyr)

opt = theme(legend.position  = "none",
panel.background = element_rect(fill="white"),
axis.ticks       = element_blank(),
panel.grid       = element_blank(),
axis.title       = element_blank(),
axis.text        = element_blank())

cppFunction('DataFrame createTrajectory(int n, double x0, double y0,
double a, double b, double c, double d) {
// create the columns
NumericVector x(n);
NumericVector y(n);
x[0]=x0;
y[0]=y0;
for(int i = 1; i < n; ++i) {
x[i] = sin(a*y[i-1])+c*cos(a*x[i-1]);
y[i] = sin(b*x[i-1])+d*cos(b*y[i-1]);
}
// return a new data frame
return DataFrame::create(_["x"]= x, _["y"]= y);
}
')

a=-1.24458046630025
b=-1.25191834103316
c=-1.81590817030519
d=-1.90866735205054

df=createTrajectory(10000000, 0, 0, a, b, c, d)

png("Clifford.png", units="px", width=1600, height=1600, res=300)
ggplot(df, aes(x, y)) + geom_point(color="black", shape=46, alpha=.01) + opt
dev.off()

format: plain


text:
Want to ask us a question? Click here
Browse Questions
 Ad
0 votes

# An electron starts to move from point M having a potential $−100\; V$ to point N. As it reaches the point N, its kinetic energy increases by $1.83 \times 10^{–16}\; J.$ Electric potential at point N is equal to

Can you answer this question?

## 1 Answer

0 votes
(B) 995 V
Hence B is the correct answer.
answered Jun 13, 2014 by


text:
### On uniqueness of invariant measures for finite- and infinite-dimensional diffusions

Albeverio S, Bogachev V, Röckner M (1999)
Communications on Pure and Applied Mathematics 52(3): 325-362.

Zeitschriftenaufsatz | Veröffentlicht | Englisch

Es wurde kein Volltext hochgeladen. Nur Publikationsnachweis!
Autor*in
Albeverio, Sergio; Bogachev, Vladimir; Röckner, MichaelUniBi
Einrichtung
Abstract / Bemerkung
We prove uniqueness of "invariant measures," i.e., solutions to the equation L*mu = 0 where L = Delta + B . del on R-n with B satisfying some mild integrability conditions and mu being a probability measure on Rn. This solves an open problem posed by S. R. S. Varadhan in 1980. The same conditions are shown to imply that the closure of L on L-1(mu) generates a strongly continuous semigroup having mu as its unique invariant measure. The question whether an extension of L generates a strongly continuous semigroup on L-1(mu) and whether such an extension is unique is addressed separately and answered positively under even weaker local integrability conditions on B. The special case when B is a gradient of a function (i.e., the "symmetric case") in particular is studied and conditions are identified ensuring that L*mu = 0 implies that L is symmetric on L-2(mu) Or L*mu = 0 has a unique solution. We also prove infinite-dimensional analogues of the latter two results and a new elliptic regularity theorem for invariant measures in infinite dimensions. (C) 1999 John Wiley & Sons, Inc.
Erscheinungsjahr
1999
Zeitschriftentitel
Communications on Pure and Applied Mathematics
Band
52
Ausgabe
3
Seite(n)
325-362
ISSN
0010-3640
Page URI
https://pub.uni-bielefeld.de/record/1623685

### Zitieren

Albeverio S, Bogachev V, Röckner M. On uniqueness of invariant measures for finite- and infinite-dimensional diffusions. Communications on Pure and Applied Mathematics . 1999;52(3):325-362.
Albeverio, S., Bogachev, V., & Röckner, M. (1999). On uniqueness of invariant measures for finite- and infinite-dimensional diffusions. Communications on Pure and Applied Mathematics , 52(3), 325-362. doi:10.1002/(SICI)1097-0312(199903)52:3<325::AID-CPA2>3.0.CO;2-V
Albeverio, S., Bogachev, V., and Röckner, M. (1999). On uniqueness of invariant measures for finite- and infinite-dimensional diffusions. Communications on Pure and Applied Mathematics 52, 325-362.
Albeverio, S., Bogachev, V., & Röckner, M., 1999. On uniqueness of invariant measures for finite- and infinite-dimensional diffusions. Communications on Pure and Applied Mathematics , 52(3), p 325-362.
S. Albeverio, V. Bogachev, and M. Röckner, “On uniqueness of invariant measures for finite- and infinite-dimensional diffusions”, Communications on Pure and Applied Mathematics , vol. 52, 1999, pp. 325-362.
Albeverio, S., Bogachev, V., Röckner, M.: On uniqueness of invariant measures for finite- and infinite-dimensional diffusions. Communications on Pure and Applied Mathematics . 52, 325-362 (1999).
Albeverio, Sergio, Bogachev, Vladimir, and Röckner, Michael. “On uniqueness of invariant measures for finite- and infinite-dimensional diffusions”. Communications on Pure and Applied Mathematics 52.3 (1999): 325-362.

Open Data PUB

### Web of Science

Dieser Datensatz im Web of Science®


text:
# React for the algebra enthusiast – Part 1

When I learned to use the react framework, I always had the feeling that it is written in a very mathy way. Since simple googling did not give me any hints if this was a consideration in the design, I thought it might be worth sharing my thoughts on that. I should mention that I am sure others have made the same observations, but it might help algebraist to understand react faster and mathy computer scientiests to remember some algebra.

## Free monoids

In abstract algebra, a monoid is a set M together with a binary operation “$\cdot$” satisfying these two laws:

• There is a neutral element “e”, such that: $\forall x \in M: x \cdot e = e \cdot x = e$
• The operation is associative, i.e. $\forall x,y,z \in M: x \cdot (y\cdot z) = (x\cdot y) \cdot z$

Here are some examples:

• Any set with exactly one element together with the unique choice of operation on it.
• The natural numbers $\mathbb{N}=\{0,1,2,\dots \}$ with addition.
• The one-based natural numbers $\mathbb{N}_1=\{1,2,3,\dots\}$ with multiplication.
• The Integers $\mathbb Z$ with addition.
• For any set M, the set of maps from M to M is a monoid with composition of maps.
• For any set A, we can construct the set List(A), consisting of all finite lists of elements of A. List(A) is a monoid with concatenation of lists. We will denote lists like this: $[1,2,3,\dots]$

Monoids of the form List(A) are called free. With “of the form” I mean that the elements of the sets can be renamed so that sets and operations are the same. For example, the monoid $\mathbb{N}$ with addition and List({1}) are of the same form, witnessed by the following renaming scheme:

$0 \mapsto []$

$1 \mapsto [1]$

$2 \mapsto [1,1]$

$3 \mapsto [1,1,1]$

$\dots$

— so addition and appending lists are the same operation under this identification.

With the exception of $\mathbb{N}_1$, the integers and the monoid of maps on a set, all of the examples above are free monoids. There is also a nice abstract definition of “free”, but for the purpose at hand to describe a special kind of monoid, it is good enough to say, that a monoid M is free, if there is a set A such that M is of the form List(A).

## Action monoids

A react-app (and by that I really mean a react+redux app) has a set of actions. An action always has a type, which is usally a string and a possibly empty list of arguments.

Let us stick to a simple app for now, where each action just has a type and nothing else. And let us further assume, that actions can appear in arbirtrary sequences. That means any action can be fired in any state. The latter simplification will keep us clear from more advanced algebra for now.

For a react-app, sequences of actions form a free monoid. Let us look at a simple example: Suppose our app is a counter which starts with “0” and has an increment (I) and decrement (D) action. Then the sequences of action can be represented by strings like

ID, IIDID, DDD, IDI, …

which form a free monoid with juxtaposition of strings. I have to admit, so far this is not very helpful for a practitioner – but I am pretty sure the next step has at least some potential to help in a complicated situation:

## Quotients

Quotients of sets by an equivalence relation are a very basic tool of modern math. For a monoid, it is not clear if a quotient of its underlying set will still be a monoid with the “same” operations.

Let us look at an example, where everything goes well. In the example from above, the counter should show the same integer if we decrement and then increment (or the other way around). So we could say that the two action sequences

• ID and
• DI

do really nothing and should be considered equivalent to the empty action sequence. So let’s say that any sequence of actions is equivalent to the same sequence with any occurence of “DI” or “ID” deleted. So for example we get:

IIDIIDD $\sim$ I

With this rule, we can reduce any sequence to an equivalent one that is a sequence of Is, a sequence of Ds or empty. So the quotient monoid can be identified with the integers (in two different ways, but that’s ok) and addition corresponds to juxtaposition of action sequences.

The point of this example and the moral of this post is, that we can take a syntactic description (the monoid of action sequences), which is easy to derive from the source code and look at a quotient of the action monoid by a reasonable relation to arrive at some algebraic structure which has a lot to do with the semantic of the app.

So the question remains, if this works just well for an example or if we have a general recipe.

Here is a problem in the general situation: Let $x,y,z\in M$ be elements of a monoid $M$ with operation “$\cdot$” and $\sim$ be an equivalence relation such that $x$ is identified with $y$. Then, denoting equivalence classes with $[\_]$ it is not clear if $[x] \cdot [y]$ should be defined to be $[x\cdot z]$ or $[y\cdot z]$.

Fortunately problems like that disappear for free monoids like our action monoid and equivalence relations constructed in a specific way. As you can see on wikipedia, it is always ok to take the equivalence relation generated by the same kind of identifications we made above: Pick some pairs of sequences which are known “to do the same” from a semantic point of view (like “ID” and “DI” did the same as the empty sequence) and declare sequences to be equivalent, if they arise by replacing sequences known to be the same.

So the approach is that general: It works for apps, where actions do not have parameters and can be fired in any order and for equivalence relations generated by defining finitely many action sequences to do the same. The “any order” is a real restriction, but this post also has a “Part 1” in the title…

# Crashes when returning references to vector elements

Recently, I was experiencing a strange crash that I traced to a piece of C++ code looking more or less like this:

template <class T>
class container
{
public:
std::vector<T> values_;
T default_;

T const& get() const
{
if (values_.empty())
return default_;
return values.front();
}
};

This was crashing when calling get(), with a non-empty values_ member. It looks fairly innocent. And it ran in production for a couple of years already. So what changed?

I had, in fact, never instanciated this template with T = bool before. And that was causing the crash, while still compiling without any errors. Now if you’re a little versed in the C++ standard library you might know that std::vector is a special snowflake indeed. In an effort to save space, and, I suspect, prove the usefulness of template specializations, it is not really a “normal” container holding bool values. Instead, it holds some type of integers and packs each pseudo-bool into one of their bits. The consequence is that the accessor functions like operator[], front() and back() cannot return a reference to a bool. Instead, they return a “proxy” object that supports assignment to and from a bool.

Back to the get() function: it tries to return a reference to a bool. Of course, that bool doesn’t really exist except as a temporary, and so this results in a dangling reference that causes a segmentation fault when used.

I suspect there could have been a warning about a dangling reference somewhere there. I have seen clang-tidy especially report things like this (with a few false positives too), but it did not show up for me. To fix it, I am now just returning a bool instead of a bool const& for T = bool. A special case in my case to work around a special case in std::vector.

# Contiguous date ranges in Oracle SQL

In one of my last posts from a couple of weeks ago I wrote about querying gaps between non-contiguous date ranges in Oracle SQL. This week’s post is about contiguous date ranges.

While non-contiguous date ranges are best represented in a database table with a start_date and an end_date column, it is better to represent contiguous date ranges only by one date column, so that we avoid redundancy and do not have to keep the start date of a date range in sync with the end date of the previous date range. In this post I will use the start date:

CREATE TABLE date_ranges (
name VARCHAR2(100),
start_date DATE
);

The example content of the table is:

NAME	START_DATE
----	----------
A	05/02/2020
B	02/04/2020
C	16/04/2020
D	01/06/2020
E	21/06/2020
F	02/07/2020
G	05/08/2020

This representation means that the date range with the most recent start date does not have an end. The application using this data model can choose whether to interpret this as a date range with an open end or just as the end point for the previous range and not as a date range by itself.

While this is a nice non-redundant representation, it is less convenient for queries where we want to have both a start and an end date per row, for example in order to check wether a given date lies within a date range or not. Luckily, we can transform the ranges with a query:

SELECT
date_ranges.*,
LEAD(date_ranges.start_date)
OVER (ORDER BY start_date)
AS end_date
FROM date_ranges;

As in the previous post on non-contiguous date ranges the LEAD analytic function allows you to access the following row from the current row without using a self-join. Here’s the result:

NAME	START_DATE	END_DATE
----	----------	--------
A	05/02/2020	02/04/2020
B	02/04/2020	16/04/2020
C	16/04/2020	01/06/2020
D	01/06/2020	21/06/2020
E	21/06/2020	02/07/2020
F	02/07/2020	05/08/2020
G	05/08/2020	(null)

By using a WITH clause you can use this query like a view and join it with the another table, for example with the join condition that a date lies within a date range:

WITH ranges AS
(SELECT date_ranges.*, LEAD(date_ranges.start_date) OVER (ORDER BY start_date) AS end_date FROM date_ranges)
SELECT timeseries.*, ranges.name
FROM timeseries LEFT OUTER JOIN ranges ON
timeseries.measurement_date
BETWEEN ranges.start_date AND ranges.end_date;

# Co-Variant methods on C# collections

C# offers a powerful API for working with collections and especially LINQ offers lots of functional goodies to work with them. Among them is also the Concat()-method which allows to concatenate two IEnumerables.

We recently had the use-case of concatenating two collections with elements of a common super-type:

class Animal {}
class Cat : Animal {}
class Dog : Animal {}

public IEnumerable<Animal> combineAnimals(IEnumerable<Cat> cats, IEnumerable<Dog> dogs)
{
// XXX: This does not work because Concat is invariant!!!
return cats.Concat(dogs);
}

The above example does not work because concat requires both sequences to have the same type and returns a combined sequences of this type. If we do not care about the specifities of the subclasses be can build a Concatenate()-method ourselves which make the whole thing possible because instances of both subclasses can be put into a collection of their common parent class.

private static IEnumerable<TResult> Concatenate<TResult, TFirst, TSecond>(
this IEnumerable<TFirst> first,
IEnumerable<TSecond> second)
where TFirst: TResult where TSecond : TResult
{
IList<TResult> result = new List<TResult>();
foreach (var f in first)
{
result.Add(f);
}
foreach (var s in second)
{
result.Add(s);
}
return result;
}

The above method is a bit clunky to call but works as intended:

public IEnumerable<Animal> combineAnimals(IEnumerable<Cat> cats, IEnumerable<Dog> dogs)
{
// Works great!
return cats.Concatenate<Animal, Cat, Dog>(dogs);
}

A variant of the above is a Concatenate()-method can be useful if you use a collection of the parent class to collect instances of subclass collections:

private static IEnumerable<TResult> Concatenate<TResult, TIn>(
this IEnumerable<TResult> first,
IEnumerable<TIn> devs)
where TIn : TResult
{
IList<TResult> result = first.ToList();
foreach (var dev in devs)
{
result.Add(dev);
}
return result;
}

public IEnumerable<Animal> combineAnimals(IEnumerable<Cat> cats, IEnumerable<Dog> dogs)
{
IEnumerable<Animal> result = new List<Animal>();
result = result.Concatenate(cats);
return result.Concatenate(dogs);
}

Maybe the above examples can serve as an inspiration for more utility methods that may improve working with collections in C#.

# Make yourself comfortable

If you have to add a new feature to an existing code base, you’ve likely already experienced an uncomfortable truth: Nobody has thought about your use case. Nothing in the existing code base fits your goals. This isn’t because everybody wanted you to fail, but because your new feature is in fact brand new to the software and responsible software developers stop working on a code as soon as their work is done (while obeying the project’s definition of done).

So you try to shoehorn your functionality into the existing code. It’s not neat, but you get it working. Are you done? In my opionion, you haven’t even started yet. Your first attempt to combine your idea of the best implementation of your functionality and the existing system will be cumbersome and painful. Use it as a learning experience how the system behaves and throw it away once you get a working prototype. Yes, you’ve read that right. Throw it away as in undo your commits or changes. This was the learning/exploration phase of your implementation. You’ve applied your idea to reality. It didn’t work well. Now is the time to apply reality to your idea. Commence your second attempt.

For your second attempt, you should make use of your refactoring skills on the existing code. Bend it to your anticipated and tried needs. And once the code base is ready, drop your new feature into the new code “socket”. Your work doesn’t need to be cumbersome and painful. Make yourself comfortable, then make it work.

Here is a example, based on a real case:

An existing system was in development for many years and worked with a lot of domain objects. One domain object was a price tag that looked something like this:

interface PriceTag {
PriceCategory category();
TaxGroup taxGroup();
Euro nettoAmount();
Product forProduct();
}

Well, it was a normal domain object giving back other normal domain objects. The new feature should be an audio module that could read price tags out loud. The team used a text-to-speech synthesizing library that takes a string and outputs an audio stream. No big deal and pretty independent from the already existing code base.

But the code that takes a price tag and converts it into a string, aka the connection point between the unbound library code and the existing system, was ugly and undecipherable:

String priceTagToText(PriceTag price) {
return price.forProduct().getDenotation()
+ " for only "
+ CurrencyFormatter.format(price.nettoAmount())
+ " with "
+ String.valueOf(price.taxGroup().percentage())
+ " % VAT in the "
+ price.category().getDenotation()
+ " section.";
}

This is how it looks if somebody tries to combine two building blocks that aren’t meant for each other. To test this method, you’ll have to mock deep into the domain objects.

If two building blocks aren’t matching naturally, maybe it’s an idea to add some lubrication code between them. This code isn’t exactly doing anything newfound, but adds a requirement seam that point towards the existing system:

interface ReadablePriceTag {
String denotation();
String netto();
String vatPercentage();
String category();
}

You can probably already see where this is heading. Just in case you cannot, I will take you through all parts of the code.

First we can write a priceTagToText() method that reads a lot nicer:

String priceTagToText(ReadablePriceTag price) {
return price.denotation()
+ " for only "
+ price.netto()
+ " with "
+ price.vatPercentage()
+ " VAT in the "
+ price.category()
+ " section.";
}

The second and complementary part is the implementation of the ReadablePriceTag interface that is given a PriceTag object and translates the data for the new methods:

class PriceTagBasedReadablePriceTag {
private final PriceTag price;

PriceTagBasedReadablePriceTag(PriceTag price) {
this.price = price;
}

@Override
public String denotation() {
return this.price.forProduct().getDenotation();
}

@Override
public String netto() {
return CurrencyFormatter.format(this.price.nettoAmount());
}

@Override
public String vatPercentage() {
return String.valueOf(
this.price.taxGroup().percentage()) + " %";
}

@Override
public String category() {
return this.price.category().getDenotation();
}
}

Basically, you have a lot of existing code that is using PriceTag objects and some new code that wants to use ReadablePriceTag objects. The PriceTagBasedReadablePriceTag class is the connector between both worlds (at least in one direction). We can definitely argue about the name, but that’s a detail, not the main point. The main points of all this effort are two things:

1. The new code does not suffer in quality and readability from decisions made at a different time in a different context.
2. The code clearly models these contexts. If you are aware of Domain Driven Design, you probably see the “Bounded Context” border that crosses right between PriceTag and ReadablePriceTag. The PriceTagBasedReadablePriceTag class is the bridge across that border.

If you express your context borders explicitely like in this example, your code reads fine on any side of the border. There is no notion of “old and fitting” and “new and awkward” code. It seems like additional work and it surely is, but is pays off in the long run because you can play this game indefinitely. A code base that gets more muddied and forced with time will reach a breaking point after which any effort needs knowledge in archeology and cryptoanalysis.

So, my advice boils down to one thing: Make yourself comfortable when adding new code to an existing code base.
And then, think about your type names. PriceTagBasedReadablePriceTag is most likely not the best name for it. But that’s a topic for another blog post. What would be your name for this class?

# What is it with Software Development and all the clues to manage things?

As someone who started programming a long time ago (roughly 20 years, now that I think about it), but only in recent years entered the world of real software development, the mastery of day-to-day-challenges happens to consist of two main topics: First, inour rapidly evolving field we never run out of new technologies to learn, and then, there’s a certain engineering aspect underlying, how to do things in a certain manner, with lots of input every year.

So after I recently shared some of such ideas with my friends — I indeed still have a few ones of those), I wondered: How is it, that in the modern software development world, most of the information about managing things actually comes from the field itself, and rather feeding back its ideas of project management, quality, etc. into the non-software-subspaces of the world? (Ideas like the Agile movement, Software Craftmanship, the calls of doing things Lean and Clean, nowadays prospered so much that you see their application or modification in several other industries. Like advertisement, just as an example.)

I see a certain kind of brain food in this question. What tells software development apart from other current fields, so that there is a broad discussion and considerable input at its base level? After all, if you plan on becoming someone who builds houses, makes cars, or manages cities, you wouldn‘t engage in such a vivid culture of „how“ to do things, rather focussing on the „what“.

Of course, I might be mistaken in this view. But, by asking: what actually tells software development apart from these other fields of producing something, I see a certain kind of brain food, helpful for approaching every day tasks and valuing better tips over worse ones.

So, what can that be?

1. Quite peculiar is the low entry threshold in being able to call yourself a “programmer”. With the lots of resources you get at relatively little cost (assumption: you have a computer with a working internet connection), you have a lot of channels by which you can learn the „what“ of software development first, and saving the „how“ for later. If you plan on building a house, there‘s not a bazillion of books, tutorials, and videos, after all.

2. Similarly, there‘s the rather low cost of failure when drafting a quick hobby project. Not always will a piece of code that you write in your free time tell yourself „hey man, you ever thought about some better kind of architecture?“ – which is, why bad habits can stick and even feel right. If you choose the „wrong“ mindset, you don‘t always lose heaps of money, and neither do you, if you switch your strategy once in a while, you also don‘t automatically. (you probably will, though, if you are too careless in this process).

3. Furthermore, there‘s the dynamic extension of how your project is going to be used („Scope Creep“). One would build a skyscraper in a different way than a bungalow (I‘m not an expert, though), but with software, it often feels like adding a simple feature here, extending the scope there, unless you hit a point where all its interdependencies are in a complex state of conflict…

4. Then, it‘s a matter of transparency: If you sit in a badly designed car, it becomes rather obvious when it always exhausts clouds of black smoke. Or your house always smells like scents of fresh toilet. Of course, a well designed piece of software will come with a great user experience, but as you can see in many commercial products, there also is quite some presence of low-than-average-but-still-somehow-doing-what-it-should software. Probably users are more tolerant with software than with cars?

5. Also, as in most technical fields, it is not the case that „pure consultants“ are widely received in a positive light. For most nerds, you don‘t get a lot of credibility if you talk about best practices without having got your hands dirty over a longer period of time. Ergo, it needs some experienced software programmers in order to advise less experienced software programmers… but surely, it‘s questionable whether this is a good thing.

6. After all, the requirements for someone who develops a project might be very different in each field. From my academical past in computational Physics, I know that there is quite some demand for „quick & dirty“ solutions. Need to add some Dark Matter in your model here? Well, plug this formula in and check the results. Not every user has the budget or liberty in creating a solid structure of your program. If you want to have a new laboratory building, of course, you very well want it it do be designed as good as it can get.

All in all, these observations somehow boil down to the question, whether software development is to be seen more like a set of various engineering skills, rather like a handcraft, an art, or a complex program of study. It is the question, whether the “crack” in this field is the one who does complex arithmetics in its head, or the one who just gets what the customer wants. I like thinking about such peculiar modes of thought, as they help me in understanding what kinds of things I should learn next.

Or is there something completely else to it?

# Compiling Agda 2.6.2 on Fedora 32

Agda is a dependently typed functional programming language that I like very much. Its latest versions have some special features which are not supported by any more well known languages, for example higher inductive types. Since I want to use all the special features of Agda, I regularly compile the latest version. This is a procedure which comes with a few surprises more often than not, so this post is about saving you the time it took me to figure out what to do.

I like to compile Agda using the Haskell tool Stack, which can be installed with

curl -sSL https://get.haskellstack.org/ | sh

The sources of Agda have to be checked out with all submodules – otherwise there will be some weird “cabal” (another Haskell tool, more basic than Stack) errors which I was not able to understand. This can be done with:

git clone --recurse-submodules https://github.com/agda/agda.git

Now if you go to the Agda folder

cd agda

There should be files called “stack-8.8.4.yaml” and similar. Those files can can tell Stack how to build Agda. The number is the version of the Haskell compiler which is used to build Agda. I usually use the latest, you do not have to figure out which (if any) is installed on your system, since Stack will just download the appropriate compiler for you.

However, just running stack failed for my on Fedora 32 due to some linking problem in the end. It turned out, that “libtinfo.so” was not found by the linker. “libtinfo.so.6” is available on Fedora 32, so adding a link to it fixed the problem:

sudo ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so

Now, you can tell Stack to get all necessary things and compile and install Agda with:

stack install --stack-yaml stack-8.8.4.yaml

This also installs a binary into “~/.local/bin” which is in PATH on Fedora 32 by default, so you should be able to call agda from the command line. Also, you can use “agda-mode” to configure emacs for agda.

# Unintentionally hidden application state

What do libraries like React and Dear Imgui or paradigms like Data-oriented design and Data-driven programming have in common?
One aspect is that they all rely on explictly modeling an application’s state as data.

## What do I mean by hidden state?

Now you will probably think: of course, I do that too. What other way is there, really? Let me give you an example, from the widely used Qt library:

QMessageBox box;
msgBox.setText("explicitly modeled data!");
msgBox.exec();

So this appears to be harmless, but is actually one of the most common cases were state is modeled implicitly. But we’re explicitly setting data there, you say. That is not the problem. The exec() call is the problem. It is blocking until the the message box is closed again, thereby implicitly modeling the “This message box is shown” state by this thread’s instruction pointer and position on the call stack. The instruction pointer is now tied to this state: while it does not move out of that function, the message box is still shown.

This is usually not a big problem, but it demonstrates nicely how state can be hidden unintentionally in an application. And even a small thing like this already prevents you from doing certain things, for example easily serializing your complete UI state.

## Is it bad?

This cannot really be avoided while keeping some kind of conceptual separation between code and data. It can sure be minimized. But is it bad? Well, it is certainly good to know when you’re using implicit state like that. And there’s one critiria for when it should most certainly minimized as much as possible: highly interactive programs, like user interfaces, games, machine control systems and AI agents.
These kinds of programs usually have some spooky and sponteanous interactions between different, seemlingly unrelated objects, and weird transitions between states. And using the call-stack and instruction pointer to model those states makes them particularly unsuitable to being interacted with.

## Alternatives?

So what can you use instead? The tried and tested alternative is always a state-machine. There are also related alternatives like behavior trees, which are actually quite similar to a “call stack in data” but much more flexible. Hybrid solutions that move only bits of the code into the realm of data are promises/futures and coroutines. Both effectively allow a “linear” function to be decoupled from its call-stack, and be treated more like data. And if their current popularity is any indicator, that is enough for many applications.

What do you think? Should hidden state like this always be avoided?

# Changing the keyboard navigation behaviour of form inputs

The default behaviour in HTML forms is that you can move the focus from one input element to the next via the tab key and submit the form via the enter key. This is also how dialogs work on most operating systems when using the native UI components. This behaviour is consistent across all browsers, and changing it messes with the user’s expectations and reduces accessibility. So I would normally advise against changing this behaviour without good reasons.

However, one of our customers wanted a different behaviour for an application developed by us. This application replaced an older application where the enter key did not submit the form, but moved the focus to the next input element. The ‘muscle memory’ effect made users accidentally submit the form by hitting the enter key, causing frustration. Since this application is not a public web site, but merely a web technology based intranet application with a small and specialized user base, changing the default behaviour is acceptable if the users want it.

So here’s how to do it. The following JavaScript function focusNextInputOnEnter takes a form element as a parameter and changes the focus behaviour on the input elements within this form.

function focusNextInputOnEnter(form) {
var inputs = form.querySelectorAll('input, select, textarea');
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
input.addEventListener('keypress', (function(index) {
return function(event) {
if (!isEnter(event.which)) {
return;
}
var nextIndex = index + 1;
while (nextIndex < inputs.length) {
var nextInput = inputs[nextIndex];
if (nextInput.disabled) {
nextIndex++;
continue;
}
nextInput.focus();
break;
}
};
})(i));
}

function isEnter(keyCode) {
return keyCode === 13;
}
}

It works by handling the keypress events on the input elements and checking the key code for the enter key (code 13). It has an additional check so that disabled input elements are skipped.

To apply this change in behaviour to a form we have to call the function when the DOM content is loaded:

<form id="demo-form">
<input type="text">
<input type="text" disabled="disabled">
<input type="checkbox">
<select>
<option>A</option>
<option>B</option>
</select>
<textarea></textarea>
<input type="text">
<input type="text">
</form>

<script>
document.addEventListener('DOMContentLoaded', function() {
focusNextInputOnEnter(document.getElementById('demo-form'));
});
</script>

I want to reiterate my warning that you should definitely not do this for public web sites, and elsewhere only if you know that this is what your users want.

# Using (elastic)search with .NET Core

Many modern applications require powerful search mechanisms to become useful and make their users more productive. That is in large part due to the amount of data available to work with. Thankfully there are already powerful tools to index your data and make it searchable.

One of the most well known state-of-the-art solutions is ElasticSearch and it has an API to be used from .NET called NEST. While the documentation is ok I want to give a quick rundown on how to add searching capabilities to your .NET Core application. Some ideas are borrowed from the great post “Using Elasticsearch with ASP.NET Core and Docker“.

## Getting ElasticSearch running

The easiest way to get up and running with elasicsearch is to use their docker images and just run the container on your development machine. I like to a docker compose file like the following to get elasticsearch and its tooling application kibana up and running fast:

version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
container_name: elastic
environment:
- node.name=elastic
- cluster.initial_master_nodes=elastic
ports:
- "9200:9200"
- "9300:9300"
volumes:
- type: bind
source: ./esdata
target: /usr/share/elasticsearch/data
networks:
- esnetwork
kibana:
image: docker.elastic.co/kibana/kibana:7.8.0
ports:
- "5601:5601"
networks:
- esnetwork
depends_on:
- elasticsearch
volumes:
esdata:
networks:
esnetwork:
driver: bridge

After you run it with docker compose you can talk to the search service on http://localhost:9200/ and the kibana management GUI on http://localhost:5601/. On the Kibana UI especially the Dev Tools and its console are interesting for experimenting with search queries.

## Access ElasticSearch from your .NET Core app

I find it quite elegant to write a extension method for the IServiceCollection to configure the ElasticClient and register it as a Singleton to the dependency injection framework of .NET Core like so

    public static class ElasticSearchExtension
{
public static void AddElasticsearch(
this IServiceCollection services, IConfiguration configuration)
{
var url = configuration["elasticsearch:url"];
var settings = new ConnectionSettings(new Uri(url))
.DefaultMappingFor<SearchableDevice>(deviceMapping => deviceMapping
.IndexName("devices")
.IdProperty(dev => dev.Id)
)
;
var client = new ElasticClient(settings);
var response = client.Indices.Create("devices", creator => creator
.Map<SearchableDevice>(device => device
.AutoMap()
)
);
// maybe check response to be safe...
services.AddSingleton<IElasticClient>(client);
}
}

The configuration block looks like following

  "ElasticSearch": {
"url": "http://localhost:9200/"
},

and allows for future extension.

Our search service has to be registered in Startup of course:

public void ConfigureServices(IServiceCollection services)
{
...
services.AddElasticsearch(Configuration);
}

## Indexing our objects

In the above example we built a SearchableDevice class whose public properties are going to be indexed by ElasticSearch. The API allows for a much more fined grained control about what and how to index but we want to keep things simple without having to worry about excluding Properties and so on. If you have set it up that way indexing a SearchableDevice is merely one simple call:

// SearchClient is the injected IElasticClient
// mySearchableDevice is an instance of SearchableDevice
SearchClient.IndexDocument(mySearchableDevice);

## Searching for objects

When developing a search query I like to try it in the Kibana Dev Tools and then transform it to a NEST call. A simple query to look in all device properties if they start with “needle” looks like this:

{
"query": {
"multi_match": {
"type": "phrase_prefix",
"fields": ["*"],
"query": "needle"
}
}
}

The nice thing about the Kibana Dev Tools console is that it can display and complete the possible values for fields like “type” in your multi_match query.

That search query can then be translated to a NEST call in a straightforward way and looks this way:

var response = SearchClient.Search<SearchableDevice>(sd => sd
.Query(q => q
.MultiMatch(query => query
.Type(TextQueryType.PhrasePrefix)
.Fields("*")
.Query("needle")
)
)
);

The search response contains the hits with their source objects and some metadata like the score and result count.

Bear in mind that ElasticSearch only returns the first/best 10 matches by default, so specifying the result size often might be closer to what you want.

## Wrapping it up

Getting started with ElasticSearch in .NET Core does not require too much boiler plate an setup work if you use tools like docker and the NEST library. Making it usable and tuning the indexing and querying may require a lot of work to achieve the best results. On the other hand smaller applications can start-off with a simple search setup like shown above and simply evolve it when need be.


text:
GMAT Question of the Day: Daily via email | Daily via Instagram New to GMAT Club? Watch this Video

 It is currently 28 Feb 2020, 09:35

### 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

# In March, Kurt ran an average of 1.5 miles an hour. If by June he had

Author Message
TAGS:

### Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 61548
In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

19 Jan 2020, 22:09
00:00

Difficulty:

55% (hard)

Question Stats:

58% (02:23) correct 42% (02:22) wrong based on 50 sessions

### HideShow timer Statistics

Competition Mode Question

In March, Kurt ran an average of 1.5 miles an hour. If by June he had increased his pace by 10 seconds per mile, then which of the following expresses the number of hours it would take Kurt to complete one mile in June?

A. $$\frac{2390}{60^2}$$

B. $$\frac{2410}{60^2}$$

C. $$\frac{3586}{60^2}$$

D. $$\frac{3590}{60^2}$$

E. $$\frac{60^2}{3590}$$

Are You Up For the Challenge: 700 Level Questions

_________________
Intern
Joined: 12 Jun 2019
Posts: 30
GMAT 1: 500 Q43 V17
GMAT 2: 510 Q44 V17
GMAT 3: 600 Q48 V25
GMAT 4: 650 Q50 V28
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 01:45
1
1
There are information provided
- K used to run speed @ 1.5 miles/ 1 hour
- Now he runs faster
- He runs 10 secs faster per 1 mile
- And question ask about time in "hours" it uses to run in "1 mile"

So we should focus on question which is "per hours" and "per 1 mile"

Let's try to calculate
1. We convert the first speed into "1 mile" unit
1.5 mile per 1 hour
1 mile per 1*1/1.5 hour = 2/3 hour = 40 mins

2. We convert mins into secs so that we can calculate it with the pace which is "secs per 1 mile"
40mins = 2,400 secs

3. We reduce the the secs by 10 secs as the question provided information "he had increased his pace by 10 seconds per mile"
So the time spent after the increasing speed is
2,400 - 10 = 2,390 secs per 1 mile
(**BE CAREFUL**; 10 secs FASTER means that he runs faster and the time spent should be reduced NOT increased.)

4. Now we convert our calculation into what question want. The question want "hours" spent per "1 mile"
what we have is 2,390 secs per 1 mile.
we convert secs per mile into hour per mile by divide it with 60^2
(**TRICK**; sometime we are not sure whether we should divide or multiply when we have to convert some units. The easy way that I do is just think like should it have to go larger or smaller? eg. convert 100,000 secs into hrs. Just think like should hrs be a lot larger than 100k secs or a lot smaller than 100k secs? larger NO! we go smaller, then we just divide it with 60*60. For me think like this can easily eliminate the confusion during rush time)

so the answer is = 2,390/60^2
I believe that answer is "A" (Please give me suggestion if I calculate something wrong )

My Learning
- I believe that there is another approach where we start to convert from 10secs/1mile into n secs / 1.5mile and add it with the 1hr/1.5mile. This approach can lead to answer too. But it requires a little more calculation. That's why I think we should focus on question. The question ask about time per 1 mile. So convert per 1mile to per 1.5mile may need another convert back to per 1mile in the end.. This little trick could reduce time using by 15-30secs.
VP
Joined: 20 Jul 2017
Posts: 1337
Location: India
Concentration: Entrepreneurship, Marketing
WE: Education (Education)
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

Updated on: 20 Jan 2020, 22:36
1
In March, time taken to run 1 mile = $$\frac{Distance}{speed}$$ = $$\frac{1}{1.5}$$
= $$\frac{2}{3}$$ hour = $$\frac{2}{3}*60*60$$ = 2400 seconds per mile

If by June he had increased his pace by 10 seconds per mile
--> Time taken to travel 1 mile in June = 2400 - 10 = 2390 seconds
--> Number of hours = $$\frac{2390}{60^2}$$

Option A

Originally posted by Dillesh4096 on 20 Jan 2020, 02:12.
Last edited by Dillesh4096 on 20 Jan 2020, 22:36, edited 1 time in total.
VP
Joined: 24 Nov 2016
Posts: 1248
Location: United States
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 05:47
1
Quote:
In March, Kurt ran an average of 1.5 miles an hour. If by June he had increased his pace by 10 seconds per mile, then which of the following expresses the number of hours it would take Kurt to complete one mile in June?

A. 2390/60^2
B. 2410/60^2
C. 3586/60^2
D. 3590/60^2
E. 60^2/3590

r=d/t=1.5/1=1.5
d=1:t=d/r=1/1.5=2/3hours*60*60=2400secs
r(secs)=2400-10=2390
r(hrs)=2390secs/60^2

d=1:t=d/r=1/2390/60^2=1/1*2390/60^2=2390/60^2

Ans (A)
Manager
Joined: 17 Jan 2019
Posts: 155
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 07:37
1
In March, Kurt ran an average of 1.5 miles an hour. If by June he had increased his pace by 10 seconds per mile, then which of the following expresses the number of hours it would take Kurt to complete one mile in June?

In march, he ran 1.5 miles per 3600 seconds meaning he can run 1 miles in 2400 seconds
In april he increase his pace by 10 seconds per mile meaning he ran faster 10 seconds per mile meaning
2400-10 =2390 seconds per mile
2390 sec (1min/60sec) (1 hr/60 min)
therefore 2390/60^2
A
Director
Joined: 30 Sep 2017
Posts: 696
GMAT 1: 720 Q49 V40
GPA: 3.8
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 07:44
1
Initially, Kurt ran an average of 1.5 miles an hour.
--> In one mile, he spent 2/3 of an hour (=2,400 secs)

By June he had increased his pace by 10 seconds per mile.
--> in June, he spent (2400-10) = 2,390 sec per mile = 2, 390/60^2 hour per mile

Posted from my mobile device
SVP
Joined: 03 Jun 2019
Posts: 2025
Location: India
GMAT 1: 690 Q50 V34
WE: Engineering (Transportation)
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 08:12
1
In March
1.5 miles run in 1 hour = 3600 seconds
1 mile run in 1/1.5 hour = 2400 seconds

In June
1 mile run in 2400-10 = 2390 seconds = 2390/60^2 hours

IMO A

Posted from my mobile device
Director
Joined: 07 Mar 2019
Posts: 728
Location: India
GMAT 1: 580 Q43 V27
WE: Sales (Energy and Utilities)
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 09:50
1
In March, Kurt ran an average of 1.5 miles an hour. If by June he had increased his pace by 10 seconds per mile, then which of the following expresses the number of hours it would take Kurt to complete one mile in June?

A. $$\frac{2390}{60^2}$$

B. $$\frac{2410}{60^2}$$

C. $$\frac{3586}{60^2}$$

D. $$\frac{3590}{60^2}$$

E. $$\frac{60^2}{3590}$$

Average speed of Kurt, Sk = 1.5mph
Time taken to cover 1 mile = 1/1.5 hour = 40 minutes = 2400 sec

Since he improves by 10 sec, new time taken to cver 1 mile = 2400-10 = 2390 sec = $$\frac{2390}{60^2}$$

_________________
Ephemeral Epiphany..!

GMATPREP1 590(Q48,V23) March 6, 2019
GMATPREP2 610(Q44,V29) June 10, 2019
GMATPREPSoft1 680(Q48,V35) June 26, 2019
Senior Manager
Joined: 01 Mar 2019
Posts: 451
Location: India
Concentration: Strategy, Social Entrepreneurship
Schools: Ross '22, ISB '20, NUS '20
GPA: 4
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 17:25
1
1.5 miles in an hr....i.e for 1mile he took 2/3hrs...i.e 2400sec
But he had increased his pace by 10 seconds per mile....so he can complete a mile in 2390sec.....i.e 2390/3600 hrs

OA:A
Manager
Joined: 26 Dec 2017
Posts: 54
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 18:53
1
Ans: A

1.5 miles time 60*60 sec
1 miles time 2400 sec

now, in June he takes=(2400-10)=2390sec=2390/(60^2) hr
CR Forum Moderator
Joined: 18 May 2019
Posts: 715
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 20:18
1
In March, Kurt ran at a speed of 1.5mph. So if Kurt were to run for a mile, he would take the time t hours = 1/1.5 = 2/3 hours
So we now know that Kurt has improved his pace of running in June by running a mile 10 seconds faster, implying that his speed has increased and that he takes lesser time to cover 1mile in his runs.
So his new time to cover a mile = 2/3hrs - 10/3600 = (2400-10)/3600 = 2390/3600 hours

Director
Joined: 25 Jul 2018
Posts: 578
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

20 Jan 2020, 21:32
1
1.5 miles — 1 hour (3600 seconds )
1 mile — x hour
—> $$x =\frac{( 1 hour* mile)}{( 1.5 miles) }= 40 minutes = 2400 second$$

Increased his pace by 10 seconds per mile —> 2400–10 = 2390
—> it would take 2390 seconds to compete 1 mile in June or $$\frac{2390}{3600}$$ hours

Posted from my mobile device
Math Expert
Joined: 02 Sep 2009
Posts: 61548
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had  [#permalink]

### Show Tags

21 Jan 2020, 23:00
Bunuel wrote:

Competition Mode Question

In March, Kurt ran an average of 1.5 miles an hour. If by June he had increased his pace by 10 seconds per mile, then which of the following expresses the number of hours it would take Kurt to complete one mile in June?

A. $$\frac{2390}{60^2}$$

B. $$\frac{2410}{60^2}$$

C. $$\frac{3586}{60^2}$$

D. $$\frac{3590}{60^2}$$

E. $$\frac{60^2}{3590}$$

Are You Up For the Challenge: 700 Level Questions

OFFICIAL EXPLANATION

The problem has two conversions to watch out for; first, it gives 1.5 miles in March but 1 mile in June second, it adds 10 seconds to his mile per hour rate. The order in which you deal with these are up to you, but they must be dealt with. First let’s deal with the 1.5 mile to 1 mile problem. Initially, he runs 1.5 miles per hour, which is the same as saying that he does 3 halves of a mile in 60 minutes, thus each half must take 20 minutes. Now we know that in March it took him 40 minutes to run a mile. Let’s now convert those minutes to seconds, 40 minutes = 2400 seconds. If by June he increased his pace by 10 seconds, that means it would take him less time to complete the mile, so in June a mile would take him 2390 seconds. Now we have the time it would take him to do a mile in June, so the last step is to convert 2390 seconds to hours. To do so we must divide 2390 by 60 to get minutes and then divide it again by 60 to convert minutes into hours.
_________________
Re: In March, Kurt ran an average of 1.5 miles an hour. If by June he had   [#permalink] 21 Jan 2020, 23:00
Display posts from previous: Sort by


text:
## statistics

What is the p-value when we test H0 : µ = 10 versus Ha: µ < 10 and have a calculated test statistic Z = -2.41 (ó is known)


text:
# How do you divide ((b^4)/(b^7))^-5?

Jul 19, 2015

I found: ${b}^{15}$

#### Explanation:

You can start inside the bracket by remembering that: ${a}^{b} / {a}^{c} = {a}^{b - c}$;
so you get:
${\left({b}^{4 - 7}\right)}^{-} 5 =$
$= {\left({b}^{-} 3\right)}^{-} 5 =$
Now you can use the fact that ${\left({a}^{b}\right)}^{c} = {a}^{b \cdot c}$;
so you get:
${b}^{- 3 \cdot - 5} = {b}^{15}$


text:
# Math Help - Integrate 3cos^2(x)

1. ## Integrate 3cos^2(x)

Hey guys,

Can you please show me a step by step integration for

Find the solution for the differential equation :

3Cos^2(x) , y= Pi , x = Pi/2

Thank you !

2. Originally Posted by ZaZu
Hey guys,

Can you please show me a step by step integration for

Find the solution for the differential equation :

3Cos^2(x) , y= Pi , x = Pi/2

Thank you !
Note that $\cos (2x) = \cos^2 x - \sin^2 x = 2 \cos^2 x - 1 \Rightarrow \cos^2 x = \frac{\cos (2x) + 1}{2}$.

3. Thanks for the reply, but where did the Cos2(x) come from ?!

4. Originally Posted by ZaZu
Thanks for the reply, but where did the Cos2(x) come from ?!
Are you familiar with the double angle formulae, specifically the fact that $\cos (2x) = \cos^2 x - \sin^2 x ?$ That was my starting point.

5. Yes I do, but I dont understand how using that will affect my answer :S

6. Originally Posted by ZaZu
Yes I do, but I dont understand how using that will affect my answer :S
For goodness sake! I have shown you how to write $\cos^2 x$ in terms of things you should be able to integrate.

Do you know how to integrate $\frac{1}{2} (\cos (2x) + 1) ?$

7. Is it 1/4 Sin2(x) + x ?

8. Originally Posted by ZaZu
Is it 1/4 Sin2(x) + x ?
Only half right. You needed to realise that $\frac{1}{2} (\cos (2x) + 1) = \frac{1}{2} \cos (2x) + \frac{1}{2} \, ....$

9. Oh sorry didnt realize the 1/2 is multiplied by the whole thing in brackets

So its 1/4 Sin2(x) + x/2

10. Originally Posted by ZaZu
Oh sorry didnt realize the 1/2 is multiplied by the whole thing in brackets

So its 1/4 Sin2(x) + x/2
+ C.

And now your job is to find the value of C using the given data.

11. Ohhhh okay got it

So its a rule that I should know, when I have an even power, I should double the angle to get an easier function right ???

12. ummm, sort of. You do have to use double angle formulae if that's what you mean.

Think of this:

$\int cos^4 \theta \ d \theta=\int (cos^2 \theta)^2 \ d \theta$

We already know that (i'll show how Mr F gets his answer since you've never seen it before):

$cos^2 \theta +sin^2 \theta=1$ and $cos^2 \theta - sin^2 \theta= cos 2\theta$.

We require an expression for $cos^2 \theta$.

$cos^2 \theta +sin^2 \theta=1 \Rightarrow \ sin^2 \theta = 1-cos^2 \theta$ from the first identity.

Putting this into the second identity gives:

$2cos^2 \theta -1=cos 2 \theta \Rightarrow \ cos^2 \theta = \frac{cos 2 \theta +1}{2}$.

Going back to our original integral:

$\int cos^4 \theta \ d \theta=\int (cos^2 \theta)^2 \ d \theta = \ \int \left( \frac{cos 2 \theta +1}{2} \right)^2 d \theta$ $=\frac{1}{4} \int (cos 2 \theta +1)^2 d \theta=\frac{1}{4} \int cos^2 2 \theta +2 cos 2 \theta +1 d \theta$.

The big problem now is the $cos^2 2 \theta$.

Looking at the integral you posted and what I have done here, can you finish this integral off?

(Hint: $cos^2 (2 \theta)+sin^2 (2 \theta)=1$ and $cos^2 (2 \theta)- sin^2 (2 \theta)=cos(4 \theta)$).

13. Thanks, Ill get on with it and ill reply when im done


text:
# Extension preserves the relation between two measures

Let $\rho_1$, $\rho_2$ be two measures(not necessarily nonnegative) on $(\Omega,\mathcal{F})$, where $\Omega$ is a set, and $\mathcal{F}$ is a $\sigma$-field in $\Omega$. Let $\mathcal{F}_0$ be a field in $\Omega$ and assume that $\mathcal{F}$ is the $\sigma$-field generated by $\mathcal{F}_0$. Suppose that $\rho_1$, $\rho_2$ are $\sigma$-finite over $\mathcal{F}_0$. (Namely, we can find a countable partition $\cup\Omega_j$ of $\Omega$, where each $\Omega_j\in\mathcal{F}_0$ and $\rho_1(\Omega_j)<\infty$, $\rho_2(\Omega_j)<\infty$.)

If $\rho_1(A)\le \rho_2(A)$ for any $A\in \mathcal{F}_0$, then do we have $\rho_1(A)\le \rho_2(A)$ for any $A\in \mathcal{F}$?

• Consider the set of all $A$ that satisfy $\rho_1(A)\le\rho_2(A)$ and show that it is a $\sigma$-algebra. – user1688 Nov 4 '17 at 5:00
• @Corbennick: In general, this set is not a $\sigma$-algebra. However, I think it is a monotone class (at least when you restrict to the case of finite measures, and then the $\sigma$-finite case follows easily). – Nate Eldredge Nov 4 '17 at 14:33
• I took away the probability-measures tag since you said you want $\sigma$-finite signed measures. – Nate Eldredge Nov 4 '17 at 14:39
• Also, I am guessing the $\sigma$-finite assumption should say that $|\rho_i|(\Omega_j) < \infty$, etc? – Nate Eldredge Nov 4 '17 at 14:40

Suppose first that $\rho_1, \rho_2$ are finite signed measures. Then the collection $\mathcal{M} = \{A \in \mathcal{F} : \rho_1(A) \le \rho_2(A)\}$ is easily seen to be a monotone class (because countably additive finite signed measures are continuous from above and from below). By the monotone class theorem, since $\mathcal{F}_0 \subset \mathcal{M}$ by assumption, we conclude $\mathcal{F} = \sigma(\mathcal{F}_0) \subset \mathcal{M}$, which is the desired statement.
In the $\sigma$-finite case, consider the finite measures $\rho_i^j(A) = \rho_i(A \cap \Omega_j)$ which are, in effect, the restriction of $\rho_i$ to $\Omega_j$. By applying the above to $\rho_i^j$, conclude that $$\rho_1(A \cap \Omega_j) = \rho_1^j(A) \le \rho_2^j(A) = \rho_2(A \cap \Omega_j)$$ for all $A \in \mathcal{F}$. Now use continuity from below once more.
(I assume $\sigma$-finite here means that the positive parts of $\rho_i$ are $\sigma$-finite and the negative parts are finite, or vice versa. If both parts are potentially non-finite then you have problems with additivity because you can get $\infty - \infty$.)
• Thanks! But in the $\sigma$-finite case, I don't know how to conclude that $\rho_1(A\cap\Omega_j)\le \rho_2(A\cap\Omega_j)$, though we know that $\rho_1(A)\le \rho_2(A)$ and $\rho_1(\Omega_j)\le \rho_2(\Omega_j)$. Could you add some details? Thanks! – mygreatwall Nov 4 '17 at 16:26


text:
Vol. 10, No. 1, 2016

 Download this issue For screen For printing
 Recent Issues
 The Journal About the Journal Editorial Board Editors’ Interests Subscriptions Submission Guidelines Submission Form Policies for Authors Ethics Statement ISSN: 1944-7833 (e-only) ISSN: 1937-0652 (print) Author Index To Appear Other MSP Journals
Stable sets of primes in number fields
1–36

Alexander Ivanov

Hopf–Galois structures arising from groups with unique subgroup of order $p$
37–59

Timothy Kohl

On tensor factorizations of Hopf algebras
61–87

Marc Keilberg and Peter Schauenburg

Extension theorems for reductive group schemes
89–115

Actions of some pointed Hopf algebras on path algebras of quivers
117–154

Ryan Kinser and Chelsea Walton

On the image of the Galois representation associated to a non-CM Hida family
155–194

Jaclyn Lang

Linear relations in families of powers of elliptic curves
195–214


text:
# Dynamical energy analysis

Dynamical energy analysis (DEA)[1] is a method for numerically modelling structure borne sound and vibration in complex structures. It is applicable in the mid-to-high frequency range and is in this regime computational more efficient than traditional deterministic approaches (such as finite element and boundary element methods). In comparison to conventional statistical approaches such as statistical energy analysis (SEA),[2] DEA provides more structural details and is less problematic with respect to subsystem division. The DEA method predicts the flow of vibrational wave energy across complex structures in terms of (linear) transport equations. These equations are then discretized and solved on meshes.

## Key point summary of DEA

• High frequency method in numerical acoustics.
• The flow of energy is tracked across a mesh. Can be thought of as ray tracing using density of rays instead of individual rays.
• Can use existing FEM meshes. No remodelling necessary.
• Computational time is independent of frequency.
• The necessary mesh resolution does not depend on frequency and can be chosen coarser than in FEM. It only should resolve the geometry.
• Fine structural details can be resolved, in contrast to SEA which gives only one number per subsystem.
• Greater flexibility for the models usable by DEA. No implicit assumptions (equilibrium in weakly coupled subsystems) as in SEA.

## Introduction

This image describes the range of applicability of dynamical energy analysis (DEA) in comparison to statistical energy analysis (SEA) and the finite element method (FEM). Horizontal axis is frequency, vertical axis is complexity of the structure.

Simulations of the vibro-acoustic properties of complex structures (such as cars, ships, airplanes,...) are routinely carried out in various design stages. For low frequencies, the established method of choice is the finite element method (FEM). But high frequency analysis using FEM requires very fine meshes of the body structure to capture the shorter wavelengths and therefore is computational extremely costly. Furthermore the structural response at high frequencies is very sensitive to small variations in material properties, geometry and boundary conditions. This makes the output of a single FEM calculation less reliable and makes ensemble averages necessary furthermore enhancing computational cost. Therefore at high frequencies other numerical methods with better computational efficiency are preferable.

The statistical energy analysis (SEA)[2] has been developed to deal with high frequency problems and leads to relatively small and simple models. However, SEA is based on a set of often hard to verify assumptions, which effectively require diffuse wave fields and quasi-equilibrium of wave energy within weakly coupled (and weakly damped) sub-systems.

One alternative to SEA is to instead consider the original vibrational wave problem in the high frequency limit, leading to a ray tracing model of the structural vibrations.[note 1] The tracking of individual rays across multiple reflection is not computational feasible because of the proliferation of trajectories. Instead, a better approach is tracking densities of rays propagated by a transfer operator. This forms the basis of the Dynamical Energy Analysis (DEA) method introduced in reference.[3] DEA can be seen as an improvement over SEA where one lifts the diffusive field and the well separated subsystem assumption. One uses an energy density which depends both on position and momentum. DEA can work with relatively fine meshes where energy can flow freely between neighboring mesh cells. This allows far greater flexibility for the models used by DEA in comparison to the restriction imposed by SEA. No remodeling as for SEA is necessary as DEA can use meshes created for a FE analysis. As a result, finer structural details than SEA can be resolved by DEA.

## Method

The implementation of DEA on meshes is called Discrete Flow Mapping (DFM). We will here briefly describe the idea behind DFM, for details see the references[1] [3] [4] [5] [6] [7] below. Using DFM it is possible to compute vibro-acoustic energy densities in complex structures at high frequencies, including multi-modal propagation and curved surfaces. DFM is a mesh based technique where a transfer operator is used to describe the flow of energy through boundaries of subsystems of the structure; the energy flow is represented in terms of a density of rays ${\displaystyle \rho }$, that is, the energy flux through a given surface is given through the density of rays passing through the surface at point ${\displaystyle s}$ with direction ${\displaystyle p}$. Here, ${\displaystyle s}$ parametrises the surface and ${\displaystyle p}$ is the direction component tangential to the surface. In what follows, the surfaces is represented by the union of all boundaries of the mesh cells of the FE mesh describing the car floor. The density ${\displaystyle \rho (s,p)=\rho (X_{s})}$, with phase space coordinate ${\displaystyle X_{s}=(s,p)}$, is transported from one boundary to the adjacent boundary intersection via the boundary integral operator

${\displaystyle {\mathcal {B}}[\rho ](X'_{s}):=\int w(X'_{s})\delta (X'_{s}-\phi (X_{s}))\rho (X_{s})\,\mathrm {d} X_{s}}$

(1)

where ${\displaystyle \phi (X_{s})}$ is the map determining where a ray starting on a boundary segment at point ${\displaystyle s}$ with direction ${\displaystyle p_{s}}$ passes through another boundary segment, and ${\displaystyle w(X_{s})}$ is a factor containing damping and reflection/transmission coefficients (akin to the coupling loss factors in SEA). It also governs the mode conversion probabilities in the case of both in-plane and flexural waves, which are derived from wave scattering theory (see[8]). This allows DEA to take curvature and varying material parameters into account. Equation (1) is a way to write ray tracing across one single mesh cell in terms of an integral equation transferring an energy density from one surface to an adjacent surface.

In a next step, the transfer operator (1) is discretised using a set of basis functions of the phase space. Once the matrix ${\displaystyle {\bf {B}}}$ has been constructed, the final energy density ${\displaystyle \rho }$ on the boundary phase-space of each element is given in terms of the initial density ${\displaystyle \rho _{0}}$ by the solution of a linear system of the form

${\displaystyle ({\bf {1}}-{\bf {B}})\rho =\rho _{0}.}$

(2)

The initial density ${\displaystyle \rho _{0}}$ models some source distribution for vibrational excitations, for example the engine in ship. Once the final density ${\displaystyle \rho }$ (describing the energy density on all cell boundaries) has been computed, the energy density at any location inside the structure may be computed as a post-processing step.

Concerning the terminology, there is some ambiguity concerning the terms "Discrete Flow Mapping(DFM)" and "Dynamical Energy Analysis". To some extent, one can use one term in place of the other. For example, consider a plate. In DFM, one would subdivide the plate into many small triangles and propagate the flow of energy from triangle to (neighbouring) triangle. In DEA, one would not subdivide the plate, but use some high order basis functions (both in position and momentum) on the boundary of the plate. But in principle it would be admissible to describe both procedures as either DFM or DEA.

## Examples

This image compares the results from Dynamical Energy Analysis (DEA) with that of frequency averaged FEM. Shown is the kinetic energy distribution resulting from a point excitation on a carfloor panel on a logarithmic color scale.

As an example application, a simulation[9] [10] of a carfloor panel is shown here. A point excitation at 2500 Hz with 0.04 hysteretic damping was applied. The results from a frequency averaged FEM simulation are compared with a DEA simulation (for DEA, no frequency averaging is necessary). The results also show a good quantitative agreement. In particular, we see the directional dependence of the energy flow, which is predominantly in the horizontal direction as plotted. This is caused by several horizontally extended out-of-plane bulges. It is only in the lower right part of the panel, with negligible energy content, that deviations between the FEM and DFM predictions are visible. The total kinetic energy given by the DFM prediction is within 12% of the FEM prediction. For more details, see the cited works.

This image shows the result of a DEA simulation on a model of a Yanmar tractor. Shown is the out-of-plane acceleration on a logarithmic color scale for a frequency of 1000 Hz.

As a more applied example, the result of a DEA simulation[11] on a Yanmar tractor model (body in blue: chassis/cabin steel frame and windows) is shown here to the left. In the cited work, the numerical DEA results are compared with experimental measurements at frequencies between 400 Hz and 4000 Hz for an excitation on the back of the gear casing. Both results agree favorably. The DEA simulation can be extended to predict the sound pressure level at driver's ear.

## Notes

1. ^ Well known examples for this mechanism are the transition from quantum mechanics to classical mechanics and the transition from electromagnetic wave dynamics to light rays.

## References

1. ^ a b Bajars, J.; Chappell, D.J.; Hartmann, T.; Tanner, G. (2017). "Improved Approximation of Phase-Space Densities on Triangulated Domains Using Discrete Flow Mapping with p-Refinement". Journal of Scientific Computing. 72: 1290–1312. doi:10.1007/s10915-017-0397-8.
2. ^ a b Lyon, R.H.; DeJong, R.G. (1995). Theory and Application of Statistical Energy Analysis. Butterworth-Heinemann.
3. ^ a b Tanner, G. (2009). "Dynamical energy analysis—Determining wave energy distributions in vibro-acoustical structures in the high-frequency regime". Journal of Sound and Vibration. 320: 1023–1038. arXiv:. Bibcode:2009JSV...320.1023T. doi:10.1016/j.jsv.2008.08.032.
4. ^ Chappell, D.J.; Tanner, G. (2013). "Solving the stationary Liouville equation via a boundary element method". Journal of Computational Physics. 234: 487–498. arXiv:. Bibcode:2013JCoPh.234..487C. doi:10.1016/j.jcp.2012.10.002.
5. ^ Chappell, D.J.; Tanner, G.; Giani, G. (2012). "Boundary element dynamical energy analysis: A versatile method for solving two or three dimensional wave problems in the high frequency limit". Journal of Computational Physics. 231: 6181–6191. arXiv:. Bibcode:2012JCoPh.231.6181C. doi:10.1016/j.jcp.2012.05.028.
6. ^ Chappell, D.J.; Tanner, G.; Löchel, D.; Søndergaard, N. (2013). "Discrete flow mapping: transport of phase space densities on triangulated surfaces". Proc. R. Soc. A. 469: 20130153. arXiv:. Bibcode:2013RSPSA.46930153C. doi:10.1098/rspa.2013.0153.
7. ^ Chappell, D.J.; Löchel, D.; Søndergaard, N.; Tanner, G. (2014). "Dynamical energy analysis on mesh grids: A new tool for describing the vibro-acoustic response of complex mechanical structures". Wave Motion. 51: 589–597. doi:10.1016/j.wavemoti.2014.01.004.
8. ^ Langley, R.S.; Heron, K.H. (1990). "Elastic wave transmission through plate/beam junctions". J. Sound Vib. 143: 241–253. Bibcode:1990JSV...143..241L. doi:10.1016/0022-460X(90)90953-W.
9. ^ Hartmann, Timo; Tanner, Gregor; Xie, Gang; Chappell, David; Bajars, Janis (2016). Modelling of high-frequency structure-borne sound transmission on FEM grids using the Discrete Flow Mapping technique. MoVic-RASD 2016.
10. ^ Hartmann, Timo; Xie, Gang; Bajars, Janis; Chappell, David; Tanner, Gregor (2016). Vibro-acoustic energy flow through spot-welds in Dynamical Energy Analysis (PDF). Internoise 2016.
11. ^ Hartmann, Timo; Satoshi, Morita; Tanner, Gregor; Chappell, David; Chronopoulos, Dimitrios (2016). High-frequency structure-borne sound transmission on an FE mesh for a tractor model using Dynamical Energy Analysis. ISMA 2016.