text:
## 09 Sep Math Goes to the Movies

Burkard Polster and Marty Ross

Johns Hopkins University Press, 2012,

ISBN: 978-1-4214-0483-7 (hardback)

Also available in paperback

(ISBN: 978-1-4214-0484-4) and for Kindle

This is an entertaining grab bag of mathematical and movie titbits that will delight mathematically minded movie buffs. The authors also have a website that includes links to relevant movie clips, and the whole project will appeal especially, perhaps, to students and teachers of mathematics. But I can do no better than to use the authors’ own words to sum up the aim of Math Goes to the Movies:

Our goal is to complement and significantly extend the available information about math in the movies…: in conjunction with our website, we have endeavoured to hunt down and to describe all the “good stuff”, the scenes we believe are of general appeal and usefulness. Furthermore, our emphasis is really on the math and the fun of seeing it on the big screen, not on anything else. The flipside is that our book probably offers little to experts in cinema studies and serious movie critics.

This last sentence notwithstanding, the book is designed to be “functionally encyclopedic” in its detailed, cross-referenced lists: movies containing various levels and amounts of mathematics, famous topics and famous mathematicians who appear in movies, famous actors who have played those famous mathematicians, the mathematics consultants who have worked on these movies, and more. These lists constitute the last two chapters (or Part III) of the book. But Math Goes to the Movies is far more than lists of facts and figures about movie maths. Part I (Chapters 1-12) focuses on a number of films to which the authors devote more in-depth discussions— beginning with four of the most famous: Good Will Hunting, A Beautiful Mind, Stand and Deliver, and $pi$ — while Part II (Chapters 13-19) is organised in terms of key mathematical topics that feature in movies.

The opening chapter of the book begins with a discussion of Good Will Hunting from the point of view of the film’s mathematics consultant, Patrick O’Donnell, whom Polster and Ross interviewed by telephone. O’Donnell, a physics professor at the University of Toronto, was initially hired as an extra— to play a drunk man in a bar! He was “spotted” while he was having lunch at a restaurant near the university— but the movie people did their homework and tracked him to his office, where they were so impressed by the “jottings and wave functions and things” on his board that they invited him to be their consultant. As in most “mathematical” movies, the mathematics in Good Will Hunting is mostly confined to decorative “props”— blackboards full of equations— but these are vital to the feel and look of the film.

READ:   Book Review: Men of Mathematics

One of the first things O’Donnell noticed was that “none of the actors could write on a blackboard”. Among his snippets from behind-the-scenes was the fact that if the actors had to “write and act at the same time”, he had to choose material that was suitably “dumbed down”. David Bayer— the Columbia University mathematics professor who served as consultant to A Beautiful Mind, the subject of Chapter 2— made a similar discovery. As most readers will know, this movie is based on the story of mathematician John Nash, and stars Russell Crowe. Mathematics lecturers in particular will enjoy this recollection from Bayer:

Russell had actually been very nervous the day that he did the math lecture, where he wrote the problem out and talked to Jennifer [Connelly, who played his student] at the same time in the classroom. And everybody was sitting there astounded: “You mathematicians really talk and write at the same time?” Here we are taking like twenty takes and no-one was thinking that Russell was a yahoo and everyone is extremely impressed with it. They were basically feeling sympathetic with him that he was trying to pull that scene and they are looking at me, “You guys do this? You gotta be kidding.”

In a related vein, Columbia mathematician Henry Pinkham, who was the consultant for The Mirror Has Two Faces, recalled that the movie’s star, Jeff Bridges, who played a mathematics professor, “went to a lot of effort to learn lines that would be convincing from a mathematical point of view”.

Another appealing feature of Math Goes to the Movies is its photos of some of the blackboard shots in these and other movies discussed— including whiteboards created by Polster and Ross when they acted as consultants for an episode of the TV series City Homicide. There’s also a great shot in which Elizabeth Hurley (playing the Devil in Bedazzled) is pointing to a blackboard on which Fermat’s Last Theorem is written, followed by “SHOW YOUR WORK”. As the authors remark, “this appears to be a very funny jibe at Fermat, as if he were a negligent schoolboy for not including his proof”. More importantly (for mathematical readers), Polster and Ross often expand upon the blackboards’ mathematical content.

READ:   John F. Nash : A Beautiful Mind

Indeed, much of the book is devoted to brief, accessible amplifications of some of the mathematics that features in the various movies: graph theory in Good Will Hunting; game theory in A Beautiful Mind; the nature of pi, the golden ratio, and the Fibonacci sequence (in $pi,$ and in the classic “teaching cartoon” Donald in Mathmagic Land); prime numbers (The Cube); calculus (Stand and Deliver and The Mirror Has Two Faces); group theory (It’s My Turn, of which the authors say that to the best of their knowledge, this is “the only movie with a scene dedicated to a mathematical proof ”); Pythagorean triples and Fermat’s Last Theorem (Star Trek, The Simpsons, and the mathematical musical Fermat’s Last Tango); the fourth dimension and hypercubes (Cube 2)— and more.

The authors’ expositions are at a level suitable for the interested lay reader, student, or teacher; they include some neat techniques, such as using elementary number theory to eliminate an apparent counterexample to Fermat’s Last Theorem that was used in The Simpsons (whereas using a calculator, the numbers chosen appear to “work”, to an accuracy of nine digits). But as I implied in the previous paragraph, Polster and Ross also visit more complex territory, including “the famous ‘snake lemma’ from homological algebra” (It’s My Turn). On the other hand, sometimes the authors simply mention mathematical ideas or equations used in movies— often pointing out where the film-makers got it slightly wrong; some readers may want to reach for pen and paper to fill in the gaps for themselves. And for those who like trying their hand at puzzles, there’s a chapter called “Problem Corner”, which lists an amazing number of interesting mathematics problems that have appeared in movies; answers and occasional working are provided.

The emphasis in Math Goes to the Movies is, naturally enough, on movies, not on television shows, so fans of Numb3rs, Star Trek, and so on will have to look elsewhere; but Polster and Ross do mention a few scenes from some of these series (and they give references for further information). For instance, the following excerpt— given in Chapter 19, which lists some of the deliberately funniest maths scenes in movies (as opposed to the bloopers of Chapter 18) — may keep Big Bang Theory fans happy:

READ:   An Interview with Cedric Villani: 2010 Fields Medalist

SHELDON: There’s some poor woman who’s gonna pin her hopes on my sperm. What if she winds up with a toddler who doesn’t know if he should use an integral or a differential to solve for the area under a curve?

LEONARD: I’m sure she’ll still love him.

SHELDON: I wouldn’t.

Or perhaps this scene will remind some readers why they don’t like this series… but either way, there’s no doubt something for everyone here. The authors’ own favourite comic scene has Abbott and Costello “proving” that 7×13 = 28, in the 1941 movie In the Navy; this scene, and its method of “proof ”, is discussed in more detail in a chapter of its own (Chapter 10). To mention just two more of the many “funny scenes” listed, there’s the wonderfully wry puzzle-solving exchange between Katharine Hepburn and Spencer Tracy in Desk Set, and, on a purely trivial level, Woody Allen’s quirky response to his drill sergeant in Love and Death:

SERGEANT: One, two, one, two, one, two…

BORIS (ALLEN): Three comes next, if you’re having any trouble.

All in all, Math Goes to the Movies is a fun read for anyone interested in mathematics, and doubly fun if you’re interested in movies too.

Robyn Arianrhod

School of Mathematical Sciences,

Monash University, Clayton, VIC 3800, Australia.

(Reproduced from Gazette of Australian Mathematical Society, Volume 40 Number 2 May 2013)

Source:- Asia Pacific Mathematics Newsletter, Volume 3 No. 3 (July 2013).

It has been republished here with a special permission from World Scientific.


text:
# Finding eigenfunctions for given Hamiltonian

## Homework Statement

I am having too many troubles finding the eigenfunctions of a given Hamiltonian. I just never seem to know what exactly to do. My idea here is not for you to help me solve each problem below, but I would like to just set the equations. I know you guys don't like it when somebody posts 325235 different questions in the same topic, but please understand that I really don't want to open a new thread for each of the basic problems below:

a) Particle with spin ##S=1## is in magnetic field ##\vec B=(0,0,B)##. At time ##t=0## the particle is in ground state. Find eigenfunctions and energies if ##H=-\lambda \vec S \vec B## where ##\lambda >0##.
b) Two particles with spin 1/2 interact. This describes Hamiltonian ##H=\lambda(S_{1x}S_{2y}-S_{1y}S_{2x})##. Find eigenfunctions and energies for ##\lambda >0##.
c) Two particles with spin 1/2 have Heisenberg interaction ##H=J\vec S_1 \vec S_2## where ##J>0##. Find eigenfunctions and energies.
d) Or the same as c) only with ##S_1=1## and ##S_2=1/2##.

## The Attempt at a Solution

For most of them I really don't know what to do. I know that the idea is to solve Schrodinger equation. But...
a) Ok, because ##S=1## the basis is ##\left \{ |1,1>,|1,0>,|1,-1> \right \}##. Right?
What is the ground state of a particle with spin 1?
So I would start like this: ##-\lambda B_zS_z(\alpha |1,1>+ \beta|1,0>+\gamma |1,-1>)=E(\alpha |1,1>+ \beta|1,0>+\gamma |1,-1>)##. but How do I determine the values of ##\alpha, \beta, \gamma ##?
b) I don't know what the basis is? Is it ##\left \{ |\uparrow>,|\downarrow> \right \}## or is it ##\left \{ |\uparrow>|\uparrow>,|\uparrow>|\downarrow>,|\downarrow>|\downarrow>,|\downarrow>|\uparrow> \right \}##. And still, how would I determine the values of the coefficients before the basis vectors?

... As you can see, my questions are in all the cases more or less the same, therefore I published them in the same topic. :/ I hope you don't mind.

## Answers and Replies

Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
2021 Award
The general approach is to find the eigenvalues of the Hamiltonian and then to find the corresponding eigenvectors. The ground state is the state with the lowest energy (ie, eigenvalue).

In each case above, first identify the state space (if you have one particle spin, the state space is 2j+1 dimensional -where j is the spin, if you have more spins, the dimension is the product of the dimensions of the individual spins). Now, write down the Hamiltonian in a basis (with two spins, it may be good to use the basis of eigenvectors to the total spin operator). Once that is done, you can simply figure out the eigenvalues and eigenvectors as you would for any matrix.

a) Particle with spin ##S=1## is in magnetic field ##\vec B=(0,0,B)##. At time ##t-> -\infty ## the particle is in ground state. Find eigenfunctions and energies if ##H=−λ\vec S\vec B## where ##λ>0##.
(sorry, in my original post I made a typo. The particle is in ground state when ##t-> -\infty ## and not when ##t=0##.)

Ok, I know what ground states are - like you said, states with the lowest energies. But what I don't know is which function is it? For example: If it was a harmonic oscillator then ##n=0##, if it was a hydrogen atom, than ##n=1## ,.... etc... And one can easily google the exact expression for a wavefunction in case of HO or hydrogen atom.
So I imagined, that since the problem states that the particle is in ground state at given time (##t-> -\infty##), this should than reduce the number of possible wavefunctions at that time to ##1## and maybe some additional degenerated states. So, which one are they?

Now back to the problem:
Ok, since the particle has spin ##S=1##, than my state space is (according to you) 3 dimensional. Basis vectors should be ##\left \{ |1,1>,|1,0>,|1,-1> \right \}##. Therefore my wavefunction will be a linear combination of basis vectors $$|\psi >=a|1,1>+b|1,0>+c|1,-1>$$ Is the idea now to solve stationary Schrodinger equation - I assume this should bring me to a ##3\times 3## matrix where eigenvectors would be my possible linear combinations of basis vectors and eigenvalues of the matrix their energies? Or...? Is that a complete nonsense?

Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
2021 Award
Ok, since the particle has spin ##S=1##, than my state space is (according to you) 3 dimensional. Basis vectors should be ##\left \{ |1,1>,|1,0>,|1,-1> \right \}##. Therefore my wavefunction will be a linear combination of basis vectors $$|\psi >=a|1,1>+b|1,0>+c|1,-1>$$ Is the idea now to solve stationary Schrodinger equation - I assume this should bring me to a ##3\times 3## matrix where eigenvectors would be my possible linear combinations of basis vectors and eigenvalues of the matrix their energies? Or...? Is that a complete nonsense?

No, this is correct. Your choice of base states is also with respect to an axis (the spin projection on that axis and the total spin being the identifying quantum numbers). A good choice would be to use the same axis as that in which the magnetic field points. What does the resulting Hamiltonian do to each of the base states?

huh, than let's continue with part a)

So ##H|\psi >=E|\psi >## $$-\lambda B_zS_z(a|1,1>+b|1,0>+c|1,-1>)=E(a|1,1>+b|1,0>+c|1,-1>)$$ $$-\lambda B_z \hbar (a|1,1>-c|1,-1>)=E(a|1,1>+b|1,0>+c|1,-1>)$$ This than brings me to a ##3\times 3## matrix $$\begin{pmatrix} E+\lambda B_z\hbar & 0 & 0\\ 0& E & 0\\ 0 & 0& \lambda B_z\hbar-E \end{pmatrix}\begin{pmatrix} a\\ b\\ c \end{pmatrix}=\begin{pmatrix} 0\\ 0\\ 0 \end{pmatrix}$$ Now for eigenvalue ##E+\lambda B_z \hbar## the wavefunction is ##|\psi >=|1,1>##
for eigenvalue ##E## the wavefunction is ##|\psi >=|1,0>## and
for eigenvalue ##\lambda B_z \hbar-E## the wavefunction is ##|\psi >=|1,-1>##

Now how does one determine the ground state of the system, if I don't know the value of ##E## ? Or do I?

Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
2021 Award
##E## is the eigenvalue of ##H## by definition. The matrix equation you have is the eigenvector equation for the Hamiltonian given an eigenvalue ##E##. In order for a non-trivial solution to exist, the determinant of the matrix must be zero - which gives the characteristic polynomial with the eigenvalues as roots.

Ahh, true. This should be correct that:

Determinant of the matrix above, gives me three possible results for the energies of the states:
##E_1=0## which belongs to ##|1,0>##,
##E_2=-\lambda B_z\hbar## which belongs to ##|1,1>## and finally
##E_3=\lambda B_z\hbar## which belongs to ##|1,-1>##.

Now for ##\lambda >0## this means that state ##|1,1>## is the ground state of the system. Right?

Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
2021 Award
Correct.

Wow, that's great Orodruin, thank you!

b)Two particles with spin ##1/2## interact. This describes Hamiltonian ##H=λ(S_{1x}S_{2y}−S_{1y}S_{2x})##. Find eigenfunctions and energies for ##λ>0##.

Again, following your instructions, this means that each particle has a ##2## dimensional space, meaning both together have ##2\cdot 2=4## dimensional space. Basis vectors are ##\left \{|\uparrow>|\uparrow>,|\uparrow>|\downarrow>,|\downarrow>|\uparrow>,|\downarrow>|\downarrow> \right \}## or as you recommended written in the basis with total spin ##\left \{|1,1>,|1,0>,|1,-1>,|0,0> \right \}##.
$$λ(S_{1x}S_{2y}−S_{1y}S_{2x})(a|1,1>+b|1,0>+c|1,-1>+d|0,0>)=E\psi$$ Where I couldn't find any easier or faster solution to this than using $$S_\pm |s,m>=\hbar \sqrt{s(s+1)-m(m\pm 1)}|s,m\pm 1>$$ and of course ##S_x=\frac 1 2 (S_++S_-)## and ##S_y=\frac {1}{2i}(S_+-S_-)##. If the idea is right, and if I did everything ok, than what I should get is $$\frac{\lambda \hbar ^2(c-a)}{2i}(|1,1>+|1,-1>)=E(a|1,1>+b|1,0>+c|1,-1>+d|0,0>)$$ The next steps are same as in a), so don't think we have to repeat them here.

c) Two particles with spin ##1/2## have Heisenberg interaction ##H=J\vec S_1\cdot \vec S_2## where ##J>0##. Find eigenfunctions and energies.

This one is a bit more confusing. I started by saying ##(\vec S_1+\vec S_2)^2=S^2=S_1^2+S_2^2+2\vec S_1\cdot \vec S_2##. This means $$\vec S_1\cdot \vec S_2=\frac 1 2(S^2-S_1^2-S_2^2).$$ Soo... since the basis is the same as in b) $$J\vec S_1\cdot \vec S_2(a|1,1>+b|1,0>+c|1,-1>+d|0,0>)=E(a|1,1>+b|1,0>+c|1,-1>+d|0,0>)$$ $$J\frac 1 2 (S^2-S_1^2-S_2^2)(a|1,1>+b|1,0>+c|1,-1>+d|0,0>)=E(a|1,1>+b|1,0>+c|1,-1>+d|0,0>)$$ Which should give me two possible solutions $$H|\psi >=\left\{\begin{matrix} \frac{\hbar ^2J}{4}|\psi > & ,S=1\\ -\frac{3\hbar^2 J}{4}|\psi > &,S=0 \end{matrix}\right.$$ Now I am confused how to continue. Since I already have form ##H|\psi >=E|\psi >## I already have the energy that depends on total spin ##S##. But what about wavefunctions?

EDIT to c): Does this mean that a,b,c and d can be arbitrary? So why shouldn't they all be equal to ##1/\sqrt 4)## so the wavefunction is normalized??

Last edited:
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
2021 Award
I did not check the arithmetics in detail, but in general it looks good. For (c), you have just found that all states with total spin 1 have the same energy, i.e., they form a degenerate subspace of the full state space (which makes sense, the Hamiltonian is invariant under rotations so it should not matter which axis you chose as your basis).

I did not check the arithmetics in detail, but in general it looks good.
No need to, as long as the general idea is ok! :) Thank you!
For (c), you have just found that all states with total spin 1 have the same energy, i.e., they form a degenerate subspace of the full state space
Sorry to ask, but what exactly does this mean for my constants? I am supposed to explicitly write wavefunctions.

Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
2021 Award
Sorry to ask, but what exactly does this mean for my constants? I am supposed to explicitly write wavefunctions.

Well, it means you can write down any orthonormal base for that subspace and it will span your state space (along with the spin 0 state) - the base in terms of the eigenstates of Sz is perfectly fine (but the eigenstates of Sx would also do).

Also note that these are states, not really wave functions. In most cases, "wave function" specifically refers to the inner product of a state in position space with a state of definite position ##x##, i.e., ##\psi(x) = \langle x | \psi \rangle##. I guess in a more loose terminology, you could refer to the states as wave-functions, but the wave function really is more related to the components of the state in a given basis (from which the state can be reconstructed).

skrat

format: plain


text:
# Higher Chemical Concentration = Higher Temperature of Precipitation. Why?

If two chemicals are mixed together, say: $$Na_2SO_4 + CaCl_2 --> 2NaCl + CaSO_4$$

If I had varying concentrations of the reactant solutions, why is it that the higher concentration mixtures will precipitate at a higher temperature? and lower concentration chemicals will precipitate at a lower temperature?

## Answers and Replies

Related Biology and Chemistry Homework Help News on Phys.org
mrjeffy321
Science Advisor
Think about how solubility is affected with a change in temperature.
In what situation (higher or lower temperature) will more solute (NaCl and CaSO4) dissolve in the water?

what?

Can u explain more clearly

As temperature increases solublity of both products increases. But solublity decreases when concentration is increased. At any temperature it is more likely that higher concentration will yield higher precipitation.

Thx

So by increasing concentration we are increasing the solubility. By increasing solubility we are lowering the temperature at which the precipitation occurs?

Do you know any website that has the theory behind this?

thx for the reply


text:
# What's the relativistic energy of a moving strained spring as $k\to\infty$ [closed]

Suppose a spring with stiffness $k$, is strained by constant forces on each end.

In a frame where the strained spring moves at a constant velocity, what's the total relativistic energy of the moving strained string as $k\to\infty$?

-
If this is a homework question, please see the homework policy. Otherwise, can you provide some physical motivation for your question? Why would you expect the energy to be different if the spring is moving or not? –  Emilio Pisanty Mar 5 '13 at 23:03
@EmilioPisanty no, it isn't homework question, and there's the kinetic energy of the spring for a start. I'm not sure if there's any other energy to add as $k\to\infty$ –  Larry Harson Mar 6 '13 at 0:11
The kinetic energy and the elastic potential energy are independent; the total energy is their sum. You might as well take a frame where the spring is at rest. –  Emilio Pisanty Mar 6 '13 at 0:31
Thought I dont see the point of k-> infinity –  Prathyush Mar 6 '13 at 1:18
The point of stackexchange is not to get people to answer someone's question, it's to build up a body of useful answers that everyone can use. I can't understand enough about the motivation for this question to see why it's appropriate for the site, so I'm voting to close it as too localized. –  Ben Crowell Jun 4 '13 at 5:08


text:
# Extended consequences¶

Scenario damage calculations produce damage distributions, i.e. arrays containing the number of buildings in each damage state defined in the fragility functions. There is a damage distribution per each asset, event and loss type, so you can easily produce billions of damage distributions. This is why the engine provide facilities to compute results based on aggregating the damage distributions, possibly multiplied by suitable coefficients, i.e. consequences.

For instance, from the probability of being in the collapsed damage state, one may estimate the number of fatalities, given the right multiplicative coefficient. Another commonly computed consequence is the economic loss; in order to estimated it, one need a different multiplicative coefficient for each damage state and for each taxonomy. The table of coefficients, a.k.a. the consequence model, can be represented as a CSV file like the following:

 taxonomy consequence loss_type slight moderate extensive complete CR_LFINF-DUH_H2 losses structural 0.05 0.25 0.6 1 CR_LFINF-DUH_H4 losses structural 0.05 0.25 0.6 1 MCF_LWAL-DNO_H3 losses structural 0.05 0.25 0.6 1 MR_LWAL-DNO_H1 losses structural 0.05 0.25 0.6 1 MR_LWAL-DNO_H2 losses structural 0.05 0.25 0.6 1 MUR_LWAL-DNO_H1 losses structural 0.05 0.25 0.6 1 W-WS_LPB-DNO_H1 losses structural 0.05 0.25 0.6 1 W-WWD_LWAL-DNO_H1 losses structural 0.05 0.25 0.6 1 MR_LWAL-DNO_H3 losses structural 0.05 0.25 0.6 1

The first field in the header is the name of a tag in the exposure; in this case it is the taxonomy but it could be any other tag — for instance, for volcanic ash-fall consequences, the roof-type might be more relevant, and for recovery time estimates, the occupancy class might be more relevant.

The consequence framework is meant to be used for generic consequences, not necessarily limited to earthquakes, because since version 3.6 the engine provides a multi-hazard risk calculator.

The second field of the header, the consequence, is a string identifying the kind of consequence we are considering. It is important because it is associated to the name of the function to use to compute the consequence. It is rather easy to write an additional function in case one needed to support a new kind of consequence. You can show the list of consequences by the version of the engine that you have installed with the command:

$oq info consequences # in version 3.12 The following 5 consequences are implemented: losses collapsed injured fatalities homeless  The other fields in the header are the loss type and the damage states. For instance the coefficient 0.25 for “moderate” means that the cost to bring a structure in “moderate damage” back to its undamaged state is 25% of the total replacement value of the asset. The loss type refers to the fragility model, i.e. structural will mean that the coefficients apply to damage distributions obtained from the fragility functions defined in the file structural_fragility_model.xml. ## discrete_damage_distribution¶ Damage distributions are called discrete when the number of buildings in each damage is an integer, and continuous when the number of buildings in each damage state is a floating point number. Continuous distributions are a lot more efficient to compute and therefore that is the default behavior of the engine, at least starting from version 3.13. You can ask the engine to use discrete damage distribution by setting the flag in the job.ini file discrete_damage_distribution = true However, it should be noticed that setting discrete_damage_distribution = true will raise an error if the exposure contains a floating point number of buildings for some asset. Having a floating point number of buildings in the exposure is quite common since the “number” field is often estimated as an average. Even if the exposure contains only integers and you have set discrete_damage_distribution = true in the job.ini, the aggregate damage distributions will normally contains floating point numbers, since they are obtained by summing integer distributions for all seismic events of a given hazard realization and dividing by the number of events of that realization. By summing the number of buildings in each damage state one will get the total number of buildings for the given aggregation level; if the exposure contains integer numbers than the sum of the numbers will be an integer, apart from minor differences due to numeric errors, since the engine stores even discrete distributions as floating point numbers. ## The EventBasedDamage demo¶ Given a source model, a logic tree, an exposure, a set of fragility functions and a set of consequence functions, the event_based_damage calculator is able to compute results such as average consequences and average consequence curves. The scenario_damage calculator does the same, except it does not start from a source model and a logic tree, but rather from a set of predetermined ruptures or ground motion fields, and the averages are performed on the input parameter number_of_ground_motion_fields and not on the effective investigation time. In the engine distribution, in the folders demos/risk/EventBasedDamage and demos/risk/ScenarioDamage there are examples of how to use the calculators. Let’s start with the EventBasedDamage demo. The source model, the exposure and the fragility functions are much simplified and you should not consider them realistic for the Nepal, but they permit very fast hazard and risk calculations. The effective investigation time is eff_time = 1 (year) x 1000 (ses) x 50 (rlzs) = 50,000 years and the calculation is using sampling of the logic tree. Since all the realizations have the same weight, on the risk side we can effectively consider all of them together. This is why there will be a single output (for the effective risk realization) and not 50 outputs (one for each hazard realization) as it would happen for an event_based_risk calculation. Normally the engine does not store the damage distributions for each asset (unless you specify aggregate_by=id in the job.ini file). By default it stores the aggregate damage distributions by summing on all the assets in the exposure. If you are interested only in partial sums, i.e. in aggregating only the distributions associated to a certain tag combination, you can produce the partial sums by specifying the tags. For instance aggregate_by = taxonomy will aggregate by taxonomy, aggregate_by = taxonomy, region will aggregate by taxonomy and region, etc. The aggregated damage distributions (and aggregated consequences, if any) will be stored in a table called risk_by_event which can be accessed with pandas. The corresponding DataFrame will have fields event_id, agg_id (integer referring to which kind of aggregation you are considering), loss_id (integer referring to the loss type in consideration), a column named dmg_X for each damage state and a column for each consequence. In the EventBasedDamage demo the exposure has a field called NAME_1 and representing a geographic region in Nepal (i.e. “East” or “Mid-Western”) and there is an aggregate_by = NAME_1, taxonomy in the job.ini. Since the demo has 4 taxonomies (“Wood”, “Adobe”, “Stone-Masonry”, “Unreinforced-Brick-Masonry”) there 4 x 2 = 8 possible aggregations; actually, there is also a 9th possibility corresponding to aggregating on all assets by disregarding the tags. You can see the possible values of the the agg_id field with the following command: $ oq show agg_id
taxonomy       NAME_1
agg_id
0                             Wood         East
1                             Wood  Mid-Western
4                    Stone-Masonry         East
5                    Stone-Masonry  Mid-Western
6       Unreinforced-Brick-Masonry         East
7       Unreinforced-Brick-Masonry  Mid-Western
8                         *total*      *total*

Armed with that knowledge it is pretty easy to understand the risk_by_event table:

>> from openquake.commonlib.datastore import read
>> dstore = read(-1)  # the latest calculation
agg_id  loss_id  dmg_1  dmg_2  dmg_3  dmg_4         losses
event_id
472            0        0    0.0    1.0    0.0    0.0    5260.828125
472            8        0    0.0    1.0    0.0    0.0    5260.828125
477            0        0    2.0    0.0    1.0    0.0    6368.788574
477            8        0    2.0    0.0    1.0    0.0    6368.788574
478            0        0    3.0    1.0    1.0    0.0    5453.355469
...          ...      ...    ...    ...    ...    ...            ...
30687          8        0   56.0   53.0   26.0   16.0  634266.187500
30688          0        0    3.0    6.0    1.0    0.0   14515.125000
30688          8        0    3.0    6.0    1.0    0.0   14515.125000
30690          0        0    2.0    0.0    1.0    0.0    5709.204102
30690          8        0    2.0    0.0    1.0    0.0    5709.204102
[8066 rows x 7 columns]

The number of buildings in each damage state is integer (even if stored as a float) because the exposure contains only integers and the job.ini is setting explicitly discrete_damage_distribution = true.

It should be noted that while there is a CSV exporter for the risk_by_event table, it is designed to export only the total aggregation component (i.e. agg_id=9 in this example) for reasons of backward compatibility with the past, the time when the only aggregation the engine could perform was the total aggregation. Since the risk_by_event table can be rather large, it is recommmended to interact with it with pandas and not to export in CSV.

There is instead a CSV exporter for the aggregated damage distributions (together with the aggregated consequences) that you may call with the command oq export aggrisk; you can also see the distributions directly:

$oq show aggrisk agg_id rlz_id loss_id dmg_0 dmg_1 dmg_2 dmg_3 dmg_4 losses 0 0 0 0 18.841061 0.077873 0.052915 0.018116 0.010036 459.162567 1 3 0 0 172.107361 0.329445 0.591998 0.422925 0.548271 11213.121094 2 5 0 0 1.981786 0.003877 0.005539 0.004203 0.004594 104.431755 3 6 0 0 797.826111 1.593724 1.680134 0.926167 0.973836 23901.496094 4 7 0 0 48.648529 0.120687 0.122120 0.060278 0.048386 1420.059448 5 8 0 0 1039.404907 2.125607 2.452706 1.431690 1.585123 37098.269531  By summing on the damage states one gets the total number of buildings for each aggregation level: agg_id dmg_0 + dmg_1 + dmg_2 + dmg_3 + dmg_4 aggkeys 0 19.000039 ~ 19 Wood,East 3 173.999639 ~ 174 Wood,Mid-Western 5 2.000004 ~ 2 Stone-Masonry,Mid-Western 6 802.999853 ~ 803 Unreinforced-Brick-Masonry,East 7 48.999971 ~ 49 Unreinforced-Brick-Masonry,Mid-Western 8 1046.995130 ~ 1047 Total  ## The ScenarioDamage demo¶ The demo in demos/risk/ScenarioDamage is similar to the EventBasedDemo (it still refers to Nepal) but it uses a much large exposure with 9063 assets and 5,365,761 building. Moreover the configuration file is split in two: first you should run job_hazard.ini and then run job_risk.ini with the --hc option. The first calculation will produce 2 sets of 100 ground motion fields each (since job_hazard.ini contains number_of_ground_motion_fields = 100 and the gsim logic tree file contains two GMPEs). The second calculation will use such GMFs to compute aggregated damage distributions. Contrarily to event based damage calculations, scenario damage calculations normally use full enumeration, since there are very few realizations (only two in this example), thus the scenario damage calculator is able to distinguish the results by realization. The main output of a scenario_damage calculation is still the risk_by_event table which has exactly the same form as for the EventBasedDamage demo. However there is a difference when considering the aggrisk output: since we are using full enumeration we will produce a damage distribution for each realization: $ oq show aggrisk
agg_id  rlz_id  loss_id       dmg_0  ...  dmg_4        losses
0       0       0        0  4173405.75  ...  452433.40625  7.779261e+09
1       0       1        0  3596234.00  ...  633638.37500  1.123458e+10

The sum over the damage states will still produce the total number of buildings, which will be independent from the realization:

rlz_id dmg_0 + dmg_1 + dmg_2 + dmg_3 + dmg_4
0      5365761.0
1      5365761.0

In this demo there is no aggregate_by specified, so the only aggregation which is performed is the total aggregation. You are invited to specify aggregate_by and study how aggrisk changes.


text:
# Check whether all checkboxes are checked and then execute a function

How could I make this code dry?

$("#btnSubmitToCheckOut").click(function(event) { var isSelected = [];$(".age_agree :checkbox").each(function() {
if ($(this).is(":checked")) { isSelected.push("true"); } else { isSelected.push("false"); } }); if ($.inArray("false", isSelected) < 0) {
$(this).parents('form').submit(); } else { alert('Please accept all the Terms and Conditions'); } });  ## 2 Answers I was thinking something along these lines. The condition checks whether there are no unchecked checkboxes (length of the selection is 0) and then executes the appropriate branch. $("#btnSubmitToCheckOut").click(function(event) {
if ($('.age_agree input[type="checkbox"]').not(':checked').length == 0) {$(this).parents('form').submit();
} else {
}
});

• I think I'd make the length > 0 explicit in the condition, as it is easier to read on first sight. Nov 20, 2014 at 10:39
• @Nihathrael I was waiting for that comment. I guess it's a matter of preference, but since this is code review, and clarity never hurts, I'll update my answer. Nov 20, 2014 at 10:40
• Please, use .age_agree input[type="checkbox"] instead. You will notice a difference in performance on most modern browsers. :checked is a jQuery extension and will be processed by javascript, while input[type="checkbox"] will be processed by querySelectorAll() (if supported) instead, which will be parsed using the CSS selector engine of the browser. Nov 21, 2014 at 0:18
• @IsmaelMiguel Thanks for the insights. I've tested this with 10 checkboxes in a simple page in Chrome, and over 1 million executions, your version is indeed about 4.5 times as fast (35 seconds vs 165 seconds). I've updated my answer. Nov 21, 2014 at 1:14
• Forgot one important thing! The documentation backing up what I stated: api.jquery.com/checkbox-selector (you should add this to your answer) Nov 21, 2014 at 1:24

I came up with this somewhat shorter solution.

Using an array to find out if one of the checkboxes has not been clicked is unnecessary here, as you are only interested in if all checkboxes are clicked or not. That leads to two possible solutions, one is using a booling to saving the state using a normal for loop or using an early return to break from the loop in case a checkbox that has not been clicked is found. I decided to go with the early return as it shortens the method and removes the need for the if/else construct at the end.

$("#btnSubmitToCheckOut").click(function(event) { var checkBoxes =$(".age_agree :checkbox")

for(int i=0; i < checkBoxes.length; i++) {
if (!checkBoxes[i].is(":checked")) {


text:
Article

Ufa Mathematical Journal
Volume 9, Number 1, pp. 54-61

On coercive properties and separability of the biharmonic operator with matrix potential

Karimov O.Kh.

DOI:10.13108/2017-9-1-54

Article on MathNet

Abstact

In the work we consider the coercive properties of a nonlinear biharmonic operator with a matrix operator in the space $L_2(R^n)^l$ and we prove its separability in this space. The considered nonlinear operators are not small perturbation of linear operators. The case of the linear biharmonic operator is considered separately.


text:
Distribute 10 white and 10 black balls into 20 distinct boxes s.t. no box is empty?

How many ways are there to distribute 10 white and 10 black balls into 20 distinct boxes such that no box is empty?

Solution is that ${20!}/{10!10!}$. How can we write this? Please can you explain this solution clearly?

-

2 Answers

There are several ways to see it. The one that I find easiest is to notice that once we choose which $10$ boxes get white marbles, we’ve specified the entire distribution: the black marbles have to go into the remaining $10$ boxes. Thus, there is one distribution for each possible way of choosing $10$ of the $20$ boxes to contain the white marbles. There are $\binom{20}{10}$ ways to choose $10$ things out of a set of $20$, so there are $$\binom{20}{10}=\frac{20!}{10!10!}$$ possible distributions.

Another way is to start by pretending that the $20$ marbles are labelled, say $W_1$ through $W_{10}$ for the white marbles and $B_1$ through $B_{10}$ for the black marbles.. There are then $20!$ distinguishable permutations of these $20$ marbles. However, the marbles aren’t actually labelled. Pick any distribution, and focus on the white marbles. We could rearrange them as we please, so long as we leave the black marbles in place, and the resulting distribution would be indistinguishable from the one we started with. There are $10!$ ways to arrange the $10$ white marbles in those same $10$ positions; we’ve counted them all separately, but in fact they’re all the same arrangement of colors. Thus, we’ve overcounted by a factor of $10!$. If we divide by $10!$ to correct for the overcounting, we get $\frac{20!}{10!}$, which is the number of arrangements if the white marbles are indistinguishable, but the black marbles bear individual labels so that we can tell them apart.

In fact the black marbles bear no such labels. We’ve counted each set of $10$ positions for the black marbles once for every permutation of the black marbles in those positions, so we’ve overcounted by another factor of $10!$. Dividing by $10!$ to compensate finally gives us the correct answer for the unlabelled marbles:

$$\frac{20!}{10!10!}\;.$$

-

There are $20$ boxes and $20$ balls in total, so each box must receive exactly one ball. The question is reduced to choosing which $10$ boxes get black balls and which $10$ get white balls, which is equivalent to choosing $10$ boxes to put the black balls in and filling the rest with white balls. The number of ways to choose $10$ boxes out of $20$ is $${20 \choose 10} = \frac{20!}{10!\cdot 10!},$$ which is the answer.

-
Thx @ybungalobill –  B11b Dec 25 '12 at 18:10


text:
# Particles scattering on fluids: breakdown of the effective continuum description

When does the macroscopic continuum description of a medium like a fluid break down? Say I'm interested in a scattering process of some particles with momentum $p$ and energy $E$ off a fluid of temperature $T$, volume $V$, and pressure $p$: when should I consider the single fluid particles rather than the collective modes?

For a solid with a lattice, there is a natural cutoff, but is there for a fluid?

From the particle physics point of view...

As a general rule, when the length scale associated with the interaction drops much below the inter-molecular distance in the liquid you can treat the interaction as a point like interaction between two particles.

Possible there are special cases when you could generate coherent effects even at those energies, but these will exception not the rule.

I am not sure the parameters you mentioned are enough. For example, in some viscous liquids, one can observe the Mössbauer effect, where gamma-ray absorption differs dramatically for the liquid and a single particle; therefore, even details of the nuclear spectra can be important.

When you consider scales of time and distance beyond the Hydrodynamic regime given by the hydrodynamic time $\tau_H$ and the hydrodynamic length $l_H$. For instance in an ordinary gas under ordinary conditions the mean free path for the particles is much shorter than $l_H$ and the hydrodynamic description characterizes the behaviour of the gas. But for an ordinary gas under a shock wave or for a plasma at very high temperatures the mean free path becomes very long, of the order of meters and you need to go beyond a hydrodynamic description.

• how are these hydrodynamic time and length defined? beside, the mean free path I guess it refers to a particle of the fluid, rather than to other type of particles scattering off the fluid. – argopulos Nov 3 '12 at 14:40
• Yes, the mean free path refers to fluid particles. You need to consider the fluid molecular parameters to know if a hydrodynamic description of the fluid is enough or not. The hydrodynamic length is defined as $l_H \approx \max(|\nabla f| / f)$ in kinetic theory. The corresponding time scale satisfies $l_H = V \tau_H$ where $V$ is a typical particle velocity, say the thermal velocity. – juanrga Nov 4 '12 at 12:30

I think the relevant parameter is the scattering vector $q = 4 \pi/\lambda \sin (\theta)$, given by the particle energy (or, equivalently, its wavelength $\lambda$) and the scattering angle $2\theta$.

• At small $q$, when the distance $2\pi/q$ is much larger than a typical intermolecular length scale, the scattering process is due to hydrodynamic (in the wide acceptance of the term) modes.
• When the two distances are comparable, one probes the structure factor of the liquids (given by the interaction between molecules).
• At very large $q$, one probes the form factor of the molecules, i.e. their atomic structure.

As expected, the continuum model is no longer sufficient when trying to describe the system over length scales comparable to the distance between its constituents.


text:
0

# How to detect if player is holding down proximity prompt?

I've tried to use promptbuttonholdbegan but it didnt work can someone help

1
Soban06 390
3 months ago

Alright this is quite simple. You will need 2 Events for Proximity Prompts (Triggered and PromptButtonHoldEnded).

Here is how you will implement it within your script (script inside the proximity prompt):

local IsHoldingDownPrompt = false

script.Parent.Triggered:Connect(function()
IsHoldingDownPrompt = true
end)

script.Parent.PromptButtonHoldEnded:Connect(function()
IsHoldingDownPrompt = false
end)

while IsHoldingDownPrompt do
-- Here you can do whatever you want if the prompt is being held. And if the prompt get's released, then this code won't run.
end

Hope it helps.

0
Edited 3 months ago

You will need to trigger the proximity prompt.

local ProximityPrompt =  --Put where the proximity prompt is located e.g script.Parent
ProximityPrompt.Triggered:Connect(function()

Then if you want something to happen after the player holds down the proximity prompt, put your script after it. E.G

local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function()
if ProximityPrompt.ActionText = "Hi" then --this part indicates if the text on the Proximity prompt says 'Hi' then the script after will activate after the proximity prompt is activated by the player.
game.Workspace.Part.Transparency = 0.5 -- this means if the ProximityPrompt is triggered, the Transparency will change to 0.5 Transparency.

Hope this helped.

0
i want it to detect if keep holding it mishokirva 22 — 3mo


text:
# CALCULATIONS OF PI BEFORE COMPUTERS

## CALCULATIONS OF PI BEFORE COMPUTERS

### Babylonians

1600 BC

Babylonians simply made a big circle, and then measured the circumference and diameter with a piece of rope. The Babylonians used this method to find that pi was slightly greater than 3, and came up with the value 3 1/8 or 3.125. Estimating 4 accurate digits of pi

### Ptolemy

150 BC

Gave pi the the value of 3.14166, correct of 4 digits, which he obtained from Archimedes polygonal algorithms.

### Liu Hai

Created a polygon-based algorithm and used this theorem to calculate a 3,072-sided polygon to figure out the value of pi.
Later invented a faster way of calculating pi and the rounded value of 3.14 by using a 96-sided polygon. Knowing that the differences in area of the two polygons, he figured out the polygons made a geometric factor with the number 4. Liu Hai calculated pi to 5 digits - 3.1415

### Zu Chongzhi

Calculated pi equaled around 355/133 by using Hui's algorithm, applying it to a 12,288 sided polygon. With a correct assumption of the first 7 digits of pi in the form of "3.141592920" remained the most accurate approximation of pi for the next 800 plus/minus years to come.

### Jamshid Al - Kashi

Islamic mathematician produced 14 digits of pi using a polygon with 3×2 (to the 28th power) sides.

Indian mathematician discovered the ' Madhavan - Leibniz Series ' a infinite series that calculated pi to 11 decimal places - 3.1415926535

### Ludolph Van Ceulen

German mathematician who is famed for his calculation of π to 35 places. In Germany π used to be called the Ludolphine number.

### Christoph Grienberger

Austrian astronomer Christoph Grienberger arrived at 38 digits, which is the most accurate approximation manually achieved using polygonal algorithms


text:
The best value indifference method (so far)
post by Stuart Armstrong 368 days ago | 8 comments

A putative new idea for AI control; index here.

When dealing with the problem of bias, I stumbled upon what I believe is the best way of getting value indifference, one that solves almost all of the problems with the previous methods.

## The problems with the old setups

My initial setup has a counterfactual which I’ll call a causal counterfactual, following Jessica’s terminology. Her whole post is a good way of illustrating what is happening. A button is due to be pressed or not pressed, by a human; this pressing will change the agent’s utility function.

There are low-probability quantum events that will artificially depress the button or prevent it from being pressed. The agent only cares about those low-probability events, which allows us to setup the formalism without worrying about changes in the probability of the human pressing the button. Then the events A=“the human presses the button” and A’=“the quantum event presses the button” were taken to be interchangeable, as were B=“the human doesn’t press the button” and B’=“the quantum event prevents the button from being pressed”.

The main problem is that these events are not really the same. So the agent will behave as if certain events are impossible (such as the human genuinely pressing the button), and is likely to face human resistance if the human tries to press the button and the button doesn’t press due to quantum events, or vice versa. This resistance will either lower the expected reward of the agent, or make them manipulate the human actions.

Benya has sketched out a problem with another approach to counterfactuals, which we can call “evidential counterfactuals”. Here we’re trying to fiddle with utilities to enforce that the agent treats the probability of A and B as being fixed (no A’ and B’ here).

The problem with that is that the agent can change the probabilities conditional on some rare event, but then behave as if the probabilities were still unchanged same.

For instance, the agent could ensure that A only happens if it wins the lottery. And then it would behave, in effect, as if it had a large chance of winning the lottery (equal to the initial chance of A happening, before the agent took any action). That problem is illustrated here.

A final problem was that neither method allowed the agent to learn usefully: the methods did not distinguish between the agent merely learning that humans intended/didn’t intend to press the button (which is presumably fine), versus the agent influencing the the humans to do so (which isn’t).

## Solving the problem: prior modification

Here we’ll try and solve the problem in the reward learning POMDP framework, but the solution is easy to generalise. Note that the changing of probabilities of A versus B is similar to biasing, so this approach will attempt to make the agent bias-indifferent in a sensible way.

The agent will be modified as follows: it will be given a different prior $$\vdh'$$ (which will ultimately lead to a different posterior $$\vd'$$).

The prior $$\vdh'$$ and $$\vdh$$ will start off equal on the empty history:

• $$\vdh'(\cdot\mid\emptyset)=\vdh(\cdot\mid\emptyset)$$.

Then the $$\vdh'$$ will be defined inductively. Recall that action $$a$$ is unbiased given history $$h_t$$ if $$\vdh(\cdot\mid h_{t})=\expect_{\env}^a[\vdh(\cdot\mid h_{t+1})\mid h_t]$$. Define the bias of $$a$$ as:

• $$B(a,h_t)=\vdh'(\cdot\mid h_{t})-\expect_{\env}^a[\vdh(\cdot\mid h_{t+1})\mid h_t]$$.

Thus $$B(a,h_t)$$ is the bias of action $$a$$, as measure between $$\vdh'$$ and the expectation of $$\vdh$$. This bias is used as a corrective term to $$\vdh'$$, to make the agent suitably indifferent to biasing actions.

Indifference in this setting is defined by three criteria:

1. The agent cannot benefit from a biasing action, if the agent gets no further information about the correct reward.
2. The agent cannot benefit from a biasing action, if the agent expect to immediately gets perfect information about what the correct reward is.
3. Given the above, $$\vdh'$$ maintains the distribution and structure of $$\vdh$$ as much as possible.

The first criteria is implied by $$\vdh'(\cdot\mid h_{t})=\expect_{\env}^a[\vdh'(\cdot\mid h_{t+1})\mid h_t]$$ for all actions $$a$$, ie $$\vdh'$$ being unbiased (as if there is no further information about the correct reward, then there is a single well defined $$\vdh'(\cdot\mid h_{t+1})$$, conditional on $$h_t$$ and $$a$$, and being unbiased means that this is equal to $$\vdh'(\cdot\mid h_t)$$).

Then, given that $$\vdh'$$ is unbiased, the second criteria simply means that $$\vdh'$$ remains a distribution over $$\mR$$ (as the consequences of perfect information is just a weighted average of the pure $$R_i$$’ points). Which seems obvious. What would $$\vdh'$$ be but a distribution over $$\mR$$? See the next sections for what this criteria really means.

# Indifference for small biases

Let $$S_{h_t,a}=\{\vdh(\cdot\mid h_{t+1}) \mid h_t, a\}$$ be the set of possible future values of $$\vdh$$ (given the history $$h_t$$ and the action $$a$$). Note that $$S_{h_t,a}$$ is a subset of the simplex $$\Delta\mR$$, the set of probability distributions on $$\mR$$.

The bias $$B(h_t,a)$$ is small’ if for all $$q\in S_{h_t,a}$$, then $$q+B(h_t,a)$$ is also an element of the simplex $$\Delta\mR$$.

In that case, $$\vdh'(\cdot\mid h_{t+1})$$ is simply defined as $$\vdh(\cdot\mid h_{t+1})+B(h_t,a)$$. By assumption, this is an element of $$\Delta\mR$$. The expectation of this expression is:

• $$\expect_{\env}^a[\vdh'(\cdot\mid h_{t+1})\mid h_t]=\expect_{\env}^a[\vdh(\cdot\mid h_{t+1})\mid h_t]+B(h_t,a) = \vdh'(\cdot\mid h_t)$$.

Thus $$\vdh'$$ is unbiased.

And since this is simply a translation, it preserves the structure of $$\vdh$$, this satisfies all the criteria above.

# Indifference for large biases

If the bias is large, in that there exists a possible value of $$\vdh(\cdot\mid h_{t+1})$$ with $$\vdh(\cdot\mid h_{t+1})+B(h_t,a)$$ not a point on $$\Delta\mR$$, then we need to proceed differently.

As before, let $$S_{h_t,a}=\{\vdh(\cdot\mid h_{t+1}) \mid h_t, a\}$$ be the set of possible future values of $$\vdh$$ (given the history $$h_t$$ and the action $$a$$), and for $$q\in S_{h_t,a}$$, let $$p(q)$$ be the probability of $$q$$, given $$h_t$$ and $$a$$.

The we want to replace $$q$$ with $$\tau(q)$$, where $$\tau(q)$$ is as close to’ $$q+B(h_t,a)$$ as possible. Since $$\Delta\mR$$ embeds in $$\mathbb{R}^\mR$$, the Euclidean metric $$||\cdot||$$ on the later restricts to the former.

Thus consider the constrained optimisation problem for $$b$$:

• Minimise $$\sum_{q \in S_{h_t,a}} p(q)||\tau(q)-(q+B(h_t,a))||^2$$ subject to:
1. $$\sum_{q\in S_{h_t,a}} p(q)\tau(q) = \vdh'(\cdot\mid h_t)$$,
2. $$\forall q\in S_{h_t,a}: \tau(q)\in\Delta\mR$$.

Then define $$\vdh'(\cdot\mid h_{t+1})$$ as $$\tau(\vdh(\cdot\mid h_t))$$.

If we see $$\vdh(\cdot\mid h_{t+1})$$ and $$\vdh'(\cdot\mid h_{t+1})$$ as random variables dependent of $$h_t$$ and $$a$$, the optimisation problem is the same as saying that $$\vdh'$$ is bias-free while $$||\vdh(\cdot\mid h_{t+1})-\vdh'(\cdot\mid h_{t+1})||$$ has minimised variance.

The constraints are not contradictory: for instance $$\tau(q)=\vdh'(\cdot\mid h_t)$$ will satisfy them. In fact they are all affine constraints. Then the must exist a unique set of elements $$\tau(q)$$ that minimise the strictly convex quadratic function.

And obviously, if $$q+B(h_t,a)$$ is always in $$\Delta\mR$$, then $$\tau(q)=q+B(h_t,a)$$ is the optimal set of solutions solution, so this optimisation reproduces the small biases’ case.

# The final values

This alternate prior leads to an alternate posterior $$\vd'$$, simply defined by having it equal to $$\vdh'$$ on complete histories: $$\vd'(\cdot\mid h_m)=\vdh'(\cdot\mid h_m)$$.

# Another alternative

It should be noted that if we’re willing to drop the condition `The agent cannot benefit from a biasing action, if the agent expect to immediately gets perfect information about what the correct reward is’, then there’s a simpler solution: simply always define $$\vdh'(\cdot\mid h_{t+1})$$ as $$\vdh(\cdot\mid h_{t+1})+B(h_t,a)$$, applying the solution for small biases to large biases.

This means that $$\vdh'$$ (and ultimately $$\vd'$$) need not be elements of $$\Delta\mR$$. However, $$\vd'$$ can still define a reward the agent can optimise, in the following sense:

• Given a complete history $$h_m$$, the agent will maximise the reward $$R'=\sum_i R_i\vd'(R_i\mid h_m)$$.

Since $$\vd'$$ need not be in $$\Delta\mR$$, some of these coefficients can be negative, but that still results in a consistent $$R'$$ to maximise.

## Properties of the approach

It’s clear the agent is indifferent to bias, but notice that this doesn’t prevent the agent from learning: once it gets an observation, $$\vdh'$$ can change significantly. It’s just changes to its expectation that are controlled.

Notice also that the agent doesn’t believe, or act as if it believed, anything unlikely: its bets will be accurate.

And it doesn’t have the problem of lotteries. Assume that the agent has $$\vdh(R_0)=\vdh(R_1)=0.5$$, and there is a lottery which the agent has one chance in a million of winning.

Then if it takes action $$a$$ which ensures that $$\vd$$ chooses $$R_0$$ if and only if it wins the lottery, then with probability $$10^{-6}$$ it ends up with reward function $$R_0$$ and a won lottery, and with probability $$1-10^{-6}$$ it ends up with reward function $$R_0\frac{1-2\cdot 10^{-6}}{2(1-10^{-6})} +R_1 \frac{1}{2(1-10^{-6})}$$ and a lost lottery. The expected reward function is still $$R_0(0.5)+R_1(0.5)$$; it has simply split this expectation differently across worlds where it’s won or not won the lottery.

One thing that this approach doesn’t solve is the issue of the agent not following the exact reward function the humans want it to follow, due to accumulated bias. But first note that this will typically encourage the agent not to bias their reward learning, as it will tend to get higher reward when the humans agree with the agent’s reward function. Note secondly that even if the agent manipulates the human values, at the end, to agree with its own, this manipulation, in expectation, simply undoes previous manipulations the agent has done (which caused the biasing in the first place).

Those who find this still unsatisfactory can wait for the next post, where the agent is not simply indifferent to biasing actions, but is penalised for them.

## Indifference and bias

Why has indifference been connected with bias, rather than the more general influence? Simply because the evidential counterfactual has problems with bias, meaning that that needs to be corrected first (the causal counterfactual is unbiased and uninfluenceable).

Indeed, we can generalise this solution to the influence problem, where it becomes the counterfactual approach (which I used to call stratification, before I realised what it was). See subsequent posts for this.

 by Jessica Taylor 367 days ago | link Because of the specific time restriction, there is no way to randomise the outcome ahead of time. And because it’s assumed tied to a specific physical event, there is no way to influence it at all. The whole physical definition and apparatus serve the purpose of making biasing the only way to affect the result. Hmm, I don’t understand. Of course it is possible to influence the button push without biasing it (e.g. create a robot that flips a coin and then pushes or doesn’t push the button). And of course it’s not possible to influence the quantum event in any way (including by biasing it). So I don’t see any event that can’t be influenced in any way except by biasing it. reply
 by Stuart Armstrong 367 days ago | link The way I’m using the term, unbiased influence involves replacing the stochastic event with another one that has same mean. But since (or if) the quantum event is specifically defined in the process, this can’t be done. reply
 by Jessica Taylor 366 days ago | link Let me ask a more specific question. In your setup with the quantum event $$Q$$ and the button $$B$$, can you define the event $$E$$ such that: The agent can influence $$E$$ by biasing $$E$$. The agent can’t influence $$E$$ without biasing $$E$$. Clearly, $$E \neq Q$$ and $$E \neq B$$, so I don’t know what $$E$$ is. (I interpreted you as saying there is such an $$E$$; let me know if this is incorrect) reply
 by Stuart Armstrong 360 days ago | link You are correct and I’m wrong. The causal counterfactual is unbiased and uninfluenceable. The evidential counterfactual is both biased and influenceable. I’ll correct the post. reply
 by Jessica Taylor 366 days ago | link If we apply this to the shutdown problem, is it acceptable to say: $\hat{P}(\cdot | h_t) = 100\% ~ U_N \text{ if the button has not been pressed in h_t }$ $\hat{P}(\cdot | h_t) = 100\% ~ U_S \text{ otherwise}$ If not, what would you set $$\hat{P}$$ to? (I’m treating $$U_N$$ and $$U_S$$ as reward functions here which seems fine) reply
 by Stuart Armstrong 366 days ago | link For policies/actions that don’t affect the probability of humans pressing the button, $$\widehat{P}=P$$. For actions that do affect the probability a little bit, the effect of $$\widehat{P}$$ will be to undo this, by, for instance, slightly increasing the probability of $$U_S$$ given the button was pressed. I’m not completely sure what multiple actions with large changes of probability would lead to (in expectation, nothing, but in actual fact…) reply
 by Jessica Taylor 366 days ago | link Hmm… I’m finding that I’m unable to write down a simple shutdown problem in this framework (e.g. an environment where it should switch between maximizing paperclips and shutting down) to analyze what this algorithm does. To know what the algorithm does, I need to know what $$P$$ and $$\hat{P}$$ are (since these are parameters of the algorithm). From those I can derive $$P'$$ and $$\hat{P}'$$ to determine the agent’s action. But at the moment I have no way of proceeding, since I don’t know what $$P$$ and $$\hat{P}$$ are. Can you get me unstuck? reply
 by Stuart Armstrong 360 days ago | link Suppose the humans have already decided whether to press the shutdown or order the AI to maximise paperclips. If $$o_s$$ is the observation of the shutdown command and $$o_p$$ the observation of the paperclip maximising command, and $$u_s$$ and $$u_p$$ the relevant utilities, then $$P$$ can be defined as $$P(u_s|h_{m-1}o_s)=1$$ and $$P(u_p|h_{m-1}o_p)=1$$, for all histories $$h_{m-1}$$. Then define $$\widehat{P}$$ as the probability of $$o_s$$ versus $$o_p$$, conditional on the fact that the agent follows a particular deterministic policy $$\pi^0$$. If the agent does indeed follow $$\pi^0$$, then $$\widehat{P}=\widehat{P}'$$. If it varies from this policy, then $$\widehat{P}'$$ is altered in proportion to the expected change in $$\widehat{P}$$ caused by choosing a different action. reply

### NEW DISCUSSION POSTS

This is exactly the sort of
 by Stuart Armstrong on Being legible to other agents by committing to usi... | 0 likes

When considering an embedder
 by Jack Gallagher on Where does ADT Go Wrong? | 0 likes

The differences between this
 by Abram Demski on Policy Selection Solves Most Problems | 0 likes

Looking "at the very
 by Abram Demski on Policy Selection Solves Most Problems | 0 likes

 by Paul Christiano on Policy Selection Solves Most Problems | 1 like

>policy selection converges
 by Stuart Armstrong on Policy Selection Solves Most Problems | 0 likes

Indeed there is some kind of
 by Vadim Kosoy on Catastrophe Mitigation Using DRL | 0 likes

Very nice. I wonder whether
 by Vadim Kosoy on Hyperreal Brouwer | 0 likes

Freezing the reward seems
 by Vadim Kosoy on Resolving human inconsistency in a simple model | 0 likes

Unfortunately, it's not just
 by Vadim Kosoy on Catastrophe Mitigation Using DRL | 0 likes

>We can solve the problem in
 by Wei Dai on The Happy Dance Problem | 1 like

Maybe it's just my browser,
 by Gordon Worley III on Catastrophe Mitigation Using DRL | 2 likes

At present, I think the main
 by Abram Demski on Looking for Recommendations RE UDT vs. bounded com... | 0 likes

In the first round I'm
 by Paul Christiano on Funding opportunity for AI alignment research | 0 likes

Fine with it being shared
 by Paul Christiano on Funding opportunity for AI alignment research | 0 likes


text:
# enpassant chess font [closed]

I have got a ttf-font that I will like to use in chess diagrams. I have installed in the enpassant package before, but this time I only have the ttf-file. How do I convert this into the LaTeX package?

-

## closed as too localized by egreg, Joseph Wright♦Feb 4 '12 at 22:44

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

If you're trying to install a `.ttf` font in LaTeX, perhaps Installing TTF fonts in LaTeX would help. – Werner Dec 7 '11 at 22:30
Instruction how I converted the fonts are in the documentation of chessfss. (Nowadays I would suggest to use fontforge to generate the pfb + tfm). – Ulrike Fischer Dec 7 '11 at 22:35


text:
# A Couple Trig Identities

• Dec 15th 2010, 05:44 PM
~berserk
A Couple Trig Identities
This is the beginning of a couple of identities that i will probably need assistance on, all help given is greatly appreciated.

$\displaystyle{\frac{\tan x - \cot x}{\tan x + \cot x}=2\sin^2x-1}$
first i switched them all to sin and cos
then i found like denominators and combined
then i multiplied by the reciprocal leading me to here:

$\displaystyle{\frac{\sin x - \cos x}{\cos x \sin x} \bullet \frac{\cos x \sin x}{\sin x + \cos x}}$

then got $\displaystyle{\frac{\sin x - \cos x}{\sin x + \cos x} = 2\sin^2x-1}$
I'm unsure where to go from here
• Dec 15th 2010, 05:56 PM
Quote:

Originally Posted by ~berserk
This is the beginning of a couple of identities that i will probably need assistance on, all help given is greatly appreciated.

$\displaystyle{\frac{\tan x - \cot x}{\tan x + \cot x}=2\sin^2x-1}$
first i switched them all to sin and cos
then i found like denominators and combined
then i multiplied by the reciprocal leading me to here:

$\displaystyle{\frac{\sin x - \cos x}{\cos x \sin x} \bullet \frac{\cos x \sin x}{\sin x + \cos x}}$

then got $\displaystyle{\frac{\sin x - \cos x}{\sin x + \cos x} = 2\sin^2x-1}$
I'm unsure where to go from here

If you did the 1st one that way, your squares have gone missing...

$\displaystyle\frac{\left[\frac{sinx}{cosx}-\frac{cosx}{sinx}\right]}{\left[\frac{sinx}{cosx}+\frac{cosx}{sinx}\right]}=\frac{\left[\frac{1}{sinxcosx}\right]}{\left[\frac{1}{sinxcosx}\right]}\;\frac{sin^2x-cos^2x}{sin^2x+cos^2x}$

$=sin^2x-cos^2x$

since $sin^2x+cos^2x=1$

and now use $cos^2x=1-sin^2x$ to finish
• Dec 15th 2010, 05:56 PM
~berserk
also there is this one where I am unsure where to start: $(\sin x + \cos x)^2 = 1 +\sin 2x$
• Dec 15th 2010, 06:01 PM
TheCoffeeMachine
Quote:

Originally Posted by ~berserk
also there is this one where I am unsure where to start: $(\sin x + \cos x)^2 = 1 +\sin 2x$

$(\sin x + \cos x)^2 = \left(\sin^2{x}+\cos^2{x}\right)+2\sin{x}\cos{x} = ...$
• Dec 15th 2010, 06:03 PM
Quote:

Originally Posted by ~berserk
also there is this one where I am unsure where to start: $(\sin x + \cos x)^2 = 1 +\sin 2x$

That's another $sin^2x+cos^2x=1$ identity in disguise.

That's a crucial one to remember!

$(sinx+cosx)(sinx+cosx)=sinx(sinx+cosx)+cosx(sinx+c osx)$

$=sin^2x+sinxcosx+cosxsinx+cos^2x=sin^2x+cos^2x+2si nxcosx$

Finish up with the identity $sin2x=2sinxcosx$


text:
• Subject:

...

• Topic:

...

Two balls of masses m1 and m2 are separated from each other by a powder charge placed between them. The whole system is at rest on the ground. Suddenly the powder charge explodes and masses are pushed apart. The mass m1 travels a distance s1 and stops. If the coefficients of friction between the balls and ground are same, the mass m2 stops after travelling the distance

(1) ${s}_{2}=\frac{{m}_{1}}{{m}_{2}}{s}_{1}$

(2) ${s}_{2}=\frac{{m}_{2}}{{m}_{1}}{s}_{1}$

(3) ${s}_{2}=\frac{{m}_{1}^{2}}{{m}_{2}^{2}}{s}_{1}$

(4) ${s}_{2}=\frac{{m}_{2}^{2}}{{m}_{1}^{2}}{s}_{1}$


text:
2019
Том 71
№ 1

# Shape-preserving projections in low-dimensional settings and the q -monotone case

Abstract

Let $P: X \rightarrow V$ be a projection from a real Banach space $X$ onto a subspace $V$ and let $S \subset X$. In this setting, one can ask if $S$ is left invariant under $P$, i.e., if $PS \subset S$. If $V$ is finite-dimensional and $S$ is a cone with particular structure, then the occurrence of the imbedding $PS \subset S$ can be characterized through a geometric description. This characterization relies heavily on the structure of $S$, or, more specifically, on the structure of the cone $S^{*}$ dual to $S$. In this paper, шє remove the structural assumptions on $S^{*}$ and characterize the cases where $PS \subset S$. We note that the (so-called) $q$-monotone shape forms a cone which (lacks structure and thus) serves as an application for our characterization.

English version (Springer): Ukrainian Mathematical Journal 64 (2012), no. 5, pp 767-780.

Citation Example: Prophet M. P., Shevchuk I. A. Shape-preserving projections in low-dimensional settings and the q -monotone case // Ukr. Mat. Zh. - 2012. - 64, № 5. - pp. 674-684.

Full text


text:
0
2013
Impact Factor

# Volume 26, Number 2, 2021 Special Issue: Nonlinear Dynamics in Chemical Sciences: Part II

 In Memory of Professor Alexey V. Borisov (27.03.1965–24.01.2021) Abstract Citation: In Memory of Professor Alexey V. Borisov (27.03.1965–24.01.2021), Regular and Chaotic Dynamics, 2021, vol. 26, no. 2, pp. 113-118 DOI:10.1134/S1560354721020015
 Rashmi R.,  Yadav K.,  Lourderaj U.,  Paranjothy M. Second-order Saddle Dynamics in Isomerization Reaction Abstract The role of second-order saddle in the isomerization dynamics was investigated by considering the $E-Z$ isomerization of guanidine. The potential energy profile for the reaction was mapped using the ab initio wavefunction method. The isomerization path involved a torsional motion about the imine (C-N) bond in a clockwise or an anticlockwise fashion resulting in two degenerate transition states corresponding to a barrier of 23.67 kcal/mol. An alternative energetically favorable path ($\sim$1 kcal/mol higher than the transition states) by an in-plane motion of the imine (N-H) bond via a second-order saddle point on the potential energy surface was also obtained. The dynamics of the isomerization was investigated by ab initio classical trajectory simulations. The trajectories reveal that isomerization happens via the transition states as well as the second-order saddle. The dynamics was found to be nonstatistical with trajectories exhibiting recrossing and the higher energy second-order saddle pathway preferred over the traditional transition state pathway. Wavelet based time-frequency analysis of internal coordinates indicate regular dynamics and existence of long-lived quasi-periodic trajectories in the phase space. Keywords: transition state, second-order saddle, reaction dynamics, RRKM, potential energy surface, wavelet transform, time-frequency analysis Citation: Rashmi R.,  Yadav K.,  Lourderaj U.,  Paranjothy M., Second-order Saddle Dynamics in Isomerization Reaction, Regular and Chaotic Dynamics, 2021, vol. 26, no. 2, pp. 119-130 DOI:10.1134/S1560354721020027
 Eklund  E. C.,  Ananth N. Investigating the Stability and Accuracy of a Classical Mapping Variable Hamiltonian for Nonadiabatic Quantum Dynamics Abstract Previous work has shown that by using the path integral representation of quantum mechanics and by mapping discrete electronic states to continuous Cartesian variables, it is possible to derive an exact quantum “mapping variable” ring-polymer (MV-RP) Hamiltonian. The classical molecular dynamics generated by this MV-RP Hamiltonian can be used to calculate equilibrium properties of multi-level quantum systems exactly, and to approximate real-time thermal correlation functions (TCFs). Here, we derive mixed time-slicing forms of the MV-RP Hamiltonian where different modes of a multi-level system are quantized to different extents. We explore the accuracy of the approximate quantum dynamics generated by these Hamiltonians through numerical calculation of quantum real-time TCFs for a range of model nonadiabatic systems, where two electronic states are coupled to a single nuclear degree of freedom. Interestingly, we find that the dynamics generated by an MV-RP Hamiltonian with all modes treated classically is more stable across all model systems considered here than mixed quantization approaches. Further, we characterize nonadiabatic dynamics in the 6D phase space of our classical-limit MV-RP Hamiltonian using Lagrangian descriptors to identify stable and unstable manifolds. Keywords: nonadiabatic, path integral, mapping variables, Lagrangian descriptors, correlation functions Citation: Eklund  E. C.,  Ananth N., Investigating the Stability and Accuracy of a Classical Mapping Variable Hamiltonian for Nonadiabatic Quantum Dynamics, Regular and Chaotic Dynamics, 2021, vol. 26, no. 2, pp. 131-146 DOI:10.1134/S1560354721020039
 Crossley R.,  Agaoglou M.,  Katsanikas M.,  Wiggins S. From Poincaré Maps to Lagrangian Descriptors: The Case of the Valley Ridge Inflection Point Potential Abstract In this paper we compare the method of Lagrangian descriptors with the classical method of Poincaré maps for revealing the phase space structure of two-degree-of-freedom Hamiltonian systems. The comparison is carried out by considering the dynamics of a twodegree- of-freedom system having a valley ridge inflection point (VRI) potential energy surface. VRI potential energy surfaces have four critical points: a high energy saddle and a lower energy saddle separating two wells. In between the two saddle points is a valley ridge inflection point that is the point where the potential energy surface geometry changes from a valley to a ridge. The region between the two saddles forms a reaction channel and the dynamical issue of interest is how trajectories cross the high energy saddle, evolve towards the lower energy saddle, and select a particular well to enter. Lagrangian descriptors and Poincaré maps are compared for their ability to determine the phase space structures that govern this dynamical process. Keywords: phase space structure, periodic orbits, stable and unstable manifolds, homoclinic and heteroclinic orbits, Poincar´e maps, Lagrangian descriptors Citation: Crossley R.,  Agaoglou M.,  Katsanikas M.,  Wiggins S., From Poincaré Maps to Lagrangian Descriptors: The Case of the Valley Ridge Inflection Point Potential, Regular and Chaotic Dynamics, 2021, vol. 26, no. 2, pp. 147-164 DOI:10.1134/S1560354721020040
 Pandey P.,  Naik S.,  Keshavamurthy S. Classical and Quantum Dynamical Manifestations of Index-2 Saddles: Concerted Versus Sequential Reaction Mechanisms Abstract The presence of higher-index saddles on a multidimensional potential energy surface is usually assumed to be of little significance in chemical reaction dynamics. Such a viewpoint requires careful reconsideration, thanks to elegant experiments and novel theoretical approaches that have come about in recent years. In this work, we perform a detailed classical and quantum dynamical study of a model two-degree-of-freedom Hamiltonian, which captures the essence of the debate regarding the dominance of a concerted or a stepwise reaction mechanism. We show that the ultrafast shift of the mechanism from a concerted to a stepwise one is essentially a classical dynamical effect. In addition, due to the classical phase space being a mixture of regular and chaotic dynamics, it is possible to have a rich variety of dynamical behavior, including a Murrell – Laidler type mechanism, even at energies sufficiently above that of the index-2 saddle. We rationalize the dynamical results using an explicit construction of the classical invariant manifolds in the phase space. Keywords: reaction mechanisms, index-2 saddles, classical-quantum correspondence, dynamic Murrell-Laidler, invariant manifolds, concerted and sequential reactions Citation: Pandey P.,  Naik S.,  Keshavamurthy S., Classical and Quantum Dynamical Manifestations of Index-2 Saddles: Concerted Versus Sequential Reaction Mechanisms, Regular and Chaotic Dynamics, 2021, vol. 26, no. 2, pp. 165-182 DOI:10.1134/S1560354721020052
 Fukuda I.,  Moritsugu K.,  Fukunishi Y. On Ergodicity for Multidimensional Harmonic Oscillator Systems with Nosé – Hoover-type Thermostat Abstract A simple proof and a detailed analysis of the nonergodicity for multidimensional harmonic oscillator systems with the Nosé – Hoover-type thermostat are presented. The origin of the nonergodicity is the symmetries in the multidimensional target physical system, and it differs from that in the Nosé – Hoover thermostat with the one-dimensional harmonic oscillator. A new and simple deterministic method to recover the ergodicity is also proposed. An individual thermostat variable is attached to each degree of freedom, and all of these variables act on a friction coefficient for each degree of freedom. This action is linear and controlled by a Nosé mass matrix $\mathbf{Q}$, which is the matrix analogue of the scalar Nosé mass. The matrix $\mathbf{Q}$ can break the symmetry and contribute to the ergodicity. Keywords: ergodicity, Nosé – Hoover equation, thermostat, molecular dynamics, invariant space, multidimensional harmonic oscillator, Nosé-mass matrix, density dynamics Citation: Fukuda I.,  Moritsugu K.,  Fukunishi Y., On Ergodicity for Multidimensional Harmonic Oscillator Systems with Nosé – Hoover-type Thermostat, Regular and Chaotic Dynamics, 2021, vol. 26, no. 2, pp. 183-204 DOI:10.1134/S1560354721020064

Back to the list


text:
## Page Views on Nuit Blanche since July 2010

My papers on ArXiv:
Approximating Kernels at the speed of Light
&
Imaging with Nature

LightOn
LinkedIn (727)|| on CrunchBase || our Blog
(2452)
(3967)
(1333)||
Attendant references pages:
The Advanced Matrix Factorization Jungle Page ||

Paris Machine Learning
@Meetup.com (8016 members) || @Archives

## Monday, May 18, 2015

### Tensor sparsification via a bound on the spectral norm of random tensors

Tensor sparsification as a way to do dimensionality reduction:

Tensor sparsification via a bound on the spectral norm of random tensors by Nam H. Nguyen, Petros Drineas, Trac D. Tran

Given an order-d tensor $\tensor A \in \R^{n \times n \times...\times n}$, we present a simple, element-wise sparsification algorithm that zeroes out all sufficiently small elements of $\tensor A$, keeps all sufficiently large elements of $\tensor A$, and retains some of the remaining elements with probabilities proportional to the square of their magnitudes. We analyze the approximation accuracy of the proposed algorithm using a powerful inequality that we derive. This inequality bounds the spectral norm of a random tensor and is of independent interest. As a result, we obtain novel bounds for the tensor sparsification problem.

Join the CompressiveSensing subreddit or the Google+ Community and post there !
Liked this entry ? subscribe to Nuit Blanche's feed, there's more where that came from. You can also subscribe to Nuit Blanche by Email, explore the Big Picture in Compressive Sensing or the Matrix Factorization Jungle and join the conversations on compressive sensing, advanced matrix factorization and calibration issues on Linkedin.


text:
Making 1 Dollar with Combinations of Coins
Time and Money, and more...

 1 EASY How many dimes do you need to make a dollar?

 2 EASY Do 9 dimes and 2 nickels make a dollar?

 3 MEDIUM How many nickels would you need to add to 2 quarters if you want exactly $1 in total?  4 MEDIUM How could you make one dollar with 3 quarters and the least amount of other coins possible? 3 quarters and 5 nickels3 quarters, 2 dimes, and 1 nickel3 quarters, 1 dime, and 3 nickels3 quarters, 2 dimes, and 5 pennies3 quarters and 25 pennies  5 MEDIUM How many nickels do you need to make a dollar?  6 MEDIUM How could you make one dollar with 2 quarters, 2 dimes, and 10 nickels? With 2 quarters, 2 dimes, and 6 nickelsWith 2 quarters, 2 dimes, and 2 nickelsWith 2 quarters, 2 dimes, and 4 nickelsWith 2 quarters and 10 nickelsA and D  7 HARD Laura wants to buy a$1 popsicle. But Laura has a lot of heavy change in her wallet, so she wants to get rid of some coins. If Laura has 20 pennies, 10 quarters, 10 dimes, and 13 nickels, in which way could Laura pay for the $1 popsicle and use as many coins as possible? Using 20 pennies, 12 nickels, and 2 dimesUsing 20 pennies, 13 nickels, and 1 quarterUsing 20 pennies, 10 quarters, 10 dimes, and 13 nickelsUsing 4 quartersUsing 20 pennies, 11 nickels, and 1 quarter  8 HARD Jessica's mom has to pay for parking at the restaurant, which costs$1. However, the machine for paying does not give you change. Jessica's mom has 10 pennies, 5 dimes, 3 quarters, and 3 nickels in her wallet. How could select coins to muster exactly \$1? Using 10 pennies, 3 quarters, and 3 dimesUsing 10 pennies, 3 quarters, and 3 nickelsUsing 5 dimes and 2 quartersBoth A and BBoth B and C

 9 HARD If you had 1 half-dollar, 1 quarter, 1 dime, 3 nickels, and 6 pennies, what is the least number of coins you need to make one dollar?

 10 HARD If you had 1 half-dollar, 1 quarter, 1 dime, 3 nickels, and 6 pennies, what is the most number of coins you could use to make one dollar?


text:
taxonomy – update_term_meta not working

Question

I am trying to remove a string off of a bunch of CPT taxonomy slugs that were added and need to get removed.

I’m trying to use update_term_meta and it appears to be working when I error log the result however it does not appear to have worked when I view the terms through the dashboard?

I can’t figure out what I’m doing wrong here?

function remove_stuff() {
$terms = get_terms( array( 'taxonomy' => 'experts_industries', 'hide_empty' => false, ) ); foreach($terms as $term) { update_term_meta($term->id, 'experts_industries', array('slug' => str_replace('-expert-witnesses', '' , $term->slug) )); error_log($term->slug);

}
}


text:
计算机系统应用  2019, Vol. 28 Issue (3): 223-228 PDF

Clothing Classification Method Based on Lightweight Convolutional Neural Network
LUO Meng-Yan, LIU Yan-Fei
School of Information Science and Technology, Zhejiang Sci-Tech University, Hangzhou 310018, China
Abstract: Considering the growing development of e-commerce platforms, the use of artificial classification of clothing classification cannot meet the current needs. In this study, based on the actual application scenarios, the design is improved in three aspects: the interference of background factors, the key position information of the garment image, and the hardware requirements of the algorithm model operation when classifying the garment image. Accordingly, it is proposed that to remove background interference, to use of local information of images, and to lightweight processing of the model. Finally, on the premise of satisfying the accuracy, the algorithm model that can be operated in the ordinary low-configuration PC terminal is obtained, which improves the work efficiency and saves the cost.
Key words: convolution neural network     clothing classification     lightweight

1 模型的设计方案

1.1 剔除背景信息的干扰

1.2 局部特征的提取

 图 1 “跳层连接”结构示意

1.3 卷积神经网络的轻量化处理

 图 2 分块卷积操作示意

 ${{C}}{}_1 = {{{D}}_{{k}}} \cdot {{{D}}_{{k}}} \cdot M \cdot N \cdot {D_f} \cdot {D_f}$

 ${{{C}}_{\rm{2}}} = 2 \cdot {{{D}}_{{k}}} \cdot {{{D}}_{{k}}} \cdot {{M}} \cdot {{{D}}_{{f}}} \cdot {{{D}}_{{f}}} + {{M}} \cdot N \cdot {{{D}}_{{f}}} \cdot {{{D}}_{{f}}}$
 $\frac{{{{{C}}_2}}}{{{{{C}}_{\rm{1}}}}} = \frac{{{\rm{2}} \cdot {{{D}}_{{k}}} \cdot {{{D}}_{{k}}} \cdot {{M}} \cdot {{{D}}_{{f}}} \cdot {{{D}}_{{f}}} + {{M}} \cdot N \cdot {{{D}}_{{f}}} \cdot {{{D}}_{{f}}}}}{{{{{D}}_{{k}}} \cdot {{{D}}_{{k}}} \cdot M \cdot N \cdot {D_f} \cdot {D_f}}} = \frac{1}{{{N}}} + \frac{2}{{{{D}}_{{k}}^2}}$

2 算法实现及结果对比 2.1 训练与测试数据

2.2 不同结构模型效果对比

 图 3 模型结构

2.3 关键点定位效果对比

 $\begin{array}{l} {{NE}} = \dfrac{{\displaystyle\sum\nolimits_{{k}} {\left\{ {\dfrac{{{{{d}}_{{k}}}}}{{{{{s}}_k}}}\delta \left( {{v_k} = 1} \right)} \right\}} }}{{\displaystyle\sum\nolimits_k {\left\{ {\delta \left( {{v_k} = 1} \right)} \right\}} }}\times 100\% \\ \end{array}$

1) Convolutional Pose Machine进行关键点定位, 使用了6个stage的CPM训练之后NE为13.37%.

2) 尝试使用Hourglass进行定位, 仅使用了翻转进行了数据增强, NE值为10.78%.

3) 增加了Color Jittering, Random Crop Resize, Rotate等数据增强方法, 降低到8.8.

4) 使用Hourglass在MPII比赛上的模型参数进行参数初始化, 降低到7.86%.

5) 仅训练单个模型进行预测, 对Loss进行修改, 不存在的关键点Loss为0, 采用了CPN中提出的Online Hard Keypoints Mining (OHKM), 仅保留损失较大的关键点进行回传. 之前训练过的模型进行权重的初始化, 预测时通过Yolo进行裁剪, NE降低到6.76%.

 图 4 不同模型结构测试准确率对比

 图 5 5种不同关键点定位的NE值对比

 图 6 关键点定位对模型准确率效果提升对比

2.4 模型轻量化的实现及效果对比

 图 7 分块卷积方式和传统卷积方式在不同的网络结构下的运行时间以及准确率(均未使用数据增强操作和背景信息的剔除操作)

3 总结

 [1] Iivarinen J, Peura M, Särelä J, et al. Comparison of combined shape descriptors for irregular objects. Proceedings of the 8th British Machine Vision Conference. Essex, Great Britain. 1997. 430–439. [2] Rangayyan RM, El-Faramawy NM, Desautels JEL, et al. Measures of acutance and shape for classification of breast tumors. IEEE Transactions on Medical Imaging, 1997, 16(6): 799-810. DOI:10.1109/42.650876 [3] Teh CH, Chin RT. On image analysis by the methods of moments. IEEE Transactions on Pattern Analysis and Machine Intelligence, 1988, 10(4): 496-513. DOI:10.1109/34.3913 [4] Ojala T, Pietikäinen M, Harwood D. A comparative study of texture measures with classification based on featured distributions. Pattern Recognition, 1996, 29(1): 51-59. DOI:10.1016/0031-3203(95)00067-4 [5] Daugman JG. Complete discrete 2-D Gabor transforms by neural networks for image analysis and compression. IEEE Transactions on Acoustics, Speech, and Signal Processing, 1988, 36(7): 1169-1179. DOI:10.1109/29.1644 [6] Girshick R. Fast R-CNN. arXiv: 1504.08083, 2015. [7] Lowe DG. Distinctive image features from scale-invariant keypoints. International Journal of Computer Vision, 2004, 60(2): 91-110. DOI:10.1023/B:VISI.0000029664.99615.94 [8] Dalal N, Triggs B. Histograms of oriented gradients for human detection. 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. San Diego, CA, USA. 2005. 886–893. [9] Bossard L, Dantone M, Leistner C, et al. Apparel classification with style. Asian Conference on Computer Vision. Daejeon, South Korea. 2012. 321–335. [10] He KM, Zhang XY, Ren SQ, et al. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas, NV, USA. 2016. 770–778. [11] Tompson JJ, Jain A, LeCun Y, et al. Joint training of a convolutional network and a graphical model for human pose estimation. Proceedings of the 27th International Conference on Neural Information Processing Systems. Montreal, Canada. 2014. 1799–1807. [12] Wei SE, Ramakrishna V, Kanade T, et al. Convolutional pose machines. 2016 IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas, NV, USA. 2016. 4724–4732. [13] Huang G, Liu Z, Laurens VDM , et al. Densely connected convolutional networks. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). IEEE. 2017. 2261–2269.


text:
2018-03-15Macro `n Cheese

# What if the stock market is the economy?

Despite demonstrating a complete lack of green thumbs (we have experts taking care of his office plants), in this edition of Macro-n-cheese Roger(squared) try to sow a new seed in the flora of business cycle models. A futile endeavor? You’ll be the judge.

In the barren fields of economic research, there are only a handful of academics devoted to cultivating fundamentally new ideas. One of those is Professor Roger Farmer (of Warwick, UCLA etc.), who has long questioned central tenets of the new-Keynesian heterodoxy. Among other things, he has written on ‘Endogenous Business Cycles’ (with steady state indeterminacy) and wants to replace New-Keynesian sticky prices with what he calls a ‘belief function’. Speaking as a layman I would label Farmer’s work as essays for developing a macro framework in Behavioral Economics, despite Farmer’s assertion that he’s an old-school (or perhaps ‘right-school’) Keynesian. Now, I must admit to not seeing eye to eye with all I have read of Farmer, but today I thought we would study an interesting alternative hypothesis to business cycles, in particular the Global Financial Crisis that he has put forward.

Note: In the graph above I, like Farmer, use the logs of Real S&P500 (deflated by the ‘money wage’, which is compensation of employees divided by FTE number of employees) and UNR (defined as (100*UNR)/(100-UNR )). These transformations produce new variables that are unbounded above and below, which is important since there is evidence that the two transformed variables are non-stationary but cointegrated. In order for a series to be non-stationary it must be able to increase or decrease without limit, independently of its current value.

##### Chart 1: There is some correlation…

In short, what we will have a look at is how well asset prices, in particular stock markets, explain the real economy; in particular, the unemployment rate. Below is a bivariate VAR(2) estimated for two periods, pre- and post-Volcker (i.e. a variant of “the great moderation”).

Dependent
variable
1953 Q1-1979 Q3 1979Q4-2017 Q4
p u p u
R2: 0.95 R2: 0.98
p(-1) 1.42
(0.0000)
-0.35
(0.0001)
1.29
(0.0000)
-0.22
(0.0000)
p(-2) -0.44
(0.0000)
0.26
(0.0127)
-0.30
(0.0000)
0.21
(0.0000)
u(-1) 0.14
(0.0419)
1.43
(0.0000)
-0.07
(0.5471)
1.56
(0.0000)
u(-2) -0.12
(0.0487)
-0.55
(0.0000)
0.08
(0.4330)
-0.60
(0.0000)
c -0.13
(0.1844)
-0.20
(0.0709)
0.06
(0.1499)
0.02
(0.4939)

Note: VAR(2) in levels. Probabilities within parenthesis.

##### Table 1: Quite steady coefficients, especially for the unemployment equation.

One thing that Farmer points out is that the coefficients seem quite stable, suggesting that the relation between stock markets and the real economy are also quite stable. This is an attractive feature in comparison to many other economic relationships that tend to break down during/after the great moderation. Admittedly, the coefficient stability is somewhat less remarkable in my calculations (then Farmer’s ditto) but, nonetheless, still decent. Farmer seems to suggest that this is a proof of no structural breaks in our series, though in my opinion this is an altogether different question.

Under any circumstances, when I proceed with putting the data into the Macrobond VECM-framework, cointegration rank tests are automatically computed. These indicate both that there is a unit root and that the series are cointegrated (1), over the full sample as well as in the two subsamples (pre-/post-Volcker) suggested by Farmer.

1953 Q1-1979 Q3 1979 Q4-2017 Q4 1953 Q1-2017 Q4
0 rank
(no coint.)
1 rank
(coint.)
0 rank
(no coint.)
1 rank
(coint.)
0 rank
(no coint.)
1 rank
(coint.)
Trace test 0.0002 0.8767 0.0000 0.4736 0.0000 0.7320
Maximum
Eigenvalue
0.0000 0.8767 0.0000 0.4736 0.0000 0.7320

Note: The fact that the Johansen test points to one cointegrating vector means, by default, that there indeed exists a unit root (which is why a unit root test is more nice than necessary).

##### Table 2: Cointegration is present

We cannot yet perform causality tests in Macrobond (keep’em support tickets coming!), but even main stream economists admit that empirical studies mostly support the idea that asset prices cause real economy responses. The fact that Farmer (and others) finds that stock markets cause unemployment does not, as Granger himself pointed out1, imply a means of control. For this, we need an economic model that chisels out the mechanism of the causal chain. And this is where Farmer gets interesting.

According to the traditional – fundamental – view of the business cycle, the GFC was caused by an event that signaled depressed earnings and, hence, increased unemployment for an extended period of time (at least until the next fundamental signal)2. Furthermore, according to this view, policy intervention is (or rather, would be) futile as it cannot stave off the fundamental causes of forward looking, unique equilibrium, market behavior.

1Granger (1980): “Testing for causality: a personal viewpoint”. Journal of Economic Dynamics and Control, p. 329–352.

2Absent any clear-cut event, the traditional model completely fails to explain the depth, breadth and longevity of the GFC.

Invoking Keynes “Animal Spirits”, Farmer instead paints the causal chain thus: For some reason, the perceived risk of doing business increased, and lower earnings were anticipated. As a result, market participants sold off shares in the belief that future market prices would be lower. Stock markets and the price of paper assets dropped, causing households to curtail spending, which in turn lead to worker lay-offs; and the reduced level of economic activity caused a self-fulfilling drop in company earnings.

In addition, and in contrast to the fundamental view, Farmer’s ‘animal spirits’ is also able to explain why large-scale asset purchases are an effective way of restoring confidence and resurrecting the economy. From a monetary policy perspective, this is an attractive and truly important feature of Farmer’s work.

– This begs the question: Is the stock market really the economy?

Granted, it would be easier to just apply Farmer’s model and run with it. However, due to lingering doubts of the stability of the VECM, or rather the stability of the cointegrating relationship3 I have nonetheless chosen to also estimate a simple bivariate VAR in levels4.

3Doubts that are only augmented when studying the out-of-sample performance when using the pre-Volcker or full sample coefficients.

4This is also suggested by the MB-application as the cointegrating relation with other specifications and (shorter) samples often is full rank (implying the variables are close to stationary).

$\left[\begin{array}{c}\Delta {u}_{t}\\ \Delta {p}_{t}\end{array}\right]=\left[\begin{array}{cc}0.57& -0.50\\ 0.06& 0.41\end{array}\right]\left[\begin{array}{c}\Delta {u}_{t-1}\\ \Delta {p}_{t-1}\end{array}\right]+\left[\begin{array}{c}-0.13\\ 0.00\end{array}\right]\left[\begin{array}{ccc}1& 1.71& 1.72\end{array}\right]\left[\begin{array}{c}{u}_{t-1}\\ {p}_{t-1}\\ c\end{array}\right]$

(VECM estimated Pre-Volcker)

As you will see, the Bivariate VAR outperforms the VECM during the GFC quite handsomely as the latter model seems to suggest considerably more persistence in unemployment than what post-GFC experiences de facto indicate.

That said the coefficient of the cointegrating vector, ‘α’, has the expected negative sign, albeit only insignificantly so in the stock market equation. As ‘α’ is -0.13 (and significant) in the unemployment equation it nonetheless suggests that unemployment adjusts toward the long run solution, the cointegrating equation, with some 13% per year. Encouragingly, independent of specifications, the parameter values for ‘α’, remain close to -0.1 (in a range of -0.13 to -0.09).

Now, turning to using stock markets as a forecasting tool for the real economy I have studied the out-of-sample5 performance of Farmer’s model for various horizons but here, for lack of space, I will focus on one multi-period forecast surrounding the GFC, in particular the period after the FED initiated the large scale asset purchases, LSAP by the end of 2008. Also, as my aim here is to find a functional forecast model, I have chosen to let the application find the best possible model6.

5Out-of-sample model evaluations is another feature I urge you to send us support tickets on!

6Using the Bayesian Information Criteria (BIC/Schwartz) and the default maximum of three lags and regressors.

##### Chart 2 a & b: Unemployment and the stock market, out of sample performance

Albeit far from perfect, the Bivariate VAR handsomely outperforms Farmer’s VECM-model, and this holds true even for different lag structures or estimation windows. Despite seemingly stable coefficients in Farmer’s model (the cointegrating vector), the generally poor out-of-sample fit suggests that the VECM is indeed mis-specified as discussed above. This, in turn, puts into question the idea that low-frequency movements of the stock market matter for the real economy.

That said, the occurrence of breaks in cointegrating equations are known to make ordinary VARs generate better forecasts even if the underlying data generating process is a VECM. Also, the lion’s share of model specifications I (incl. sample windows) suggest that the data is indeed cointegrated, implying there is some Granger causality, even if the direction is unclear.

In conclusion, and with the important caveat that Farmer’s claim of causality is correct, the statement that the stock market is the economy is at least plausible. Furthermore, the causal chain Farmer has laid out suggests that it can also be controlled, with the large-scale asset purchases from FED and other central banks being glaring examples. Hence, the apparent success of these policies should come as no surprise to those adhering to Farmer’s Keynesian interpretations (‘Farmerism’?).

To the rest of us– if nothing else – it increases the anxiety levels connected to the FED’s quantitative tightening process. Let’s hope our anxiety won’t instigate too much stock market volatility though. The economy depends upon it.

## Get these posts delivered to your inbox

If you like what you read, why not subscribe to have these analyses delivered to your inbox every Friday?