text:
# Keras Visualization Toolkit

keras-vis is a high-level toolkit for visualizing and debugging your trained keras neural net models. Currently supported visualizations include:

• Activation maximization
• Saliency maps
• Class activation maps

All visualizations by default support N-dimensional image inputs. i.e., it generalizes to N-dim image inputs to your model.

The toolkit generalizes all of the above as energy minimization problems with a clean, easy to use, and extendable interface. Compatible with both theano and tensorflow backends with 'channels_first', 'channels_last' data format.

## Getting Started

In image backprop problems, the goal is to generate an input image that minimizes some loss function. Setting up an image backprop problem is easy.

Define weighted loss function

Various useful loss functions are defined in losses. A custom loss function can be defined by implementing Loss.build_loss.

from vis.losses import ActivationMaximization
from vis.regularizers import TotalVariation, LPNorm

filter_indices = [1, 2, 3]

# Tuple consists of (loss_function, weight)
losses = [
(ActivationMaximization(keras_layer, filter_indices), 1),
(LPNorm(model.input), 10),
(TotalVariation(model.input), 10)
]

Configure optimizer to minimize weighted loss

In order to generate natural looking images, image search space is constrained using regularization penalties. Some common regularizers are defined in regularizers. Like loss functions, custom regularizer can be defined by implementing Loss.build_loss.

from vis.optimizer import Optimizer

optimizer = Optimizer(model.input, losses)

Concrete examples of various supported visualizations can be found in examples folder.

## Installation

1) Install keras with theano or tensorflow backend. Note that this library requires Keras > 2.0

2) Install keras-vis

From sources

sudo python setup.py install

PyPI package

sudo pip install keras-vis

## Visualizations

NOTE: The links are currently broken and the entire documentation is being reworked. Please see examples/ for samples.

Neural nets are black boxes. In the recent years, several approaches for understanding and visualizing Convolutional Networks have been developed in the literature. They give us a way to peer into the black boxes, diagnose mis-classifications, and assess whether the network is over/under fitting.

Guided backprop can also be used to create trippy art, neural/texture style transfer among the list of other growing applications.

Various visualizations, documented in their own pages, are summarized here.

### Conv filter visualization

Convolutional filters learn 'template matching' filters that maximize the output when a similar template pattern is found in the input image. Visualize those templates via Activation Maximization.

### Dense layer visualization

How can we assess whether a network is over/under fitting or generalizing well?

### Attention Maps

How can we assess whether a network is attending to correct parts of the image in order to generate a decision?

### Generating animated gif of optimization progress

It is possible to generate an animated gif of optimization progress by leveraging callbacks. Following example shows how to visualize the activation maximization for 'ouzel' class (output_index: 20).

from vis.losses import ActivationMaximization
from vis.regularizers import TotalVariation, LPNorm
from vis.modifiers import Jitter
from vis.optimizer import Optimizer

from vis.callbacks import GifGenerator
from vis.utils.vggnet import VGG16

# Build the VGG16 network with ImageNet weights
model = VGG16(weights='imagenet', include_top=True)

# The name of the layer we want to visualize
# (see model definition in vggnet.py)
layer_name = 'predictions'
layer_dict = dict([(layer.name, layer) for layer in model.layers[1:]])
output_class = [20]

losses = [
(ActivationMaximization(layer_dict[layer_name], output_class), 2),
(LPNorm(model.input), 10),
(TotalVariation(model.input), 10)
]
opt = Optimizer(model.input, losses)
opt.minimize(max_iter=500, verbose=True, image_modifiers=[Jitter()], callbacks=[GifGenerator('opt_progress')])

Notice how the output jitters around? This is because we used Jitter, a kind of ImageModifier that is known to produce crisper activation maximization images. As an exercise, try:

• Without Jitter
• Varying various loss weights

## Citation

Please cite keras-vis in your publications if it helped your research. Here is an example BibTeX entry:

@misc{raghakotkerasvis,
title={keras-vis},
author={Kotikalapudi, Raghavendra and contributors},
year={2017},
publisher={GitHub},
howpublished={\url{https://github.com/raghakot/keras-vis}},
}


text:
Question on spherical integration

1. Nov 4, 2013

PsychonautQQ

1. The problem statement, all variables and given/known data
So if you integrate over a spherical area, say a ball of radius 1, then 0≤p≤1, 0≤θ≤2∏, and 0≤∅≤∏. My question is why don't you integrate ∅ between 0 and 2∏? I mean if you are integrating over a sphere then you have to go around it vertically AND horizontally completely? wouldn't both the angles be from 0 to 2∏?

Thanks genius's :D

edit: does it have something to do with the fact that you add a p^2sin(phi) when integrating in spherical coordinates?

2. Nov 4, 2013

Staff: Mentor

No, it's much simpler than that.

A point (r, θ) describes any point in the horizontal plane, and as you know, 0 ≤ θ ≤ $2\pi$. To describe a point in space, and we can do this by adding a 3rd coordinate, $\phi$. All we need to identify this point in space is a direction angle, $\phi$. Keep in mind that $\phi$ is measured from the positive z-axis, so having a range of [0, $\pi$] gets us all the way from straight up to straight down.

Note that r is the distance from the origin to the point in polar and cylindrical coordinates. In spherical coordinates, the distance from the origin to the point is ρ, "rho."

format: plain


text:
# Definition of wigner D matrix

1. Mar 30, 2012

### sunjin09

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

I'm not sure if this is the appropriate board, but quantum mechanics people surely know about spherical harmonics. I need to implement the Wigner D matrix to do spherical harmonic rotations. I am looking at
http://en.wikipedia.org/wiki/Wigner_D-matrix#Wigner_.28small.29_d-matrix
for the definition, since I'm not a quantum mechanics guy, I need to verify whether this definition of the Wigner D matrix correspond to the rotation of the spherical harmonics itself or the coordinate system? In other words, if
$$u(\theta,\phi)=\sum_ma_mY_l^m(\theta,\phi)$$
then does
$$u(\theta', \phi')=\sum_{m'}b_{m'}Y_l^{m'}(\theta', \phi')$$
where $b_{m'}=\sum_md^l_{m',m}(\beta)a_m$, correspond to the same function u under the new coordinates rotated around y axis by β? $d^l_{m',m}(\beta)$ is the small d matrix element.
Further more, I assume the spherical harmonics Ylm is the standard definition where Y_l^(-m)=(-1)^mY_l^m*? Thank you for your patience.

2. Relevant equations

3. The attempt at a solution


text:
# Testing statistically significant difference between samples

I have 1 variable measured for 8 samples. so, for e.g. height of 8 men. I want to say something about: if height of men is significantly different amongst them. How can I do this?

Without any reference theoretical mean, I can not do a simple t-test.

-
As is, this question is unanswerable, as far as I can tell. You have the height of 8 men. If that's all you have, you cannot do any statistical testing. You could find the mean and standard deviation and so on. "Statistically different amongst them" is not a hypothesis, so it can't be tested. Also, with only 8 people, even if you had another variable (age, race, political party, whatever) it would take an absolutely huge effect size to find statistical significance. –  Peter Flom Dec 16 '12 at 14:54
I changed "parameter" to "variable"; probably "sample" should be "subjects" as well. –  Peter Flom Dec 16 '12 at 14:55
Thanks Peter. Indeed, I can add 2 more variables to the height- lets say weight and age. But, is there anyway, i can say that the samples are different or not? Can i do something with mean or median? any suggestions will be helpful. –  abhishek Dec 16 '12 at 14:56
You need to formulate a hypothesis. "Samples are different" is not a hypothesis. If you said "these heights are different from the heights of XXXX" you could test it. XXX could be taken from some general population for which you know the average height. Or you could just take a number (e.g. "these heights are not equal to 175 cm". –  Peter Flom Dec 16 '12 at 15:02
thanks again. I got the point. –  abhishek Dec 16 '12 at 15:20


text:
# Problem Solving

## No 01

The given diagram shows the graph $$y = f(x)$$.

The curve undergoes in succession, the following transformations:

• A translation of 3 units in the negative direction of the x-axis
• A scaling parallel to the x-axis by a factor $$\frac 12$$

Find the equation of the resulting curve in the form $$y = f(ax + b)$$ where a and b are constants to be found.

Sketch the graph of the resulting equation.


text:
282 views

Rectangular tiles each of size $70$ cm by $30$ cm must be laid horizontally on a rectangular floor of size $110$ cm by $130$ cm, such that the tiles do not overlap. A tile can be placed in any orientation so long as its edges are parallel to the edges on the floor. No tile should overshoot any edge of the floor. The maximum number of tiles that can be accommodated on the floor is

1. $4$
2. $5$
3. $6$
4. $7$

1
449 views


text:
GMAT Changed on April 16th - Read about the latest changes here

 It is currently 22 Apr 2018, 22:33

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

# If a square region has area x, what is the length of the diagonal of

Author Message
TAGS:

### Hide Tags

Board of Directors
Joined: 01 Sep 2010
Posts: 3414
If a square region has area x, what is the length of the diagonal of [#permalink]

### Show Tags

28 May 2017, 04:01
Top Contributor
2
This post was
BOOKMARKED
00:00

Difficulty:

25% (medium)

Question Stats:

64% (00:31) correct 36% (00:22) wrong based on 85 sessions

### HideShow timer Statistics

If a square region has area x, what is the length of its diagonal in terms of x ?

A) $$\sqrt{x}$$

B) $$\sqrt{2x}$$

C) $$2 \sqrt{x}$$

D) $$x \sqrt{2}$$

E) $$2x$$
[Reveal] Spoiler: OA

_________________
Director
Joined: 18 Aug 2016
Posts: 631
Re: If a square region has area x, what is the length of the diagonal of [#permalink]

### Show Tags

28 May 2017, 04:07
B as the diagonal of a square with side a is sqrt(2) * a. Here a is sqrt(x)

Sent from my iPhone using GMAT Club Forum
_________________

We must try to achieve the best within us

Thanks
Luckisnoexcuse

Math Expert
Joined: 02 Sep 2009
Posts: 44609
Re: If a square region has area x, what is the length of the diagonal of [#permalink]

### Show Tags

28 May 2017, 04:13
carcass wrote:
If a square region has area x, what is the length of its diagonal in terms of x ?

A) $$\sqrt{x}$$

B) $$\sqrt{2x}$$

C) $$2 \sqrt{x}$$

D) $$x \sqrt{2}$$

E) $$2x$$

Are of a square = $$\frac{diagonal^2}{2}$$.

Given: $$\frac{diagonal^2}{2}=x$$;

$$diagonal=\sqrt{2x}$$.

_________________
Senior Manager
Joined: 09 Mar 2016
Posts: 441
Re: If a square region has area x, what is the length of the diagonal of [#permalink]

### Show Tags

09 Apr 2018, 02:01
Bunuel wrote:
carcass wrote:
If a square region has area x, what is the length of its diagonal in terms of x ?

A) $$\sqrt{x}$$

B) $$\sqrt{2x}$$

C) $$2 \sqrt{x}$$

D) $$x \sqrt{2}$$

E) $$2x$$

Are of a square = $$\frac{diagonal^2}{2}$$.

Given: $$\frac{diagonal^2}{2}=x$$;

$$diagonal=\sqrt{2x}$$.

Hello Bunuel isnt the formula of the area of square $$a^2$$ where $$a$$ is side of square ?

is it another formula ? $$\frac{diagonal^2}{2}$$. does diagonal of square mean $$a\sqrt{2}$$ cause you write so $$diagonal^2$$

have a great monday
Math Expert
Joined: 02 Sep 2009
Posts: 44609
Re: If a square region has area x, what is the length of the diagonal of [#permalink]

### Show Tags

09 Apr 2018, 02:05
1
KUDOS
Expert's post
dave13 wrote:
Bunuel wrote:
carcass wrote:
If a square region has area x, what is the length of its diagonal in terms of x ?

A) $$\sqrt{x}$$

B) $$\sqrt{2x}$$

C) $$2 \sqrt{x}$$

D) $$x \sqrt{2}$$

E) $$2x$$

Are of a square = $$\frac{diagonal^2}{2}$$.

Given: $$\frac{diagonal^2}{2}=x$$;

$$diagonal=\sqrt{2x}$$.

Hello Bunuel isnt the formula of the area of square $$a^2$$ where $$a$$ is side of square ?

is it another formula ? $$\frac{diagonal^2}{2}$$. does diagonal of square mean $$a\sqrt{2}$$ cause you write so $$diagonal^2$$

have a great monday

Yes, the area of a square could also be found by $$\frac{diagonal^2}{2}$$.
_________________
Re: If a square region has area x, what is the length of the diagonal of   [#permalink] 09 Apr 2018, 02:05
Display posts from previous: Sort by


text:
# Isoperimetric inequalities in unbounded convex bodies

created by leonardi on 13 Jun 2016

[BibTeX]

Preprint

Inserted: 13 jun 2016
Last Updated: 13 jun 2016

Year: 2016

Abstract:

We consider the problem of minimizing the relative perimeter under a volume constraint in an unbounded convex body $C\subset {\mathbb R}^{n+1}$, without assuming any further regularity on the boundary of $C$. Motivated by an example of an unbounded convex body with null isoperimetric profile, we introduce the concept of unbounded convex body with \textit{uniform geometry}. We then provide a handy characterization of the uniform geometry property and, by exploiting the notion of \textit{asymptotic cylinder} of $C$, we prove existence of isoperimetric regions in a generalized sense. By an approximation argument we show the strict concavity of the isoperimetric profile and, consequently, the connectedness of generalized isoperimetric regions. We also focus on the cases of small as well as of large volumes; in particular we show existence of isoperimetric regions with sufficiently large volumes, for special classes of unbounded convex bodies. We finally address some questions about isoperimetric rigidity and analyze the asymptotic behavior of the isoperimetric profile in connection with the notion of \textit{isoperimetric dimension}.


text:
# Stephen Hawking

(Redirected from A Brief History of Time)
For millions of years, mankind lived just like the animals. Then something happened which unleashed the power of our imagination. We learned to talk and we learned to listen.
If machines produce everything we need, the outcome will depend on how things are distributed. Everyone can enjoy a life of luxurious leisure if the machine-produced wealth is shared, or most people can end up miserably poor if the machine-owners successfully lobby against wealth redistribution. So far, the trend seems to be toward the second option, with technology driving ever-increasing inequality.

## Quotes

Many people would claim that the boundary conditions are not part of physics but belong to metaphysics or religion. They would claim that nature had complete freedom to start the universe off any way it wanted. That may be so, but it could also have made it evolve in a completely arbitrary and random manner. Yet all the evidence is that it evolves in a regular way according to certain laws.
Consideration of black holes suggests, not only that God does play dice, but that he sometimes confuses us by throwing them where they can't be seen.
We need something new. We can't predict what that will be or when we will find it because if we knew that, we would have found it already!
in chronological order
• The subject of this book is the structure of space-time on length-scales from 10-13cm, the radius of an elementary particle, up to 1028cm, the radius of the universe. ...we base our treatment on Einstein's General Theory of Relativity. This theory leads to two remarkable predictions about the universe: first, that the final fate of massive stars is to collapse behind an event horizon to form a 'black hole' which will contain a singularity; and secondly, that there is a singularity in our past which constitutes, in some sense, a beginning to the universe.
• with G.F.R. Ellis, "The Large Scale Structure of Space-Time" (1973) Preface.
• Many people would claim that the boundary conditions are not part of physics but belong to metaphysics or religion. They would claim that nature had complete freedom to start the universe off any way it wanted. That may be so, but it could also have made it evolve in a completely arbitrary and random manner. Yet all the evidence is that it evolves in a regular way according to certain laws. It would therefore seem reasonable to suppose that there are also laws governing the boundary conditions.
• "The Quantum State of the Universe", Nuclear Physics (1984)
• If you are disabled, it is probably not your fault, but it is no good blaming the world or expecting it to take pity on you. One has to have a positive attitude and must make the best of the situation that one finds oneself in; if one is physically disabled, one cannot afford to be psychologically disabled as well. In my opinion, one should concentrate on activities in which one's physical disability will not present a serious handicap. I am afraid that Olympic Games for the disabled do not appeal to me, but it is easy for me to say that because I never liked athletics anyway. On the other hand, science is a very good area for disabled people because it goes on mainly in the mind. Of course, most kinds of experimental work are probably ruled out for most such people, but theoretical work is almost ideal. My disabilities have not been a significant handicap in my field, which is theoretical physics. Indeed, they have helped me in a way by shielding me from lecturing and administrative work that I would otherwise have been involved in. I have managed, however, only because of the large amount of help I have received from my wife, children, colleagues and students. I find that people in general are very ready to help, but you should encourage them to feel that their efforts to aid you are worthwhile by doing as well as you possibly can.
• My goal is simple. It is a complete understanding of the universe, why it is as it is and why it exists at all.
• There ought to be something very special about the boundary conditions of the universe and what can be more special than that there is no boundary?
• What I have done is to show that it is possible for the way the universe began to be determined by the laws of science. In that case, it would not be necessary to appeal to God to decide how the universe began. This doesn't prove that there is no God, only that God is not necessary.
• Der Spiegel (17 October 1988).
• We are just an advanced breed of monkeys on a minor planet of a very average star. But we can understand the Universe. That makes us something very special.
• Der Spiegel (17 October 1988).
• On seeing the Enterprise's warp engine while visiting the set of Star Trek: The Next Generation (where he would briefly play himself in the 1993 episode Descent, Part I), Hawking smiled and said: I'm working on that.
• Quoted in The Star Trek Encyclopedia (1999) by Michael Okuda and Denise Okuda, p. 185.
• For millions of years, mankind lived just like the animals. Then something happened which unleashed the power of our imagination. We learned to talk and we learned to listen. Speech has allowed the communication of ideas, enabling human beings to work together to build the impossible. Mankind's greatest achievements have come about by talking, and its greatest failures by not talking. It doesn't have to be like this. Our greatest hopes could become reality in the future. With the technology at our disposal, the possibilities are unbounded. All we need to do is make sure we keep talking.
• [discussing Roger Penrose] These lectures have shown very clearly the difference between Roger and me. He's a Platonist and I'm a positivist. He's worried that Schrödinger's cat is in a quantum state, where it is half alive and half dead. He feels that can't correspond to reality. But that doesn't bother me. I don't demand that a theory correspond to reality because I don't know what it is. Reality is not a quality you can test with litmus paper. All I'm concerned with is that the theory should predict the results of measurements. Quantum theory does this very successfully. It predicts that the result of an observation is either that the cat is alive or that it is dead. It is like you can't be slightly pregnant: you either are or you aren't.
• I don't believe that the ultimate theory will come by steady work along existing lines. We need something new. We can't predict what that will be or when we will find it because if we knew that, we would have found it already! It could come in the next 20 years, but we might never find it.
• Science Watch (September 1994).
• The human race is just a chemical scum on a moderate-sized planet, orbiting around a very average star in the outer suburb of one among a hundred billion galaxies. We are so insignificant that I can't believe the whole universe exists for our benefit. That would be like saying that you would disappear if I closed my eyes.
• I think computer viruses should count as life … I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
• It is not clear that intelligence has any long-term survival value.
Although September 11 was horrible, it didn't threaten the survival of the human race, like nuclear weapons do.
• All my life, I have been fascinated by the big questions that face us, and have tried to find scientific answers to them.
• From the 1997 television program Stephen Hawking's Universe
• Unsourced variant: All of my life, I have been fascinated by the big questions that face us, and have tried to find scientific answers to them. Perhaps that is why I have sold more books on physics than Madonna has on sex. This quote seems to combine the above sentence from Stephen Hawking's Universe with a statement from the Foreword to The Illustrated Brief History of Time: As Nathan Myhrvold of Microsoft (a former post-doc of mine) remarked: I have sold more books on physics than Madonna has on sex.
• The world has changed far more in the past 100 years than in any other century in history. The reason is not political or economic but technological — technologies that flowed directly from advances in basic science.
• One might think this means that imaginary numbers are just a mathematical game having nothing to do with the real world. From the viewpoint of positivist philosophy, however, one cannot determine what is real. All one can do is find which mathematical models describe the universe we live in. It turns out that a mathematical model involving imaginary time predicts not only effects we have already observed but also effects we have not been able to measure yet nevertheless believe in for other reasons. So what is real and what is imaginary? Is the distinction just in our minds?
• Although September 11 was horrible, it didn't threaten the survival of the human race, like nuclear weapons do.
I don't think the human race will survive the next thousand years, unless we spread into space...
• I don't think the human race will survive the next thousand years, unless we spread into space. There are too many accidents that can befall life on a single planet. But I'm an optimist. We will reach out to the stars.
• "Colonies in space may be only hope, says Hawking" by Roger Highfield in Daily Telegraph (16 October 2001).
• We shouldn't be surprised that conditions in the universe are suitable for life, but this is not evidence that the universe was designed to allow for life. We could call order by the name of God, but it would be an impersonal God. There's not much personal about the laws of physics.
• I have no idea. People who boast about their IQ are losers.
• Response upon being questioned as to his IQ, in interview with Deborah Solomon "The Science of Second-Guessing", The New York Times (12 December 2004).
• Life would be tragic if it weren't funny.
• As quoted in "The Science of Second-Guessing", The New York Times (12 December 2004).
• My expectations were reduced to zero when I was 21. Everything since then has been a bonus.
• As quoted in "The Science of Second-Guessing", The New York Times (12 December 2004)
• Unsourced variant: "When one's expectations are reduced to zero, one really appreciates everything one does have."
• The life we have on Earth must have spontaneously generated itself. It must therefore be possible for life to generate spontaneously elsewhere in the universe.
I'm sorry to disappoint science fiction fans, but if information is preserved, there is no possibility of using black holes to travel to other universes. If you jump into a black hole, your mass energy will be returned to our universe but in a mangled form which contains the information about what you were like but in a state where it can not be easily recognized.
• I'm sorry to disappoint science fiction fans, but if information is preserved, there is no possibility of using black holes to travel to other universes. If you jump into a black hole, your mass energy will be returned to our universe but in a mangled form which contains the information about what you were like but in a state where it can not be easily recognized. It is like burning an encyclopedia. Information is not lost, if one keeps the smoke and the ashes. But it is difficult to read. In practice, it would be too difficult to re-build a macroscopic object like an encyclopedia that fell inside a black hole from information in the radiation, but the information preserving result is important for microscopic processes involving virtual black holes.
• Evolution has ensured that our brains just aren't equipped to visualise 11 dimensions directly. However, from a purely mathematical point of view it's just as easy to think in 11 dimensions, as it is to think in three or four.
• I think that it's important for scientists to explain their work, particularly in cosmology. This now answers many questions once asked of religion.
• As quoted in "Return of the time lord" in The Guardian (27 September 2005).
• It is a waste of time to be angry about my disability. One has to get on with life and I haven't done badly. People won't have time for you if you are always angry or complaining.
• As quoted in "Return of the time lord" in The Guardian (27 September 2005).
Equations are just the boring part of mathematics. I attempt to see things in terms of geometry.
• Equations are just the boring part of mathematics. I attempt to see things in terms of geometry.
• As quoted in Stephen Hawking: A Biography (2005) by Kristine Larsen, p. 43.
• The victim should have the right to end his life, if he wants. But I think it would be a great mistake. However bad life may seem, there is always something you can do, and succeed at. While there's life, there is hope.
• The danger is that global warming may become self-sustaining, if it has not done so already. The melting of the Arctic and Antarctic ice caps reduces the fraction of solar energy reflected back into space, and so increases the temperature further. Climate change may kill off the Amazon and other rain forests, and so eliminate once one of the main ways in which carbon dioxide is removed from the atmosphere. The rise in sea temperature may trigger the release of large quantities of carbon dioxide, trapped as hydrides on the ocean floor. Both these phenomena would increase the greenhouse effect, and so global warming further. We have to reverse global warming urgently, if we still can.
• ABC News interview (16 August 2006).
• As scientists, we understand the dangers of nuclear weapons and their devastating effects, and we are learning how human activities and technologies are affecting climate systems in ways that may forever change life on Earth. As citizens of the world, we have a duty to alert the public to the unnecessary risks that we live with every day, and to the perils we foresee if governments and societies do not take action now to render nuclear weapons obsolete and to prevent further climate change... There’s a realization that we are changing our climate for the worse. That would have catastrophic effects. Although the threat is not as dire as that of nuclear weapons right now, in the long term we are looking at a serious threat.
• I'm not religious in the normal sense. I believe the universe is governed by the laws of science. The laws may have been decreed by God, but God does not intervene to break the laws.
• In a world that is in chaos politically, socially and environmentally, how can the human race sustain another 100 years?
• Open question, posted to the Internet, as quoted in The Guardian, and "Watching the World" in Awake! magazine (June 2007); a month after posting the question he explained: I don’t know the answer. That is why I asked the question, to get people to think about it, and to be aware of the dangers we now face.
• To confine our attention to terrestrial matters would be to limit the human spirit.
• From Hawking's Foreward to The Physics of Star Trek by Lawrence Krauss (2007), p. xiii.
• I have lived with the prospect of an early death for the last 49 years. I'm not afraid of death, but I'm in no hurry to die. I have so much I want to do first... I regard the brain as a computer which will stop working when its components fail. There is no heaven or afterlife for broken down computers; that is a fairy story for people afraid of the dark.
• The Dreams that stuff is made of
• The Dreams that Stuff is Made of, the title of a collection by Hawking of the most earth shaking papers in Quantum mechanics, 2011.
• [In response to a question on how we should live] We should seek the greatest value of our action.
• name="TG-20110515" />
• Science predicts that many different kinds of universe will be spontaneously created out of nothing. It is a matter of chance which we are in.
• I believe that disabled people should concentrate on things that their handicap doesn’t prevent them from doing and not regret those they can’t do…I visited the Soviet Union seven times. The first time I went with a student party in which one member, a Baptist, wished to distribute Russian-language Bibles and asked us to smuggle them in. We managed this undetected, but by the time we were on our way out the authorities had discovered what we had done and detained us for a while. However, to charge us with smuggling Bibles would have caused an international incident and unfavorable publicity, so they let us go after a few hours.
• The development of full artificial intelligence could spell the end of the human race. We cannot quite know what will happen if a machine exceeds our own intelligence, so we can't know if we'll be infinitely helped by it, or ignored by it and sidelined, or conceivably destroyed by it.

### A Brief History of Time (1988)

The whole history of science has been the gradual realization that events do not happen in an arbitrary manner, but that they reflect a certain underlying order, which may or may not be divinely inspired.
• Someone told me that each equation I included in the book would halve the sales. I therefore resolved not to have any equations at all. In the end, however, I did put in one equation, Einstein's famous equation, ${\displaystyle E=mc^{2}}$. I hope that this will not scare off half of my potential readers.
• Any physical theory is always provisional, in the sense that it is only a hypothesis: you can never prove it. No matter how many times the results of experiments agree with some theory, you can never be sure that the next time the result will not contradict the theory. On the other hand, you can disprove a theory by finding even a single observation that disagrees with the predictions of the theory. As philosopher of science Karl Popper has emphasized, a good theory is characterized by the fact that it makes a number of predictions that could in principle be disproved or falsified by observation. Each time new experiments are observed to agree with the predictions the theory survives, and our confidence in it is increased; but if ever a new observation is found to disagree, we have to abandon or modify the theory.
• Ch. 1.
• It has certainly been true in the past that what we call intelligence and scientific discovery have conveyed a survival advantage. It is not so clear that this is still the case: our scientific discoveries may well destroy us all, and even if they don’t, a complete unified theory may not make much difference to our chances of survival. However, provided the universe has evolved in a regular way, we might expect that the reasoning abilities that natural selection has given us would be valid also in our search for a complete unified theory, and so would not lead us to the wrong conclusions.
• Ch. 1.
• Bodies like the earth are not made to move on curved orbits by a force called gravity; instead, they follow the nearest thing to a straight path in a curved space, which is called a geodesic. A geodesic is the shortest (or longest) path between two nearby points.
• Ch. 2
I still believe there are grounds for cautious optimism that we may now be near the end of the search for the ultimate laws of nature.
• The whole history of science has been the gradual realization that events do not happen in an arbitrary manner, but that they reflect a certain underlying order, which may or may not be divinely inspired.
• Ch. 8.
• Galileo, perhaps more than any other single person, was responsible for the birth of modern science.
• p. 179.
• One could say: "The boundary condition of the universe is that it has no boundary." The universe would be completely self-contained and not affected by anything outside itself. It would neither be created nor destroyed. It would just BE.
• Ch. 8.
• Just like a computer, we must remember things in the order in which entropy increases. This makes the second law of thermodynamics almost trivial. Disorder increases with time because we measure time in the direction in which disorder increases. You can’t have a safer bet than that!
• Ch. 9.
• As I shall describe, the prospects for finding such a theory seem to be much better now because we know so much more about the universe. But we must beware of overconfidence - we have had false dawns before! At the beginning of this century, for example, it was thought that everything could be explained in terms of the properties of continuous matter, such as elasticity and heat conduction. The discovery of atomic structure and the uncertainty principle put an emphatic end to that. Then again, in 1928, physicist and Nobel Prize winner Max Born told a group of visitors to Gottingen University, "Physics, as we know it, will be over in six months." His confidence was based on the recent discovery by Dirac of the equation that governed the electron. It was thought that a similar equation would govern the proton, which was the only other particle known at the time, and that would be the end of theoretical physics. However, the discovery of the neutron and of nuclear forces knocked that one on the head too. Having said this, I still believe there are grounds for cautious optimism that we may now be near the end of the search for the ultimate laws of nature.
• Ch. 11.
• Maybe that is our mistake: maybe there are no particle positions and velocities, but only waves. It is just that we try to fit the waves to our preconceived ideas of positions and velocities.The resulting mismatch is the cause of the apparent unpredictability.
• Ch. 12.
• Even if there is only one possible unified theory, it is just a set of rules and equations. What is it that breathes fire into the equations and makes a universe for them to describe? The usual approach of science of constructing a mathematical model cannot answer the questions of why there should be a universe for the model to describe. Why does the universe go to all the bother of existing?
• Ch. 12.

### Black Holes and Baby Universes and Other Essays (1993)

If we do discover a complete theory, it should in time be understandable in broad principle by everyone, not just a few scientists. Then we shall all, philosophers, scientists, and just ordinary people, be able to take part in the discussion of the question of why it is that we and the universe exist.
• The ultimate objective test of free will would seem to be: Can one predict the behavior of the organism? If one can, then it clearly doesn't have free will but is predetermined. On the other hand, if one cannot predict the behavior, one could take that as an operational definition that the organism has free will … The real reason why we cannot predict human behavior is that it is just too difficult. We already know the basic physical laws that govern the activity of the brain, and they are comparatively simple. But it is just too hard to solve the equations when there are more than a few particles involved … So although we know the fundamental equations that govern the brain, we are quite unable to use them to predict human behavior. This situation arises in science whenever we deal with the macroscopic system, because the number of particles is always too large for there to be any chance of solving the fundamental equations. What we do instead is use effective theories. These are approximations in which the very large number of particles are replaced by a few quantities. An example is fluid mechanics … I want to suggest that the concept of free will and moral responsibility for our actions are really an effective theory in the sense of fluid mechanics. It may be that everything we do is determined by some grand unified theory. If that theory has determined that we shall die by hanging, then we shall not drown. But you would have to be awfully sure that you were destined for the gallows to put to sea in a small boat during a storm. I have noticed that even people who claim everything is predetermined and that we can do nothing to change it, look before they cross the road. … One cannot base one's conduct on the idea that everything is determined, because one does not know what has been determined. Instead, one has to adopt the effective theory that one has free will and that one is responsible for one's actions. This theory is not very good at predicting human behavior, but we adopt it because there is no chance of solving the equations arising from the fundamental laws. There is also a Darwinian reason that we believe in free will: A society in which the individual feels responsible for his or her actions is more likely to work together and survive to spread its values.
• pp. 133–135.
• If we do discover a complete theory, it should in time be understandable in broad principle by everyone, not just a few scientists. Then we shall all, philosophers, scientists, and just ordinary people, be able to take part in the discussion of the question of why it is that we and the universe exist. If we find the answer to that, it would be the ultimate triumph of human reason — for then we would know the mind of God.
• Last lines. Hawking later wrote: "In the proof stage I nearly cut the last sentence in the book... Had I done so, the sales might have been halved.

### The Beginning of Time (1996)

Online text
To show this diagram properly, I would really need a four dimensional screen. However, because of government cuts, we could manage to provide only a two dimensional screen.
• When I gave a lecture in Japan, I was asked not to mention the possible re-collapse of the universe, because it might affect the stock market. However, I can re-assure anyone who is nervous about their investments that it is a bit early to sell: even if the universe does come to an end, it won't be for at least twenty billion years. By that time, maybe the GATT trade agreement will have come into effect.
• The Steady State theory was what Karl Popper would call a good scientific theory: it made definite predictions, which could be tested by observation, and possibly falsified. Unfortunately for the theory, they were falsified.
• To show this diagram properly, I would really need a four dimensional screen. However, because of government cuts, we could manage to provide only a two dimensional screen.
• The universe would have expanded in a smooth way from a single point. As it expanded, it would have borrowed energy from the gravitational field, to create matter. As any economist could have predicted, the result of all that borrowing, was inflation. The universe expanded and borrowed at an ever-increasing rate. Fortunately, the debt of gravitational energy will not have to be repaid until the end of the universe.

### God Created the Integers (2007)

Full title: God Created the Integers: The Mathematical Breakthroughs That Changed History (2007).

• Mathematics is more than a tool and language for science. It is also an end in itself, and as such, it has, over the centuries, affected our worldview in its own right.
• Preface.

### Into The Universe with Stephen Hawking (2010)

• So next time someone complains that you have made a mistake, tell him that may be a good thing. Because without imperfection, neither you nor I would exist.
• If aliens visit us, the outcome would be much as when Columbus landed in America, which didn't turn out well for the Native Americans. … We only have to look at ourselves to see how intelligent life might develop into something we wouldn't want to meet.

### The Grand Design (2010)

• Because there is a law such as gravity, the universe can and will create itself from nothing. Spontaneous creation is the reason there is something rather than nothing, why the universe exists, why we exist. It is not necessary to invoke God to light the blue touch paper and set the universe going.

### Curiosity (2011)

• We are each free to believe what we want and it is my view that the simplest explanation is there is no God. No one created the universe and no one directs our fate. This leads me to a profound realization. There is probably no heaven, and no afterlife either. We have this one life to appreciate the grand design of the universe, and for that, I am extremely grateful. (Quoted from the Discovery Channel, 15 August 2011.)

## Misattributed

• I have hardly ever known a mathematician who was able to reason.
• Plato, The Republic, Book VII, 531-E.
• The greatest enemy of knowledge is not ignorance. It is the illusion of knowledge.
• Sometimes attributed to Hawking without a source, but originally from historian Daniel J. Boorstin. It appears in different forms in The Discoverers (1983), Cleopatra's Nose (1995), and introduction to The Decline and Fall of the Roman Empire (1995)


text:
• Free Trial & Practice Exam
BEAT THE GMAT EXCLUSIVE

Available with Beat the GMAT members only code

• 1 Hour Free
BEAT THE GMAT EXCLUSIVE

Available with Beat the GMAT members only code

• 5-Day Free Trial
5-day free, full-access trial TTP Quant

Available with Beat the GMAT members only code

• Award-winning private GMAT tutoring
Register now and save up to $200 Available with Beat the GMAT members only code • Free Veritas GMAT Class Experience Lesson 1 Live Free Available with Beat the GMAT members only code • Magoosh Study with Magoosh GMAT prep Available with Beat the GMAT members only code • 5 Day FREE Trial Study Smarter, Not Harder Available with Beat the GMAT members only code • Get 300+ Practice Questions 25 Video lessons and 6 Webinars for FREE Available with Beat the GMAT members only code • Free Practice Test & Review How would you score if you took the GMAT Available with Beat the GMAT members only code Performance on quant affects the question level in verbal This topic has 4 expert replies and 1 member reply gmatwar13 Senior | Next Rank: 100 Posts Joined 22 Apr 2012 Posted: 58 messages Followed by: 1 members Upvotes: 2 Performance on quant affects the question level in verbal Fri Nov 16, 2012 3:58 am Hi GMAT I feel that whenever i do good in quant on gmatprep the level of questions I see on verbal after break are comparatively difficult and I see questions of much higher difficulty in the beginning of the verbal test. I used to suppose that verbal and quant are two independent way to measure skills. But lately as i attempted gmatprep i figured out that doing very well in quant throws difficult questions in verbal from the very beginning of the test... _________________ If all u see are obstacles, may be it is because you have taken your eyes off the goal... Need free GMAT or MBA advice from an expert? Register for Beat The GMAT now and post your question in these forums! AbhiJ Master | Next Rank: 500 Posts Joined 19 May 2010 Posted: 381 messages Followed by: 2 members Upvotes: 41 Top Reply Wed Dec 12, 2012 3:53 am As you do well in Quant, your performance in Verbal improves due to higher confidence, so you see more difficult question. CR Abilities . GMAT/MBA Expert David@VeritasPrep GMAT Instructor Joined 22 Feb 2010 Posted: 2193 messages Followed by: 507 members Upvotes: 1186 GMAT Score: 770 Top Reply Wed Dec 12, 2012 4:59 am AbhiJ that is ver clever! I have to agree!! However, if I were being serious there is one thing I would say... It is your impression of how you did that matters more than how you really did. In my last two exams that I have taken - official tests - it was my impression of how I did on the Quant that mattered more in terms of the verbal. On the test from 2010 I thought that I was doing great on the Quant section. I guess I made a few simple mistakes and that meant that I had some easier questions so it felt great. I went into the Verbal section literally thinking 790. I actually road that wave to a perfect 51 on the verbal. Then I got my score and it was my lowest Quant score and a 760 overall. Then in 2011 I had a hard time on the Quant. I was a little tired and things were tougher. I struggled more and I felt like I had done poorly. This impacted my verbal and I dropped to a 46. However, it was my top quant score and I got a 770. Yet, if I had tried my best in the verbal instead of being down it would have been a 780. The moral of the story is that how you actually did on Quant does not matter. You will not know until the test is over. How you think you did does matter. So whatever happens tell yourself you did great!!! If it was easy, that is because you are so smart. If it was tough, that is because you are so smart! Whatever the reality you will find out soon enough. So throughout the entire test just tell yourself that you are doing great... _________________ Veritas Prep | GMAT Instructor Veritas Prep Reviews Save$100 off any live Veritas Prep GMAT Course

Enroll in a Veritas Prep GMAT class completely for FREE. Wondering if a GMAT course is right for you? Attend the first class session of an actual GMAT course, either in-person or live online, and see for yourself why so many students choose to work with Veritas Prep. Find a class now!
AbhiJ Master | Next Rank: 500 Posts
Joined
19 May 2010
Posted:
381 messages
Followed by:
2 members
41
Wed Dec 12, 2012 3:53 am
As you do well in Quant, your performance in Verbal improves due to higher confidence, so you see more difficult question. CR Abilities .

GMAT/MBA Expert

David@VeritasPrep GMAT Instructor
Joined
22 Feb 2010
Posted:
2193 messages
Followed by:
507 members
1186
GMAT Score:
770
Wed Dec 12, 2012 4:59 am
AbhiJ that is ver clever! I have to agree!!

However, if I were being serious there is one thing I would say...

It is your impression of how you did that matters more than how you really did. In my last two exams that I have taken - official tests - it was my impression of how I did on the Quant that mattered more in terms of the verbal.

On the test from 2010 I thought that I was doing great on the Quant section. I guess I made a few simple mistakes and that meant that I had some easier questions so it felt great. I went into the Verbal section literally thinking 790. I actually road that wave to a perfect 51 on the verbal. Then I got my score and it was my lowest Quant score and a 760 overall.

Then in 2011 I had a hard time on the Quant. I was a little tired and things were tougher. I struggled more and I felt like I had done poorly. This impacted my verbal and I dropped to a 46. However, it was my top quant score and I got a 770. Yet, if I had tried my best in the verbal instead of being down it would have been a 780.

The moral of the story is that how you actually did on Quant does not matter. You will not know until the test is over. How you think you did does matter. So whatever happens tell yourself you did great!!! If it was easy, that is because you are so smart. If it was tough, that is because you are so smart! Whatever the reality you will find out soon enough. So throughout the entire test just tell yourself that you are doing great...

_________________
Veritas Prep | GMAT Instructor

Veritas Prep Reviews
Save $100 off any live Veritas Prep GMAT Course Enroll in a Veritas Prep GMAT class completely for FREE. Wondering if a GMAT course is right for you? Attend the first class session of an actual GMAT course, either in-person or live online, and see for yourself why so many students choose to work with Veritas Prep. Find a class now! GMAT/MBA Expert David@VeritasPrep GMAT Instructor Joined 22 Feb 2010 Posted: 2193 messages Followed by: 507 members Upvotes: 1186 GMAT Score: 770 Tue Nov 27, 2012 10:10 am Also, Rebecca made clear in the posting I have linked below that your performance in one question type (CR, SC, RC) does not impact the questions that you get for the other. So not only does Quant not impact Verbal, but the other areas of verbal do not impact each other! Maybe it is just that you work so hard to do well at Quant that you are tired in verbal? Of else tough luck? http://www.beatthegmat.com/how-does-the-cat-format-work-for-specific-question-types-t114296.html _________________ Veritas Prep | GMAT Instructor Veritas Prep Reviews Save$100 off any live Veritas Prep GMAT Course

Enroll in a Veritas Prep GMAT class completely for FREE. Wondering if a GMAT course is right for you? Attend the first class session of an actual GMAT course, either in-person or live online, and see for yourself why so many students choose to work with Veritas Prep. Find a class now!

Best Conversation Starters

1 lheiannie07 120 topics
2 ardz24 65 topics
3 LUANDATO 63 topics
4 swerve 61 topics
5 AAPL 59 topics
See More Top Beat The GMAT Members...

Most Active Experts

1 Scott@TargetTestPrep

Target Test Prep

186 posts
2 Brent@GMATPrepNow

GMAT Prep Now Teacher

171 posts
3 Jeff@TargetTestPrep

Target Test Prep

147 posts
4 Rich.C@EMPOWERgma...

EMPOWERgmat

133 posts
5 GMATGuruNY

The Princeton Review Teacher

128 posts
See More Top Beat The GMAT Experts


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 23 Sep 2018, 03:33

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

# Which of the following is equal to x^(3/2)?

Author Message
TAGS:

### Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 49309
Which of the following is equal to x^(3/2)?  [#permalink]

### Show Tags

26 Aug 2018, 21:11
00:00

Difficulty:

15% (low)

Question Stats:

72% (00:33) correct 28% (00:27) wrong based on 54 sessions

### HideShow timer Statistics

Which of the following is equal to $$x^{\frac{3}{2}}$$?

(A) $$x^2 \sqrt{x}$$

(B) $$x \sqrt{x}$$

(C) $$\sqrt[3]{x^2}$$

(D) $$\sqrt[3]{x}$$

(E) $$(x^3)^2$$

_________________
Director
Status: Learning stage
Joined: 01 Oct 2017
Posts: 859
WE: Supply Chain Management (Energy and Utilities)
Re: Which of the following is equal to x^(3/2)?  [#permalink]

### Show Tags

26 Aug 2018, 21:19
Bunuel wrote:
Which of the following is equal to $$x^{\frac{3}{2}}$$?

(A) $$x^2 \sqrt{x}$$

(B) $$x \sqrt{x}$$

(C) $$\sqrt[3]{x^2}$$

(D) $$\sqrt[3]{x}$$

(E) $$(x^3)^2$$

$$x^{\frac{3}{2}}$$ can be written as:

$$x^{1+\frac{1}{2}}$$
$$=x^1*x^{\frac{1}{2}}$$$$=x*\sqrt{x}$$

Ans. (B)
_________________

Regards,

PKN

Rise above the storm, you will find the sunshine

Manager
Status: Started with mock tests,Kaplan and manhattan score's below
Joined: 11 Jun 2017
Posts: 86
Location: India
GMAT 1: 630 Q44 V33
GMAT 2: 680 Q47 V37
GPA: 3.2
Re: Which of the following is equal to x^(3/2)?  [#permalink]

### Show Tags

26 Aug 2018, 21:34
2
Bunuel wrote:
Which of the following is equal to $$x^{\frac{3}{2}}$$?

(A) $$x^2 \sqrt{x}$$

(B) $$x \sqrt{x}$$

(C) $$\sqrt[3]{x^2}$$

(D) $$\sqrt[3]{x}$$

(E) $$(x^3)^2$$

Below rules are used:
$$x^{\frac{n}{m}}= \sqrt[m]{x^n}$$
$$\sqrt{x}\sqrt{y}=\sqrt{xy}$$

Substitute:
$$x^{\frac{3}{2}}=\sqrt[2]{x^3}$$
$$\sqrt{x^2}\sqrt{x}=\sqrt{x^3}$$

Ans .B
_________________

Thanks,
Ankit
Target Score:730+

If the post was useful,please send the kudos

Director
Status: Learning stage
Joined: 01 Oct 2017
Posts: 859
WE: Supply Chain Management (Energy and Utilities)
Which of the following is equal to x^(3/2)?  [#permalink]

### Show Tags

27 Aug 2018, 04:31
1
onyx12102 wrote:
PKN

x1+12x1+12
=x1∗x12=x1∗x12 =x∗x√=x∗x

Hi onyx12102,

You must know the following basic rules of exponents and roots:-
1) Fraction as a power:-
$$a^{\frac{1}{n}}=\sqrt[n]{a}$$ and vice-versa
$$a^n*a^m=a^{n+m}$$ and vice-versa

So, $$x^{1+\frac{1}{2}}$$ can be written as $$x^1*x^{\frac{1}{2}}$$ (Using rule(2) above, n=1, m=$$\frac{1}{2}$$, a=x)

Now, $$x^{\frac{1}{2}}$$ can be written as ($$\sqrt{x}$$ Using rule(1) above,a=x, n=2 )

Hence, $$x^1*x^{\frac{1}{2}}$$ =$$x*\sqrt{x}$$

Hope it helps.

Note:- $$\sqrt[n]{a}=\sqrt{a}$$ . The symbol '√' unless specified, it refers to square root operation. So no need to mention 2 on the lap of √. By default '√' means a square root operation.

P.S:- You may visit https://gmatclub.com/forum/exponents-an ... 74993.html master thread for more tips on exponents and roots.
_________________

Regards,

PKN

Rise above the storm, you will find the sunshine

Intern
Joined: 25 Feb 2016
Posts: 11
Re: Which of the following is equal to x^(3/2)?  [#permalink]

### Show Tags

27 Aug 2018, 04:44
PKN Thank you

I eventually worked it out but I think it's beneficial to other beginners to see how you got there. Thanks alot
Re: Which of the following is equal to x^(3/2)? &nbs [#permalink] 27 Aug 2018, 04:44
Display posts from previous: Sort by

# Which of the following is equal to x^(3/2)?

## Events & Promotions

 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:
econometrics.it

Federico Belotti's niche on the web

Missing data, multiple imputation and xsmle

Missing data can pose major problems when estimating econometric models since it is generally unlikely that missing values are Missing Completely At Random. A strategy to address this issue without using more complex econometric approaches is represented by multiple imputation, that is the process of replacing missing values by multiple sets of plausible values. This post provides a simple example in which xsmle is used together with mi, a Stata's suite of commands that deals with multiple data imputation. Consider the following data in which the only regressor (x1) has 14 missing values

. sum y x1

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
y |       940    4.144785    1.674932  -.7510805   9.170195
x1 |       926    1.375773    1.202928  -2.039139   4.966914

Since these missing values make the panel unbalanced, xsmle will not be able to work. Nonetheless, we can overcome the obstacle by exploiting mi and xsmle jointly.

The first step is to declare the dataset as a mi dataset. The command mi set wide is the appropriate one. Indeed, data must be mi setted before other mi commands can be used. It does not matter which mi style you choose since you can always change it using mi convert. In this example, I choose the wide style.

. mi set wide

. mi register imputed x1

. set seed 1712

. mi impute regress x1 = i.cat, add(10)

Univariate imputation                   Imputations =       10
Imputed: m=1 through m=10                   updated =        0

|              Observations per m
|----------------------------------------------
Variable |   complete   incomplete   imputed |     total
---------------+-----------------------------------+----------
x1 |        926           14        14 |       940
--------------------------------------------------------------
(complete + incomplete = total; imputed is the minimum across m
of the number of filled in observations.)

Once the dataset has been mi setted, the second step is to register the variables with missing values. In this example, x1 is a variable that has missing values and mi register imputed x1 declares this variable as a variable to be imputed. A good practice for reproducible results is to set the seed of the Stata's pseudo random number generator using the command set seed #, where # is any number between between 0 and 2^31-1.

Then, the command mi impute regress x1 = i.cat, add(10) can be used to fill in missing values of x1 using the set of dummy variables from the categorical variable cat through the regress method (see help mi impute for detail on the available methods). The option add(10) specifies the number of imputations to add to the mi data (currently, the total number of imputations cannot exceed 1,000). After mi impute regress x1 = i.cat, add(10) has been executed, ten new variables _#_x1 (with # = 1,...,10) will be created in the dataset, each representing an imputed version of x1.

. mi estimate, dots: xsmle y x1, wmat(W) model(sdm) fe type(ind)

Imputations (10):
.........10 done

Multiple-imputation estimates                     Imputations     =         10
SDM with spatial fixed-effects                    Number of obs   =        940
Average RVI     =     0.0409
Complete DF     =        748
DF adjustment:   Small sample                     DF:     min     =     421.51
avg     =     624.79
max     =     732.54
Model F test:       Equal FMI                     F(   7,  730.5) =     214.64
Within VCE type:          OIM                     Prob > F        =     0.0000

------------------------------------------------------------------------------
y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Main         |
x1 |   .3927311   .0358267    10.96   0.000     .3223164    .4631458
-------------+----------------------------------------------------------------
Wx           |
x1 |   .7172546   .0759222     9.45   0.000     .5682036    .8663056
-------------+----------------------------------------------------------------
Spatial      |
rho |   .3342481   .0404076     8.27   0.000     .2548957    .4136005
-------------+----------------------------------------------------------------
Variance     |
sigma2_e |   .8201919   .0385477    21.28   0.000     .7445121    .8958717
-------------+----------------------------------------------------------------
Direct       |
x1 |   .4641954   .0315439    14.72   0.000     .4021925    .5261983
-------------+----------------------------------------------------------------
Indirect     |
x1 |   1.215779   .1155787    10.52   0.000     .9888711    1.442687
-------------+----------------------------------------------------------------
Total        |
x1 |   1.679974    .127172    13.21   0.000     1.430302    1.929647
------------------------------------------------------------------------------

Finally, as documented in help mi estimate, the prefix command mi estimate: estimation_command can be used to execute the estimation_command on the imputed _#_x1 variables. This command will adjust coefficients and standard errors for the variability between imputations according to the combination rules by Rubin (1987). In this example, the command

mi estimate, dots: xsmle y x1, wmat(W) model(sdm) fe type(ind)

estimates a spatial fixed effects Durbin model on the ten imputed versions of the x1 variable.

References

Official Stata manuals and help files.
Rubin, D. B. 1987. Multiple Imputation for Nonresponse in Surveys. New York: Wiley.

A xsmle brief tutorial

Given the high number of requests, my colleagues and I have decided to provide a brief tutorial on how to get started with xsmle. First of all, you have to install the command by typing

net install xsmle, all from(http://www.econometrics.it/stata)

It is fundamental to use the option all because when you install a user-written package without using this option, the ancillary files (in this case "product.dta" and "usaww.spmat") won't be downloaded, while with the all option all the ancillary files will always (conditionally on the presence of an internet connection) be downloaded to 1) your current working directory OR 2) the directory you specified for ancillary files using the net set other command.

Now, lets assume that you haven't changed your "ancillary files" directory and that your Stata current working directory is the Desktop. Then, you should now find on your Desktop two new files: "product.dta" and "usaww.spmat". These files contain informations on public capital productivity in 48 US states observed over 17 years, as well as the spatial weights matrix for the US states (Munnel, 1990). The examples reported in the xsmle help file make use of these files, also available in R through the Ecdat package.

The first step is to load the "product.dta" into memory by typing

use product.dta, clear

Then, you have to do the same for the spatial weights matrix contained in the "usaww.spmat" file. Being an spmat file, this can be done by typing

spmat use W using "usaww.spmat"

At this stage, after computing the logarithm of the dependent and independent variables, we have all the ingredients to estimate a spatial panel data model. For instance, the syntax to estimate a Spatial AutoRegressive (SAR) model with random effects is

xsmle lngsp lnpcap lnpc lnemp unemp, wmat(W) model(sar)

Notice that the dataset "product.dta" has been already declared to be a panel. In general, you need to declare your dataset to be a panel dataset by using the xtset command.

References

Munnell AH (1990). “Why Has Productivity Growth Declined? Productivity and Public Investment.” New England Economic Review, 1990, 3–22.

Spatial panel data models using Stata

A new command for estimating and forecasting spatial panel data models using Stata is now available: xsmle.

xsmle fits fixed or random effects spatial models for balanced panel data. See the mi prefix command in order to use xsmle in the unbalanced case. Consider the following general specification for the spatial panel data model:

$y_{it} = \tau y_{it-1} + \rho W y_{it} + X_{it} \beta + D Z_{it} \theta + a_i + \gamma_t + v_{it}$
$v_{it} = \lambda E v_{it} + u_{it}$

where $u_{it}$ is a normally distributed error term, $W$ is the spatial matrix for the autoregressive component, $D$ the spatial matrix for the spatially lagged independent variables, $E$ the spatial matrix for the idiosyncratic error component. $a_i$ is the individual fixed or random effect and $\gamma_t$ is the time effect. xsmle fits the following nested models:

i) The SAR model with lagged dependent variable ( $\theta=\lambda=0$ )

$y_{it} = \tau y_{it-1} + \rho W y_{it} + X_{it} \beta + a_i + \gamma_t + u_{it}$ ,

where the standard SAR model is obtained by setting $\tau=0$ .

ii) The SDM model with lagged dependent variable ( $\lambda=0$ )

$y_{it} = \tau y_{it-1} + \rho W y_{it} + X_{it} \beta + D Z_{it} \theta + a_i + \gamma_t + u_{it}$ ,

where the standard SDM model is obtained by setting $\tau=0$ . xsmle allows to use a different weighting matrix for the spatially lagged dependent variable ( $W$ ) and the spatially lagged regressors ( $D$ ) together with a different sets of explanatory ( $X_{it}$ ) and spatially lagged regressors ( $Z_{it}$ ). The default is to use $W=D$ and $X_{it}=Z_{it}$ .

iii) The SAC model ( $\theta=\tau=0$ )

$y_{it} = \rho W y_{it} + X_{it} \beta + a_i + \gamma_t + v_{it}$ ,
$v_{it} = \lambda E v_{it} + u_{it}$ ,

for which xsmle allows to use a different weighting matrix for the spatially lagged dependent variable ( $W$ ) and the error term ( $E$ ).

iv) The SEM model ( $\rho=\theta=\tau=0$ )

$y_{it} = X_{it} \beta + a_i + \gamma_t + v_{it}$ ,
$v_{it} = \lambda E v_{it} + u_{it}$ .

v) The GSPRE model ( $\rho=\theta=\tau=0$ )

$y_{it} = X_{it} \beta + a_i + v_{it}$ ,
$a_i = \phi W a_i + \mu_i$ ,
$v_{it} = \lambda E v_{it} + u_{it}$ ,

where also the random effects have a spatial autoregressive form.

The command was written together with Andrea Piano Mortari and Gordon Hughes.

You may install it by typing

net install xsmle, all from(http://www.econometrics.it/stata)


text:
# construction of central proportional

Task. Given two line segments $p$ and $q$. Using compass and straightedge, construct the central proportional (the geometric mean) of the line segments.

Solution. Set the line segments  $AD=p$  and  $DB=q$  on a line so that $D$ is between $A$ and $B$. Draw a half-circle with diameter $AB$ (for finding the centre, see the entry midpoint). Let $C$ be the point where the normal line of $AB$ passing through $D$ intersects the arc of the half-circle. The line segment $CD$ is the required central proportional. Below is a picture that illustrates this solution:

(For more details on the procedure to create this picture, see compass and straightedge construction of geometric mean.)

Proof. By Thales’ theorem, the triangle $ABC$ is a right triangle. Its height $CD$ this triangle into two smaller right triangles which have equal angles with the triangle $ABC$ and thus are similar (http://planetmath.org/SimilarityInGeometry). Accordingly, we can write the proportion equation concerning the catheti of the smaller triangles

 $p:CD\,=\,CD:q.$

The equation shows that $CD$ is the central proportional of $p$ and $q$.

Note. The word catheti (in sing. cathetus) the two shorter sides of a right triangle.

Title construction of central proportional ConstructionOfCentralProportional 2013-03-22 17:34:14 2013-03-22 17:34:14 pahio (2872) pahio (2872) 14 pahio (2872) Algorithm msc 51M15 GoldenRatio CompassAndStraightedgeConstructionOfGeometricMean ConstructionOfFourthProportional cathetus catheti


text:
# Calculating determinant with different numbers on diagonal and x everywhere else

I'm having troubles solving the following determinant:

$$\left| \begin{array}{cccc} a_1 & x & \ldots & x \\ x & a_2 & \ldots & \vdots \\ \vdots & \ldots & \ddots & x \\ x & \ldots & x & a_n \\ \end{array} \right|$$

I have tried coming up with recurrent formula, but there's always one lingering row and column. I also tried finding values of x for which determinant is 0, hoping I could get a nice polynomial solution, with no luck.

By subtracting first row from every other I get somewhat nicer result, but there's still that one row/column which I can't solve. If all other columns are added to the first one and then I subtract the first row, then the column doesn't depend on x anymore, but I haven't found 1..n much more useful.

• Possible duplicate of How to calculate the following determinants (all ones, minus $I$) – amd Jan 23 '17 at 20:06
• @amd the diagonal entries are different here. – StubbornAtom Jan 23 '17 at 20:12
• Even though the question is different, the answer is similar; however, I cannot pull out any factor after adding everything to the first row, since I have different numbers on the diagonal (I have $$a_i+(n-1)x$$ instead of $$a+(n-1)x$$) – Luke Jan 23 '17 at 20:13
• Your matrix is $D + xk^T k$, where $D$ is the diagonal matrix $\operatorname{diag}\left(a_1-x,a_2-x,\ldots,a_n-x\right)$, and $k$ is the row vector $\left(1,1,\ldots,1\right)$. Now, use the fact so inventively and unambiguously christened the "matrix determinant lemma" ( en.wikipedia.org/wiki/Matrix_determinant_lemma#Statement , see the version without the invertibility requirement). – darij grinberg Jan 23 '17 at 20:18
• @darij grinberg You should give your comment as an answer. – Jean Marie Jan 23 '17 at 21:20

As requested, here is the answer I hinted to in my comment:

Theorem 1. Let $n\in\mathbb{N}$. Let $\mathbb{K}$ be a commutative ring. Let $a_{1},a_{2},\ldots,a_{n}$ be $n$ elements of $\mathbb{K}$. Let $x\in\mathbb{K}$. Let $A\in\mathbb{K}^{n\times n}$ be the $n\times n$-matrix $\left( \begin{array} [c]{ccccc} a_{1} & x & x & \cdots & x\\ x & a_{2} & x & \cdots & x\\ x & x & a_{3} & \cdots & x\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ x & x & x & \cdots & a_{n} \end{array} \right)$ (this is the $n\times n$-matrix whose diagonal entries are $a_{1},a_{2},\ldots,a_{n}$, while all its other entries are $x$). For each $i\in\left\{ 1,2,\ldots,n\right\}$, set $b_{i}=\prod\limits_{\substack{k\in \left\{ 1,2,\ldots,n\right\} ;\\k\neq i}}\left( a_{k}-x\right)$. Then,

$\det A=\prod\limits_{i=1}^{n}\left( a_{i}-x\right) +x\sum\limits_{i=1}^{n}b_{i}$.

To prove this, we recall the following fact (known as the matrix determinant lemma, although it would not surprise me if it has several contenders for its rather generic name):

Lemma 2. Let $n\in\mathbb{N}$. Let $\mathbb{K}$ be a commutative ring. Let $\mathbf{A}\in\mathbb{K}^{n\times n}$ be an $n\times n$-matrix. Let $\mathbf{u}\in\mathbb{K}^{n\times1}$ and $\mathbf{v}\in\mathbb{K}^{n\times1}$ be two column vectors. Then,

$\det\left( \mathbf{A}+\mathbf{uv}^{T}\right) =\det\mathbf{A}+\mathbf{v} ^{T}\left( \operatorname*{adj}\mathbf{A}\right) \mathbf{u}$.

(Here and in the following, $\operatorname*{adj}\mathbf{A}$ denotes the adjugate of $\mathbf{A}$.)

See Matrix determinant lemma with adjugate matrix for a proof of Lemma 2.

We also shall use the following simple fact:

Lemma 3. Let $n\in\mathbb{N}$. Let $\mathbb{K}$ be a commutative ring. Let $a_{1},a_{2},\ldots,a_{n}$ be $n$ elements of $\mathbb{K}$. For each $i\in\left\{ 1,2,\ldots,n\right\}$, set $b_{i}=\prod\limits_{\substack{k\in \left\{ 1,2,\ldots,n\right\} ;\\k\neq i}}a_{k}$. Then,

$\operatorname*{adj}\left( \left( a_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}\right) =\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}$.

(Here, as usual, $\delta_{i,j}$ is the Kronecker delta of $i$ and $j$.)

Proof of Lemma 3. Lemma 3 simply says that the adjugate of the diagonal matrix with diagonal entries $a_{1},a_{2},\ldots,a_{n}$ is the diagonal matrix with diagonal entries $b_{1},b_{2},\ldots,b_{n}$. This is easy to check (since each $\left( n-1\right) \times\left( n-1\right)$-submatrix of a diagonal matrix either is a diagonal matrix itself, or has a zero row).

Now, we can prove Theorem 1:

Proof of Theorem 1. Let $\mathbf{A}$ be the $n\times n$-matrix $\left( \left( a_{i}-x\right) \delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}$. (This $\mathbf{A}$ is the diagonal matrix with diagonal entries $a_{1}-x,a_{2}-x,\ldots,a_{n}-x$). Thus, $\det\mathbf{A}=\prod\limits_{i=1} ^{n}\left( a_{i}-x\right)$ (since the determinant of a diagonal matrix is the product of its diagonal entries). But Lemma 3 (applied to $a_{1} -x,a_{2}-x,\ldots,a_{n}-x$ instead of $a_{1},a_{2},\ldots,a_{n}$) yields that

$\operatorname*{adj}\left( \left( \left( a_{i}-x\right) \delta _{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}\right) =\left( b_{i} \delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}$.

Since $\left( \left( a_{i}-x\right) \delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}=\mathbf{A}$, this rewrites as

$\operatorname*{adj}\mathbf{A}=\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}$.

Let $\mathbf{v}\in\mathbb{K}^{n\times1}$ be the column vector $\left( 1,1,\ldots,1\right) ^{T}$. Then, $\mathbf{vv}^{T}=\left( 1\right) _{1\leq i\leq n,\ 1\leq j\leq n}$, so that $x\mathbf{vv}^{T}=x\left( 1\right) _{1\leq i\leq n,\ 1\leq j\leq n}=\left( x\right) _{1\leq i\leq n,\ 1\leq j\leq n}$. Hence, it is easy to see that $A=\mathbf{A}+x\mathbf{vv}^{T}$.

Recall that $\mathbf{v}=\left( 1,1,\ldots,1\right) ^{T}$. Thus, for every $n\times n$-matrix $B$, we have

$\mathbf{v}^{T}B\mathbf{v}=\left( \text{the sum of all entries of }B\right)$.

Applying this to $B=\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}$, we obtain

$\mathbf{v}^{T}\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}\mathbf{v}$

$=\left( \text{the sum of all entries of }\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}\right)$

$=\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}b_{i}\delta_{i,j}=\sum\limits_{i=1}^{n}b_{i} \underbrace{\sum\limits_{j=1}^{n}\delta_{i,j}}_{=1}=\sum\limits_{i=1}^{n}b_{i}$.

But from $A=\mathbf{A}+x\mathbf{vv}^{T}$, we obtain

$\det A=\det\left( \mathbf{A}+x\mathbf{vv}^{T}\right)$

$=\underbrace{\det\mathbf{A}}_{=\prod\limits_{i=1}^{n}\left( a_{i}-x\right) }+\mathbf{v}^{T}\underbrace{\left( \operatorname*{adj}\mathbf{A}\right) }_{=\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n} }x\mathbf{v}$

(by Lemma 2, applied to $\mathbf{u}=x\mathbf{v}$)

$=\prod\limits_{i=1}^{n}\left( a_{i}-x\right) +\mathbf{v}^{T}\left( b_{i} \delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}x\mathbf{v}$

$=\prod\limits_{i=1}^{n}\left( a_{i}-x\right) +x\underbrace{\mathbf{v}^{T}\left( b_{i}\delta_{i,j}\right) _{1\leq i\leq n,\ 1\leq j\leq n}\mathbf{v}} _{=\sum\limits_{i=1}^{n}b_{i}}$

$=\prod\limits_{i=1}^{n}\left( a_{i}-x\right) +x\sum\limits_{i=1}^{n}b_{i}$.

This proves Theorem 1.

• @becko: Your answer uses division, which in general requires a Zariski-density-style argument; I made the conscious choice to avoid that in my post. Other than this, your answer is indeed simpler. – darij grinberg Sep 26 '18 at 16:41
• This answer looks overly complicated. The OP question can be answered more directly, please see math.stackexchange.com/a/2931799/10063. Also (as in your comment), the result can be computed simply applying the Sherman Morrison formula. – becko Sep 26 '18 at 16:42
• @becko: The Sherman-Morrison uses division, too :) – darij grinberg Sep 26 '18 at 16:43
• I meant for real matrices. I think your proof is much more ambitious. – becko Sep 26 '18 at 16:47


text:
# Questions tagged [producer-theory]

Study of the behavior of firms in organizing their production and allocating productive resources.

62 questions
Filter by
Sorted by
Tagged with
2k views

### Why are cost functions often assumed to be convex in microeconomics?

Why are cost functions typically assumed to be convex in producer theory of (introductory) microeconomics? For me this goes against the intuition of economies of scale. There are fixed costs (FC) ...
41 views

### Why does LRAC not connect the minima of SRAC curves? [duplicate]

Can anyone please provide an intuitive explanation and proper mathematical reason for non-intersection of SRAC and LRAC at the minimas of SRAC? I am seeing conflicting [1] [2] answers on the site ...
101 views

### Interior Solution for profit maximisation problem

A function $c: \mathbb{R}^K_+ \xrightarrow{} \mathbb{R}_+$ is is said to be a cost function if The value of function $c$ at $y = \textbf{0}$ is $0$: $c(\textbf{0}) = 0$ $c$ is continuous on the ...
83 views

### Walras Law in a production economy with fixed costs

Consider a price taking firm with fixed costs $fc \geq 0$: \begin{align*} \Pi &= \max_{n^D} \left\{ P_c F(n^D) - w\times n^D - fc \right\} \end{align*} A representative household owns this firm:...
77 views

### Properties on conditional demand correspondence from the textbook of Mas-Colell et al

I have a question on the properties of conditional demand correspondence Let $z(w,q)$ be the conditional factor demand correspondence, i.e. the solution of the cost minimization problem \begin{align} \...
141 views

### If production function is concave, then demonstrate that profit function will also be concave

Show that concavity of firm's production function implies concavity of its profit function. (Hint: For a concave function, first order conditions gives the vector that maximizes the function) ...
251 views

### Why was activity analysis abanadoned as a field of research?

Activity analysis was a thriving research area in the 1940's and 1950's. It was fruitful enough to earn the Nobel prize for Tjalling Koopmans. But it seems to have been abandoned altogether. Mas ...
209 views

### The existence of solution for profit maximization problem

I'm thinking about the conditions for existence of solution of this profit maximization problem(PMP), i.e., $\max_{z \in R_+^{K-1}} pf(z) -wz$, where $z \geq 0$: input vector, $p>0$: the price of ...
34 views

316 views

### Curvature of Cost and Production Function

I have been trying to understand the duality theory between cost and production function. Please let me know if my following statement is correct; If the cost function $C(w,q)$ is convex in $q$, the ...
2k views

### CES Production Function with $\rho>1$

In using CES production functions of the form $f(x_1,x_2)=(x_1^\rho+x_2^\rho)^{1/\rho}$, we always assume that $\rho\leq1$. Why do we make that assumption? I understand that if $\rho>1$, the ...
690 views

### Monotonic Transformation

How does positive monotonic transformation of production function effect the resulting profit function? For example if we had production function $f(x)$ and that gave profit function $\pi(p,w)$. Now ...
116 views

### Homothetic Production Technologies

Can someone suggest a good resource on homothetic technologies and what properties they imply about cost function, profit function, input demands, output supply etc? Also is it possible to have ...
754 views

### Homothetic production function and Profit Function

I know that homothetic production function implies that cost function is multiplicatively separable in input prices and output, and it can be written as C(w,y)=h(y)C(w,1). Can some one help me derive ...
How do I know which utility function I can use to find an isoelastic demand function, e.g., $x(p)=Ap^a$? And similarly, which cost function can I use to find an isoelastic supply function? Does it ...


text:
# On Semi C-Reducibility of General (α, β) Finsler Metrics

Tiwari, Bankteshwar;Gangopadhyay, Ranadip;Prajapati, Ghanashyam Kr.

• Received : 2017.07.17
• Accepted : 2018.11.27
• Published : 2019.06.23
• 5 2

#### Abstract

In this paper, we study general (${\alpha}$, ${\beta}$) Finsler metrics and prove that every general (${\alpha}$, ${\beta}$)-metric is semi C-reducible but not C2-like. As a consequence of this result we prove that every general (${\alpha}$, ${\beta}$)-metric satisfying the Ricci flow equation is Einstein.

#### Keywords

Finsler space;general (${\alpha}$, ${\beta}$)-metric;semi C-Reducible metrics;Ricci flow equation


text: // // Copyright (C) 2016-17 by the lazyten authors // // This file is part of lazyten. // // lazyten is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // lazyten is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with lazyten. If not, see . // #pragma once #include "lazyten/config.hh" #ifdef LAZYTEN_HAVE_ARPACK #include "detail.hh" #include "lazyten/Base/Solvers.hh" #include "lazyten/Exceptions.hh" #include "lazyten/PtrVector.hh" namespace lazyten { template struct ArpackEigensolverState : public EigensolverStateBase { typedef EigensolverStateBase base_type; typedef typename base_type::eproblem_type eproblem_type; typedef typename base_type::scalar_type scalar_type; typedef typename base_type::size_type size_type; /** The current state of the ARPACK ido parameter */ int ido; /** The current iparam parameter as used by ARPACK * * \note quite some of the n_ ... int references * refer into this array at appropriate places */ std::array iparam; /** The number of converged ritz values */ const int& n_conv_ritz; /** The number of applies B*x */ const int& n_bmtx_applies; /** The number of reorthogonalisation steps */ const int& n_reortho_steps; /** The pointer to the current residual vector */ std::shared_ptr> resid_ptr; /** Do we have a residual from a previous run */ bool have_old_residual; /** The pointer to the reverse communication workbench */ std::shared_ptr> workd_ptr; /** Get the number of Arnoldi iterations performed. * * \note * Since Arpack does not support obtaining an intermediate * iteration count, the value this function returns * is 0 unless the iteration has converged. **/ size_t n_iter() const override { return static_cast(iparam[2]); } /** Get the number of Problem matrix applies (A*x or Diag*x) * * \note This value is only sensible once the Arpack * iterations are converged. */ size_t n_mtx_applies() const override { return static_cast(iparam[8]); } /** Setup the initial state from an eigenproblem to solve */ ArpackEigensolverState(const eproblem_type problem) : base_type(std::move(problem)), ido(0), iparam(), n_conv_ritz(iparam[4]), n_bmtx_applies(iparam[9]), n_reortho_steps(iparam[10]), resid_ptr{new std::vector(base_type::eigenproblem().dim(), 0.0)}, have_old_residual(false), workd_ptr{ new std::vector(3 * base_type::eigenproblem().dim(), 0.0)} {} }; DefException1(ExcArpackInvalidIdo, int, << "ARPACK ido parameter " << arg1 << " is unknown to us. Check ARPACK documentation."); DefSolverException2(ExcArpackInfo, std::string, function, int, info, << "Arpack function " << function << " returned with info value " << info << ". Check Arpack documentation for the meaning of this value."); DefSolverException2(ExcArpackCannotFindMoreEigenpairs, size_t, desired, size_t, found, << "ARPACK has found all eigenpairs it can possibly find. " << desired << " eigenpairs were desired, but " << found << " eigenpairs were found."); DefSolverException1(ExcArpackCouldNotApplyShifts, size_t, n_arnoldi_vectors, << "ARPACK has failed with info==3, which implies that it could " << "not apply shifts during the implicit restart. One way to " << "tackle this problem is to increase the number of Arnoldi " << "vectors beyond the current value ( " << n_arnoldi_vectors << " ) using the key 'n_arnoldi_vectors' in a GenMap."); /** Class which contains all GenMap keys which are understood * by the ArpackSolver update_control_params as static string * members. * See their doc strings for the types required. */ struct ArpackEigensolverKeys : public EigensolverBaseKeys { /** Maximum number of iterations. Type: size_t */ static const std::string max_iter; /** Number of Arnoldi vectors. Type: size_t */ static const std::string n_arnoldi_vectors; /** Arpack mode to use, Type: int */ static const std::string mode; }; /** \brief Arpack eigensolver class * * ## Control parameters and their default values * - max_iter: Maximum number of iterations. Default: 100 * - which: Which eigenvalues to target. Default: "SR"; * allowed values: * - "SM" Smallest magnitude * - "LM" Largest magnitude * - "SR" Smallest real * - "LR" Largest real * - "SI" Smallest imaginary * (only for complex scalar types) * - "LI" Largest imaginary * (only for complex scalar types) * - "BE" Both ends * - tolerance: Tolerance for eigensolver. Default: Default numeric * tolerance (as in Constants.hh) * - mode: Arpack mode to use. We use mode 1 for normal * eigenproblems and mode 2 for generalised * eigenproblems by default (see below) * - n_arnoldi_vectors: The number of Arnoldi vectors to use. * Has to be larger than twice the number of eigenpairs * to be obtained. * * ## The expected matrices in A, B and Diag. * ### mode 1 * Normal solve mode. Only allowed if A == Diag and B is not specified * (not a generalised eigenproblem) * * ### mode 2 * Generalised solve mode by taking the inverse of B. * For this the metric matrix needs to have an implemented * apply_inverse function, for details how to get this see the * inverse() method * * ### mode 3 * Shift-and-invert mode. Diag == $(A - \sigma B)^{-1}$ * May be a generalised or a non-generalised problem. * * ### modes > 3 * Not supported. Check Arpack documentation for dnaupd, * dsaupd or znaupd on your own. * * * ## Handlers and events * Since we have no way of knowing when Arpack starts a new * iteration the functions start_iteration_step and end_iteration_step * are not used by this class. Consequently the handlers * before_iteration_step() and after_iteration_step() are never * triggered. * * \note Currently only double precision scalar types can be used. * * \tparam Eigenproblem The eigenproblem to solve. * \tparam State The state type of the solver. */ template > class ArpackEigensolver : public EigensolverBase { static_assert(std::is_same::value, "The type Eigenproblem and the implicit eigenproblem type in the SCF " "state have to agree"); // TODO remove assertion and generalise static_assert(std::is_same::value, "Arpack can only solve real problems at double precision at " "the moment"); // TODO remove assertion and generalise static_assert(Eigenproblem::hermitian, "Can only solve Hermitian eigenproblems at the moment."); public: //@{ /** Forwarded types */ typedef EigensolverBase base_type; typedef typename base_type::state_type state_type; typedef typename base_type::scalar_type scalar_type; typedef typename base_type::real_type real_type; typedef typename base_type::evalue_type evalue_type; typedef typename base_type::evector_type evector_type; typedef typename base_type::esoln_type esoln_type; typedef typename base_type::stored_matrix_type stored_matrix_type; //@} /** \name Constructor */ //@{ /** Construct an eigensolver with the default parameters */ ArpackEigensolver() {} /** Construct an eigensolver setting the parameters from the map */ ArpackEigensolver(const krims::GenMap& map) : ArpackEigensolver() { update_control_params(map); } //@} /** \name Iteration control */ ///@{ /** \briefArpack mode used. * * See Arpack documentation for details what is expected for the * structure of the A and the Diag matrix in this case. * * \note We use 1 for the normal eigenproblem and 2 for the * geneneralised eigenproblem by default. */ int mode = Eigenproblem::generalised ? 2 : 1; /** \name Number of arnoldi vectors * By default 0, which implies that we use * std::min(dim, 3*n_ep/2) vectors, where dim is the dimensionality * of the problem and n_ep is the number of eigenpairs. */ size_t n_arnoldi_vectors = 0; // i.e. auto-determine /** Maximum number of iterations */ size_t max_iter = 100; /** Update control parameters from Parameter map */ void update_control_params(const krims::GenMap& map) { base_type::update_control_params(map); max_iter = map.at(ArpackEigensolverKeys::max_iter, max_iter); n_arnoldi_vectors = map.at(ArpackEigensolverKeys::n_arnoldi_vectors, n_arnoldi_vectors); mode = map.at(ArpackEigensolverKeys::mode, mode); } /** Get the current settings of all internal control parameters and * update the GenMap accordingly. */ void get_control_params(krims::GenMap& map) const { base_type::get_control_params(map); map.update(ArpackEigensolverKeys::max_iter, max_iter); map.update(ArpackEigensolverKeys::n_arnoldi_vectors, n_arnoldi_vectors); map.update(ArpackEigensolverKeys::mode, mode); } ///@} /** Implementation of the IterativeSolver method */ void solve_state(state_type& state) const override; private: /** Assert that the state of the control parameters is sensible. * In case its not, raise an ExcInvalidEigensolverParameters * exception */ void assert_valid_control_params(state_type& s) const; /** Setup the state before actually running the solve steps * (i.e. reset some counters, install a guess, ... ) */ void setup_state(state_type& s) const; /** Deal with the ido parameter we got */ void arpack_ido_step(state_type& s, std::array ipntr) const; }; // // ---------------------------------------------------------- // template void ArpackEigensolver::assert_valid_control_params( state_type& state) const { // TODO I do not like this, since some checks could be performed // before the call of solve ... separate this? // // Some stuff is more general and affects multiple solver classes // this is not reflected here const Eigenproblem& problem = state.eigenproblem(); // // which // const std::string& which = base_type::which; if (krims::IsComplexNumber::value) { solver_assert(which == "SR" || which == "LR" || which == "SM" || which == "LM" || which == "SI" || which == "LI", state, ExcInvalidSolverParametersEncountered( "The value " + which + " for which is not allowed in an " "Arpack solver call that will yield " "complex eigenvalues")); } else { solver_assert(which == "SR" || which == "LR" || which == "SM" || which == "LM" || which == "BE", state, ExcInvalidSolverParametersEncountered( "The value " + which + " for which is not allowed in an " "Arpack solver call that will yield " "real eigenvalues")); } // // mode // if (Eigenproblem::generalised) { solver_assert(mode != 1, state, ExcInvalidSolverParametersEncountered( "For generalised eigenproblems mode 1 is not allowed.")); } else { solver_assert(mode != 2, state, ExcInvalidSolverParametersEncountered( "For normal eigenproblems mode 2 is not allowed.")); } // dsaupd accepts modes between 1 and 5. // dnaupd accepts modes between 1 and 4. // znaupd accepts modes between 1 and 3. solver_assert(mode >= 1 && mode <= 5, state, ExcInvalidSolverParametersEncountered( "The value " + std::to_string(mode) + " for mode is not allowed. Only values within [1,5] are ok.")); if (mode == 1 || mode == 2) { // note: We compare memory addresses solver_assert(&problem.A() == &problem.Diag(), state, ExcInvalidSolverParametersEncountered( "For mode 1 or 2 the matrices A and Diag need " "to be the same objects.")); } else { // note: We compare memory addresses solver_assert(&problem.A() != &problem.Diag(), state, ExcInvalidSolverParametersEncountered( "For modes > 2 the matrices A and Diag have to be different " "objects, e.g. for mode 3 we need Diag = (A-sigma*S)^{-1}")); } if (mode == 2) { solver_assert(problem.B().has_apply_inverse(), state, ExcInvalidSolverParametersEncountered( "For mode 2 the metric B needs to have an implemented " "apply_inverse function (See documentation of the function " "inverse() how to get this).")); } // // Arnoldi vectors // if (n_arnoldi_vectors > 0) { // if == 0 we select automatically. solver_assert( n_arnoldi_vectors <= problem.dim(), state, ExcInvalidSolverParametersEncountered( "The number of arnoldi vectors " + std::to_string(n_arnoldi_vectors) + " should be no larger than the problem size " + std::to_string(problem.dim()) + ".")); solver_assert(n_arnoldi_vectors > 2 * problem.n_ep() + 1, state, ExcInvalidSolverParametersEncountered( "The number of arnoldi vectors (== " + std::to_string(n_arnoldi_vectors) + " is too small to obtain " + std::to_string(problem.n_ep()) + " eigenvalues.")); } // // Eigenpairs // solver_assert( problem.n_ep() < problem.dim(), state, ExcInvalidSolverParametersEncountered( "The number of eigenpairs to compute (==" + std::to_string(problem.n_ep()) + ") must be less than the dimensionality of the problem (== " + std::to_string(problem.dim()) + ")")); } template void ArpackEigensolver::arpack_ido_step( state_type& state, std::array ipntr) const { const Eigenproblem& problem = state.eigenproblem(); typedef typename state_type::scalar_type scalar_type; // Nothing to do if we are converged. if (state.ido == 99) return; typedef PtrVector ptrvec_t; // Build MultiVectors for the important vectors, such // that we can use apply with them. // Note: Since Arpack uses 1-based indices (Fortran) we need to // take one away before we use them. scalar_type* workd = &(*state.workd_ptr)[0]; auto x = make_as_multivector(workd + ipntr[0] - 1, problem.dim()); auto y = make_as_multivector(workd + ipntr[1] - 1, problem.dim()); auto Bx = make_as_multivector(workd + ipntr[2] - 1, problem.dim()); if (mode == 3 && state.ido == -1) { // Arpack wants y = Diag*x. // and Bx is not yet valid. // // Note: // Our definition of Diag differs from the one // Arpack uses for the case mode == 3, // this is why this case is treated specially. std::unique_ptr tmp_ptr(new scalar_type[problem.dim()]); auto tmp = make_as_multivector(tmp_ptr.get(), problem.dim()); problem.B().apply(x, tmp); // tmp = B x // y = (A - \sigma B)^{-1} tmp problem.Diag().apply(tmp, y); return; } switch (state.ido) { case -1: case 1: // Arpack wants y = Diag*x // - if ido == -1: Bx is not valid. // - if ido == 1: Bx is valid. if (mode == 2) { problem.A().apply(x, y); // y = A*x // Copy from y to x; Note: This is strictly required by ARPACK std::copy(std::begin(y[0]), std::end(y[0]), std::begin(x[0])); problem.B().apply_inverse(x, y); // y = B^{-1} * (A*x) } else if (mode == 3) { // This has already been dealt with above, we should // never get here: assert_internal(state.ido == 1); // special, since our definition of Diag differs // from ARPACK's (see above) // y = (A - \sigma B)^{-1} * B * x problem.Diag().apply(Bx, y); } else { problem.Diag().apply(x, y); // y = Diag * x } break; case 2: problem.B().apply(x, y); // y = B x break; case 3: // TODO ido==3 exists, but we do not have it implemented assert_implemented(false); break; default: // Check that we have a sensible ido assert_dbg(false, ExcArpackInvalidIdo(state.ido)); } } template void ArpackEigensolver::setup_state(state_type& state) const { // Clear the ido and the iparam: state.ido = 0; // Setup iparam array: std::fill(state.iparam.begin(), state.iparam.end(), 0); state.iparam[0] = 1; // Automatically determine shifts state.iparam[2] = static_cast(max_iter); state.iparam[6] = mode; esoln_type& soln = state.eigensolution(); auto& evectors = soln.evectors(); auto& evalues = soln.evalues(); std::vector& resvec = *state.resid_ptr; // // Compute residual (if needed and possible) // if (evectors.n_vectors() > 0 && !state.have_old_residual) { // Accumulate eigenvalue-weighted average eigenvector in res PtrVector res(resvec.data(), resvec.size()); for (size_t i = 0; i < evectors.n_vectors(); ++i) { for (size_t j = 0; j < evectors.n_elem(); ++j) { // Since larger eigenvalues are favoured by Krylov-based methods // We use the evalues to damp the components of the individual // vectors // // TODO This entirely my guts feeling. I have not investigated // closely whether this is sensible or not. res(j) += evectors[i](j) / evalues[i]; } } res /= norm_l2(res); state.have_old_residual = true; } } template void ArpackEigensolver::solve_state(state_type& state) const { // TODO Remove assertions and generalise. assert_implemented(mode == 2 || mode == 1); static_assert(std::is_same::value, "Arpack can only solve real problems at double precision at " "the moment"); // ------- assert_dbg(!state.is_failed(), krims::ExcInvalidState("Cannot solve a failed state")); const Eigenproblem& problem = state.eigenproblem(); esoln_type& soln = state.eigensolution(); // Assert that control parameters and state fit. assert_valid_control_params(state); // Setup the state for the solver run setup_state(state); // // Setup local parameters // // Number of arnoldi vectors (0 == autodetermined) size_t n_arnoldi_actual = n_arnoldi_vectors; if (n_arnoldi_actual == 0) { // Auto-determine number of arnoldi vectors // Note: This is exactly the algorithm used by scipy. n_arnoldi_actual = std::min(problem.dim(), std::max(2 * problem.n_ep() + 1, 20)); } // Info parameter for ARPACK: // If == 1 ARPACK uses the residual we provide (or computed // in setup_state), else a random residual vector is used. int info = state.have_old_residual ? 1 : 0; // // Run arpack ds_upd // // Setup Arpack wrapper detail::ds_upd_wrapper arpack{ Eigenproblem::generalised, problem.dim(), base_type::which, problem.n_ep(), base_type::tolerance, n_arnoldi_actual, state.resid_ptr, state.workd_ptr}; // Perform an Arnoldi/Lanczos step in Arpack and then deal with the ido until Arpack // flags convergence. while (state.ido != 99) { arpack.arnoldi_step(state.ido, state.iparam, info); arpack_ido_step(state, arpack.ipntr); } state.have_old_residual = true; // info == 0 implies that all is fine // info == 1 implies that we cannot find any more Ritz vectors // (but we still can get some of them) // info == 3 implies that no shifts could be applied during the // implicit restart, usutally this means that the // number of arnoldi vectors has been too small solver_assert(info != 3, state, ExcArpackCouldNotApplyShifts(n_arnoldi_actual)); solver_assert(info == 0 || info == 1, state, ExcArpackInfo("dsaupd", info)); // Purge eigenpairs from previous runs: soln.evalues().clear(); soln.evectors().clear(); // // Compute eigenpairs // //! Container for eigenvectors, one after another std::vector evectors; //! We currently use no shift (mode 3 not implemented) const double sigma = 0.0; int info_ev; arpack.eigenpairs(sigma, state.iparam, soln.evalues(), evectors, info_ev); solver_assert(info_ev == 0, state, ExcArpackInfo("dseupd", info_ev)); size_t converged_ep = problem.n_ep(); if (info == 1) { // Shrink to keep only those eigenpairs which are converged. converged_ep = state.iparam[4]; soln.evalues().resize(converged_ep); } assert_internal(converged_ep * problem.dim() <= evectors.size()); soln.evectors().reserve(converged_ep); for (double* begin = evectors.data(); begin < evectors.data() + converged_ep * problem.dim(); begin += problem.dim()) { evector_type v(begin, begin + problem.dim()); soln.evectors().push_back(std::move(v)); } // info == 1 implies that we cannot find any more Ritz vectors solver_assert(info != 1, state, ExcArpackCannotFindMoreEigenpairs(problem.n_ep(), soln.evalues().size())); } } // namespace lazyten #endif // LAZYTEN_HAVE_ARPACK