Server Bug Fix: Significance of circular flow diagram?

Original Source Link

A staple of intro economics textbooks is the circular flow diagram. Example from Frank et al. (2019, Principles of Economics)

enter image description here

What is the significance of the above diagram?

One thing it can illustrate is that Production = Consumption = Income. But it seems to me that this point could be stated separately without resort to some diagram such as the above.

Is there anything else the above diagram can usefully illustrate?


Thoughts: It seems to me that these circular flow diagrams are just some cutesy device that some textbook writer long ago first came up with, and which other textbook writers have simply and mindlessly stuck with.

These diagrams seem “cool” because they’re analogous to similar diagrams in the natural sciences (e.g. the water cycle). But they have not anywhere near as much significance (or indeed any significance at all). Of course, I could very well be wrong–hence this question.

As you pointed out the diagram is used to illustrate that Production (or more appropriately output) = Income. In this case it equates it to consumption but that is not generally true of all circular flow diagrams. However, besides that it has many other uses as well as it is an easy way of provide a bird’s eye view of all important flows in the economy.

Also you cant judge a tool only based on its most simplified version. A more involved versions of circular flow diagram as for example the one taken from Krugman’s macro textbook that you can find below the text also include financial markets (where people can save), government, international sector and so on.

The point of these is to provide birds eye view of the economy, to show students that in economics everything is interconnected (and you would be amazed by how many people do not realize that), and also it also highlights the specific interactions that occur between different sectors of an economy. The circular flow also is a good and easy way how to introduce 101 econ students to the idea that in macroeconomics income is endogenous, I seen it also be used as illustration of how money multiplier works.

Thoughts: It seems to me that these circular flow diagrams are just some cutesy device that some textbook writer long ago first came up with, and which other textbook writers have simply and mindlessly stuck with.

In a sense yes (except for the mindless part) because circular flow is just a didactic tool – you compare it to a water cycle and thats actually a good comparison. You can also describe water cycle in terms of physical processes in a mathematical model and you can do the same with circular flow which is ultimately based on the national income identity and related macro general equilibrium models but that might be too intimidating for highschool/undergraduate 101 students. The tool does not get included in textbook because professors mindlessly copy it but because its genuinely useful classroom device.

Arguably the circular flow does not have much use outside classroom or self-study, but that does not mean that it is not a useful or significant tool as it helps students who’s math skills might not be yet ready for mathematical presentation understand important concepts in macroeconomics. In most fields you will find that there are tools that outside classroom have no much use yet I would argue thats enough significance in itself. I would also not say it has any less significance than water cycle which is again mostly just teaching/visualization tool. You can compare it to other tools, for example when I was studying math and we were covering topology our professor would bring us examples of Klein bottle, 3D printed tesseract and other ‘cutsy toys’ – ultimately they were literary just cool looking paperweights but I found them useful when learning topology and I am sure other students did as well. The circular flow just serves similar purposes and makes teaching as well as learning easier.

enter image description here

My field of interest is the government bond markets. Based on a couple of decades of experience, I would argue that it is safe to say that people do not intuitively grasp the circular flow of income in the economy. Instead, they ask where the money to buy government bonds will come from?

This understanding could be picked up by looking at systems of equations, but it appears most people do not want to do that, or cannot develop an intuition for the concept. Circular flow diagrams are a way to develop that intuition.

I cannot vouch as to how effective they are as a teaching tool, but some tool is needed.

This diagram actually communicates simply what economists do when thinking about General Equilibrium Theory. Though The image dosen’t embody all details of whats going on the picture is captured.

To get feel of whats going on here more technically usually in intermediate macroeconomics II/intermediate microeconomics II courses we work through examples of Robinson Crusoe Economies.

I think its a great teaching tool, then again I am yet to teach introductory microeconomics and macroeconomics.

Tagged : /

Making Game: SmoothDraw 3 Stopped working

Original Source Link

My SmoothDraw 3 has stopped working all of a sudden. When I click on the icon it opens a window that says “SmoothDraw has stopped working. Windows is checking for a solution to the problem…” and then the window closes without anything else happening.

I have uninstalled the program and then reinstalled it twice already. I have also restarted my computer 3 times.

Any one else experience this before or have an idea on how to fix this? I am using Windows 8.

Tagged : /

Code Bug Fix: Is there a way for a React Component to be notified when the element it is attached to is deleted outside of React

Original Source Link

Our application consists of lots of legacy code written using jQuery and some newer React components.
We have mostly been able to handle separating concerns between the two, most of our code is one or the other – but occasionally we have React Components within JQuery Components.

In most cases:
JQuery creates a Div, the Div Element is passed to a ReactDOM.render and control for that div is controlled by react.
Then before JQuery destroys the Div it will call ReactDOM.unmountComponentAtNode to do the tear down.

However we have some JQuery code that is being removed in a way that is not trivial to detect that some of it is actually React, creating a component memory leak.

The correct fix for us it to solve the tear down, so that the unMounts are always called correctly, but there are engineering risks in this as the legacy code is not the cleanest and the risk of introduction of new bugs is high.

My question is whether there is a way that React Components can spot that they have become orphaned. ComponentWillUnmount is not the answer (as it does not get called in this scenario).

You could use a mutation observer on the component’s parent, but I’d be surprised if it were really necessary.

Basically, you’d:

  • Use a ref on the top-level element returned by your component in render.
  • In componentDidMount, use current from the ref to find the parentNode and set up a mutation observer on it, watching for childList changes.
  • In the observer callback, look for a mutation record where the ref’s current node in the list of removed nodes.
    • If so, do any cleanup that you have to do.

Live Example:

class Example extends React.Component {
    constructor(props) {
        super(props);
        this.ref = React.createRef(null);
        this.cleanedUp = false;
    }
    
    componentDidMount() {
        this.cleanedUp = false;
        // assert(this.ref.current !== null);
        if (this.observer) {
            this.observer.disconnect();
        }
        this.observer = new MutationObserver(records => {
            if (this.cleanedUp) {
                return;
            }
            for (const record of records) {
                for (const node of record.removedNodes) {
                    if (node === this.ref.current) {
                        this.cleanup();
                        return;
                    }
                }
            }
        });
        this.observer.observe(this.ref.current.parentElement, {
            childList: true,
            subtree: true
        });
    }
    
    componentWillUnmount() {
        this.cleanup();
    }

    cleanup() {
        console.log("Clean up here");
        this.observer.disconnect();
        this.observer = null;
        this.cleanedUp = true;
    }
    
    render() {
        return <div ref={this.ref}>This is the component's top level element</div>;
    }
}

const root = document.getElementById("root");
ReactDOM.render(<Example/>, root);

// Outside React...
setTimeout(() => {
    root.innerHTML = ""; // Bludgeon its contents
}, 1000);
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.12.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.12.0/umd/react-dom.production.min.js"></script>

You might have to watch from further up in the document tree than just the component’s immediate parent, but that’s the general idea…


Note: Using for-of on the removedNodes as I have above relies on the browser making NodeList iterable. Modern browsers do, but slightly older ones may not. My answer here talks about how to make them iterable (assuming the iteration protocol is supported by the browser’s JavaScript engine), or you might use forEach instead (also discussed there).

Tagged : /

Server Bug Fix: Chain transfer agents and rate of free radical polymerization

Original Source Link

In free radical addition polymerizations sometimes chain transfer agents are added. From what I understand chain transfer agents (e.g. XR’ below) reduce the average molecular weight by transferring the free radical from the growing polymer chain (P•) to another molecule (R’•).

P• + XR’ → PX + R’•

My question is what effect would this have on the overall “rate” of polymerization itself, i.e say the consumption of monomer.

In other words the R’• species is then free to combine with more Monomer, right? And being a smaller molecule (in general) would it be expected to have a higher rate constant for the reaction:

R’• + M–> P•

Not really.

As long as you are in solution (=unreacted monomer or solvent), it makes no difference if the reactive chain end is diffusing slow or fast. The monomer molecules come by at the same rate.

The mobile chain end would help against a local depletion of monomer, but once your mixture gets so viscous that this could happen, neither a long or a short active chain can still diffuse well (and neither can the transfer agent).

The only general difference you will see with transfer agent is that the Trommsdorff-Norish or gel effect sets in a bit later, because the overall viscosity of short chains is lower. In that sense, the transfer agent even slows down the reaction a bit. Which in that case is very welcome.

Of course the transfer agent radical can be either more reactive with the given monomer or less. (See “copolymerisation parameter”.) So the chain restart can either be fast (in which case it makes practically no difference), or it can eventually be much slower. That depends on the specific transfer agent / monomer pair.

Tagged : / /

Linux HowTo: How to set the command (cmd) prompt colors

Original Source Link

Pretty easy to do in Bash, but, for the life of me, I cannot find a way to change the prompt (and only the prompt) colors in Windows 7’s cmd window.

Note: the solution suggested in the comments seems to be limited with regard to 64-bit systems. It is replacing (extending, to be more precise) the command processor instead of playing within the rules (not necessarily a bad thing, though).

Try this command @reg add "hkcusoftwaremicrosoftcommand processor" /v defaultcolor /t reg_dword /d 0xf /f. any color also available from 0x0 to 0xf.

This question in SO, suggested in the comment to my question has answers that seem to be working on my Win10 machine.

Tagged : / / / /

Code Bug Fix: Smooth line with Plotly in R

Original Source Link

I have one data set which contain data in two column about Gross salary and tax wedge.You can see data with code line below:

SAMPLE_WAGES_TAX_WEDGE_TEST<-data.frame(
  GROSS=c(10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900,1000),
  TAXWEDGE=c(30.1,30.4,30.7,30.9,29.1,28.9,28.6,28.5,27.9,27.2,27.1,27.0,27.0,26.8,25,24,23,21,19)
)

So my intention is to plot graph with plotly package and make some smooth line similar like function geom_smooth() from ggplot2.

library(data.table)
library(plotly)

dat <-as.data.table(SAMPLE_WAGES_TAX_WEDGE_TEST)

fig <- plot_ly(dat, x = ~GROSS, y = ~TAXWEDGE, name = "Before reform", type = 'scatter',
               mode = 'lines',line = list(dash = "solid") )

I try with this line of code but I can’t add smooth line so can anybody help how to solve this problem ?

There are two ways how to solve this issue:

1) Convert ggplot object into plotly

ggfig <- ggplot(dat, aes(x=GROSS, y=TAXWEDGE) ) +
         geom_line() + geom_smooth()

ggplotly(ggfig)

2) geom_smooth() is based on the loess smoother. You need to fit the loess first and use it in add_ribbons in connection with plot_ly object. Check this great blog entry (the last example) for implementation guidance on loess and other smoothers.

Tagged : /

Math Genius: Problem with a Non-linear system of equations with square roots

Original Source Link

Given positive reals a,b and c,

show that the system:

begin{cases}2x+y+z = sqrt{c^{2}+z^{2}} + sqrt{c^{2}+y^{2}} \ x +2y+z = sqrt{b^{2}+x^{2}} + sqrt{b^{2}+z^{2}} \ x +y+2z = sqrt{a^{2}+x^{2}} + sqrt{a^{2}+y^{2}}end{cases}

Has exactly one solution (x,y,z) with x,y,z >= 0.

I don’t seem to wrap my head around how to solve it. any hints?

Tagged :

Math Genius: How to show search direction is $A$-orthogonal to the previous ones in conjugate gradient method?

Original Source Link

Consider conjugate gradient method as follows for solving $Ax=b$ where $A$ is a positive definite matrix:

$$
x_0 = 0 , r_0 = b, p_0 = r_0\
textbf{for} quad n=1, 2, cdots quad textbf{do}\
q_n = Ap_{n-1}\
alpha_n = frac{r_{n-1}^{top}r_{n-1}}{p_{n-1}^{top}q_{n}}\
x_n = x_{n-1}+alpha_n p_{n-1}\
r_n = r_{n-1}-alpha_n q_{n}\
beta_n = frac{r_{n}^{top}r_{n}}{r_{n-1}^{top}r_{n-1}}\
p_n = r_{n}+beta_n p_{n-1}\
textbf{end for}
$$

It is well-known that new search direction $p_n$ is $A$-orthogonal to all the previous directions $p_j$ where $n>j$, i.e.,
$$
p_n^{top}Ap_j=0
$$

All the prove I have seen assume the above fact but non of them has not proven that. Is there a trick to easily conclude that or we have to derive it? Can someone prove it?

Tagged : /

Ubuntu HowTo: Problems with Codeblocks

Original Source Link

I installed Codeblocks 17.12-1 and it’s not responding after building the file.
So I wanna try Codeblocks 16.01 from the terminal but it shows errors.

:~$ sudo apt install codeblocks
[sudo] password for salil: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: 
codeblocks : Depends: codeblocks-common (= 16.01+dfsg-2.1) but it is not 
going to be installed
E: Unable to correct problems, you have held broken packages.
:~$ 

Remove the codeblocks-common.

sudo apt-get remove codeblocks-common

then

sudo apt install -f 
sudo apt-get update.

Now try to reinstall. It should work now.

Tagged : /

Making Game: How Path forwarding in Google Domains works? [closed]

Original Source Link

I just registered a domain name in Google Domains and when doing initial setup I noticed it had a path forwarding option, with the following explanation:

Path forwarding

For example, if you’re forwarding documentationexample.com to
example.com, your domain could be forwarded in the following ways:

With path forwarding on: documentationexample.com/about.html redirects
to example.com/about.html.

With path forwarding off: documentationexample.com/about.html redirects to example.com.

I wonder how it works in the “path forwarding off” scenario? In my understanding, DNS server can only reply browser’s request to translate a domain name to an IP address. The path portion in the URL is not visible to DNS server. How can it tell browser to redirect documentationexample.com/about.html to example.com?

(I tried to contact Google Domains customer support, but failed to submit the question on their web site).

DNS does not have a concept of forwarding that is similar to HTTP redirects. Of course there’s CNAMEs and stuff, but they just result in aliases.

Both examples (keeping path or dropping it) from the quoted section are not achievable with DNS alone. They involve a web server (operated by Google) sending HTTP redirects.

Tagged : /