What relation does music have to math?

Question: A lot of people claim that music is just math and I don't understand why. Is there any facts behind this claim? It angers me when people make this claim and when I ask them to explain, even when they can't they don't see they are wrong.
Comment: http://homepages.abdn.ac.uk/mth192/pages/html/maths-music.html
Comment: See also: http://math.stackexchange.com/questions/79885/mathematics-and-music
Comment: Also, could you please define music?  Do you mean notes on a page, or the sound waves generated by an instrument?  Or, do you perhaps mean the feeling you have when listening to a recording?
Comment: Music can be represented by math, but music is *NOT* math. I believe both mathematician and musician would have agree on "$\text{Music}\neq \text{Math}$". Especially there are emotions in both the composer's work and the interpreters's interpretation (conductor, orchestra, etc...), can you exactly measure emotions by math? maybe quantitatively by tempo, and that's a maybe. If music IS math, I would say Mahler is a pretty good mathematician.
Comment: If you can read spanish, there is a book called "Matemática, maestro!" from the collection "Ciencia que Ladra" that explains it very nicely and in layman terms. [Here](http://www.sigloxxieditores.com.ar/fichaLibro.php?libro=978-987-629-143-9) it is.
Comment: I doubt this is what you meant, but there's some (slightly) interesting math behind tuning and pitch discrepancies. See the [Pythagorean comma](http://en.wikipedia.org/wiki/Pythagorean_comma) and the various pages it links to.
Answer: There are many mathematical aspects of music, but there also many non-mathematical aspects that are inherently cultural.
As an example of a "math aspect", take a look at harmonics: we like hearing sounds that produce the "same" frequencies, and these are just integer multiples of the basic frequency that is being played. Another example would be that of equal temperament, which creates a semi-optimal distance between notes, such that the possible harmonies are maximized.
That being said, the actual number of tones in an octave as well as the choice of scale are completely culture dependent - Western ears are used to 12 tone octaves and certain scales but not others, in what seems to be a rather arbitrary choice. So I think it's fair to say that music is definitely not "just math" - it's very strongly tied to the culture we were brought up in rather than to some mathematical formula.
Answer: Additionally to he two answers given so far: I think the main link between maths and music is hidden behind the scenes:

Rules: Composition as well as Improvisation heavily relies on a reduced decision space as humans cannot deal with all possible alternatives at once. This reduction is usually done by exercising certain rules. One of the tasks of modern music theory is to find out the rules that are used in a certain composition or define a certain style. Students in music theory or composition courses learn the rules that underlie certain compositional styles such as Gregorian music, Counterpoint or Bach chorals. On the other hand rules have been used to compress music such as figured bass or chord symbols in modern songs.
Intuition: Both mathematics and music heavily rely on intuition. Intuition enables humans to follow or analyse rules implicitly. This is the case when a mathematician formulates a conjecture or when a composer has some kind of feeling how a composition should be done. In my music theory course the lecturer told the students to learn the rules, practice them and forget them afterwards in favour of the intuition they got during practising. The same idea is helpful in solving mathematical problems.
Fantasy: Both mathematics and music rely on fantasy. For music this is a well-known fact. The most well-known fact is that transformation of some inspiration into a score is linked with fantasy. But also on the technical level of composition music lives from a small amount of surprise, i.e. breaking the rules that have been established during the past of a piece. Surprise is not a paradigm in mathematics. But breaking the rules is an important as well as hidden feature in mathematics. It is done mainly in three ways: Using a duality to switch over to another branch of mathematics, introducing a newly defined object that has properties that are not directly deduced from the used formalism. One of the important ways to solve mathematical problems is to imagine some solution, explore its properties and solve the problem backwards.[1][1] Sometimes this imagination comes from the problem itself, sometimes people use an analogue from the "real world". The fantasy is usually invisible as soon as a proof has been written down.
Creativity: Some mathematicians consider mathematics as an art like lyrics. The constraints that limit mathematical methods are usually as wide as in the arts. In comparison: Engineers usually deal with much more constraints of technical or economic nature that can not be widened temporarily. Some more ideas can be found in a book about musical creativity [2]
[1] G. Polya: How to Solve it?, 1945, Princeton University Press
[2] G. Mazzola, J. Park, and F. Thalmann: Musical Creativity, 2011, Springer
Answer: If you want to have a full picture of what is music, you have to keep in mind that we are humans listening and creating this music. Therefore, you have to include cognitive science to get the whole picture. As far as I know, cognitive science is not "just math."
That said, there are some really cool connections between math and music, like the harmonic series and equal temperament, chords and groups, and some more involved things like the book "The Topos of Music" by Mazzola.
Answer: Yes, hello.  Some of these comparisons between Music and Math are actual.  However I cannot help but think the statement using the musical term harmonics, is wrong. A harmonic is an overtone.  On a guitar it can be easily heard on the 12th fret by touching your finger to the string on the fret and pulling it off, while plucking the string with your picking hand. (Roundabout and many other songs use this).  It makes more sense to say HARMONY is related to MUSIC.  Harmony is measured in Music by numbers.  The root of the voice can be a middle "C" and the next voice can be an "E".  These are 3rds apart .
A middle "C" and a "G" is a fifth apart and so on.
Also to be mentioned is that all musical notes have a measurement with Math.  An "A" 440 vibs per sec is the traditional open A 5th string on a guitar.
I can go on and on with similarities between Math and Music.  Progressions are referred to as 145 or 1625 meaning from the key center you are counting to the next note or chord.
All chords are a number system, all timing is a number system, all harmony is a number system, arrangements are number systems.
Something to think about,
Edmund Lubowiecki
2/23/20

What relation does music have to math?


In the sentence: " count" ("count of ") should  be plural or singular?

Question: For instance, should I say: 1) "The book count is overwhelming" or 2) "(The?) Books count is overwhelming"? I am specifically interested in the version without "of" (as in brackets in the question).
Answer: In your sentences, "count" is the subject and "book" is an adjective. The verb and the definite article need to agree with "count" (i.e. without the adjective, you would say "The count is overwhelming," not "Count is overwhelming.").
There's no hard rule about whether a noun used as an adjective should be plural, but in most cases, the singular is used. "Book count" sounds much more natural than "books count" (LD).
The book count is overwhelming.
Comment: @Cromax You could say "the numbers game is overwhelming," for example, or "the media frenzy is overwhelming." Whether the plural or singular noun is used as an adjective depends on the noun it is paired with, not the rest of the sentence. As to "book" as an adjective, think "book club" or "book drive" or "book sales."
Comment: Can you, please, give an example of a sentence, where one would use plural adjective in the above scenario? Asking just out of the curiosity. (I still can't get use to thinking of "book" as an adjective, thou). I've noticed some examples under link you provided.


How do you manipulate Roshan aggro

Question: I've seen many players (on stream or in competitive game) manipulate roshan aggro from one melee hero to another. Or for example from a hero to sylla's sprit bear. How does that work. How do you force roshan changing target ? Any answer and more general tips on how roshan react would be great. Thanks
Answer: You need to be the closest hero to draw aggro. Melee heroes technically have a range of 128, so all else being equal Roshan will pick between them. The solution is to move the unit that you want to be focused even closer than that 128 range (m+click on Roshan or just right click precisely) and then continue attacking him. At this point, your ally who is currently under attack will be able to drop aggro by A+clicking on you or retreating and re-engaging.
Comment: doesn't hp trigger aggro as well? afaik units with less then ~20% hp get prioritised (lowest hp will then get the focus after this point). is this changed? otherwise it should be added
Comment: @Wandang Not sure. If you can confirm it, feel free to add it.

How do you manipulate Roshan aggro


Is there a way to make the Enter key work with a Logitech K811 keyboard?

Question: The key is labeled such that it looks like holding down fn and pressing Return will produce Enter (as with Apple's keyboards). However, when I do that it only produces a regular Return.
Answer: If you don't need to use fn otherwise, you could simply remap it to behave like Enter. This is easily doable using the free tool Karabiner-Elements — download and install it, then add a "Simple Modification" from fn to keypad_enter. If you want to only remap your external keyboard, then set the checkboxes in the Devices tab appropriately.

If you want to keep fn's functionality, you need a more advanced remapping/macro utility such as BetterTouchTool or Keyboard Maestro. I'm not aware of any free options in this realm (though they may exist) besides the full version of Karabiner, which doesn't currently work on Sierra.
fn is not a typical modifier key, so it can't be captured in the same ways that the others (e.g. ⌥ and ⌘) can. Because of this, there is no way I'm aware of to assign fnreturn to anything. However, using one of the tools I mentioned, you can easily assign another hotkey to do the same thing, for example, ⌥return.
Comment: Thanks for the suggestions, but what about the root issue? Shouldn't it be able to produce Enter without remapping anything? I wonder whether this is a hardware or driver problem.
Comment: @MichaelTsai Basically, the way the keyboard is programmed, the fn key is purely internal — when you press it with an F1-12 key, it sends a single key press signal to the computer. If you were to program some custom firmware you could alter that behavior, but I don't think it's possible otherwise.
Comment: Sounds like you're saying this is a hardware problem. The keyboard is sending the wrong signal.
Comment: @MichaelTsai Well, in that it has to do with the keyboard itself, yes, but it's more a design flaw than a hardware problem. I actually have the same keyboard, and it works the same way for me.
Comment: I see, so you don't think it's a defect in my particular unit? They just designed it not to support Enter? Thanks.
Comment: @MichaelTsai Exactly. Unfortunate, but I'm pretty sure there's no way around it without hacking skills.
Comment: Maybe write to Logitech and ask for a firmware update?
Comment: I've written to their support. Will update if I hear anything interesting.
Comment: Logitech support said that it's supposed to support Enter, so the fact that it isn't working is a hardware problem. They sent me a replacement K811, but it has the same problem.
Comment: @MichaelTsai Sounds like they need to update the firmware then—now 3/3 of our sample size don't support it.
Comment: Logitech now says that "the problem is the Operating System. Chances that the FN+Return is no longer supported as Enter." However, I think you were right that the fn key is internal. I also tested the keyboard back to OS X 10.10 and got the same results. So if it's an OS issue, it's not a recent one.
Answer: @MichaelTsai I'm betting that this is a Logitech driver issue.  I have used the K811 for a couple of years and have had no problem with fn-return as enter (as well as the mappings for fn-arrow keys and fn-delete outlined in this help document).
However, I just recently upgraded to Sierra (currently 10.12.6) and upgraded my Logitech options/firmware (v6.70.1030). Shortly after doing so, I realized that fn-return no longer worked.  The other fn mappings still do and, weirder still, all of the fn mappings work perfectly fine using my MacBook's built-in keyboard.
So, I opened up the Keyboard Viewer to see what was going on and the problem became obvious. When typing on the Macbook's built-in keyboard, the keyboard viewer shows the normal keyboard like so:.

When you hold down the fn key, the return key turns into the Enter symbol (⌅) as expect.
However, as soon as you type on the K811, the keyboard viewer switches to an extended keyboard (with numeric keypad):

In this configuration, the fn key has no effect on the Return key's symbol (or, obviously output).
My guess is that the Logitech firmware is incorrectly defining the keyboard type for the operating system.  I have filed a support ticket with Logitech (case #06038823) and will let you know what they say.
Comment: On my Mac, nothing happens in the Keyboard Viewer when I hold down the fn key. Also, dictation and Launch Bar do not recognize when it is tapped.


How are complex number being treated in physics?

Question: In various places in physics, EM for example, complex numbers are used to describe things that are physically real. I will point a simple case - solving an ODE for resistance/charge/voltage. We get a certain value, which is in the form $a+bi$ and take its real part. My question is, what does the imaginary part of the answer physically represents? How do we know we are not "losing information" by considering only the real part when using complex numbers in calculations? The whole treatment of complex numbers in physics baffles me. What does the complex plane have to do with reality? Sometimes certain motions are also described with complex numbers.
Comment: Related/possible duplicates: https://physics.stackexchange.com/q/209069/50583, https://physics.stackexchange.com/q/512109/50583, https://physics.stackexchange.com/q/11396/50583
Comment: "Imaginary" is an unfortunate (historical) choice of naming the part of an ordered-pair number.  Also unfortunate is that no one of mathmatical influence is willing to change that name. I, personally, think "transverse" would be better. (Real) +i(Transverse) would be reminiscent of the Argand plane.
Comment: To preserve the symbols $\Bbb{C}$ and $\Bbb{R}$, I suggest the names "Complete numbers" and "Restricted numbers".
Answer: The question is based on a false premise:  that only the real part of complex current or voltage is significant.
In fact, it is the magnitude of the complex quantity that is significant.  The relationship between the real and imaginary parts tells you the timing or phase of the quantity relative to a pure resistance
If you had a circuit with a resistor, capacitor and inductance arranged in series and fed with $120$ V alternating current, you could calculate that the voltage across the inductance and the capacitor were both purely imaginary. Yet a AC voltmeter could measure a very real voltage across each of these.  More importantly, you could get blown on your backside by this imaginary voltage, if you were to touch the capacitor or inductance at the wrong moment in the alternating voltage.
As a different example: If you were to calculate the voltage individually across four circuit elements in series and find $$V_1=(5+0i) \text{ Volts}$$$$V_2=(0+5i) \text{ Volts}$$$$V_3=(0-5i) \text{ Volts}$$$$V_4=(3+4i) \text{ Volts}$$then you would know that the measured voltage across each of the elements would be exactly the same, $5$ Volts.
If you were to display the voltages on a multiple trace oscilloscope, you would see four identical sine waves with an amplitude of $5$ Volts: $V_2$ would be $90$ degrees out of phase with $V_1$, $V_3$ would be $180$ degrees out of phase with $V_2$, and $V_4$ would be $53.13$ degrees out of phase with $V_1$ $( \text{ because }\tan(53.13)=\frac{4}{3})$
Comment: I agree that in some theories the imaginary part has a well defined "real world" meaning. But I think in Quantum Mechanics the situation is quite different. Although the mathematics of QM works perfectly, the imaginary part has no meaningful physical imprint (for lack of a better word) in the measurable world. I always found this to be the most mysterious aspect of QM.
Comment: @HartmutBraun actually there kinda is a "physical" imprint of this imaginary part. since the wave function $\psi(x,t)$ is complex valued. you can apply a phase transform on it $\psi' \to e^{i\theta}\psi$. the equation that this function satisfies "Klein-Gordon equation" remains invariant under this change. but if you "localized" the change i.e. made $\theta$ a function of $(x,t)$ too not just a consonant the equation doesn't stay unchanged under that. one way to solve it is to modify the original equation by adding a term $A_\mu (x,t)$ such that this new equation would stay invariant under ...
Comment: ... the local change and see if it works. turns out that this $A_\mu$ which was added just as a kind of correction at first is equal to the electromagnetic potential. so in a way this is kind of a rediscovery of the electromagnetic field.
Comment: "The question is based on a false premise: that only the real part of complex current or voltage is significant." Actually, there is no misunderstanding here.  For example with V4 you would get the same result if you take the real part of (3+4i)*e^(iwt) which is Re[(3+4i)*e^(iwt)].
Answer: In the simplest case we may use an exponential like an $A\cdot \text{e}^{\text{i}\omega t}$ instead of a $A\cdot\sin(\omega t)$, so it is just the easiest way of writing the solutions (simplest harmonic oscillations).
But in reality the amplitude and the phase may vary with time in the transient processes, so you must write two equations instead of one. Often these two equations are equivalent to one equation with a complex coefficients and solutions simply connected to the variables in question.
Comment: Shouldn't we say that the real part and the "imaginary" part are actually used in the form $\mathrm{A} \cdot e^{\iota \omega t}$? Since, any complex number (thanks to Euler) $z=x+\iota y$ can be written in the polar form $\sqrt{x^2+y^2} \cdot e^{\iota \theta}$; where, $\theta= \tan^{-1}(\frac{y}{x})$ (phase). So, we actually have all the information for the solution to an S.H.O differential equation.
Comment: @Ishika_96_sparkle: Yes, foe a SHO there are two initial conditions and two constants to determine. Linearity and homogenity of SHO makes the exponential form of solution appealing. But in (very) general, it is not always fruitful to join two independent variables in one complex variable $z$.
Answer: Certainly you lose information by only taking the real part of a complex number, but sometimes that is the only part you are interested in. In the case of resistance, the complex quantity is called impedance, and the imaginary part (called reactance) covers the effect of capacitors and inductances.
In general complex numbers are used because they make the Maths easier. An unexpected complex answer, like getting $sin\theta>1$ in Snell's Law, tells you something different is happening.
Answer: another example:
to solution of this  differential equation:
$${\frac {d^{2}}{d{t}^{2}}}x \left( t \right) +{\omega}^{2}x \left( t
 \right) +2\,\gamma\,{\frac {d}{dt}}x \left( t \right)=0
$$
is: (Ansatz)
$$x(t)= \left( a+ib \right) {{\rm e}^{ \left( -\gamma+i\sqrt {-{\gamma}^{2}+{
\omega}^{2}} \right) t}}+ \left( a-ib \right) {{\rm e}^{ \left( -
\gamma-i\sqrt {-{\gamma}^{2}+{\omega}^{2}} \right) t}}
$$
where the imaginary part of x(t) is zero .
Thus : because  $\Im(x(t))=0$ , the solution is  $\Re(x(t))$
with the   initial condition
$$x(0)=x_0\quad ,\dot{x}(0)=v_0$$
you have two equations for $a$ and $b$
$$a=\frac{x_0}{2}$$
$$b=\frac{1}{2}\,{\frac {x_{{0}}\gamma+v_{{0}}}{\sqrt {-{\gamma}^{2}+{\omega}^{2}}}}$$


What is the relationship between $Y$ and $X$ in this plot?

Question: What is the relationship between $Y$ and $X$ in the following plot?
In my view there is negative linear relationship, But because we have a lot of outliers, the relationship is very weak. Am I right?
I want to learn how can we explain scatterplots.
Comment: This is an exercise in [tasseography](http://en.wikipedia.org/wiki/Tasseography). This is very popular among day traders, and they call it [technical analysis](http://en.wikipedia.org/wiki/Technical_analysis). Basically, without knowing something about the nature of the data it's a fruitless exercise
Comment: Thanks for your comment. I just see this plot in a book. Y is dependent variable and X is independent variable. There is no theory. it plotted a scatterplot to show the relationship of Y given x. And there is a question in the book that asks for if there is any relationship or not, Linear or nonlinear?  Strong or weak?
Comment: @Aksakal Statistical language usually understands "relationship" rather literally: as describing sets of tuples of numbers. For instance, a correlation coefficient describes a relationship. There is no implication about the genesis, nature, or causal associations among underlying variables. I agree with you that "explain" usually is understood in such a deeper sense, but because relationships are so heavily emphasized in the question, I think it only fair not to push the literal meaning of "explain" too far. Suggesting that describing scatterplots is just tea-leaf reading goes too far, IMHO.
Comment: What is $X$?

What is $Y$?

What process do you produced outliers? What makes you think that they are not real measurements? What is the theory?
Comment: @Aksakal Thank you for the suggestion.  I could use a little more of your help, though, in implementing it. Are you saying my answer in this thread does not clearly indicate it is exploratory? That would be difficult to fathom, given that EDA is so prominently mentioned at the outset and that all the language and conclusions in it are consistently about the *data*, not about any underlying variables. Or are you suggesting that something within my previous comments might be misleading and I should provide a correction or clarification?
Comment: @chl you rock for donating to a bounty to whuber =)
Comment: @Aksakal It depends on the purpose of the analysis. For *drawing inferences* or *making predictions* we may be on shaky ground here, but for *describing* a batch of data or--as stated in this question--*learning how to explain (describe) scatterplots*--there is a very great deal that can be done with this exercise.
Comment: @whuber, the question was about "relationship". OP stated he wants to learn how to "explain" plots, not "describe". I see a big difference between explaining and describing. The latter belongs to exploratory analysis (EA), and the former is beyond EA, in my opinion.
Comment: @whuber, I think you should make it clear to OP that what you offered is fine in the context of exploratory analysis, and not Ok in inferential context. I'm not sure that OP understands the distinction, otherwise he'd be more careful with the language in his question.
Comment: My first reaction was that this data looks like service time data.  Maybe server response times or something.  hist(Y) looks lognormally distributed.
Answer: The question deals with several concepts: how to evaluate data given only in the form of a scatterplot,  how to summarize a scatterplot, and whether (and to what degree) a relationship looks linear.  Let's take them in order.
Evaluating graphical data
Use principles of exploratory data analysis (EDA).  These (at least originally, when they were developed for pencil-and-paper use) emphasize simple, easy-to-compute, robust summaries of data.  One of the very simplest kinds of summaries is based on positions within a set of numbers, such as the middle value, which describes a "typical" value.  Middles are easy to estimate reliably from graphics.
Scatterplots exhibit pairs of numbers.  The first of each pair (as plotted on the horizontal axis) gives a set of single numbers, which we could summarize separately.
In this particular scatterplot, the y-values appear to lie within two almost completely separate groups: the values above $60$ at the top and those equal to or less than $60$ at the bottom.  (This impression is confirmed by drawing a histogram of the y-values, which is sharply bimodal, but that would be a lot of work at this stage.)  I invite sceptics to squint at the scatterplot.  When I do--using a large-radius, gamma-corrected Gaussian blur (that is, a standard rapid image processing result) of the dots in the scatterplot I see this:

The two groups--upper and lower--are pretty apparent.  (The upper group is much lighter than the lower because it contains many fewer dots.)
Accordingly, let's summarize the groups of y-values separately.  I will do that by drawing horizontal lines at the medians of the two groups.  In order to emphasize the impression of the data and to show we're not doing any kind of computation, I have (a) removed all decorations like axes and gridlines and (b) blurred the points.  Little information about the patterns in the data is lost by thus "squinting" at the graphic:

Similarly, I have attempted to mark the medians of the x-values with vertical line segments.  In the upper group (red lines) you can check--by counting the blobs--that these lines do actually separate the group into two equal halves, both horizontally and vertically.  In the lower group (blue lines) I have only visually estimated the positions without actually doing any counting.
Assessing Relationships: Regression
The points of intersection are the centers of the two groups.  One excellent summary of the relationship among the x and y values would be to report these central positions.  One would then want to supplement this summary by a description of how much the data are spread in each group--to the left and right, above and below--around their centers.  For brevity, I won't do that here, but note that (roughly) the lengths of the line segments I have drawn reflect the overall spreads of each group.
Finally, I drew a (dashed) line connecting the two centers.  This is a reasonable regression line.  Is it a good description of the data?  Certainly not: look how spread out the data are around this line.  Is it even evidence of linearity?  That's scarcely relevant because the linear description is so poor.  Nevertheless, because that is the question before us, let's address it.
Evaluating Linearity
A relationship is linear in a statistical sense when either the y values vary in a balanced random fashion around a line or the x values are seen to vary in a balanced random fashion around a line (or both).
The former does not appear to be the case here: because the y values seem to fall into two groups, their variation is never going to look balanced in the sense of being roughly symmetrically distributed above or below the line.  (That immediately rules out the possibility of dumping the data into a linear regression package and performing a least squares fit of y against x: the answers would not be relevant.)
What about variation in x?  That is more plausible: at each height on the plot, the horizontal scatter of points around the dotted line is pretty balanced.  The spread in this scatter seems to be a little bit greater at lower heights (low y values), but maybe that's because there are many more points there.  (The more random data you have, the wider apart their extreme values will tend to be.)
Moreover, as we scan from top to bottom, there are no places where the horizontal scatter around the regression line is strongly unbalanced: that would be evidence of non-linearity.  (Well, maybe around y=50 or so there may be too many large x values.  This subtle effect could be taken as further evidence for breaking the data into two groups around the y=60 value.)
Conclusions
We have seen that

It makes sense to view x as a linear function of y plus some "nice" random variation.

It does not make sense to view y as a linear function of x plus random variation.

A regression line can be estimated by separating the data into a group of high y values and a group of low y values, finding the centers of both groups by using medians, and connecting those centers.

The resulting line has a downward slope, indicating a negative linear relationship.

There are no strong departures from linearity.

Nevertheless, because the spreads of the x-values around the line are still large (compared to the overall spread of the x-values to begin with), we would have to characterize this negative linear relationship as "very weak."

It might be more useful to describe the data as forming two oval-shaped clouds (one for y above 60 and another for lower values of y).  Within each cloud there is little detectable relationship between x and y.  The centers of the clouds are near (0.29, 90) and (0.38, 30).  The clouds have comparable spreads, but the upper cloud has far fewer data than the lower one (maybe 20% as much).

Two of these conclusions confirm those made in the question itself that there is a weak negative relationship.  The others supplement and support those conclusions.
One conclusion drawn in the question that does not seem to hold up is the assertion that there are "outliers."  A more careful examination (as sketched below) will fail to turn up any individual points, or even small groups of points, that validly could be considered outlying.  After sufficiently long analysis, one's attention might be drawn to the two points near the middle right or the one point at the lower left corner, but even these are not going to change one's assessment of the data very much, whether or not they are considered outlying.

Further Directions
Much more could be said.  The next steps would be to assess the spreads of those clouds.  The relationships between x and y within each of the two clouds could be evaluated separately, using the same techniques shown here.  The slight asymmetry of the lower cloud (more data seem to appear at the smallest y values) could be evaluated and even adjusted by re-expressing the y values (a square root might work well).  At this stage it would make sense to look for outlying data, because at this point the description would include information about typical data values as well as their spreads; outliers (by definition) would be too far from the middle to be explained in terms of the observed amount of spreading.
None of this work--which is quite quantitative--requires much more than finding middles of groups of data and doing some simple computations with them, and therefore can be done quickly and accurately even when the data are available only in graphical form.  Every result reported here--including the quantitative values--could easily be found within a few seconds using a display system (such as hardcopy and a pencil :-)) which permits one to make light marks on top of the graphic.
Comment: As humans we are extraordinarily inclined to find patterns, even ones that are not there. I think it is quite plausible to obtain a scatter plot like the one we have here with just two independent RVs, one of them skewed. I have no proof of that, and I have no alternative analysis to offer - other than one that says there is little or no relationship. Yes, it is possible that bimodality is present. If the process could be observed further, we could see what happens. I just think  we need to be cautious and aware of our inclination to react to plausibly spurious patterns.
Comment: Wow. I would never have seen those two groups and the resulting line. And I question it.
Comment: @Russ I am glad to hear that somebody questions this exploration, because no EDA is unique or dispositive.  I have included another image to help you see what I see.  I would like to invite you to post an answer that is equally or more parsimonious and as usefully descriptive.
Comment: @Russ You are correct.  Experience is needed to keep from reading too much into patterns. My experience says that with 150-200 points it is difficult randomly to obtain the strong bimodality I measured in the y-coordinates. Such experience can easily and quickly be supplemented nowadays by simulation: when you think you see a pattern, then (1) characterize it quantitatively and (2) look for it in random samples that are generated according to a simpler alternative hypothesis.  If the pattern shows up very much, then you can blame your visual cortex, but otherwise you may have found something.
Comment: @Russ Thank you. That was not the residual plot I described--the roles of x and y are reversed. However, it is informative nonetheless. The heteroscedasticity is the most striking thing: it actually seems to lend support to the two-cluster hypothesis (which would make the heteroscedasticity disappear). Mind you, I'm agnostic about that hypothesis. Everything I have written here is in the original spirit of careful, robust description of the data. *Any* single curve as a description of these data is going to be crude and perhaps unsatisfactory.
Comment: I knew it was whuber by looking at the first blurred plot.  Good work, sir.  Thought: A 2d nonparametric histogram might do a good job of bringing the message to the part of the brain that interprets pictures that are more than lines.
Comment: +1, one thing I do wonder about from looking at the plot is if there is a floor effect. The y values seem more bunched up at the bottom than I would expect from simple bivariate normals.
Comment: Thank you very much for the complete answer. I learned a lot just by asking this question :)
Comment: @ whuber : would you please say your opinion about the scatterplot that I have posted in the following link, if it is linear or not, strong or weak? and compare regression line with lowess line. I appreciate your help. http://stats.stackexchange.com/questions/114397/what-is-the-effect-of-having-skewed-dependent-variable-on-scatterplot-result
Comment: I wonder if Y is vehicle eMPG and the top group are the electric cars... Or it could be some other ratio.
Comment: (Contd.) The issues are basic. EDA seeks simple, parsimonious descriptions of data, recognizing there is no perfect one in any case--that's an an ideal and a guide to analysis. Its principles work very well in this situation. I found the y grouping by critically examining the very suggestion you later made: would it help to re-express the y-values as logarithms? The answer--because of the bimodality--was a clear no. Additionally, the impression of two groups of y-values holds up even when controlling for x. This example shows how EDA is not mere subjective human-derived pattern construction.
Comment: After reviewing all the other answers--as well as yours, @Russ--and the chat dialog, it strikes me that you seem to be objecting to the least significant element of this analysis: my suggestion that "it may be useful" to point to two y groups. Whether or not you agree with that opinion, the remaining analysis still holds up. The robust exploratory methods I used (which amount to finding two typical points within a cloud and drawing the line between them) will still produce a reasonable estimate of the trend. *None* of the other conclusions depend on a finding of y bimodality (or not).
Comment: @whuber - I'd like you to show us the residual plot for your reasonable estimate of the trend. Residuals versus fitted, separately by your groups, or with different symbols, as you prefer.
Comment: @Russ When I did this analysis I had only the image--and in it I believe I can see the residuals just fine. Since you have the data, I invite you to look at the residuals for the two fits I made: (1) for **x** relative to the line through the points (0.29,90) and (0.38,30) (bullets 1 and 3 in the conclusions); and (2) for x relative to the *constant value* 0.29 when y>=60 and the constant value 0.38 when y<60 (bullet point 7). Fit (2) is practically as good, with homoscedastic residuals symmetrically distributed around 0. There *are* small trends in those residuals: in opposite directions!
Comment: OK, I added the plot you requested to my answer, showing the slight trends for fit (1). It's troubling, isn't it, to see residuals varying over the range $(-200,+200)$ when the $Y$ values themselves vary over the range $(0,120)$
Comment: @Engr That is a good suggestion. I am trying to limit the analysis to what is readily available from the image of the scatterplot alone, because that is what the OP had available--not the raw data.  With the data on hand there is a lot more that could be done and your suggestion would be one of the natural first steps.
Comment: If you could remove the lines, and perform something like ifft2(fft2(a).*fft2(a)) then you might find a subset of the field is translated.  It would create a second, lower, peak in the 2d cross-correlation plot of the images.  It looks like the translation is about 1.5-2.0 grid spacings.
Answer: Let's have some fun!
First of all, I scraped the data off your graph.
Then I used a running line smoother to produce the black regression line below with the dashed 95% CI bands in gray. The graph below shows a span in the smooth of one half the data, although tighter spans revealed more or less precisely the same relationship. The slight change in slope around $X=0.4$ suggested a relationship that could be approximated using a linear model and adding linear hinge function of the slope of $X$ in a a nonlinear least squares regression (red line):
$$Y = \beta_{0} + \beta_{X}X + \beta_{\text{c}}\max\left(X-\theta,0\right) + \varepsilon$$
The coefficient estimates were:
$$Y = 50.9 -37.7X -26.74436\max\left(X-0.46,0\right)$$
I would note that while the redoubtable whuber asserts that there are no strong linear relationships, the deviation from the line $Y = 50.9 - 37.7X$ implied by the hinge term is on the same order as the slope of $X$ (i.e. 37.7), so I would respectfully disagree that we see no strong nonlinear relationship (i.e. Yes there are no strong relationships, but the nonlinear term is about as strong as the linear one).

Interpretation
(I have proceeded assuming that you are only interested in $Y$ as the dependent variable.) Values of $Y$ are very weakly predicted by $X$ (with an Adjusted-$R^{2}$=0.03). The association is approximately linear, with a slight decrease in slope at about 0.46. The residuals are somewhat skewed to the right, probably because the is a sharp lower bound on values of $Y$. Given the sample size $N=170$, I am inclined to tolerate violations of normality. More observations for values of $X>0.5$ would help nail down whether the change in slope is real, or is an artifact of decreased variance of $Y$ in that range.
Updating with the $\ln(Y)$ graph:
(The red line is simply a linear regression of ln(Y) on X.)

In comments Russ Lenth wrote: "I just wonder if this holds up if you smooth $\log Y$ vs. $X$. The distribution of $Y$ is skewed right." This is quite a good suggestion, as the $\log Y$ transform versus $X$ also gives a slightly better fit that a line between $Y$ and $X$ with residuals that are more symmetrically distributed. However, both his suggested $\log(Y)$ and my linear hinge of $X$ share a preference for a relationship between (untransformed) $Y$ and $X$ that is not described by a straight line.
Comment: Alexis, Tukey's *EDA* book is full of them.  For more techniques (of greater sophistication, with mathematical justification) see Hoaglin, Mosteller, & Tukey, *Understanding Robust and Exploratory Data Analysis*.
Comment: @rivu manual. Took 10 or 15 minutes tops. Placed each point initially with pointer, then precisely located it using the arrow keys.
Comment: I just wonder if this holds up if you smooth $\log Y$ vs. $X$. The distribution of $Y$ is skewed right, and I think a transformation that makes the distribution more symmetric won't also look a lot like the iconic null scatterplot.
Comment: @Russ It is classical that bimodal distributions can appear skew and suggest log transformations. But the y distribution here is indeed bimodal and a log is probably not a useful way to re-express it. When the two components are separated, the lower one is still positively skewed and a square root is about the right amount to transform it to obtain a symmetric distribution.  The square root does not affect the symmetry of the upper group appreciably, indicating the root may be a good choice.  However, that does not fix the bimodality--and therein lies the problem with any smooth of this type.
Comment: Alexis, in our answers we are both guilty of using "strong" in undefined ways. The sense in which I meant "weak" was hinted at in some of my phrasing, which was meant to indicate that the slope is small compared to the scatter in the y values. I don't think your analysis comes up with any different conclusion in that regard. I felt a need for caution because, accepting hypothetically that there might be merit to the mixture model for y, it appears that in the upper group there might actually be a weak *positive* relationship between x and y and no relationship in the lower group.
Comment: Thanks a lot :) I appreciate your taking time and running line smoother on the scatterplot
Comment: +1s all the way around! @whuber can you recommend techniques that formalize your eyeball investigation into the bimodality of $Y$? (Is that what finite mixture models are about?)
Comment: @whuber I agree with the points about "strong". I like to push back against the common bias in practice of (to refurbish a line from John Cleese in *The Meaning of Life*) stampeding towards the assumption of a linear relationship. But of course: these are *weak* relationships. :)
Comment: @RussLenth You are right on the log(Y) plot: more symmetrically distributed residuals, a relationship more reasonably inferred as linear, and about double the $R^{2}$.
Comment: @Alexis, if you don't mind, how did you scrape the whole data? Using the automatic mode or the manual mode?
Answer: Here's my 2¢ 1.5¢.  To me the most prominent feature is that the data abruptly stop and 'bunch up' at the bottom of the range of Y.  I do see the two (potential) 'clusters' and the general negative association, but the most salient features are the (potential) floor effect and the fact that the top, low-density cluster only extends across part of the range of X.
Because the 'clusters' are vaguely bivariate normal, a parametric normal mixture model may be interesting to try.  Using @Alexis' data, I find that three clusters optimize the BIC.  The high-density 'floor effect' is picked out as a third cluster.  The code follows:
<code>library(mclust)
dframe = read.table(url("http://doyenne.com/personal/files/data.csv"), header=T, sep=",")

mc = Mclust(dframe)
summary(mc)
# ----------------------------------------------------
#   Gaussian finite mixture model fitted by EM algorithm
# ----------------------------------------------------
#
#   Mclust VVI (diagonal, varying volume and shape) model with 3 components:
#
#   log.likelihood   n df       BIC       ICL
#        -614.4713 170 14 -1300.844 -1338.715
#
# Clustering table:
#  1  2  3
# 72 72 26
</code>

Now, what shall we infer from this?  I do not think that <code>Mclust</code> is merely human pattern recognition gone awry.  (Whereas my read of the scatterplot may well be.)  On the other hand, there is no question that this is post-hoc.  I saw what I thought might be an interesting pattern and so decided to check it.  The algorithm does find something, but then I only checked for what I thought might be there so my thumb is definitely on the scale.  Sometimes it is possible devise a strategy to mitigate against this (see @whuber's excellent answer here), but I have no idea how to go about such a process in cases like this.  As a result, I take these results with a lot of salt (I've done this sort of thing sufficiently often that someone is missing a whole shaker).  It does give me some material to think about and discuss with my client when next we meet.  What are these data?  Does it make any sense that there could be a floor effect?  Would it make sense that there could be different groups?  How meaningful / surprising / interesting / important would it be if these were real?  Do independent data exist / could we get them conveniently to perform an honest test of these possibilities?  Etc.
Comment: +1 For pointing out how an exploratory analysis naturally leads to interesting *questions*. I wish I had emphasized that point more in my answer. Although I think it would be pushing things to believe (at this point) that there really are three distinct groups, the cluster results still present a valid way of *seeing* that there is a negative relationship between x and y and of summarizing that relationship. I am led to wonder to what extent automatic clustering could be a generally useful exploratory tool--provided we are not tempted to read too much into the results.
Answer: Let me describe what I see as soon as I look at it:
If we're interested in the conditional distribution of $y$ (which if often where interest focuses if we see $x$ as IV and $y$ as DV),
then for $x\leq 0.5$ the conditional distribution of $Y|x$ appears bimodal with an upper group (between about 70 and 125, with mean a bit below 100) and a lower group (between 0 and about 70, with mean around 30 or so). Within each modal group, the relationship with $x$ is nearly flat. (See red and blue lines below drawn roughly
where I guess some rough sense of location to be)
Then by looking at where those two groups are more or less dense in $X$, we can go on to say more:
For $x>0.5$ the upper group disappears completely, which makes the overall mean of $x$ fall, and below about 0.2, the lower group is much less dense than above it, making the overall average higher.
Between these two effects, it induces an apparent negative (but nonlinear) relationship between the two, as $E(Y|X=x)$ seems to be decreasing against $x$ but with a broad, mostly flat region in the center. (See purple dashed line)

No doubt it would be important to know what $Y$ and $X$ were, because then it might be clearer why the conditional distribution for $Y$ might be bimodal over much of its range (indeed, it might even become clear that there are indeed two groups, whose distributions in $X$ induce the apparent decreasing relationship in $Y|x$).
This what I saw based on purely "by-eye" inspection. With a bit of playing around in something like a basic image manipulation program (like the one I drew the lines with) we could start to figure out some more accurate numbers. If we digitize the data (which is pretty simple with decent tools, if sometimes a little tedious to get right), then we can undertake more sophisticated analyses of that sort of impression.
This kind of exploratory analysis can lead to some important questions (sometimes ones that surprise the person who has the data but has only shown a plot), but we must take some care over the extent to which our models are chosen by such inspections - if we apply models chosen on the basis of the appearance of a plot and then estimate those models on the same data, we'll tend to encounter the same problems we get when we use more formal model-selection and estimation on the same data. [This is not to deny the importance of exploratory analysis at all - it's just we must be careful of the consequences of doing it without regard to how we go about it. ]

Response to Russ' comments:
[later edit: To clarify -- I broadly agree with Russ' criticisms taken as a general precaution, and there's certainly some possibility I've seen more than is really there. I plan to come back and edit these into a more extensive commentary on spurious patterns we commonly identify by eye and ways we might start to avoid the worst of that. I believe I'll also be able to add some justification about why I think it's probably not just spurious in this specific case (e.g. via a regressogram or 0-order  kernel smooth, though of course, absent more data to test against, there's only so far that can go; for example, if our sample is unrepresentative, even resampling only gets us so far.]
I completely agree we have a tendency to see spurious patterns; it's a point I make frequently both here and elsewhere.
One thing I suggest, for example, when looking at residual plots or Q-Q plots is to generate many plots where the situation is known (both as things should be and where assumptions don't hold) to get a clear idea how much pattern should be ignored.
Here's an example where a Q-Q plot is placed among 24 others (which satisfy the assumptions), in order for us to see how unusual the plot is. This kind of exercise is important because it helps us avoid fooling ourselves by interpreting every little wiggle, most of which will be simple noise.
I often point out that if you can change an impression by covering a few points, we may be relying on an impression generated by nothing more than noise.
[However, when it's apparent from many points rather than few, it's harder to maintain that it's not there.]
The displays in whuber's answer supports my impression, the Gaussian blur plot seems to pick up the same tendency to bimodality in $Y$.
When we don't have more data to check, we can at least look at whether the impression tends to survive resampling (bootstrap the bivariate distribution and see if it's nearly always still present), or other manipulations where the impression shouldn't be apparent if it's simple noise.
1) Here's one way to see if the apparent bimodality is more than just skewness plus noise - does it show up in a kernel density estimate? Is it still visible if we plot kernel density estimates under a variety of transformations? Here I transform it toward greater symmetry, at 85% of default bandwidth (since we're trying to identify a relatively small mode, and the default bandwidth is not optimized for that task):

The plots are $Y$, $\sqrt{Y}$ and $\log(Y)$. The vertical lines are at $68$, $\sqrt{68}$ and $\log(68)$. The bimodality is diminished, but still quite visible. Since it's very clear in the original KDE it seems to confirm it's there - and the second and third plots suggest its at least somewhat robust to transformation.
2) Here's another basic way to see if it's more than just "noise":
Step 1: perform clustering on Y

Step 2: Split into two groups on $X$, and cluster the two groups separately, and see if it's quite similar. If there's nothing going on the two halves shouldn't be expected to split all that much alike.

The points with dots were clustered differently from the "all in one set" cluster in the previous plot. I'll do some more later, but it seems like perhaps there really might be a horizontal "split" near that position.
I'm going to try a regressogram or Nadaraya-Watson estimator (both being local estimates of the regression function, $E(Y|x)$). I haven't generated either yet, but we'll see how they go. I'd probably exclude the very ends where there's little data.
3) Edit: Here's the regressogram, for bins of width 0.1 (excluding the very ends, as I suggested earlier):

This is entirely consistent with the original impression I had of the plot; it doesn't prove my reasoning was correct, but my conclusions arrived at the same result the regressogram does.
If what I saw in the plot - and the resulting reasoning - was spurious, I probably should not have succeeded at discerning $E(Y|x)$ like this.
(Next thing to try would be a Nadayara-Watson estimator. Then I might see how it goes under resampling if I have time.)
4) Later edit:
Nadarya-Watson, Gaussian kernel, bandwidth 0.15:

Again, this is surprisingly consistent with my initial impression. Here's The NW estimators based on ten bootstrap resamples:

The broad pattern is there, though a couple of the resamples don't as clearly follow the description based on the whole of the data. We see that the case of the level of the left is less certain than on the right - the level of noise (partly from few observations, partly from the wide spread) is such that it's less easy to claim the mean is really higher at the left than at the center.
My overall impression is that I probably wasn't simply fooling myself, because the various aspects stand up moderately well to a variety of challenges (smoothing, transformation, splitting into subgroups, resampling) that would tend to obscure them if they were simply noise. On the other hand, the indications are that the effects, while broadly consistent with my initial impression, are relatively weak, and it may be too much to claim any real change in expectation moving from the left side to the center.
Comment: @Russ don't worry about the downvote, it really doesn't matter, outside of the fact that it signals there's something I should address. Much more important to get at why we disagree (to the extent that we do at all) than to worry about fake internet points. You have an objection worth discussing, and I'd gladly pay ten times that downvote to have even this brief discussion. I encourage you to downvote me every time you disagree, if you'll say why. That's my chance to learn something.
Comment: +1 I actually did a lot of this analysis but did not want to overly extend my answer with those results.  You have done a great job in presenting it in a clear, readable, and convincing form. One thing I did in addition was to regress (actually, smooth) x against y (despite the characterization of y as "dependent"): I think the result was helpful in assessing nonlinearity in the relationship in a way that is agnostic about whether y should be treated as one or two groups.
Comment: I questioned one answer, but this one I am confident in saying it is finding stuff that isn't there
Comment: I tried to reverse my down vote, but I guess I can't. Just because I really disagree with your answer doesn't necessarily mean it doesn't contribute to the discussion. I'm not sure how to use down-votes, and don't mean anything personal by it.p
Comment: @RussLenth you can undo a downvote (or upvote) by re-clicking the down vote. If you are unsure of where your votes are at the hovertext over the down (or up) arrow will let you know.
Comment: @RussLenth thanks for responding (I appreciate it). Is it the claim of bimodality in  $Y|x$ you're saying is not there? Everything else I say pretty much follows directly from that.
Comment: Well, I comment at greater length on whuber's answer. I just think this answer goes to even greater lengths to respond to patterns that are likely to be spurious. What I'm curious about is that it appears it could be a problem in a textbook, and I wonder if there is an answer in the back, or in the instructor's manual.
Comment: @Russ - This is not particularly specific about where my answer is actually flawed, but I've made my best guess -- my response grew too long, so I've moved it to the bottom of my answer.
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/16990/discussion-between-russ-lenth-and-glen-b).
Comment: What clustering algorithm did you use? I didn't even bother w/ k-means, hierarchical, or DEBSCAN, as I thought they wouldn't work w/ this type of cluster. I jumped straight to GMM.
Comment: @gung straight k-means with 2 groups, directly on Y (since that is the variable I said was "grouping")
Comment: Another +1 for the kernel-density and (ahem) clustering investigation into bimodality.
Answer: OK folks, I followed Alexis's lead and captured the data. Here is a plot of $\log y$ versus $x$.
And the correlations:
<code>> cor.test(~ x + y, data = data)

    Pearson's product-moment correlation

data:  x and y
t = -2.6311, df = 169, p-value = 0.009298
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.33836844 -0.04977867
sample estimates:
       cor
-0.1983692

> cor.test(~ x + log(y), data = data)

    Pearson's product-moment correlation

data:  x and log(y)
t = -2.8901, df = 169, p-value = 0.004356
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.35551268 -0.06920015
sample estimates:
       cor
-0.2170188
</code>
The correlation test does indicate a likely negative dependence. I remain unconvinced of any bimodality (but also unconvinced that it's absent).
[I removed a residual plot I had in an earlier version because I overlooked the point that @whuber was trying to predict $X|Y$.]
Comment: Incidentally... it just occurred to me that taking the log(Y) transformation as dependent is still equivalent to finding a non-linear relationship... the log(Y) is nicer wrt the residuals than the hinge function I played with in my answer... but one of the conclusions is similar: the relationship between $Y$ and $X$ has better functional expressions than $Y=a+bX$.
Comment: Thank you for that residual plot, Russ. This is not a request, but I would like to point out that what I found to be of interest--and perhaps of greater value for exploring GoF--was the relationship of **x** as a function of **y** rather than this way around. Looking at the *x* residuals prompts some additional (maybe useful) questions not heretofore raised, such as whether we could learn something through non-linear re-expressions of *x* (yes, we can); whether much can be said regardless of the two-population hypothesis (yes, again), and about the robustness of my fit (it is very robust).
Comment: Well, maybe you want to do the residual plot for that. I'm moving on to other stuff.
Answer: Russ Lenth wondered how the graph would look if the Y axis were logarithmic. Alexis scraped the data, so it is easy to plot on with a log axis:

On a log scale, there is no hint of bimodality or trend. Whether a log scale makes sense or not depends, of course, on the details of what the data represent. Similarly, whether it makes sense to think that the data represent sampling from two populations as whuber suggests depends on the details.

Addendum: Based on the comments below, here is a revised version:
Comment: This graphic presents an interesting example of the effect of a poor choice of visualization: by shrinking the aspect ratio and extending the y-axis more than twice as far as it need be, the software has automatically suppressed the visual impression of any vertical scatter, making it difficult for the viewer to see much of anything. This is why a good exploration, although guided by graphical representation, must (a) use suitable methods of visualization that *reveal*, rather than suppress, data behavior, and (b) support them with additional analyses (such as shown in @Glen_b's post).
Comment: I posted my graph within a few minutes of Russ Lenth posting his. I hadn't seen his, or I wouldn't have posted mine.
Comment: I find that in estimation the (straight up linear) regression results are stronger with log($Y$).
Comment: For the ranges of Y in the question, log base 2 would be a simpler choice to have a reasonable range of values for the Y axis. It would also prevent the upper range from the nice values of 1 and 1,000 which do not conform to the data at hand.
Answer: Well, you are right, the relationship is weak, but not zero. I would guess positive. However, don't guess, just run a simple linear regression (OLS regression) and find out! There you will get a slope of xxx which tells you what the relationship is. And yes, you do have outliers that might bias the results. That can be dealt with. You could use Cook's distance or create a leverage plot to estimate the outliers' effect on the relationship.
Good luck
Comment: @Alexis is correct in emphasizing that assumptions such as linearity must be justified, whether by domain theory or by model checking. However, I think the outright deletion of outliers *without carefully considering why such values occured* is a very common error in statistical analysis.
Comment: What makes you think that they're real outliers rather than the DGP being non-linear?
Comment: Well I suppose that might also be the case. But it's hard to tell, the dots are so scattered.
Comment: Why assume linearity with OLS? Nonparametric regression FTW! :)
Comment: Yes, outliers can't be deleted without a good justification, such as wrong value. But transformations can help adjust the distribution of value to a better fit, and reduce outliers. And yes I agree, I believe it is quite common do delete outliers without justifiable cause.
Comment: @Glen_b already linked to the .csv file in my answer (click "data").
Comment: @Alexis my apologies. I missed it.
Answer: You already provided some intuition to your question by looking at the orientation of the X/Y data points and their dispersion. In short you're correct.
In formal terms orientation can be referred to as correlation sign and dispersion as variance. These two links will give you more information on how to interpret the linear relationship between two variables.
Answer: This is a home work. So, the answer to your question is simple. Run a linear regression of Y on X, you'll get something like this:
<code>    Coefficient Standard Er t Stat
C   53.14404163 6.522516463 8.147781908
X   -44.8798926 16.80565866 -2.670522684
</code>
So, the t-statistics is significant on X variable at 99% confidence. Hence, you can declare the variables as having some kind of relationship.
Is it linear? Add a variable X2 = (X-mean(X))^2, and regress again.
<code>    Coefficient Stand Err   t Stat
C   53.46173893 6.58938281  8.11331508
X   -43.9503443 17.01532569 -2.582985779
X2  -44.601130  114.1461801 -0.390736951
</code>
The coefficient at X is still significant, but X2 is not. X2 represents nonlinearity. So, you declare that teh relationship appears to be linear.
The above was for a home work.
In real life, things are more complicated. Imagine, that this was the data on a class of students. Y - bench press in pounds, X - time in minutes of holding one's breath before the bench press. I'd ask for the gender of the students. Just for fun of it, let;s add another variable, Z, and let's say that Z=1 (girls) for all Y<60, and Z=0 (boys) when Y>=60. Run the regression with three variables:
<code>    Coefficient Stand Error t Stat
C   92.93031357 3.877092841 23.969071
X   -6.55246715 8.977138488 -0.72990599
X2  -43.6291362 59.06955097 -0.738606194
Z   -63.3231270 2.960160265 -21.39179009
</code>
What happened?! The "relationship" between X and Y has disappeared! Oh, it seems that the relationship was spurious due to confounding variable, gender.
What is the moral of the story? You need to know what is the data to "explain" the "relationship", or even to establish it in the first place. In this case, the moment I'm told that the data on students' physical activity, I'll immediately ask for their gender, and will not even bother analyzing the data without getting the gender variable.
On the other hand, if you're asked to "describe" the scatter plot, then anything goes. Correlations, linear fits etc. For your home work, first two steps above should be sufficient: look at coefficient of X (relationship), then X^2 (linearity). Make sure you de-mean the X variable (subtract the mean).


Install elementary OS

Question: Thank you for the beautiful work you guys have done with this OS, I'm having a problem, I followed all the steps on you site to try to install the USB I made when downloading the OS, I chose the 64 bit version and I tried to install it on a Acer AO1-431-C8G8 computer with Windows 10 pre installed, I tried to install a single boot overwriting Windows as I complete dislike Windows and I bought this computer with the sole purpose of turning into a Linux machine.
Can you please if possible send me a step by step instructions of the installation if possible, or could it be possible that when I made the USB I messed up something.
Comment: Did something go wrong with the installation? If so, what was the error message?
Answer: The setup is very simple and easy
Anyway, here's how to install it
This is the first screen you'll get

-Click "Install elementary"
-"Continue"
-Check "Erase disk and install elementary" then press "Install now"
-"Continue"
-Choose your location then "Continue"
-Choose your keyboard layout then press "Continue"
-Set your username and password then "Continue"
-It gonna take few minutes installing and you'll be ready to go
-Have a nice day
Answer: So, you didn't even start installing it? If so, you should create a bootable USB (using Rufus, for example), then reboot your computer, and select your USB as a boot device. From there, elementary OS will boot, and you should follow the instructions on the installer to install it.

Install elementary OS


Expected value of general diffusion

Question: lets take measurable $b,\sigma:\mathbb{R}^+\times \mathbb{R}\to\mathbb{R}$ and consider the SDE
$$dX_t=b(t,X_t)dt+\sigma(t,X_t)dB_t$$
with $X_0=x$. How can i use Itô's Lemma to show
$$E_x[X_t-x]=t\cdot b(t,x)+o(t)\\
E_x[(X_t-x)^2]=t\cdot\sigma^2(t,x)+o(t)$$
as $t\downarrow 0$?
Answer: Write $X_t-x=\int_0^t b(s,X_s) ds + \int_0^t \sigma(s,X_s) dB_s$, now the first fact can be obtained by using the fundamental theorem of calculus on the first term and then noting that the second term has exactly zero expectation even when $t$ is finite.
The second fact relies on some scaling arguments that are rooted in Ito's lemma, which essentially tell you that the three terms in the square scale as $t^2,t^{3/2}$ and $t^1$ as $t \to 0$, with the last (asymptotically largest) one being the square of the stochastic term. Then you actually calculate this expectation by using the Ito isometry, and then again use the fundamental theorem of calculus to get the small $t$ asymptotic.
Comment: Thanks so far, but i do not really understand why it is possible to apply the fund. thm of calc and how since $b$ ist just measurable.
Comment: If $b$ is just measurable then the result is not exactly true as stated since $b$ is not really defined pointwise. But the suitable generalization still follows from the Lebesgue FTC.
Comment: Okay, let's assume that $b$ is continuous. Then FTC says
$$E(X_t)=E\int_0^tb(s,X_s)ds=\int_0^t E(b(s,X_s))ds$$ so $\frac{d}{dt}E(X_t)=E(b(t,X_t))$. Then i stuck. Could you give me a hint?
Comment: Now differentiate at $t=0$ and take the first order Taylor approximant.
Comment: I get then via Taylor
$$EX_t-x=E(b(0,x))\cdot (t-0)+o(t)= t\cdot b(0,x)+o(t)$$.
This is not ... $b(t,x)$.... Did i do something completely wrong?
Comment: It should be $tb(0,x)$, similar for the variance.
Comment: (But then, $b(t,x)=b(0,x)+o(1)$ gives $tb(t,x)=tb(0,x)+o(t)$, so you can just absorb the difference into the $o(t)$ term if you want.)
Answer: Ciao,
I will just do explicitly the computation suggested by Ian.
So we have to prove that
$$
E[X_t-x] = tb(t,x) + o(t).
$$
Let's assume that $b(t,x)$ differentiable w.r.t. $t$ then:
$$
b(t,x) = b(0,x) + t \partial_tb(0,x) + o(t).
$$
and so:
$$
b(0,x)-b(t,x) = - t \partial_tb(0,x) + o(t).
$$
We are now ready for the straightforward computation:
\begin{align}
E[X_t-x] & = tE[b(0,x)] + o(t) \\
& = tE[b(t,x)] + tE[b(0,x)-b(t,x)] + o(t) \\
& = tE[b(t,x)] - t^2 \partial_tb(0,x) + to(t) + o(t) \\
& = tE[b(t,x)] + o(t)
\end{align}
Here we are.
Ciao

Expected value of general diffusion


What should be done when a passport wasn't stamped on arrival in the US?

Question: Recently, my wife and I entered the USA in Atlanta. We scanned our passport and visa, gave our fingerprints and had our photos taken at the kiosk. We received a receipt, which was given to an Immigration officer. He had us go through the Customs luggage check, after which our passports were returned to us.
Once we arrived home, we found that only one passport was stamped for admittance, one is not. What don't know whether this was just an oversight and we don't know what to do.
Do we need to return to the airport and have this corrected? If we don't do anything, will we have future problems exiting and re-entering the US?
Comment: If your [online I-94](https://i94.cbp.dhs.gov/I94/#/home) is correct, then I wouldn't worry too much. If your entry, however, has not been recorded, I would recommend going to the nearest CBP office to ensure correction of the record.
Comment: Are you still in the US? "Home" is a bit ambiguous.
Comment: If they received two receipts at the kiosk, it's recorded, on the receipts as well as in the computers.
Comment: What kind of visa do you have?
Answer: If any of you is a US citizen, that person needs no record of entry.
For foreigners, the entry should be electronically recorded and searcable on the I-94 Website. Thus, an entry stamp isn't really needed in practice these days, but if a foreigner doesn't get one, carrying a printout of the result page of the linked search, along with your passport, is a good idea in case you're stopped by the police, Immigration Enforcement or Border Patrol.
Comment: @Giorgio those systems, or at least some of them, also process VWP and B-visa visitors.
Comment: Much of what you say about "foreigners" is specific to non-residents. I am a foreigner, relative to the US, but use Global Entry kiosks and carry my green card in case I get stopped by the Border Patrol.
Comment: @Sam_Butler there is a law, seldom enforced but often invoked by Border Patrol to justify their demands that all aliens carry immigration documents, that says anyone who has been "registered and fingerprinted" must carry with them any "alien registration receipt" issued to them. Regulations define the creation of an electronic I-94 record as equivalent to issuing a registration receipt. It could be argued therefore, that you *should* "choose to conserve" those printouts, and if you don't get one, you should print one from the website. But in practice you're probably okay without one.
Comment: The info suggests that OP is a US resident which allows them to use the automated kiosk system, which documents their arrival.
Comment: I have Global Entry and don't usually get an entry stamp. Sometimes I've had an I-94 'receipt' print out, which I can choose to conserve, but the record is properly held by CBP and can be requested either through their website or by applying to them under Freedom of Information laws.


How to estimate I2C bus capacitance?

Question: In my current project, I need a microcontroller to retrieve the temperature of 60 temperature sensors which are located on the same PCB with distances not exceeding 50 cm. The temperature sensor's reference is MAX30205. It communicates using I2C and offers 32 different I2C addresses.
I was thinking of using three I2C buses (which is the maximum with my microcontroller), and putting 20 sensors in each bus.
I do not have big contrains regarding the bus clock, as I will only need to get the temperature of sensors from time to time, so we can suppose I will use I2C in its standard mode (speed = 100 kHz).
The MAX30205 will be supplied at 3 V, meaning that the minimum possible pull-up resistors value is 1 kohm (because I2C spec dictates a maximum current of 3 mA on SCL and on SDA). Given the number of sensors, I will choose R as small as possible, so maybe around 1.1 kohm.
The MAX30205 has an input capacitance of 3 pF, and the microcontroller has an input capacitance of 5 pF, meaning each bus will have at least a bus capacitance of 103 pF. The maximum capacitance for standard mode I2C is 400 pF. There is a remaining bus capacitance due to PCB and traces.
Is it possible to estimate it ? Can it be close to 300 pF ?
Do you think I need an I2C buffer ?
Answer: TI's application report Effect of Parasitic Capacitance in Op Amp Circuits says:

Circuit traces on a PCB with a ground and power plane will be about 1−3 pF/in.

100 in ≈ 2.5 m

If you still have doubts about the rise times, consider using an I²C accelerator like the LTC1694, or a buffer like the TCA9803.

How to estimate I2C bus capacitance?


How does echo parse $100?

Question: I'm learning echo command:
$ echo $100
00
$ echo $1

$

so why does echo parse $1 as undefined variable and print following zeros but not $100 as a whole? I'm using Ubuntu 14.04.
Answer: The positional parameters, $1, $2, ..., $9, contain the command line arguments passed to the current shell or shell function.  The string $100 will be interpreted as $1 followed by two zeroes. This will be 00 if $1 is unset or empty.
Setting the three first positional parameters explicitly in a script and testing it:
set -- a b c

echo "$100 $200 $300"

This results in the output
a00 b00 c00

Since the positional parameters beyond 9 need to be accessed with e.g. ${10}, there is no ambiguity between $1 followed by 00 and "positional parameter 10 or 100" (since there are no brackets).
If you had wanted to print the literal string $100, then you would have to either escape the $ from the shell, or use single quotes:
echo \$100
echo '$100'

Comment: `bash(1)` is clear on this: "A positional parameter is a parameter denoted by one or more digits, other than the single digit 0.  Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the set builtin command.   Positional  parameters may not be assigned to with assignment statements.  The positional parameters are temporarily replaced when a shell function is executed (see FUNCTIONS below). When a positional parameter consisting of more than a single digit is expanded, it must be enclosed in braces (see EXPANSION below)."

How does echo parse $100?


Creating a custom RPC url for metamask communication?

Question: Where can I find the spec of the RPC api's of a EVM compatible URL? I wanted to create a custom RPC url that will work with metamask and other compatible eth wallets. But I need to know what does metamask and other wallets look for when they connect to a custom RPC node like polygon, avalanche, fantom, smart chain, etc...
Comment: The URL always stays the same, its a JSON RPC API.
Answer: Ethereum provides RPC JSON standard which are implemented by all the ethreum VM based clients like eth/geth and partity.
The RPC API standard can be found at below git repository.
execution-apis
To use it you need to build and then refer to openrpc.json file.
Alternatively you can also visit Ethereum-RPC-APIs that provides HTTP version for the same.
Metamask and other wallet applications call these APIs to fulfil their requirements. Client nodes expose the URL for RPC API requests. This url is provided to wallet applications using add network[in metamask] functionality.
Wallet applications connect on that port and issue standard RPCs which gets honoured by the client node.
Answer: @NitBit's answer covers what JSON-RPC methods all Ethereum clients are expected to support, but I suspect it doesn't completely address the question because the initial wording of "custom RPC url" highlights to me there's a misunderstanding about what exactly a "RPC url" does.
RPC Background
RPC is used when talking about JSON-RPC, a way to design APIs to be used. While REST APIs are standard in web applications, Ethereum, and other blockchains have chosen JSON-RPC, mainly because the APIs serve different needs. REST stands for Representational State Transfer, where batches of data (resources) can be associated with methods (GET/POST/DELETE). RPC stands "Remote Procedure Call", and its goal is to tell a system to run a routine as if it was being executed on the machine directly. The JSON just clarifies that the data is transmitted using JSON.
The URL that accepts Ethereum RPC commands, (eventually) points to some machine running an Ethereum client, and the same is true for any other EVM compatible chain that you can use MetaMask with. This means that at the end of the day, that URL is always pointing back to some blockchain node. What non-Ethereum EVM compatible chains do is simply copy the Ethereum RPC standard and then process that RPC method in their blockchain clients to do what needs to be done.
MetaMask and URLs
At its core, MetaMask never "checks" if that RPC URL can properly serve Ethereum RPC, it just assumes it does, and will fail otherwise. Under the hood, MetaMask relies on "ethers", a JavaScript library for building RPC calls to given RPC providers from contract ABIs. "ethers" is normally initialized from a URL; one method is to run your own private node and point "ethers" to that local node; another is to look for a public URL.
In the vast majority of cases, it doesn't make sense to expose your node to public RPC traffic, since it costs money to run, and you see no financial gain from doing so. Additionally, a single node can only support so much traffic. "Custom" public RPC endpoints you see for chains that aren't Ethereum, or "Custom" private RPC endpoints in the case of Infura/Alchemy are actually pointing to a server hosted by someone who is running a large number of nodes, and will use that server to route your RPC request to a node that can respond to it.


What is the maximum size of a comment to a post on Facebook?

Question: How many characters can a comment to a post have on Facebook? Note that I'm not referring to a status update or a root post in a group but to the comments.
Answer: Great question, though there doesn't appear to be any definitive answer. I think @1kenthomas 's answer is better than the accepted one, as there was (presumably) an attempt to obtain empirical evidence.
So, I've done a series of manual tests as of a few minutes ago, and the result was exactly 7,897 characters was the limit. Even one character more causes Facebook to reject it.
Comment: On closer inspection, it appears that when editing comments this limit is not enforced, so if you simply edit the comment you can type as much as you want! `:D`
Comment: Haha! Brilliant - added to the manual test above and it seems work. Great hack! :)
Comment: THANK YOU, @Magicode!  Your "edit" trick worked for my 8,137 character reply comment!
Answer: At the moment (07/11/2015) the limit is 8000 bytes. Thus, if you have a single paragraph, with no non-ASCII characters, the limit is 8000 characters. Else, it depends on the characters you are using and the number of paragraphs and so forth.
I can't find an official source, but according to this website, the size of a Facebook comment is unlimited.
Comment: i often get an error when it's too long, and then manage to post the comment if i make it shorter. i doubt it's unlimited.
Comment: this answer is wrong
Answer: From some trial and error, the limit appears to (currently) be 8000.
However, this is not the number of characters, but rather the number of bytes it takes to represent the string in UTF-8. Also note that each line break counts as 2 bytes (presumably \r\n).
So if you have a string of just the character 'a' repeated, you'll be able to fit 8000 chars, if you have 1 line break you'll only fit 7999. If you want to support non-ASCII characters then you need to actually calculate the number of bytes (each character can take up to 4 bytes to store), so the actual number of characters you can fit will vary.
Comment: Is it your own calculations or do you have any officially link about this?
Comment: On top of that the amount of newlines is limited - you can have up to 100 newlines in your comment. It's something that I've found myself by manual testing, the API doesn't return a meaningful error in such case.
Comment: I couldn't find any official documentation for this, so I came to this conclusion myself through some trial and error.
Answer: This is response I got from Facebook API. So the limit is exactly 8,000 officially.
<code>{
        "message" : "An unknown error occurred",
        "type" : "OAuthException",
        "code" : 1,
        "error_subcode" : 1446011,
        "is_transient" : false,
        "error_user_title" : "Comment Text Too Long",
        "error_user_msg" : "Sorry, comments cannot be longer than 8,000 characters.",
        "fbtrace_id" : "Ap6K4QzrwsP"

}
</code>
Comment: There is one extra curly bracket or on bracket is missing?
Answer: I'm able to post about 1 page-- about just under 2000 characters.  3000 fails at the moment.


Code Generators or T4 Templates, are they really evil?

Question: I have heard people state that Code Generators and T4 templates should not be used. The logic behind that is that if you are generating code with a generator then there is a better more efficient way to build the code through generics and templating.
While I slightly agree with this statement above, I have not really found effective ways to build templates that can say for instance instantiate themselves. In otherwords I can never do :
return new T();

Additionally, if I want to generate code based on database values I have found that using Microsoft.SqlServer.Management.SMO in conjunction with T4 templates have been wonderful at generating mass amounts of code without having to copy / paste or use resharper.
Many of the problems I have found with Generics too is that to my shock there are a lot of developers who do not understand them. When I do examine generics for a solution, there are times where it gets complicated because C# states that you cannot do something that may seem logical in my mind.
What are your thoughts? Do you prefer to build a generator, or do you prefer to use generics? Also, how far can generics go? I know a decent amount about generics, but there are traps and pitfalls that I always run into that cause me to resort to a T4 template.
What is the more proper way to handle scenarios where you need a large amount of flexibility? Oh and as a bonus to this question, what are good resources on C# and Generics?
Comment: Generics and T4 templates have different purposes...
Comment: Commenting on my own post, Activator.CreateInstance(); solves this problem (KINDA)...
Answer: You can do new T(); if you do this
public class Meh<T>
  where T : new()
{
  public static T CreateOne()
  {
    return new T();
  }
}

As for code-generators.  I use one every day without any problems.  I'm using one right now in fact :-)
Generics solve one problem, code-generators solve another.  For example, creating a business model using a UML editor and then generating your classes with persistence code as I do all of the time using this tool couldn't be achieved with generics, because each persistent class is completely different.
As for a good source on generics.  The best has got to be Jon Skeet's book of course! :-)
Comment: I will have to check out Jon Skeet's book then. Yeah objects that persist cannot be generalized and tend to be large blocks of tedius code.
Answer: As the originator of T4, I've had to defend this question quite a few times as you can imagine :-)
My belief is that at its best code generation is a step on the way to producing equivalent value using reusable libraries.
As many others have said, the key concept to maintain DRY is never, ever changing generated code manually, but rather preserving your ability to regenerate when the source metadata changes or you find a bug in the code generator.  At that point the generated code has many of the characteristics of object code and you don't run into copy/paste type problems.
In general, it's much less effort to produce a parameterized code generator (especially with template-based systems) than it is to correctly engineer a high quality base library that gets the usage cost down to the same level, so it's a quick way to get value from consistency and remove repetition errors.
However, I still believe that the finished system would most often be improved  by having less total code.  If nothing else, its memory footprint would almost always be significantly smaller (although folks tend to think of generics as cost free in this regard, which they most certainly are not).
If you've realised some value using a code generator, then this often buys you some time or money or goodwill to invest in harvesting a library from the generated codebase.  You can then incrementally reengineer the code generator to target the new library and hopefully generate much less code.  Rinse and repeat.
One interesting counterpoint that has been made to me and that comes up in this thread is that rich, complex, parametric libraries are not the easiest thing in terms of learning curve, especially for those not deeply immersed in the platform.  Sticking with code generation onto simpler basic frameworks can produce verbose code, but it can often be quite simple and easy to read.
Of course, where you have a lot of variance and extremely rich parameterization in your generator, you might just be trading off complexity an your product for complexity in your templates.  This is an easy path to slide into and can make maintenance just as much of a headache - watch out for that.
Answer: Generating code isn't evil and it doesn't smell! The key is to generate the right code at the right time. I think T4 is great--I only use it occasionally, but when I do it is very helpful. To say, unconditionally, that generating code is bad is unconditionally crazy!
Answer: It seems to me code generators are fine as long as the code generation is part of your normal build process, rather than something you run once and then keep its output.  I add this caveat because if just use the code generator once and discard the data that created it, you're just automatically creating a massive DRY violation and maintenance headache; whereas generating the code every time effectively means that whatever you are using to do the generating is the real source code, and the generated files are just intermediate compile stages that you should mostly ignore.
Lex and yacc are classic examples of tools of allow you to specify functionality in an efficient manner and generate efficient code from it.  Trying to do their jobs by hand will lengthen your development time and probably produce less efficient and less readable code.  And while you could certainly incorporate something like lex and yacc directly into your code and do their jobs at run time instead of at compile time, that would certainly add considerable complexity to your code and slow it down.  If you actually need to change your specification at run time it might be worth it, but in most normal cases using lex/yacc to generate code for you at compile time is a big win.
Comment: Good answer and good point, yet philosophically if you could generate the code and enforce it to always be current then would it make a difference.
Comment: I gave you a vote but am probably not as high on yacc as you are.  I'm working on a [C++ code generator](http://webebenezer.net).
Answer: A good percentage of what is in Visual Studio 2010 would not be possible without code generation.  Entity Framework would not be possible. The simple act of dragging and dropping a control onto a form would not be possible, nor would Linq.  To say that code generation should not be used is strange as so many use it without even thinking about it.
Answer: Maybe it is a bit harsh, but for me code generation smells.
That code generation is used means that there are numerous underlying common principles which may be expressed in a "Don't repeat yourself" fashion. It may take a bit longer, but it is satisfying when you end up with classes that only contain the bits that really change, based on an infrastructure that contains the mechanics.
As to Generics...no I don't have too many issues with it. The only thing that currently doesn't work is saying that
List<Animal> a = new List<Animal>();
List<object> o = a;

But even that will be possible in the next version of C#.
Comment: No, that won't be possible in the next version of C#. Type parameter variance only will apply to interfaces and delegates.
Comment: Code Generation can smell, but writing soap classes from the wsdl by hand or creating classes from xsd's by hand is an unnecessary waste of time, especially if generated classes, especially from xsd's are some the few bits that do change.
Comment: DRY is important, I think that's why the question was on my mind. Although are you really repeating yourself if a generator is doing the repeating?
Answer: Code generation is for me a workaround for many problems found in language, frameworks, etc. They are not evil by themselves, I would say it is very very bad (i.e. evil) to release a language (C#) and framework which forces you to copy&paste (swap on properties, events triggering, lack of macros) or use magical numbers (wpf binding).
So, I cry, but I use them, because I have to.
Answer: I've used T4 for code generation and also Generics. Both are good, have their pros and cons, and are suited for different purposes.
In my case, I use T4 to generate Entities, DAL and BLL based on a database schema. However, DAL and BLL reference a mini-ORM I built, based on Generics and Reflection. So I think you can use them side by side, as long as you keep in control and keep it small and simple.
T4 generates static code, while Generics is dynamic. If you use Generics, you use Reflection which is said to be less performant than "hard-coded" solution. Of course you can cache reflection results.
Regarding "return new T();", I use Dynamic Methods like this:
public class ObjectCreateMethod
    {
    delegate object MethodInvoker();
    MethodInvoker methodHandler = null;

    public ObjectCreateMethod(Type type)
    {
        CreateMethod(type.GetConstructor(Type.EmptyTypes));
    }

    public ObjectCreateMethod(ConstructorInfo target)
    {
        CreateMethod(target);
    }

    void CreateMethod(ConstructorInfo target)
    {
        DynamicMethod dynamic = new DynamicMethod(string.Empty,
                    typeof(object),
                    new Type[0],
                    target.DeclaringType);
        ILGenerator il = dynamic.GetILGenerator();
        il.DeclareLocal(target.DeclaringType);
        il.Emit(OpCodes.Newobj, target);
        il.Emit(OpCodes.Stloc_0);
        il.Emit(OpCodes.Ldloc_0);
        il.Emit(OpCodes.Ret);

        methodHandler = (MethodInvoker)dynamic.CreateDelegate(typeof(MethodInvoker));
    }

    public object CreateInstance()
    {
        return methodHandler();
    }
}

Then, I call it like this:
ObjectCreateMethod _MetodoDinamico = new ObjectCreateMethod(info.PropertyType);
object _nuevaEntidad = _MetodoDinamico.CreateInstance();

Comment: Once the code is jitted you get the same performance as you would normally. There is no reflection there. At most you could call generics lazy as they will wait jitting the code till its really needed for a certain type.
Answer: More code means more complexity. More complexity means more places for bugs to hide, which means longer fix cycles, which in turn means higher costs throughout the project.
Whenever possible, I prefer to minimize the amount of code to provide equivalent functionality; ideally using dynamic (programmatic) approaches rather than code generation. Reflection, attributes, aspects and generics provide lots of options for a DRY strategy, leaving generation as a last resort.
Comment: Depends on the level of abstraction you are working/thinking at. Your compiler is also a code generator, but I suspect you are not kept up at night worrying about how much IL is being generated and how to keep the amount of IL minimized. High level code generation is the future for static languages.. every single product MS puts out now is using it
Answer: Generics and code generation are two different things. In some cases you could use generics instead of code generation and for those I believe you should. For the other cases code generation is a powerful tool.
For all the cases where you simply need to generate code based on some data input, code generation is the way to go. The most obvious, but by no means the only example is the forms editor in Visual Studio. Here the input is the designer data and the output is the code. In this case generics is really no help at all, but it is very nice that VS simply generates the code based on the GUI layout.
Answer: Code generators could be considered a code smell that indicate a flaw or lack of functionality in the target langauge.
For example, while it has been said here that "Objects that persist can not be generalized", it would be better to think of it as "Objects in C# that automatically persist their data can not be generalized in C#", because I surely can in Python through the use of various methods.
The Python approach could, however, be emulated in static languages through the use of operator[ ](method_name as string), which either returns a functor or a string, depending on requirements. Unfortunately that solution is not always applicable, and returning a functor can be inconvenient.
The point I am making is that code generators indicate a flaw in a chosen language that are addressed by providing a more convenient specialised syntax for the specific problem at hand.
Answer: quote:
I have not really found effective ways to build templates that can say for instance instantiate themselves. In otherwords I can never do :
return new T();
public abstract class MehBase<TSelf, TParam1, TParam2>
    where TSelf : MehBase<TSelf, TParam1, TParam2>, new()
{
    public static TSelf CreateOne()
    {
        return new TSelf();
    }
}

public class Meh<TParam1, TParam2> : MehBase<Meh<TParam1, TParam2>, TParam1, TParam2>
{
    public void Proof()
    {
        Meh<TParam1, TParam2> instanceOfSelf1 = Meh<TParam1, TParam2>.CreateOne();
        Meh<int, string> instanceOfSelf2 = Meh<int, string>.CreateOne();
    }
}

Answer: The copy/paste type of generated code (like ORMs make) can also be very useful...
You can create your database, and then having the ORM generate a copy of that database definition expressed in your favorite language.
The advantage comes when you change your original definition (the database), press compile and the ORM (if you have a good one) can re-generates your copy of the definition. Now all references to your database can be checked by the compilers type checker and your code will fail to compile when you're using tables or columns that do not exist anymore.
Think about this: If I call a method a few times in my code, am I not referring to the name I gave to this method originally? I keep repeating that name over and over... Language designers recognized this problem and came up with "Type-safety" as the solution. Not removing the copies (as DRY suggests we should do), but checking them for correctness instead.
The ORM generated code brings the same solution when referring to table and column names. Not removing the copies/references, but bringing the database definition into your (type-safe) language where you can refer to classes and properties instead. Together with the compilers type checking, this solves a similar problem in a similar way: Guarantee compile-time errors instead of runtime ones when you refer to outdated or misspelled tables (classes) or columns (properties).
Answer: Why does being able to copy/paste really, really fast, make it any more acceptable?
That's the only justification for code generation that I can see.
Even if the generator provides all the flexibility you need, you still have to learn how to use that flexibility - which is yet another layer of learning and testing required.
And even if it runs in zero time, it still bloats the code.
I rolled my own data access class.  It knows everything about connections, transactions, stored procedure parms, etc, etc, and I only had to write all the ADO.NET stuff once.
It's now been so long since I had to write (or even look at) anything with a connection object in it, that I'd be hard pressed to remember the syntax offhand.
Comment: Maybe you've only ever seen really stupid code generators?  I can't imagine anyone describing what lex and yacc do as being able to copy/paste really fast...
Comment: To answer you very first question: Because a bug in the generated code can be fixed in one place, regenerate done. With c&p one is out in the cold, since one has to track all the place where it was pasted, modified and buggified.
Comment: @Sol: Fair enough - I was over-generalising. I'm referring mostly to the kind of code that gets generated by ORMs
Comment: @David: Sure, I understand that.  I still prefer fixing a bug in one place, and _not_ having to replicate it in lots of places, even if the generator is quick and automatic.
Answer: Code generation, like generics, templates, and other such shortcuts, is a powerful tool. And as with most powerful tools, it amplifies the capaility of its user for good and for evil - they can't be separated.
So if you understand your code generator thoroughly, anticipate everything it will produce, and why, and intend it to do so for valid reasons, then have at it. But don't use it (or any of the other technique) to get you past a place where you're not to sure where you're headed, or how to get there.
Some people think that, if you get your current problem solved and some behavior implemented, you're golden. It's not always obvious how much cruft and opaqueness you leave in your trail for the next developer (which might be yourself.)


Sinking cue ball after the 8 ball in pool

Question: When I designate the pocket I'm putting the 8-ball and I am successful and then follow it in with the cue ball - do I still win?
Answer: According to Wikipedia, a player will win if

The opposing player commits any foul, including scratching the cue ball into a pocket, or knocking it off the table, in the course of a shot that pockets the 8 ball

Therefore, you would lose because you scratch the cue ball into the pocket while pocketing the 8 ball.
Wikipedia Link
Answer: In one shot pool, played with 2 1/4 inch balls on American type square pocketed pool table,  the rule is: re-spot the black and incoming player has ball in hand that to say "put anywhere on the table" with one shot only.
When playing European/UK/Australia/South Africa "2 shot pool" on basically a mini snooker table with a rounded shape to the pockets, often times played with reds and yellow balls,  the rule is: loss of game on any foul whilst potting the black ball.
Answer: IBA rules : loss of game

A shooter loses the game if he commits any of the following infractions:
...

Cue ball scratches or is a "jumped ball" while shooting the 8-ball.

UPA Tour rules : loss of game

7.2 Scratch
Pocketing the cue ball or driving it off the table is a ball in hand foul. Scratching on the 8-ball is not a loss of game as long as the 8-ball was not pocketed.

APA rules : loss of game

HOW TO WIN A GAME

8-Ball
...
e. Your opponent fouls the cue ball and pockets
the 8-ball.