text:
How do you calculate a logarithm?

How do you calculate a logarithm?

The power to which a base of 10 must be raised to obtain a number is called the common logarithm (log) of the number. The power to which the base e (e = 2.718281828…….)…CALCULATIONS INVOLVING LOGARITHMS.

Common Logarithm Natural Logarithm
log x/y = log x – log y ln x/y = ln x – ln y
log xy = y log x ln xy = y ln x

What is the common logarithm of 100?

The logarithm base 10 of a number. That is, the power of 10 necessary to equal a given number. The common logarithm of x is written log x. For example, log 100 is 2 since 102 = 100.

What is the logarithm value?

A logarithm is the power to which a number must be raised in order to get some other number (see Section 3 of this Math Review for more about exponents). For example, the base ten logarithm of 100 is 2, because ten raised to the power of two is 100: log 100 = 2. because. 102 = 100.

What is the difference between logarithm and algorithm?

An algorithm is usually a bunch of steps that you take in order to do something– often to find a particular answer. An algorithm is a finite procedure for producing a structure, object or solution to a mathematical problem A logarithm is an exponent.

What is a logarithm in simple terms?

logarithm, the exponent or power to which a base must be raised to yield a given number. For example, 23 = 8; therefore, 3 is the logarithm of 8 to base 2, or 3 = log2 8. In the same fashion, since 102 = 100, then 2 = log10 100.

What is an example of common logarithm?

A common logarithm has a fixed base of 10. Common logarithms are also known as decadic logarithm and decimal logarithm. If log N = x, then we can represent this logarithmic form in exponential form, i.e., 10 x = N. For example, the acidity and alkalinity of a substance are expressed in exponential.

What is the difference between common logarithm and natural logarithm?

The common logarithm has base 10, and is represented on the calculator as log(x). The natural logarithm has base e, a famous irrational number, and is represented on the calculator by ln(x). The natural and common logarithm can be found throughout Algebra and Calculus.

What are the 4 laws of logarithms?

Logarithm Rules or Log Rules

• There are four following math logarithm formulas: ● Product Rule Law:
• loga (MN) = loga M + loga N. ● Quotient Rule Law:
• loga (M/N) = loga M – loga N. ● Power Rule Law:
• IogaMn = n Ioga M. ● Change of base Rule Law:

What are the log rules?

The rules apply for any logarithm logbx, except that you have to replace any occurence of e with the new base b. The natural log was defined by equations (1) and (2)….Basic rules for logarithms.

Rule or special case Formula
Quotient ln(x/y)=ln(x)−ln(y)
Log of power ln(xy)=yln(x)
Log of e ln(e)=1
Log of one ln(1)=0

Is an algorithm a formula?

An algorithm is a formula as well as a procedure. Therefore conceptually a formula is a subset of an algorithm. Algorithms can be defined either in a procedure or a formula.


text:
# Irrational Numbers

Irrational Numbers
Go back to  'Numbers'

## Introduction:

Consider the Rational Line, that is, the set of all rational numbers plotted on a straight line. Are there any gaps in this line? Are there any points that have not been represented, or which have been left out? If we were traveling on this line, would we encounter holes, positions for which no corresponding rational numbers exist?

The answer is yes.

There do exist numbers that are not rational, which cannot be represented using integers and the four simple arithmetic operations. In other words, there are numbers that cannot be represented in the form of $$\frac{p}{q}$$ where  $${p}$$ and $${q}$$ are integers. These numbers are called Irrational Numbers.

Consider the following carefully:

1. There exist real, physical lengths that cannot be represented by rational numbers. This means that on the number line, there will be positions that cannot be assigned a rational number representation. Think about this in terms of geometry. For example, think about the rational number $$\frac{{14}}{{23}}$$. Geometrically speaking, take a unit length, divide it into 23 equal segments, and take 14 of those segments and put them together. The length you get will be $$\frac{{14}}{{23}}$$ of a unit length. However, not every length can be thought of this way. You can geometrically construct lengths to which no number of the form $$\frac{p}{q}$$ can be assigned. This is a very deep concept; take your time and reflect on it.
2. We have seen that between any two rational numbers, no matter how close, there will exist infinitely many rational numbers. However, there will be (infinitely many) gaps as well, as we have said already: the Rational Line is not continuous. It is full of gaps, and those gaps correspond to Irrational Numbers.

## What is an Irrational Number?

Irrational Numbers are the numbers that cannot be represented using integers in the $$\frac{p}{q}$$ form. The set of irrational numbers is denoted by $$\mathbb{I}$$

Some famous examples of irrational numbers are:

1. $$\sqrt 2$$ is an irrational number. The first few digits looks like this: $\sqrt 2 = 1.4142135623730950...(etc)$
2. $$\pi$$ is a famous irrational number. People have calculated Pi to over a quadrillion decimal places and still, there is no pattern. The first few digits look like this: $\pi = 3.14159265358979323...(etc)$
3. The number $$e$$ (Euler's Number) is another famous irrational number. People have also calculated $$e$$ to lots of decimal places without any pattern showing. The first few digits look like this: $e = 2.71828182845904523...(etc)$
4. The number $$\varphi$$ (Golden Ratio)  is an irrational number. The first few digits look like this: $\varphi = 1.61803398874989484820...(etc)$

Fun fact: In the ancient world, more than two thousand years ago, many mathematicians believed that every geometrical length can be represented using a rational number. In other words, it was believed that every number is rational, that is, every number has a $$\frac{p}{q}$$ representation. Rational numbers were believed to be sufficient to describe the universe. This view was held particularly strongly by members of the Pythagoras Brotherhood (the source of the Pythagoras Theorem). It, therefore, came as a strong shock to them when one of their own members discovered a number that could not be represented in the form $$\frac{p}{q}$$. He found that a valid geometrical length had no corresponding $$\frac{p}{q}$$ representation. This was such a shocking and unpleasant discovery for the Brotherhood that legend says that the discoverer of the number was thrown off a ship and drowned!

✍Note: The discoverer was Hippasus and the number we are talking about is $$\sqrt 2$$.

Consider a right-angled isosceles triangle, with the equal sides of length 1 unit. By the Pythagoras Theorem, the hypotenuse will be $$\sqrt 2$$:

For a long time, mathematicians struggled to find a rational representation of $$\sqrt 2$$, until it was shown (by an unfortunate Pythagorean) that it is not a rational number at all! Thus was discovered the first known irrational number.

✍Note: Square root of any prime number is an irrational number.

## Multiplying Irrational numbers:

Does the multiplication of two irrational numbers will give you a rational or an irrational number? Let's try to understand it better by taking an example:

• $$\pi \times \pi = {\pi ^2}$$ is irrational.
• $$\sqrt 2 \times \sqrt 2 = 2$$ is rational.

✍Note: Thus, the product of two irrational numbers can either be rational or irrational.

## Solved Example:

Example 1: Which of the following is not an irrational number?

$\sqrt 2 ,{\text{ }}\sqrt 3 ,{\text{ }}\sqrt 4 ,{\text{ }}\sqrt 5$

Solution: 4 is a perfect square,i.e., $$\sqrt 4 = 2$$ which is a rational number.

Also, we know that the square root of a prime number will be an irrational number. 2, 3 and 5 are prime numbers.

So, $$\sqrt 4$$ is the required answer.

Challenge: What can you say about the irrationality of circumference and area of a circle whose diameter is 6cm.

⚡Tip: $$\pi$$ is an irrational number.

## Important Topics

Numbers and Number Systems
Numbers and Number Systems
grade 9 | Questions Set 2
Numbers and Number Systems

format: plain


text:
# Parabolas

A quadratic function is a function that can be written in the form $f\left(x\right)=a{x}^{2}+bx+c$ where $a,b$, and $c$ are real numbers and $a\ne 0$. This form is called the standard form of a quadratic function.

The graph of the quadratic function is a U-shaped curve is called a parabola.

The graph of the equation $y={x}^{2}$, shown below, is a parabola. (Note that this is a quadratic function in standard form with $a=1$ and $b=c=0$.)

In the graph, the highest or lowest point of a parabola is the vertex. The vertex of the graph of $y={x}^{2}$ is $\left(0,0\right)$.

If $a>0$ in $f\left(x\right)=a{x}^{2}+bx+c$, the parabola opens upward. In this case the vertex is the minimum, or lowest point, of the parabola. A large positive value of $a$ makes a narrow parabola; a positive value of $a$ which is close to $0$ makes the parabola wide.

If $a<0$ in $f\left(x\right)=a{x}^{2}+bx+c$, the parabola opens downward. In this case the vertex is the maximum, or highest point, of the parabola. Again, a large negative value of $a$ makes the parabola narrow; a value close to zero makes it wide.

For an equation in standard form, the value of $c$ gives the $y$-intercept of the graph.

The line that passes through the vertex and divides the parabola into two symmetric parts is called the axis of symmetry.

The equation of the axis of symmetry for the graph of $y=a{x}^{2}+bx+c$, where $a\ne 0$, is $x=-\frac{b}{2a}$

In all the above graphs, the axis of symmetry is the $y$-axis, $x=0$. In the graphs below, the axis of symmetry is different (marked in red.) Note that $c$ still gives the $y$-intercept.

If you write a quadratic function like $x=f\left(y\right)=a{y}^{2}+by+c$, where $x$ is a function of $y$ (instead of a $y$ as a function of $x$), you get a parabola where the axis of symmetry is horizontal.

Note that in this case, $c$ is the $x$-intercept. If $a$ is positive, the graph opens to the right; if $a$ is negative, the graph opens to the left.

Example:

Write the equation of the axis of symmetry, and find the coordinates of the vertex of the parabola $y=-3{x}^{2}-6x+4$.

The equation of the axis of symmetry for the graph of $y=a{x}^{2}+bx+c$.

$x=-\frac{b}{2a}$

Substitute $-3$ for $a$ and $-5$ for $b$ in the equation of the axis of symmetry.

$\begin{array}{l}x=-\frac{-6}{2\left(-3\right)}\\ \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}=-1\end{array}$

So, the equation of the axis of symmetry is $x=-1$.

Since the equation of the axis of symmetry is $x=-1$ and the vertex lies on the axis, the $x$-coordinate of the vertex is $-1$.

To find the $y$-coordinate of the vertex, first substitute $-1$ for $x$ in the given equation.

$y=-3{\left(-1\right)}^{2}-6\left(-1\right)+4$

Simplify.

$\begin{array}{l}y=-3+6+4\\ \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}=7\end{array}$

Therefore, the coordinates of the vertex of the parabola is $\left(-1,7\right)$.


text:
When it comes to building solutions with AI you want to be smart. Don't just run in there and start using Tensorflow. There are many good solutions such as Clarifai out there that don't require a lot of work, but still produce superior results.

I learned that again and again when building various experiments for customers. One of the experiments I'm working on right now is a celebrity scanner. This is a fun demo that demonstrates the power of AI when it comes to recognizing faces in pictures.

The application allows you to take a picture with your webcam. It takes this picture and scans for similarities with famous celebrities.

It's quite easy to make this app. In this post I will show you how.

The goal for the celebrity scanner 3000 is to demonstrate how much fun AI can be. We combine the app with a poster that explains how a computer thinks.

It turns out its a pretty complicated topic, especially since image recognition requires a lot of code and training time to get right.

If you want to build something like a face recognition model yourself you will have to be prepared to train the model for hundreds of hours. Also it requires a deep knowledge of how a neural network works.

Now I can imagine that you don't have the time for that. And frankly for most applications you don't need to spend a lot of time to apply AI effectively.

With a tool like Clarifai you have face recognition within minutes rather than hundreds of hours. Clarifai is an online service that provides various image related AI models. You can invoke these models to do various things like:

• Recognize objects
• Tag photos
• Describe what is on the photo

The people over at Clarifai keep extending their service with models every week. It's quite amazing if you ask me.

For the celebrity scan 3000 I used the celebrity model that is currently in Beta.

To invoke the model I've written a small piece of Javascript code on my app:

let app = new Clarifai.App({
apiKey: 'some-api-key'
});

app.models.predict(modelIdentifier, {base64: pictureData}).then(function(response) {
let data = response.outputs[0].data;
let face = data
&& data.regions
&& data.regions[0].data
&& data.regions[0].data.face;

// Ah, we have a familiar face, let's grab the concepts
if(face) {
let possibleMatches = face.identity && face.identity.concepts;
let people = [];

for(let i = 0; i < Math.min(possibleMatches.length, 10); i++) {
let person = possibleMatches[i];

people.pushObject({
name: person.name,
score: person.value
});
}

return people;
}

return [];
}

Clarifai has a great Javascript programming model in the shape of a NPM package that you can install using npm i --save clarifai. You can use this in your web project using browserify, webpack or some other method.

Clarifai is a very generic image processing API, so the response is somewhat klunky. You have to travel down a few properties to get to the meat, but once you're there you get some pretty interesting results.

Getting the data for the picture

One problem though, I don't want people to upload a picture to my app I want them to take a picture with the webcam. For this I needed to build another piece of logic.

HTML5 has the media API that allows you to work with sound and video. It is however quite hard to use and not supported in all browsers. But as usual in Javascript there's a trick for that.

Some friendly people over at pitchly made a neat NPM package called pitchly-webcamjs that makes access to the webcam really simple.

So I wrote the following piece of code to access the webcam and grab a picture:

let webcam = window.webcam;
let videoElement = document.getElementById("my-picture");

webcam.init().then(function() {
videoElement.src = webcam.videoStream;
videoElement.play();
});

function captureImage() {
let canvas = document.createElement("canvas");

canvas.width = 640;
canvas.height = 480;

canvas.getContext("2d").drawImage(
videoElement, 0,0, canvas.width, canvas.height);

let imageData = canvas.toDataURL().replace(
/^data:image\/(png|jpg);base64,/, '');

return imageData;
}

The first few lines gain access to the video element to which I want to bind the live feed of the webcam.

To capture an image you need to execute the code within the captureImage function. This grabs the content of the video element and draws it on an invisible canvas.

The Clarifai API requires image data without the additional headers, so we strip them from the image that is generated through the hidden canvas element.

Combine the two elements, the clarifai API and the webcam integration and you have yourself a celebrity scanner.

Get the code

Interested in the code? Go grab it on Github: https://github.com/infosupport/celebscan


text:
## Elementary Algebra

$-7$
On the number line, starting at $-3$, move $4$ units to the $\text{ left }$ to end up at $-7$.


text:
#  and the multinomial

The binomial distribution that many of us are more familiar with is a special case of the multinomial distribution, which can have more than two outcomes to a "test".  is a common summary of how similar populations are on a genetic level and it is based on the concept of "missing heterozygosity". I was thinking of a way to illustrate the multinomial with the probabilities of genotypes under Hardy-Weinberg assumptions, an allele frequency, , and the degree of missing heterozygosity, .

Here is a small dataset to work with, counts of three genotypes of a SNP with two allelic states in a sample of 30 individuals.

• AA  4
• AT  10
• TT  16

We can go back to the binomial for a moment and estimate the allele frequency. If we ignore genotype (the association between alleles), there are 18 A's and 42 T's.

• A  18
• T  42

So 30% of the alleles are A alleles. With the binomial, the probability of the data  given an allele frequency  is

where  is the number of A alleles and  is the number of T alleles.

Plot this in R to visualize the probability of the data given the range of possible allele frequencies.

a=18
t=42
n=a+t
p <- seq(0,1,length=1000)
probx <- dbinom(a,n,p)
plot(p, probx, type='l',xlab="allele frequency", ylab="probability",
main="Binomial Probability")

We can find the maximum likelihood point by finding the partial derivative (slope) with respect to , setting it equal to zero, and solving for . First of all the binomial coefficient in the front is a constant so we can remove that for simplicity.

Let's define  as the sum of  and .

This makes intuitive sense. The best guess for the allele frequency is the number of times it is observed out of the total.

We can also integrate to get the area under the curve. The indefinite integral is

 is the ordinary hypergeometric function. First this has to be evaluated at  to put it on a scale where the area under the curve sums to one. For  and  this comes out to .

Evaluating

at the maximum likelihood point, , gives a cumulative probability of 0.4703, which is not far from 0.5, the median of the distribution. You can evaluate it online with this link to Wolfram Alpha:

https://www.wolframalpha.com/input/?i=(0.3%5E19*hypergeometric2f1(19,-42,20,0.3))%2F(19*1.7722*10%5E(-17))

Evaluating

at  for example gives a cumulative probability of 0.9991; so, more than 99% of the curve is below this point and we can say that  is significantly less than  given the data.

Okay, that was a warm up; now let's do this with the genotypes before adding in .

Going back to the original genotype dataset of 30 individuals.

• AA  4
• AT  10
• TT  16

The multinomial probability is

where  are the counts of each genotype in the sample and  is still the frequency of allele "A."

We can plot this along with the binomial curve for comparison with the following Mathematica code.

aa = 4;
at = 10;
tt = 16;
a = 2*aa + at;
t = 2*tt + at;
Plot[{Multinomial[aa, at, tt] (p^2)^aa (2 p (1 - p))^at ((1 - p)^2)^
tt, Binomial[(a + t), a] p^a (1 - p)^t}, {p, 0, 1} ,
PlotRange -> Full, PlotLegends -> {"Multinomial", "Binomial"},
AxesLabel -> {"p", "P(x)"}]

The curves are similar, they peak in the same place, but overall the multinomial curve has a lower probability than the binomial. This is because there is more information in the multinomial. Each set of the data for the binomial (allele counts) can correspond to a range of ways to divide the data into genotype counts. We can always reduce genotypes to number of alleles but we cannot do the reverse. So, a particular genotype outcome is less likely (a smaller part of all possible outcomes) than the corresponding allele count outcome.

Okay, now it gets a little more fun. We have a probability over a dimension of allele frequency of  from zero to one. Let's add another dimension of  but first let's think about what  means.  is the proportion of expected (according to Hardy-Weinberg) heterozygosity that is missing. The heterozygous genotypes don't just disappear. The alleles get reorganized into homozygous genotypes. The frequency of each allele in the heterozygotes is 1/2; so, each homozygous genotype is increased by an equal proportion, which is half of the heterozygotes that are missing. Thus, the frequency of each genotype expected given  and  is

This can be incorporated into the individual genotype probability components of the multinomial.

We can simply the frequency of each genotype terms by symbolizing then with corresponding  terms.

This is what the likelihood surface looks like over the range of  from zero to one and  from zero to one.

Here is the mathematica code used to make the plot.

a = 4;
h = 10;
t = 16;
Plot3D[Multinomial[a, h, t] (p^2 + f p (1 - p))^
a ((1 - f) 2 p (1 - p))^h ((1 - p)^2 + f p (1 - p))^t, {p, 0,
1}, {f, 0, 1}, PlotRange -> Full, AxesLabel -> {"p", "F", ""},
PlotPoints -> 100]

The curve at  corresponds to the multinomial curve above (in the plot comparing it to the binomial). We can also see that allowing positive values for  can result in higher likelihoods of the data. What do we actually expect  to be? The number of heterozygotes are 10 out of a sample of 30 genotypes, so the fraction of heterozygous genotypes is 0.333. The allele frequency is 0.3, so we expect  of the sample to be heterozygous. There is a  proportion of heterozygotes that are missing. This is  of the heterozygosity expected. So our point estimate of  is 0.207, or about 21% of the heterozygosity is missing. This appears to correspond to the top of the likelihood peak. Finally, notice that the peak is narrower in the  dimension than in the  dimension. There is more information in the dataset about the allele frequency than there is about the genotype frequencies. There is a larger sample, 60, of alleles than there are of genotypes, 30. So, the estimate of  is more refined than the estimate of .

The range of zero to one makes sense for . An allele frequency cannot be less than zero or greater than 1. Also,  cannot be more than one (all of the expected heterozygosity is missing), but it can be less than zero (negative  means there is an excess of heterozygosity). It looks like a large volume of the likely values of  and  given the data correspond to a negative . So,  is not significantly greater than zero (Hardy-Weinberg expectations) for this dataset. Let's extend the plot to encompass a range of negative values for .

...and something weird happened. There is a second likelihood peak with different values of  and  that actually has an even higher likelihood at its peak, but the parameter values are unreasonable (given what we can see in the dataset about the allele frequency and level of heterozygosity). The minimum possible  is negative one. If the entire sample were made up of heterozygotes then the allele frequency is one half, the proportion of heterozygotes expected would also be one half. This leads to a negative one half divided by one half or negative one. Extending the plot out to the full range looks even more pathological (I limited the scale and truncated the peak because it was so large).

Long story short it turns out that this is an artifact... If you closely inspect what is going on by spot checking a few points in the second peak you find that the expected number of the rarer homozygote is negative, which is impossible, and in the likelihood calculation this is raised to the fourth power, which makes it positive, etc. This is a good example of how unanticipated, and initially cryptic, errors can creep into a computational script. This is fixed by setting up an if statement to only evaluate the likelihood if the expected number of homozygotes are positive; otherwise the likelihood is zero, which is true. Here is the updated script and a plot.

a = 4;
h = 10;
t = 16;
Plot3D[Multinomial[a, h, t] If[
p^2 + f p (1 - p) >
0, (p^2 + f p (1 - p))^a ((1 - f) 2 p (1 - p))^
h ((1 - p)^2 + f p (1 - p))^t, 0], {p, 0, 1}, {f, -1, 1},
PlotRange -> Full, AxesLabel -> {"p", "F", ""}, PlotPoints -> 100]

Because  and  appear uncorrelated we can feel good about taking a slice of the likelihood surface through the maximum-likelihood value of  as a reasonable approximation of the (contour) likelihood surface of  in order to evaluate the range of possible parameter values.

This is not yet . We have been evaluating the missing heterozygosity of a single population sample. Heterozygosity can be reduced within a population by inbreeding effects where individuals do not mate randomly but tend to mate more often with closer relatives (selfing in plants is an extreme example). What was calculated above is .

Let's say we had another sample from a different population. So now we have our original population one

• AA 4
• AT 10
• TT 16

and population two.

• AA 10
• AT 14
• TT 6

Plotting the likelihood surfaces together.

a1 = 4;
h1 = 10;
t1 = 16;
a2 = 10;
h2 = 14;
t2 = 6;
Plot3D[{If[p^2 + f p (1 - p) > 0 && (1 - p)^2 + f p (1 - p) > 0,
Multinomial[a1, h1, t1] (p^2 + f p (1 - p))^
a1 ((1 - f) 2 p (1 - p))^h1 ((1 - p)^2 + f p (1 - p))^t1, 0],
If[p^2 + f p (1 - p) > 0 && (1 - p)^2 + f p (1 - p) > 0,
Multinomial[a2, h2, t2] (p^2 + f p (1 - p))^
a2 ((1 - f) 2 p (1 - p))^h2 ((1 - p)^2 + f p (1 - p))^t2, 0],
0.0005}, {p, 0, 1}, {f, -1, 1}, PlotRange -> Full,
AxesLabel -> {"p", "F", ""}, PlotPoints -> 100]

The second sample has a higher allele frequency and a value of  closer to zero (however, the two ranges of likely  values overlap and might not be considered significantly different). The second allele frequency is . With the two allele frequencies we can now calculate a point estimate of  between the population samples. The expected heterozygosity in sample 2 is . We already showed above that  and . The average allele frequency over both populations is  and the average subpopulation expected heterozygosity is . In a combined total sample, if there were population structure, the expected heterozygosity is . Therefore,

or about 7% of the expected heterozygosity is missing because of differences in allele frequencies between the populations. Why does this work? Any time there is a difference in allele frequency the average subpopulation expected heterozygosity will be lower than the combined expected heterozygosity. Why? Because the curve of heterozygosity over allele frequency space is a concave function; the average of two points will always be lower than the value of the function evaluated at that point.

 is the gap between  and , which is 7% of .

Before bringing this back together I need to introduce one more -statistic. This one is . It is the total missing heterozygosity due to both population structure and inbreeding effects. If we combine the two samples we get

• AA 14
• AT 24
• TT 22

The allele frequency  (the same as the average between the two samples) and the fraction of heterozygotes in the combined sample is  40%. We expect a heterozygosity of . So, .

 between populations is related to  and . If we know the latter two we can estimate the former.

Using an  and let's say an  we get

.

We can estimate  and  using the multinomial, which means we can also estimate . This is starting to get more complicated with lots of parameters to estimate from the data, two allele frequencies and two  statistics (if we have a single  over both populations, which seems biologically reasonable) or four parameters in total. A good way to explore higher dimensional parameter space is to use a Markov Chain in a Monte Carlo fashion (MCMC) with Metropolis-Hastings algorithm. I save the details of this method for a later post. For now let's write a "hill climbing" Monte Carlo script (Monte Carlo refers to guessing parameter values and hill climbing means that it moves to values that produce higher probabilities of the data). Here it is in R.

# data
pop1=c(4,10,16)
pop2=c(10,14,6)
popt = pop1 + pop2

# intialize variables
probbest = 0
p1best=0.5
p2best=0.5
fisbest=0
fitbest=0

# loop through some steps
for (i in 1:100000) {

tune = 1/i # narrows in as the run goes

# pick new parameter values and check to make
# sure they are not out of bounds
p1 = p1best + runif(1, min = -tune, max = tune)
if (p1<0) {p1=0} else if (p1>1) {p1=1}
p2 = p2best + runif(1, min = -tune, max = tune)
if (p2<0) {p2=0} else if (p2>1) {p2=1}
fis = fisbest + runif(1, min = -tune, max = tune)
if (fis< -1) {fis= -1} else if (fis>1) {fis=1}
fit = fitbest + runif(1, min = -tune, max = tune)
if (fit< -1) {fit= -1} else if (fit>1) {fit=1}
pt = (p1+p2)/2

# genotype probabilities
gp1=c(p1^2+fis*p1*(1-p1),2*p1*(1-p1)*(1-fis),(1-p1)^2+fis*p1*(1-p1))
gp2=c(p2^2+fis*p2*(1-p2),2*p2*(1-p2)*(1-fis),(1-p2)^2+fis*p2*(1-p2))
gpt=c(pt^2+fit*pt*(1-pt),2*pt*(1-pt)*(1-fit),(1-pt)^2+fit*pt*(1-pt))

# sample probabilities
if(p1^2+fis*p1*(1-p1)>0 & (1-p1)^2+fis*p1*(1-p1)>0) {
prob1<-dmultinom(pop1, , gp1)
} else {
prob1 = 0
}
if(p2^2+fis*p2*(1-p2)>0 & (1-p2)^2+fis*p2*(1-p2)>0) {
prob2<-dmultinom(pop2, , gp2)
} else {
prob2 = 0
}
if(pt^2+fit*pt*(1-pt)>0 & (1-pt)^2+fit*pt*(1-pt)>0) {
probt<-dmultinom(popt, , gpt)
} else {
probt = 0
}
# combined probabilities
prod = prob1 * prob2 * probt

# keep the best ones
if(prod>probbest){
p1best=p1
p2best=p2
fisbest=fis
fitbest=fit
probbest=prod
} else {
p1 = p1best
p2=p2best
fis = fisbest
fit = fitbest
}
pt = (p1+p2)/2

# calculate fst
fst = (fis-fit)/(fis-1)

# report results
print(c(p1,p2,fis,fit,fst))
}

Running this for 100,000 steps I got estimates of , , , , and ; not bad.

Okay, that's going to have to be it for this post. This could be extended to cases where the sample sizes are unequal, multiple loci ( is shared across loci but  is not), more than two alleles, more than two populations and hierarchical population groupings, and an MCMC script to estimate the probability distribution of , but I'll have to save that for later.


text:
# How do I calculate this double integral using a change of variables?

1. Dec 13, 2013

### mld993

The problem is as follows.

Calculate the double integral of cos ((x-y)/(x+y)) dA over R, where R is the triangle bounded by the points (0,0), (2,2), and (2 + pi, 2 - pi).

I understand that you have to set U = x-y and V = x+y. However, I am having a hard time finding the bounds on the integral because the slope of the lines isn't 1. I can't simply add x to the other side of each equation because of the 2+pi and 2-pi. Any help would be appreciated. Thanks!

2. Dec 13, 2013

### CAF123

It is a case of mapping the coordinates of the points in Cartesians to uv space. When x=y=0, what are u and v? When x=y=2, what are u and v? Similarly, for x,y=2±π. Once you have pairs (u,v), you can sketch the resulting region and then determine the bounds for u and v.


text:
# How do you use the rational root theorem to find the roots of f(x)=x^3+x^2-8x-6 ?

Mar 23, 2018

The zeros of $f \left(x\right)$ are $- 3$, $1 + \sqrt{3}$ and $1 - \sqrt{3}$

#### Explanation:

Given:

$f \left(x\right) = {x}^{3} + {x}^{2} - 8 x - 6$

The rational root theorem tells us that any rational zero of $f \left(x\right)$ is expressible in the form $\frac{p}{q}$ for integers $p , q$ with $p$ a divisor of the constant term $- 6$ and $q$ a divisor of the coefficient $1$ of the leading term.

That means that the only possible rational zeros are:

$\pm 1 , \pm 2 , \pm 3 , \pm 6$

Trying each of these in turn, we eventually find:

$f \left(- 3\right) = {\left(\textcolor{b l u e}{- 3}\right)}^{3} + {\left(\textcolor{b l u e}{- 3}\right)}^{2} - 8 \left(\textcolor{b l u e}{- 3}\right) - 6 = - 27 + 9 + 24 - 6 = 0$

So $x = - 3$ is a zero and $\left(x + 3\right)$ a factor:

${x}^{3} + {x}^{2} - 8 x - 6 = \left(x + 3\right) \left({x}^{2} - 2 x - 2\right)$

We can find the zeros of the remaining quadratic by completing the square and using the difference of squares identity:

${A}^{2} - {B}^{2} = \left(A - B\right) \left(A + B\right)$

with$A = \left(x - 1\right)$ and $B = \sqrt{3}$ as follows:

${x}^{2} - 2 x - 2 = {x}^{2} - 2 x + 1 - 3$

$\textcolor{w h i t e}{{x}^{2} - 2 x - 2} = {\left(x - 1\right)}^{2} - {\left(\sqrt{3}\right)}^{2}$

$\textcolor{w h i t e}{{x}^{2} - 2 x - 2} = \left(\left(x - 1\right) - \sqrt{3}\right) \left(\left(x - 1\right) + \sqrt{3}\right)$

$\textcolor{w h i t e}{{x}^{2} - 2 x - 2} = \left(x - 1 - \sqrt{3}\right) \left(x - 1 + \sqrt{3}\right)$

Hence the other two zeros are:

$x = 1 \pm \sqrt{3}$


text:
# Which hydrogen does the nucleophile attack in E2 reaction?

This reaction will be both an E2 and SN2, where the E2 will be major and the SN2 minor (If I have done it correctly). I was drawing out the mechanism as I noticed that I was making my nucleophile attack the wrong hydrogen, the one attached to the alpha-carbon. I know that the nucleophile is supposed to attack the hydrogen on the beta-carbons however how do I determine if the $MeO^-$ attacks the hydrogen on the second carbon to the left or to the right of the alpha-carbon? Or does it attack both and since the sturcture of the compound formed is the same either way, it doesn´t matter which hydrogen it removes?

Well done to narrow the options down to E2 and SN2 and recognize that E2 is likely favored over SN2.

As the comments suggest, in this case, it doesn't matter which one is deprotonated. The reason is that deprotonation at either beta-position gives the same product. If you are unsure, draw out both options.

In future similar examples, you may come across reactants with multiple possible reactive positions that are not equivalent. For example, consider 3-chlorohexane (instead of 3-chloropentane, as in the original problem). In this case, again there are two possible sites to be deprotonated (Ha and Hb). Looking at the two possible products, both are disubstituted alkenes, so they will be close in stability. There isn't much difference in the groups nearby Ha and Hb, so the kinetics of the deprotonation are probably similar. So which is the "correct" answer? In reality, both are correct. They may not be formed in exactly equal amounts, but they will probably both be formed in substantial amounts.

There are a couple of key lessons here for those studying organic chemistry:

1) Draw out all of the possible products that come from mechanisms that you think make sense. This might be lots of drawing! Nevertheless, it is much easier to realize the differences if everything is drawn out in front of you.

2) Organic chemistry is messy. Often times multiple mechanistic pathways will be viable and multiple products will form. Much of the creativity in organic chemistry is finding ways to ensure that only one mechanism can occur or one (desired) compound is formed as the major product.

• Re: "In reality, both are correct." I was taught small nucleophiles favor Satyzeff alkene, while bulky nucleophiles (like tert-butoxide) favor Hoffmann alkenes. So, how do you justify this statement? Thank you! – Gaurang Tandon Feb 16 '18 at 1:43
• @GaurangTandon in this case, which is which? They are both di-substituted. And to answer a question with a question, what does "favor" mean? Is the product distribution 100:0, 75:25, 51:49? Those all have a "major product" but they vary greatly in how much each is favored. – jerepierre Feb 16 '18 at 15:25
• "in this case, which is which?" i'd say the one on the right is the Saytzeff alkene, since it is more stable by an extra hyperconjugative structure; "what does "favor" mean?" Well I was just asking a question based on the knowledge I got at high school ^_^ I haven't done the experiments myself, so I really don't know what ratio it is exactly; but in this case the alkenes are so close in stability I guess you are right in that "both be formed in substantial amounts." – Gaurang Tandon Feb 16 '18 at 15:30


text:
## [Solved] Problem with HC

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Thorkal
Prole
Posts: 10
Joined: Tue Aug 06, 2019 4:42 pm

### [Solved] Problem with HC

Hi everyone,

I want to use HC (HardonCollider) to handle collision in my project.
I have a level class which contains entities (for now, a player and two platforms, that display their own sprite). This class also contains an instance of HC (it's a global variable) :

Code: Select all

world = HC.new(1)
each entity contains a shape variable that I instanciate that way :

Code: Select all

self.shape = world:rectangle(self:getRect())
and draws a line around it for debugging purpose :

Code: Select all

self.shape:draw('line')
I have a class that handles gravity, and more specifically a function applying it to my moving entities (so, for now, only the player) :

Code: Select all

function Gravity:apply(dt)
for k, entity in pairs(self.entities) do
if (entity.collisionType == 'dynamic') then
if not entity.isJumping then -- the object is led down only if is not accelerating upward
entity.yVelocity = entity.yVelocity + entity.weight * dt
end

if entity.yVelocity-entity.oldYVelocity > 2 then
entity.isGrounded = false
entity.lockJump = true
end

local goalX = entity.x + entity.xVelocity
local goalY = entity.y + entity.yVelocity
local candidates = world:collisions(entity.shape)

if #candidates == 0 then
entity.x = goalX
entity.y = goalY
entity.shape:moveTo(entity.x+entity.w/2, entity.y+entity.h/2)
else
for other in pairs(candidates) do
local collides, dx, dy = entity.shape:collidesWith(other)
if collides then
other:move(dx, dy)
entity.x = entity.x + entity.xVelocity
entity.y = entity.y + entity.yVelocity
end
end
end
end
end
end
So, my player and platforms are displayed and their shape is displayed with the line around them, and when my player moves, the shape follows it. When I run the program, as you can imagine, my player falls through the platform. That's pretty normal since I know that the code in the for loop on "candidates" is wrong. What's not normal to me is that the "candidates" variable is always empty, even when the player passes through the platform.

I don't understand how it works. I tried to look at the HC code and it seems to update its spatialhash only when a shape is created, and not when it's moved...

If anyone can help...
Last edited by Thorkal on Wed Aug 07, 2019 3:20 pm, edited 1 time in total.

Thorkal
Prole
Posts: 10
Joined: Tue Aug 06, 2019 4:42 pm

### Re: Problem with HC

Ok I resolved my problem, collisions are in fact detected, and there's no point in checking if #candidates > 0

### Who is online

Users browsing this forum: ivan and 3 guests


text:
Limited access

Consider the two blocks of unknown mass shown in the image. One block is sitting on a table connected by a rope over a pulley to another block hanging in the air.

Assuming frictional forces are negligible, which of the following is true concerning the acceleration, $a$, of the two block system when released?

A

$a = g$

B

$a < g$

C

$a > g$

D

There is not enough information to determine anything about the acceleration of the two block system.

Select an assignment template


text:
Just like scales are named sets of notes, so are chords. There are just fewer notes in a 'chord'-set than there are in a 'scale'-set. On this page I'll tell you about triads, which are three-note chords. Here are a few:

X:1 L:1/4 K:C "C"[CEG] "Dm"[DFA] "B♭"[_Bdf]|

On this page, I put the names of the chords above the note clusters, but this is not a requirement for a chord to be a chord1 -- it's only about the notes themselves. The first of these sets is a $C$-major, the second a $D$-minor, and the third a $B\flat$-major.

The system for naming these chords is similar again to naming scales. The chord names have two components: the root and the character.

$$\underbrace{\quad B\flat \quad}_{\text{root}}\quad \underbrace{\text{ minor}}_{\text{character}}$$

The character tells you which intervals you should add to the root to assemble the full chord. So, seeing the notation '$B\flat \text{minor}$', we know the root is a $b\flat$ and the character is minor. Now we need to know the set of intervals that belong to such a triad. Here they are for minor and major.

NameNotationIntervals
MajorNone${P1, M3, P5}$
Minorm$${P1, m3, P5} To assemble a B\flat \text{ minor} chord (B\flat_m, for short), we add all the intervals to the root:$$\begin{aligned} b\flat &+ P1 = &b\flat\\ b\flat &+ M3 = &d\\ b\flat &+ P5 = &f\\ \end{aligned}$$That's already it! It's pretty much exactly like assembling scales from their names. You can see in the table that major and minor triads differ by only one interval: the third. It's a major third for major chords and... You guessed it: a minor third for minor chords. The decision tree for recognizing the triads we know so far in the wild looks like this: graph TB; Start--M3-->M[Major]; Start--m3-->m[Minor]; There are more different triads. Here they are in a table with their names and intervals: NameNotationNotation exampleIntervals MajorNoneC$${P1, M3, P5}
Minor$m$$C_m$${P1, m3, P5}$
Diminished$\circ$$C^{\circ}$${P1, m3, d5}$
Augmented$+$$C^+$${P1, M3, A5}$

If you know about intervals from you may have noticed that I sneaked in two intervals that I did not mention previously! The diminished fifth ($d5$) and the augmented fifth ($A5$). Fortunately these are not so new after all -- the $d5$ is enharmonically the same as the tritone ($TT$) I did tell you about, and the $A5$ is enharmonically the same interval as a minor sixth ($m6$).2

Why do we write them this way then? Well, triads are actually defined not just as chords with three notes, but specifically as chords with exactly one root, one third and one fifth. So, in order to stick with this scheme, we shrink down a perfect fifth by one semitone into a diminished fifth ($d5$) for a diminished chord. Or we stretch the $P5$ out to an augmented fifth ($A5$).

For example: a set of notes like ${b\flat, c, a}$ with root $b\flat$ is not technically a triad, because it's built from the intervals ${P1, M2, M7}$. But ${b\flat, d, f\sharp}$ is a triad. Can you name the intervals that it consists of?

To wrap up this post, let's add the augmented and diminished triads to the decision tree of how triads can be identified.

graph TB; Start -- m3 --> md[Minor or diminished]; Start -- M3 --> MA[Major or augmented]; md -- d5 --> d[Diminished]; md -- P5 --> m[Minor]; MA -- P5 --> M[Major]; MA -- A5 --> A[Augmented];

I'll also add some extra examples of different triads. They are unordered by design. Play around with them. Maybe you can even identify some enharmonic anomalies here and there, like an $e\sharp$ that would otherwise be written as an $f$.

X:2 L:1/4 K:C %%stretchlast 1 "B♭m"[_B_df] | "D♯"[^DF^A] | "E♭"[_EG_B] | "Fo"[F_A_c] | "A+"[A^c^e] | "B"[B^d^f] | "Cm"[C_EG] | "D"[D^FA] | "Do"[DF_A] | "G"[GBd] | "Gm"[G_Bd] | "A"[A^ce] ||!

Footnotes

1

In styles of music that lean to the classical side you won't see chord names above the staff, whereas in jazz you'll only see chord names, and the notes that make up those chords won't be on the staff. It's a good idea to become comfortable with the mapping both ways.

2

Two notes, intervals, scales or chords are enharmonic equivalents if they have different names but have the exact same notes. Imagine a building. The ceiling of the first floor and the floor of the second floor are the same thing, but the naming is different depending on your point of view.


text:
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

To estimate if a certain vector of numbers will fit into memory, you can quite easily predict the memory usage based on the size of the vector. An integer vector will use 4 bytes per number, and a numeric vector 8 bytes (double precision float). The following function prints the estimated memory usage of a vector based on the size of the vector and the type of vector:

predict_data_size = function(numeric_size, number_type = "numeric") {
if(number_type == "integer") {
byte_per_number = 4
} else if(number_type == "numeric") {
byte_per_number = 8
} else {
stop(sprintf("Unknown number_type: %s", number_type))
}
estimate_size_in_bytes = (numeric_size * byte_per_number)
class(estimate_size_in_bytes) = "object_size"
print(estimate_size_in_bytes, units = "auto")
}

For example:

> predict_data_size(1518*1518, "numeric")
17.6 Mb
> predict_data_size(1518*1518, "integer")
8.8 Mb
>

To print the size of the vector in a nice format, I change the class of estimate_size_in_bytes to "object_size". In this way if I call print on the object, R will call print.object_size (see utils:::print.object_size for the source), which performs the formatting.

You can also use this function to estimate the size of matrices and multi-dimensional arrays, it is the total size which matters. Note that the R object (vector, matrix, array) will take a little more space if it uses metadata (e.g. dimnames), but for any decently sized object this is probably small compared to the size of the numbers.


text:
# Blog

## Trains and EEG

I had this blog post as a draft for nearly a year now… and finally here it is: In my last lab we moved buildings. Good scientists we are we did measurements to see if the system works as intended…

### The EEG Systems

• An active 64 electrode system from BrainProducts called ActiCap
• A passive 128 electrode system from ANT, a tmsi REFA-8 with actively shielded cables
• A passive 128 electrode system from ANT, eegosport with actively shielded cables

Disclaimer: All data shown here are from different subjects. Their individual alpha-peaks etc. will differ, we also switched methods a bit

### ActiCap

We measured 2 subjects with the 64 electrode system. When we checked the frequency spectrum we were very worried.

Besides the typical 50Hz artefact that we know, one can clearly see a $16 \frac{2}{3}$ Hz peak in the beta-band. The artefact is very strong and variable over time.

This can’t be right? So we recorded another subject, just to be sure. We also switched analysis methods a bit

Same thing!

Side remark: The ‘activeShield’ button did not improve the shielding (plots not shown, the support told us that the activeShield function is more thought for passive electrode systems, not our system).

### ANT/TMSI REFA-8

#### Single Amplifier (64 Electrodes)

We then measured a single subject with the ANT system with a single amplifier.

All looks fine here for now… On the second plot, we introduce the signal-to-noise (SNR) index, which is simply the current frequency-bin divided by neighbouring bins (the average of $n_{-12}$:$n_{-2}$ & $n_{+2}$:$n_{+12}$). This will enhance peaks in the spectrum. As we can see, we do not see any peaks anywhere, all is fine with 64 electrodes.

#### Two Amplifiers (128 Electrodes)

At first we thought, cool! ANT with active shielded cables is perfect, we will just not record with the brainproducts system. But ANT/tmsi allows to “chain” two amplifiers together to effectively get 127 electrodes. That is, the amplifiers share a ground electrode and a single electrode is bridged, so that the data can be referenced to a amplifier-common electrode. When we did this the following picture emerges:

The 16 Hz is back! :(. The electrode depicted in the spectrum plot is from the second amplifier. In the lower right panel we can see, especially in the second plot, that the second amplifier has a lot of 16Hz artefact but not so much in the first amplifier.

#### ANT eegosport

We much later received an ANT eegosport for testing purposes. Unfortunately for us (and ANT because we did not upgrade ;)), the artefact was also present with comparable strength. Here an interesting new phenomenon arised: when flipping the amplifiers upside down, the artefact switched from channel 1-32 to 33-64 or vice versa.

### Typical artefact behavior

The artefact was non-stationairy over time (sometimes its there, sometimes not, stronger, weaker …). Most often observed in the second amplifier, sometimes in the first. The artefact also was stronger (relatively) around the reference electrode. It does not depend on exact placement in room. We tried a lot of factors, at some point even wrapping things in foil – it did help a bit!

### What the hell is going on?

Turns out, the new building is quite close to train tracks. In Northern Germany most trains are powered electrically using overhead lines. Germany uses $16 \frac{2}{3}$ Hz to power these lines. So sometimes when a train comes along we have an artefact. Because we did not want to time our experiments to the train schedule (we a) thought about it, but the DeutscheBahn does not give away information when trains are coming and b) the artefact is not _always_ strong when a train comes, but only sometimes, also not train dependent – but who knows…)

### What can we do against it?

It took us the most part of the year (with lots of discussion with ANT & TMSI) to figure out, where exactly the artefact is induced into the signal.

### Our solution

• Keep the cables as close together as possible, all in one orientation. Because the ANT REFA system allows the ~10cm cable to go into various direction, the common-noise which influences these channels can be slightly different. If the electrical field / artefact is strong enough, this slight differences will show up in your data. Thus always keep all cable very similar. We now “comb” the connector cables
• Keep the cables parallel to the field-lines of the electrical field. I.e. don’t put your cables parallel to the elongated electrical source, this will induce stronger effects. We now lead the cables to the top, so inline with the electric field
• If you use a cascaded system, the reference-electrode that links the two systems, has to follow both strings of electrodes. I.e. you have to guide it along the connector. If you fail to do so, there will be stronger artefact in one than in the other amplifier (depending on how the cable lays relative to the artefact electrical field). We now take care of this.

Combining all these measures helped us enourmously to reduce the artefact in a stationairy setting. For mobile recordings this will be tougher.

### Debugging Lessons Learned

It took us a long time to figure out how to measure the artefact reliably and how to manipulate the system in order to study the artefact. Here are some lessons learned:

• A waterbucket+salt (=> a head without needing a human) is your friend. BUT: We tried this earlier and failed because the system was DC-maxing out (no signal in range). This was because we put in the whole ground electrode (which has a zink-connector) and not only the tip (AgCl). This gives very large DC offsets due to the zink contact and you cannot measure.
• Making turn around times super fast. This allows for more tests and easier replication of supposedly found effects. A online/live-script that shows us the current 16Hz power was very helpful here but took quite some programming to get smoothly.
• You need to show a lot of own initiative, support can help you, but not save you. This problem was very specific for us, a general solution did not exist
• If there is a non-stationairy noise source, it is very helpful to monitor the artefact with one amplifier while modifying things with the other amplifier. Only like that can you be sure that the artefact occured / your modification actually changed something (and you did not just measured in a low-artefact regime). An interesting phenomenon we saw, was that on one day after ~19.00 the artefact vanishes. We are not sure why this is the case, because trains were still running. The trains passing by do not produce a reliable effect in itself. We think this is because the power to the grid is turned on whenever a train is on the whole section, with a section being multiple kilometers long and possibly reaching into the trainstation (but we do not know this before).

### Methods

We detrended or highpass filtered the data at 1Hz. Welchs estimate does not like DC-drifts. We generally either bandpass filter the data, or use the pwelch algorithm. We also employed the TMSI matlab-toolbox and programmed a live-script to monitor the 16Hz activity while manipulating the EEG. We also used some normalization to compare the signal to its frequency-bin neighbours. This allows for relative noise effects that show up when re-referencing to a single electrode.

I uploaded the tmsi EEG live-script on github

I showed a student how I would improve a plot. The result is I think typical for what I would design. The details change for each paper and I do not have a specific “style” I wanted to emulate. I usually enjoy the before & after of other graphics, so here is mine:

PS: The data shown in the plots are preliminary

## Thesis Art: Maria Sokotushchenko

I was a supervisor for Maria Sokotushchenko’s Master’s Thesis.

In her thesis-art, I artistically visualized the brain’s surprise response to a unexpected stimulus change. This response is sorted by how fast subjects responded (late on top, fast in the bottom)

The idea of “thesis art” is to inspire discussion with persons who do not have an academic background or work in a different field. The thesis is hidden in the drawer, but the poster is out there at the wall for everyone to see. You can find all past thesis art pieces here

## Thesis Art: Edoardo Pinzuti

I was a co-supervisor for Edoardo Pinzuti’s Master’s Thesis. I finally came around to make this artwork with the text from his thesis.

He wrote an impressive matlab toolbox to analyze causality directions in time series based on Takens Theorem. The whole idea is about reconstructing embeddings of chaotic systems, with the Lorenz system (the one depicted in this artwork) being a simulation example in his thesis. Please find the DDIFTOOL toolbox here

The idea of “thesis art” is to inspire discussion with persons who do not have an academic background or work in a different field. The thesis is hidden in the drawer, but the poster is out there at the wall for everyone to see. You can find all past thesis art pieces here

## Thesis Art: Judith Schepers

I was a supervisor for Judith Scheper’s Bachelor’s Thesis.

In this thesis-art, I visualized the guided-bubble paradigm used in a recent publication in the Journal of Vision. Judith generalized the paradigm to more than five bubbles, therefore, many more bubbles are visible in the thesis-art.

The idea of “thesis art” is to inspire discussion with persons who do not have an academic background or work in a different field. The thesis is hidden in the drawer, but the poster is out there at the wall for everyone to see. You can find all past thesis art pieces here

## New Paper: The temporal dynamics of eye movements as an exploitation-exploration dilemma.

We just published a new paper in the Journal of Vision

The temporal dynamics of eye movements as an exploitation-exploration dilemma
Ehinger Kaufhold & König, 2018

The highlights:

• We put eye movements as a decision process between exploitating the current view and exploring more of the scene
• We use gaze-contingent eye-tracking to control the When and Where of eye movements
• We find large effects of how long a subject fixates on their reaction time to continue exploring
• We find large effects of the number of possible future target locations (Hick’s effect)

Check out the paper at the Journal of Vision
doi:10.1167/18.3.6

## Ubuntu 16+: Recover ctrl+alt+bksp to restart X server

Often when developing with psychotoolbox or psychopy/opensesame your program crashes. And I often then have a full-screen window open and cannot click somewhere else. I then try to Alt+Tab and execute “sca” (screen close all) into the matlab console, with often mixed success. Sometimes restarting the computer is the last option. Instead of restarting, a useful command in older ubuntu versions was: STRG + ALT + Backspace => restart X server (=> restart GUI).

In order to activate this again use:

setxkbmap -option terminate:ctrl_alt_bksp

PS: I wrote this blogpost because I looked up this thing multiple times – now I know where to look 😉

## Stretching the axes; visualizing non-linear linear regression

From time to time I explain concepts and ideas to my students.

## Background

Often this pops up in a statistical context, when one has a non-linear dependency between the to-be-predicted variable and the predictor-variables. By transforming the predictors, relationships can be made linear, i.e. a logarithmic (exponential, quadratic etc.) relationships can be modeled by a **linear** model.

## The idea

I have a very visual understanding on basis-functions / non-linear transformation of variables in terms of stretching / condensing the basis (the x-axis here). This can also be applied to the generalized linear model (here for logistic regression).

Imagine that the x-axis of a plot is made of some kind of elastic material, you can stretch and condense it. Of course you do not need to stretch every part equally, one example would be to stretch parts that are far away from zero, exponentially more than parts that are close to zero. If you would have an exponential relationship ($y = e^x$) then $y$ would now lie on a straight line.

## TLDR;

Imagine you have a non-linear relationship, by stretching the x-axis in accordance to that non-linear relationship, you will have a linear relationship.

## An exemplary non-linear relationship:

We want to do $y = b_0 + b_1x$ but obviously a linear line does not fit well. We can do something called polynomial expansion, i.e. add more predictors which are simple transformations of the predictor $x$. i.e. $y = b_0 + b_1x + b_2x^2 + b_3x^3$

The trick comes here: We can interpret the new $x^3$ basis function as a stretching of the x-axis. I.e. the further we move out on the x-axis, the longer we need to stretch the parts (exactly by x^3 times)

This can be shown also for other functions:

### Logarithmic

Note that the logarithm is not defined for negative numbers

Note how the stretching can be negative, i.e. the original negative values are stretching/transformed to positive values

## Using the trick on the y-axis

One can interprete **logistic regression** with the same trick:
$$g{-1}(y) = b_0 + b_1*x <=> y = g(b_0+b_1x)$$
with $g$, the logistic (logit) function and $g^{-1}$ the inverse logistic function (invlogit)
$$g^{-1} = \ln\frac{p}{1-p} <=> g = \frac{1}{1+e^{-x}}$$

Usually we would have some non-linear dependency on a probabilty of e.g. success. That means, with a low value of x, your success-chance are low. To model this kind of data, one can transform the y-axis using $g$ above.

## Working remote – X11 Forward, Putty, Windows, Gateway

Sometimes I need matlab/rstudio/spyder but with access to the university network. One way is to run matlab/rstudio/spyder on the university computers, but get the X (=Graphics) display on my local windows machine.

Because there is a gateway in between, I first need to tunnel the gateway to a university working computer, then use a second putty session to ssh right through the tunnel directly to the target computer.

These are the steps I need to do:

– Putty: ssh to gateway.university:22;  Go to SSH-Tunnel and put source-port: 2222 (this is your local port you gonna target the second session). destination: remote-pc-that-runs-matlab:22

– Putty again: ssh to localhost:2222 with X11 forward enabled and “xming” installed

and perfect (but sometimes slow) remote-X11-forwarding. For the future I want to check out rdb to remotely control the session. This could be a quite useful in many cases because my programs are usually running anyway 🙂

## [matlab] performance for-loops vs. vectorization vs. bsxfun

From time to time I explain my students certain concepts. To archive those and as an extended memory, I share them here. We also recently had some discussion on vectorization in our research group. e.g. in python and matlab. With the second link claiming for-loops in matlab are performing much better than before.

## Goal

Show that for-loops are still quite slow in matlab. Compare bsxfun against vectorized arithmetic expansion in matlab against bsxfun

## The contenders

• good old for-loop: Easy to understand, can be found everywhere, slow
• arithmetic expansion: medium difficulty, should be general used, fast
• bsxfun: somewhat difficult to understand, I use it regularily, fast (often)

## Comparisons

While demonstrating this to my student, I noticed that subsetting an array has interesting effects on the performance differences. The same is true for different array sizes. Therefore, I decided to systematically compare those.

I subtract one row from either a subset (first 50 rows, dashed line) or all rows of an [n x m] matrix with n= [100, 1000, 10 000] and m = [10, 100, 1000, 10 000]. Mean + SE

## Three take home messages:

• for loop is very slow
• vectorization is fastest for small first dimension, then equally fast as bsxfun
• bsxfun is fastest if one needs to subset a medium sized array (n x m >100 x 1000), but see update below!

## Update:

Prompted by Anne Urai, I redid the analysis with multiplication & devision. The pattern is the same. I did notice that allocating new matrices before doing the arithmetic expansion (vectorization) results in the same behaviour as bsxfun (but more lines of code)

A = data(ix,:);
B = data(1,:);
x = A./B;

## matlab code

tAll = [];
for dim1 = [100 1000 10000]
for dim2 = [10 100 1000 10000]
tStart = tic;
for subset = [0 1]
if subset
ix = 1:50;
else
ix = 1:dim1;
end
for run = 1:10
data = rand(dim1,dim2);

% for-loop
x = data;
tic
for k= 1:size(data,2)
x(ix,k) = data(ix,k)-data(1,k);
end
t = toc;
tAll = [tAll; table(dim1,dim2,subset,{'for-loop'},t)];
%vectorized
tic
x = data(ix,:)-data(1,:);
t = toc;
tAll = [tAll; table(dim1,dim2,subset,{'vectorization'},t)];
% bsxfun

tic
x= bsxfun(@minus,data(ix,:),data(1,:));
t = toc;
tAll = [tAll; table(dim1,dim2,subset,{'bsxfun'},t)];
end
end
fprintf('finished dim1=%i,dim2=%i - took me %.2fs\n',dim1,dim2,toc(tStart))
end
end

% Plotting using the awesome GRAMM-toolbox
% https://github.com/piermorel/gramm
figure
g = gramm('x',log10(tAll.dim2),'y',log10(tAll.t),'color',tAll.Var4,'linestyle',tAll.subset);
g.facet_grid([],tAll.dim1)
g.stat_summary()
g.set_names('x','log10(second dimension [n x *M*])','y','log10(time) [log10(s)]','column','first dimension [ *N* x m]','linestyle','subset 1:50?')
g.draw()

2 of 4
1234


text:
# How can I append associations with uneven elements? [duplicate]

My dataset is pretty simple so far:

Questions = Dataset[{
<|"Statement" -> "What is the capital of Switzerland?", "Answer" -> "Bern",
"Incorrect Answers" -> {"Zurich", "Berlin", "Vienna"}|>,
<|"Statement" -> "Who is the king of the jungle?", "Answer" -> "Lion",
"Incorrect Answers" -> {"Giraffe", "Mouse", "Monkey"}|>,
<|"Statement" -> "2+2?" , "Answer" -> "4", "Incorrect Answers" -> {"15", "13", "1e15"}|>}]

If I try the following, everything goes right:

NewQuestion1 = <|"Statement" -> "To be...", "Answer" -> "or not to be",
"Incorrect Answers" -> {"or to eat", "continued", "dummy"}|>;
Append[Questions, NewQuestion1]

Nevertheless, if I delete the dummy answer of the NewQuestion, it will not work:

NewQuestion2 = <|"Statement" -> "To be...", "Answer" -> "or not to be",
"Incorrect Answers" -> {"or to eat", "continued"}|>;
Append[Questions, NewQuestion2]

This issue seems weird since you can declare a data set with uneven lists from the beginning:

Questions = Dataset[{
<|"Statement" -> "What is the capital of Switzerland?",
"Incorrect Answers" -> {"Zurich", "Berlin", "Vienna"}|>,
<|"Statement" -> "Who is the king of the jungle?",
"Incorrect Answers" -> {"Giraffe", "Mouse", "Monkey"}|>,
<|"Statement" -> "2+2?" , "Answer" -> "4",
"Incorrect Answers" -> {"15", "13", "1e15"}|>,
<|"Statement" -> "To be...", "Answer" -> "or not to be",
"Incorrect Answers" -> {"or to eat", "continued"}|>
}]

Any suggestions on how to append NewQuestion2 and/or explanations of why this error is happening?

-

## marked as duplicate by RunnyKine, Mr.Wizard♦Jul 28 at 18:26

I read that question before posting mine and find it different since m_goldberg is trying to append an element of a different class (I must say that I found that quite interesting and certainly something for Mathematica to improve). Here the thing is that I want to append another list. –  Carlos Chida Jul 28 at 18:09
Insert[Questions, NewQuestion2, -1]. All credits to @m_goldberg in the linked Q&A. –  seismatica Jul 28 at 18:15
Super! Not as "elegant" as I am used to in Mathematica, but works perfectly. Thank you very much. –  Carlos Chida Jul 28 at 18:19
I voted for this being a duplicate. (Which, as a moderator, takes immediate effect.) The underlying problem appears to be the same, and the solutions are the same. Since your problem is resolved I don't see the need to keep this open longer. –  Mr.Wizard Jul 28 at 18:28
I enquire against since even though the solution is the same, the fact that I explained in the first comment here made it hard to get at the first sight that it could work. Moreover, we talking about undocumented functions and extending the its use. –  Carlos Chida Jul 28 at 18:38

Well, here is a workaround:

First, we load the package TypeSystem:

Needs["TypeSystem"]

Now we define the Dataset to expect any type:

Questions =
Dataset[{<|"Statement" -> "What is the capital of Switzerland?",
"Incorrect Answers" -> {"Zurich", "Berlin", "Vienna"}|>, <|
"Statement" -> "Who is the king of the jungle?",
"Incorrect Answers" -> {"Giraffe", "Mouse", "Monkey"}|>, <|
"Statement" -> "2+2?", "Answer" -> "4",
"Incorrect Answers" -> {"15", "13", "1e15"}|>},

Note the undocumented second argument of Dataset

We can now append with no problems:

NewQuestion2 = <|"Statement" -> "To be...", "Answer" -> "or not to be",
"Incorrect Answers" -> {"or to eat", "continued"}|>;

Then

Append[Questions, NewQuestion2]
`

-
Amazing, thanks. Do you also know why this happens? And do you know where does this second argument work? For instance if I used Join to add more columns, could I also specify there that they are AnyType? –  Carlos Chida Jul 28 at 18:33
@CarlosChida, I don't know for sure why it happens but think it's a bug. The second argument is undocumented and I don't know the details of its functionality. –  RunnyKine Jul 28 at 18:37


text:
# 3.2 Centripetal force  (Page 2/10)

 Page 2 / 10
$m\frac{{v}^{2}}{r}={\mu }_{\text{s}}\text{mg}\text{.}$

We solve this for ${\mu }_{\text{s}}$ , noting that mass cancels, and obtain

${\mu }_{\text{s}}=\frac{{v}^{2}}{\text{rg}}\text{.}$

Solution for (b)

Substituting the knowns,

${\mu }_{\text{s}}=\frac{\left(\text{25.0 m/s}{\right)}^{2}}{\left(\text{500 m}\right)\left(9\text{.}{\text{80 m/s}}^{2}\right)}=0\text{.}\text{13}\text{.}$

(Because coefficients of friction are approximate, the answer is given to only two digits.)

Discussion

We could also solve part (a) using the first expression in $\begin{array}{c}{F}_{\text{c}}=m\frac{{v}^{2}}{r}\\ {F}_{\text{c}}=\text{mr}{\omega }^{2}\end{array}\right\},$ because $m,$ $v,$ and $r$ are given. The coefficient of friction found in part (b) is much smaller than is typically found between tires and roads. The car will still negotiate the curve if the coefficient is greater than 0.13, because static friction is a responsive force, being able to assume a value less than but no more than ${\mu }_{\text{s}}N$ . A higher coefficient would also allow the car to negotiate the curve at a higher speed, but if the coefficient of friction is less, the safe speed would be less than 25 m/s. Note that mass cancels, implying that in this example, it does not matter how heavily loaded the car is to negotiate the turn. Mass cancels because friction is assumed proportional to the normal force, which in turn is proportional to mass. If the surface of the road were banked, the normal force would be less as will be discussed below.

Let us now consider banked curves , where the slope of the road helps you negotiate the curve. See [link] . The greater the angle $\theta$ , the faster you can take the curve. Race tracks for bikes as well as cars, for example, often have steeply banked curves. In an “ideally banked curve,” the angle $\theta$ is such that you can negotiate the curve at a certain speed without the aid of friction between the tires and the road. We will derive an expression for $\theta$ for an ideally banked curve and consider an example related to it.

For ideal banking    , the net external force equals the horizontal centripetal force in the absence of friction. The components of the normal force N in the horizontal and vertical directions must equal the centripetal force and the weight of the car, respectively. In cases in which forces are not parallel, it is most convenient to consider components along perpendicular axes—in this case, the vertical and horizontal directions.

[link] shows a free body diagram for a car on a frictionless banked curve. If the angle $\theta$ is ideal for the speed and radius, then the net external force will equal the necessary centripetal force. The only two external forces acting on the car are its weight $\mathbf{w}$ and the normal force of the road $\mathbf{N}$ . (A frictionless surface can only exert a force perpendicular to the surface—that is, a normal force.) These two forces must add to give a net external force that is horizontal toward the center of curvature and has magnitude ${\text{mv}}^{2}\text{/r}$ . Because this is the crucial force and it is horizontal, we use a coordinate system with vertical and horizontal axes. Only the normal force has a horizontal component, and so this must equal the centripetal force—that is,

find the 15th term of the geometric sequince whose first is 18 and last term of 387
I know this work
salma
The given of f(x=x-2. then what is the value of this f(3) 5f(x+1)
hmm well what is the answer
Abhi
how do they get the third part x = (32)5/4
can someone help me with some logarithmic and exponential equations.
20/(×-6^2)
Salomon
okay, so you have 6 raised to the power of 2. what is that part of your answer
I don't understand what the A with approx sign and the boxed x mean
it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared
Salomon
I'm not sure why it wrote it the other way
Salomon
I got X =-6
Salomon
ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6
oops. ignore that.
so you not have an equal sign anywhere in the original equation?
hmm
Abhi
is it a question of log
Abhi
🤔.
Abhi
I rally confuse this number And equations too I need exactly help
salma
But this is not salma it's Faiza live in lousvile Ky I garbage this so I am going collage with JCTC that the of the collage thank you my friends
salma
Commplementary angles
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
hii
Uday
hi
salma
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
a perfect square v²+2v+_
kkk nice
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
or infinite solutions?
Kim
The answer is neither. The function, 2 = 0 cannot exist. Hence, the function is undefined.
Al
y=10×
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
rolling four fair dice and getting an even number an all four dice
Kristine 2*2*2=8
Differences Between Laspeyres and Paasche Indices
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
how do you translate this in Algebraic Expressions
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
what's the easiest and fastest way to the synthesize AgNP?
China
Cied
types of nano material
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials and their applications of sensors.
what is nano technology
what is system testing?
preparation of nanomaterial
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
what is system testing
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
can nanotechnology change the direction of the face of the world
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!


text:
Definitions

# gravitation

[grav-i-tey-shuhn]
gravitation, the attractive force existing between any two particles of matter.

## The Law of Universal Gravitation

Since the gravitational force is experienced by all matter in the universe, from the largest galaxies down to the smallest particles, it is often called universal gravitation. (Based upon observations of distant supernovas around the turn of the 21st cent., a repulsive force, termed dark energy, that opposes the self-attraction of matter has been proposed to explain the accelerated expansion of the universe.) Sir Isaac Newton was the first to fully recognize that the force holding any object to the earth is the same as the force holding the moon, the planets, and other heavenly bodies in their orbits. According to Newton's law of universal gravitation, the force between any two bodies is directly proportional to the product of their masses (see mass) and inversely proportional to the square of the distance between them. The constant of proportionality in this law is known as the gravitational constant; it is usually represented by the symbol G and has the value 6.670 × 10-11 N-m2/kg2 in the meter-kilogram-second (mks) system of units. Very accurate early measurements of the value of G were made by Henry Cavendish.

The Relativistic Explanation of Gravitation

Newton's theory of gravitation was long able to explain all observable gravitational phenomena, from the falling of objects on the earth to the motions of the planets. However, as centuries passed, very slight discrepancies were observed between the predictions of Newtonian theory and actual events, most notably in the motions of the planet Mercury. The general theory of relativity proposed in 1916 by Albert Einstein explained these differences and provided a geometric explanation for gravitational phenomena, holding that matter causes a curvature of the space-time framework in its immediate neighborhood.

The Search for Gravity Waves

Tantalizing evidence for the existence of gravity waves, which are predicted by Einstein's general theory of relativity and would be analogous to electromagnetic waves, comes from astronomical observations of a binary pulsar designated 1913 + 16. The rate at which the two neutron stars in the binary rotate around each other is changing in a manner that is consistent with the emission of gravity waves. A hypothetical particle, given the name graviton, has been suggested as the mediator of the gravitational force; it is analogous to the photon, the particle embodying the quantum properties of electromagnetic waves (see quantum theory). The search for gravity waves continues with the building of large interferometers that would be sensitive enough to detect the faint waves directly (see interference). Millions of dollars have already been spent on the Laser Interferometer Gravitational Wave Observatory (LIGO), supported by the National Science Foundation, and work is beginning on the even more ambitious Laser Interferometer Space Antenna (LISA).

## The Force of Gravity

The term gravity is commonly used synonymously with gravitation, but in correct usage a definite distinction is made. Whereas gravitation is the attractive force acting to draw any bodies together, gravity indicates that force in operation between the earth and other bodies, i.e., the force acting to draw bodies toward the earth. The force tending to hold objects to the earth's surface depends not only on the earth's gravitational field but also on other factors, such as the earth's rotation. The measure of the force of gravity on a given body is the weight of that body; although the mass of a body does not vary with location, its weight does vary. It is found that at any given location, all objects are accelerated equally by the force of gravity, observed differences being due to differences in air resistance, etc. Thus, the acceleration due to gravity, symbolized as g, provides a convenient measure of the strength of the earth's gravitational field at different locations. The value of g varies from about 9.832 meters per second per second (m/sec2) at the poles to about 9.780 m/sec2 at the equator. Its value generally decreases with increasing altitude. Because variations in the value of g are not large, for ordinary calculations a value of 9.8 m/sec2, or 32 ft/sec2, is commonly used.

## Bibliography

See A. S. Eddington, Space, Time and Gravitation (1920); J. A. Wheeler, A Journey into Gravity and Spacetime (1990); M. Bartusiak, Einstein's Unfinished Symphony: Listening to the Sounds of Space-Time (2000).

Universal force of attraction that acts between all bodies that have mass. Though it is the weakest of the four known forces, it shapes the structure and evolution of stars, galaxies, and the entire universe. The laws of gravity describe the trajectories of bodies in the solar system and the motion of objects on Earth, where all bodies experience a downward gravitational force exerted by Earth's mass, the force experienced as weight. Isaac Newton was the first to develop a quantitative theory of gravitation, holding that the force of attraction between two bodies is proportional to the product of their masses and inversely proportional to the square of the distance between them. Albert Einstein proposed a whole new concept of gravitation, involving the four-dimensional continuum of space-time which is curved by the presence of matter. In his general theory of relativity, he showed that a body undergoing uniform acceleration is indistinguishable from one that is stationary in a gravitational field.

Statement that any particle of matter in the universe attracts any other with a force (math.F) that is proportional to the product of their masses (math.m1 and math.m2) and inversely proportional to the square of the distance (math.R) between them. In symbols: math.F = math.G(math.m1math.m2)/math.R2, where math.G is the gravitational constant. Isaac Newton put forth the law in 1687 and used it to explain the observed motions of the planets and their moons, which had been reduced to mathematical form by Johannes Kepler early in the 17th century.

Gravitation is a natural phenomenon by which objects with mass attract one another. In everyday life, gravitation is most commonly thought of as the agency which lends weight to objects with mass. Gravitation compels dispersed matter to coalesce, thus it accounts for the very existence of the Earth, the Sun, and most of the macroscopic objects in the universe.

Modern physics describes gravitation using the general theory of relativity. Newton's law of universal gravitation provides an excellent approximation for most calculations.

The terms gravitation and gravity are mostly interchangeable in everyday use, but a distinction may be made in scientific usage. "Gravitation" is a general term describing the phenomenon responsible for keeping the Earth and the other planets in their orbits around the Sun; for keeping the Moon in its orbit around the Earth, for the formation of tides; for convection (by which hot fluids rise); for heating the interiors of forming stars and planets to very high temperatures; and for various other phenomena that we observe. "Gravity", on the other hand, is described as the theoretical force responsible for the apparent attraction between a mass and the Earth. In general relativity, gravitation is defined as the curvature of spacetime which governs the motion of inertial objects.

## History of gravitational theory

### Early history

Efforts to understand gravity began in ancient times. Philosophers in ancient India explained the phenomenon from the 8th century BC. According to Kanada, founder of the Vaisheshika school, "Weight causes falling; it is imperceptible and known by inference.

In the 4th century BC, the Greek philosopher Aristotle believed that there was no effect without a cause, and therefore no motion without a force. He hypothesized that everything tried to move towards its proper place in the crystalline spheres of the heavens, and that physical bodies fell toward the center of the Earth in proportion to their weight.

Brahmagupta, in the Brahmasphuta Siddhanta (AD 628), responded to critics of the heliocentric system of Aryabhata (AD 476–550) stating that "all heavy things are attracted towards the center of the earth" and that "all heavy things fall down to the earth by a law of nature, for it is the nature of the earth to attract and to keep things, as it is the nature of water to flow, that of fire to burn, and that of wind to set in motion... The earth is the only low thing, and seeds always return to it, in whatever direction you may throw them away, and never rise upwards from the earth.

In the 9th century, the eldest Banū Mūsā brother, Muhammad ibn Musa, in his Astral Motion and The Force of Attraction, hypothesized that there was a force of attraction between heavenly bodies, foreshadowing Newton's law of universal gravitation. In the 1000s, the Persian scientist Ibn al-Haytham (Alhacen), in the Mizan al-Hikmah, discussed the theory of attraction between masses, and it seems that he was aware of the magnitude of acceleration due to gravity. In 1121, Al-Khazini, in The Book of the Balance of Wisdom, differentiated between force, mass, and weight, and theorized that gravity varies with the distance from the centre of the Earth, though he believed that the weight of heavy bodies increase as they are farther from the centre of the Earth. All these early attempts at trying to explain the force of gravity were philosophical in nature.

### Scientific revolution

Modern work on gravitational theory began with the work of Galileo Galilei in the late 16th century and early 17th century. In his famous (though probably apocryphal) experiment dropping balls from the Tower of Pisa, and later with careful measurements of balls rolling down inclines, Galileo showed that gravitation accelerates all objects at the same rate. This was a major departure from Aristotle's belief that heavier objects are accelerated faster. (Galileo correctly postulated air resistance as the reason that lighter objects may fall more slowly in an atmosphere.) Galileo's work set the stage for the formulation of Newton's theory of gravity.

### Newton's theory of gravitation

In 1687, English mathematician Sir Isaac Newton published Principia, which hypothesizes the inverse-square law of universal gravitation. In his own words, “I deduced that the forces which keep the planets in their orbs must be reciprocally as the squares of their distances from the centers about which they revolve; and thereby compared the force requisite to keep the Moon in her orb with the force of gravity at the surface of the Earth; and found them answer pretty nearly.” Forty-two years earlier Ismaël Bullialdus had proposed much the same theory.

Newton's theory enjoyed its greatest success when it was used to predict the existence of Neptune based on motions of Uranus that could not be accounted by the actions of the other planets. Calculations by John Couch Adams and Urbain Le Verrier both predicted the general position of the planet, and Le Verrier's calculations are what led Johann Gottfried Galle to the discovery of Neptune.

Ironically, it was another discrepancy in a planet's orbit that helped to point out flaws in Newton's theory. By the end of the 19th century, it was known that the orbit of Mercury showed slight perturbations that could not be accounted for entirely under Newton's theory, but all searches for another perturbing body (such as a planet orbiting the Sun even closer than Mercury) had been fruitless. The issue was resolved in 1915 by Albert Einstein's new General Theory of Relativity, which accounted for the small discrepancy in Mercury's orbit.

Although Newton's theory has been superseded, most modern non-relativistic gravitational calculations are still made using Newton's theory because it is a much simpler theory to work with than General Relativity, and gives sufficiently accurate results for most applications.

### General relativity

In general relativity, the effects of gravitation are ascribed to spacetime curvature instead of a force. The starting point for general relativity is the equivalence principle, which equates free fall with inertial motion and describes free-falling inertial objects as being accelerated relative to non-inertial observers on the ground. In Newtonian physics, however, no such acceleration can occur unless at least one of the objects is being operated on by a force.

Einstein proposed that spacetime is curved by matter, and that free-falling objects are moving along locally straight paths in curved spacetime. These straight lines are called geodesics. Like Newton's First Law, Einstein's theory stated that if there is a force applied to an object, it would deviate from the geodesics in spacetime. For example, we are no longer following the geodesics while standing because the mechanical resistance of the Earth exerts an upward force on us. Thus, we are non-inertial on the ground. This explains why moving along the geodesics in spacetime is considered inertial.

Einstein discovered the field equations of general relativity, which relate the presence of matter and the curvature of spacetime and are named after him. The Einstein field equations are a set of 10 simultaneous, non-linear, differential equations. The solutions of the field equations are the components of the metric tensor of spacetime. A metric tensor describes a geometry of spacetime. The geodesic paths for a spacetime are calculated from the metric tensor.

Notable solutions of the Einstein field equations include:

General relativity has enjoyed much success because of how its predictions of phenomena which are not called for by the theory of gravity have been regularly confirmed. For example:

### Gravity and quantum mechanics

Several decades after the discovery of general relativity it was realized that general relativity is incompatible with quantum mechanics. It is possible to describe gravity in the framework of quantum field theory like the other fundamental forces, such that the attractive force of gravity arises due to exchange of virtual gravitons, in the same way as the electromagnetic force arises from exchange of virtual photons. This reproduces general relativity in the classical limit. However, this approach fails at short distances of the order of the Planck length, where a more complete theory of quantum gravity (or a new approach to quantum mechanics) is required. Many believe the complete theory to be string theory, or more currently M Theory.

## Specifics

### Earth's gravity

Every planetary body (including the Earth) is surrounded by its own gravitational field, which exerts an attractive force on all objects. Assuming a spherically symmetrical planet (a reasonable approximation), the strength of this field at any given point is proportional to the planetary body's mass and inversely proportional to the square of the distance from the center of the body.

The strength of the gravitational field is numerically equal to the acceleration of objects under its influence, and its value at the Earth's surface, denoted g, is approximately expressed below as the standard average.

g = 9.8 m/s2 = 32.2 ft/s2

This means that, ignoring air resistance, an object falling freely near the earth's surface increases its velocity with 9.8 m/s (32.2 ft/s or 22 mph) for each second of its descent. Thus, an object starting from rest will attain a velocity of 9.8 m/s (32.2 ft/s) after one second, 19.6 m/s (64.4 ft/s) after two seconds, and so on, adding 9.8 m/s (32.2 ft/s) to each resulting velocity.

According to Newton's 3rd Law, the Earth itself experiences an equal and opposite force to that acting on the falling object, meaning that the Earth also accelerates towards the object. However, because the mass of the Earth is huge, the acceleration of the Earth by this same force is negligible, when measured relative to the system's center of mass.

### Equations for a falling body near the surface of the Earth

Under an assumption of constant gravity, Newton’s law of gravitation simplifies to F = mg, where m is the mass of the body and g is a constant vector with an average magnitude of 9.81 m/s². The acceleration due to gravity is equal to this g. An initially-stationary object which is allowed to fall freely under gravity drops a distance which is proportional to the square of the elapsed time. The image on the right, spanning half a second, was captured with a stroboscopic flash at 20 flashes per second. During the first 1/20th of a second the ball drops one unit of distance (here, a unit is about 12 mm); by 2/20ths it has dropped at total of 4 units; by 3/20ths, 9 units and so on.

Under the same constant gravity assumptions, the potential energy, Ep, of a body at height h is given by Ep = mgh (or Ep = Wh, with W meaning weight). This expression is valid only over small distances h from the surface of the Earth. Similarly, the expression $h = tfrac\left\{v^2\right\}\left\{2g\right\}$ for the maximum height reached by a vertically projected body with velocity v is useful for small heights and small initial velocities only. In case of large initial velocities we have to use the principle of conservation of energy to find the maximum height reached. This same expression can be solved for v to determine the velocity of an object dropped from a height h immediately before hitting the ground, $v=sqrt\left\{2gh\right\}$, assuming negligible air resistance.

### Gravity and astronomy

The discovery and application of Newton's law of gravity accounts for the detailed information we have about the planets in our solar system, the mass of the Sun, the distance to stars, quasars and even the theory of dark matter. Although we have not traveled to all the planets nor to the Sun, we know their masses. These masses are obtained by applying the laws of gravity to the measured characteristics of the orbit. In space an object maintains its orbit because of the force of gravity acting upon it. Planets orbit stars, stars orbit galactic centers, galaxies orbit a center of mass in clusters, and clusters orbit in superclusters. The force of gravity is proportional to the mass of an object and inversely proportional to the square of the distance between the objects.

In general relativity, gravitational radiation is generated in situations where the curvature of spacetime is oscillating, such as is the case with co-orbiting objects. The gravitational radiation emitted by the solar system is far too small to measure. However, gravitational radiation has been indirectly observed as an energy loss over time in binary pulsar systems such as PSR 1913+16. It is believed that neutron star mergers and black hole formation may create detectable amounts of gravitational radiation. Gravitational radiation observatories such as LIGO have been created to study the problem. No confirmed detections have been made of this hypothetical radiation, but as the science behind LIGO is refined and as the instruments themselves are endowed with greater sensitivity over the next decade, this may change.

## Anomalies and discrepancies

There are some observations that are not adequately accounted for, which may point to the need for better theories of gravity or perhaps be explained in other ways.

• Stars in galaxies follow a distribution of velocities where stars on the outskirts are moving faster than they should according to the observed distributions of normal matter. Galaxies within galaxy clusters show a similar pattern. Dark matter, which interacts gravitationally but not electromagnetically, accounts for the discrepancy. Various modifications to Newtonian dynamics have also been proposed.
• The expansion of the universe seems to be speeding up. Dark energy has been proposed to explain this. A recent alternative explanation is that the geometry of space is not homogeneous (due to clusters of galaxies) and that when the data is reinterpreted to take this into account, the expansion is not speeding up after all.
• The Pioneer spacecraft seems to be slowing down in a way which has yet to be explained.
• Various spacecraft have experienced greater accelerations during slingshot maneuvers than expected.

## Notes

• Proposition 75, Theorem 35: p.956 - I.Bernard Cohen and Anne Whitman, translators: Isaac Newton, The Principia: Mathematical Principles of Natural Philosophy. Preceded by A Guide to Newton's Principia, by I. Bernard Cohen. University of California Press 1999 ISBN 0-520-08816-6 ISBN 0-520-08817-4
• Max Born (1924), Einstein's Theory of Relativity (The 1962 Dover edition, page 348 lists a table documenting the observed and calculated values for the precession of the perihelion of Mercury, Venus, and Earth.)

## References

• Halliday, David; Robert Resnick; Kenneth S. Krane (2001). Physics v. 1. New York: John Wiley & Sons. ISBN 0-471-32057-9.
• Serway, Raymond A.; Jewett, John W. (2004). Physics for Scientists and Engineers. 6th ed., Brooks/Cole. ISBN 0-534-40842-7.
• Tipler, Paul (2004). Physics for Scientists and Engineers: Mechanics, Oscillations and Waves, Thermodynamics. 5th ed., W. H. Freeman. ISBN 0-7167-0809-4.


text:
### Chain Rule & Integration by Substitution

Rich example

How does your answer to $\displaystyle{\int_a^b \sqrt{1-x^2} \, dx}$ relate to the following diagram?


text:
# How do you convert 2/5 to a percentage?

40%
You first need to convert $\frac{2}{5}$ to a decimal.
This makes $0.4$ (you can do this by dividing $2$ by 5).
To then convert this into a percentage, you multiply by 100. This thus gets you 40%.