# If a Power Series is known to converge at a point, what can we conclude?

If it is known that the series $$\sum_{n=1}^{\infty} a_nx^n$$ is convergent at $$x=4$$. What can we conclude about the series $$\sum_{n=1}^{\infty} a_n(-7)^n$$?

A. Convergent
B. Conditionally Convergent
C. Conditionally Convergent
D. Divergent
E. May be convergent or divergent

Is my logic right? Since we are told that the series is convergent at $$x=4$$, then this might be a point inside the convergence interval or one of the endpoints, however, we do not know. Hence, the series $$\sum_{n=1}^{\infty} a_n(-7)^n$$ might be convergent or divergent (option $$E$$ is right).

• E is correct. Your logic is essentially right; however, it would be good to illustrate that it can be convergent with an example, and divergent with an example in order to be totally sure. For divergent, consider $a_i = \frac{1}{(-7)^i}$. For convergent, consider $a_i = 0$. Aug 20, 2020 at 19:42
• @user62487108 A minor point is your option B and C are identical, so I assume it's a typo. Aug 20, 2020 at 21:15

You chose the right option, but you should explain why it may converge or diverge. For instance, both series $$\sum_{n=0}^\infty\frac{x^n}{5^n}$$ and $$\sum_{n=0}^\infty\frac{x^n}{8^n}$$ converge when $$x=4$$. However, the first one diverges when $$x=-7$$, whereas the second one converges.


# Understanding a probability question about order?

A couple is planning to have 3 children. Assuming that having a boy and having a girl are equally likely, and that the gender of one child has no influence on (or, is independent of) the gender of another, what is the probability that the couple will have exactly 2 girls?

Now here is my sample space $$S=\{(BBB),(BBG),(BGG),(GGG)\}$$ which would lead me to believe that the probability of $A$ the couple having exactly two girls is $$P(A)=\frac{1}{4}$$ which turns out to be incorrect.

Now they give the sample space as $$S=\{ (BBB), (BBG), (BGB), (GBB), (GGB), (GBG), (BGG), (GGG) \}.$$ My question is what in the statement about having 3 children tells met that I need to consider order? Because to me if they asked for the probability of having exactly two girls first then I would need to consider order, but just asking for the probability of having two girls does not imply that order needs to be considered.

• From your sample space, the probability is $\frac14$, IF the four events are equally likely. What are your reasons for believing this is the case? Feb 20, 2017 at 23:08
• @David now $P(G)=P(B)=\frac{1}{2}$ which implies $P((BBB))=\frac{1}{8}$ but $P((BBG))=P(BGB)=P(GBB)=P(B)P(B)P(G)=\frac{1}{8}$ therefore my sample space is incorrect because the possible outcomes have to be equally likely. Feb 20, 2017 at 23:24
• I think that you have more or less answered your own question with that comment, yes? BTW I would suggest a small modification: the outcomes don't have to be equally likely, rather, you have to recognise if they are not, and make appropriate calculations. (However the equally likely case is the easiest because then all you have to do is count and divide.) Feb 20, 2017 at 23:35

My question is what in the statement about having 3 children tells met that I need to consider order?

Because, you have three distinct children being borne with each birth equally likely to be either sex.

This clearly generates an ordered sequence of three independent choices with two options; often phrased as "Selection with repetition".

Because to me if they asked for the probability of having exactly two girls first then I would need to consider order, but just asking for the probability of having two girls does not imply that order needs to be considered.

That actually should clue you in that order affects the measure.   Because the probability of having two girls and a boy in no particular order must equal the sum of probabilities of having two girls and a boy in each of the three particular orders.

The reasoning would be that there is more than one way of having exactly two girls. Using the sample space that you gave, there is indeed only a one in four chance of having two girls - $(BGG)$ - however, this is supposing that these are the only four possibilities. Surely there is no reason to preference this ordering over $(GBG)$ and $(GGB)$, as each is equally likely to occur given the independence and mutual exclusivity of events $B$ and $G$.

Furthermore, $(GGG)$ and $(BBB)$ are the only possible ways of having exactly three girls or exactly three boys, so their probability of occurring is surely not the same as that of having exactly two girls as this can be done in three ways. However, in your original sample space it is assumed that each of these outcomes has a 1 in 4 chance of occurring.


1. ## Optimization Help!

The problem says...

The trough in the figure is to be made to the dimension shown. Only the angle delta can be varied. What value of delta will maximize the trough's volume. (I attached a picture)

Can someone please show me and explain to me how I would do a problem like this!

2. Originally Posted by KarlosK
The problem says...

The trough in the figure is to be made to the dimension shown. Only the angle theta can be varied. What value of theta will maximize the trough's volume. (I attached a picture)

Can someone please show me and explain to me how I would do a problem like this!
Hi Karlos,

The volume of the trough can be subdivided into the central cube
and the two outside pyramids.

To calculate volume, use

$V=(cross-sectional\ area)(length)$

hence you must express the trough's height "h" in terms of $\theta$

$cos\theta=\frac{h}{1}=h$

The cross-sectional area of the right and left triangles are

$\frac{1}{2}(h)(1)sin\theta=\frac{1}{2}cos\theta\ sin\theta$

Hence the volume of the trough is

$V=20cos\theta+20(2)\frac{1}{2}cos\theta\ sin\theta=20cos\theta(1+sin\theta)$

Theta giving max volume is found by differentiating this and setting it to zero, using the product rule of differentiation

$\frac{d}{d\theta}\left(20cos\theta(1+sin\theta)\ri ght)$

$20\left(cos\theta\ cos\theta+(1+sin\theta)(-sin\theta)\right)=0$

$\left(cos^2\theta-sin\theta-sin^2\theta\right)=0$

$1-sin^2\theta-sin\theta-sin^2\theta=0$

$2sin^2\theta+sin\theta-1=0$

$(2sin\theta-1)(sin\theta+1)=0$

For an acute angle use the first factor

$2sin\theta=1$

$sin\theta=\frac{1}{2}$

$\theta=sin^{-1}\frac{1}{2}=30^o$

3. Originally Posted by KarlosK
The problem says...

The trough in the figure is to be made to the dimension shown. Only the angle delta can be varied. What value of delta will maximize the trough's volume. (I attached a picture)

Can someone please show me and explain to me how I would do a problem like this!
basic trig w/ the two congruent right triangles on each side ...

trapezoid height = $\cos{\theta}$

top trapezoid base = $1 + 2\sin{\theta}$

cross-sectional area ...

$A = \frac{\cos{\theta}}{2}[(1+2\sin{\theta}) + 1]$

proceed to find the value of $\theta$ that will maximize the cross-sectional area, and hence, the volume.

4. Originally Posted by skeeter
basic trig w/ the two congruent right triangles on each side ...

trapezoid height = $\cos{\theta}$

top trapezoid base = $1 + 2\sin{\theta}$

cross-sectional area ...

$A = \frac{\cos{\theta}}{2}[(1+2\sin{\theta}) + 1]$

proceed to find the value of $\theta$ that will maximize the cross-sectional area, and hence, the volume.
Skeeter I have Area= cos(theta)+1/2sin2(theta) Is that incorrect? I attached how I came to that...

5. Originally Posted by Archie Meade
Hi Karlos,

The volume of the trough can be subdivided into the central cube
and the two outside pyramids.

To calculate volume, use

$V=(cross-sectonal\ area)(length)$

hence you must express the trough's height "h" in terms of $\theta$

$cos\theta=\frac{h}{1}=h$

The cross-sectional area of the right and left triangles are

$\frac{1}{2}(h)(1)sin\theta=\frac{1}{2}cos\theta\ sin\theta$

Hence the volume of the trough is

$V=20cos\theta+20(2)\frac{1}{2}cos\theta\ \sin\theta=20cos\theta(1+sin\theta)$

Theta giving max volume is found by differentiating this and setting it to zero, using the product rule of differentiation

$\frac{d}{d\theta}\left[20cos\theta(1+sin\theta)\right]$

$20[cos\theta\ cos\theta+(1+sin\theta)(-sin\theta)]=0$

$20\left(cos^2\theta-sin\theta-sin^2\theta\right)=0$

$1-sin^2\theta-sin\theta-sin^2\theta=0$

$2sin^2\theta+sin\theta-1=0$

$(2sin\theta-1)(sin\theta+1)=0$

For an acute angle use the first factor

$2sin\theta=1$

$sin\theta=\frac{1}{2}$

$\theta=sin^{-1}\frac{1}{2}=30^o$

How come you have sin^-1 instead of just sin at the end of this? Thanks for the help

6. $A = \frac{\cos{\theta}}{2}[(1+2\sin{\theta}) + 1]$

$A = \frac{\cos{\theta}}{2}[2+2\sin{\theta}]$

$A = \cos{\theta}(1 + \sin{\theta})$

7. Originally Posted by skeeter
$A = \frac{\cos{\theta}}{2}[(1+2\sin{\theta}) + 1]$

$A = \frac{\cos{\theta}}{2}[2+2\sin{\theta}]$

$A = \cos{\theta}(1 + \sin{\theta})$
So after I have the area what would I do? Differentiate it? Can you tell me what steps I need to complete and then I can try to solve it?

8. Originally Posted by KarlosK
So after I have the area what would I do? Differentiate it? Can you tell me what steps I need to complete and then I can try to solve it?
find $\frac{dA}{d\theta}$ and determine the value of $\theta$ that maximizes $A$.

9. Originally Posted by KarlosK
How come you have sin^-1 instead of just sin at the end of this? Thanks for the help
At the end, we have the sine of the angle..

$sin\theta=\frac{1}{2}$

the "inverse sine" retrieves the angle

$arcsin\left(\frac{1}{2}\right)=sin^{-1}\left(\frac{1}{2}\right)=30^o$

cross-sectional area $=cos\theta+\frac{1}{2}sin2\theta$

this is correct, as

$\frac{1}{2}sin2\theta=\frac{1}{2}2sin\theta\ cos\theta=sin\theta\ cos\theta$

Since the volume is 20 times the cross-sectional area,
you only need to differentiate the cross-sectional area and set the result to zero.
Then discover the value of theta that causes the derivative to be zero.

$\frac{d}{d\theta}\left[cos\theta(1+sin\theta)\right]=0$

Use the product rule as shown earlier

or

$\frac{d}{d\theta}\left(cos\theta+\frac{1}{2}sin2\t heta\right)=0$

,

,

,

,

,

# a trough is to be made with an end of the dimensions shown

Click on a term to search for related topics.


# How to find inverse of a composite function?

I am stuck with this question,

Let $A=B=C=\mathbb{R}$ and consider the functions $f\colon A\to B$ and $g\colon B\to C$ defined by $f(a)=2a+1$, $g(b)=b/3$. Verify Theorem 3(b): $(g\circ f)^{-1}=f^{-1}\circ g^{-1}.$

I have calculated $f^{-1}$, $g^{-1}$, and their composition, but how do I find the inverse of $(g\circ f)$?

Here is how I have done so far,

\begin{align*} \text{Let}\qquad\qquad b &= f(a)\\ a&= f^{-1}(b)\\ &{ }\\ b&=f(a)\\ b&=2a+1\\ \frac{b-1}{2} &= a\\ a &= \frac{b-1}{2} \end{align*} But $a=f^{-1}(b)$, $$f^{-1}(b) = \frac{b-1}{2}.$$

${}$

\begin{align*} \text{Let}\qquad\qquad a&=g(b)\\ b&= g^{-1}(a)\\ a&= g(b)\\ a &= b/3\\ b &= 3a\\ g^{-1}(a) &= 3a\qquad(\text{because }b=g^{-1}(a) \end{align*}

${}$

\begin{align*} f^{-1}\circ g^{-1} &= ?\\ &= f^{-1}\Bigl( g^{-1}(a)\Bigr)\\ &= f^{-1}(3a)\\ f^{-1}\circ g^{-1} &= \frac{3a-1}{2} \end{align*}

\begin{align*} g\circ f&= g\bigl(f(a)\bigr)\\ &= g(2a+1)\\ g\circ f &= \frac{2a+1}{3}\\ (g\circ f)^{-1} &= ?\\ \text{Let}\qquad\qquad &b=g\circ f \end{align*}

EDIT:

Thanks for the answers, I followed the suggestions and came up with the answer, Now I have two questions,

1. The answers do match but the arguments are different. Is that ok?
2. Is $(g\circ f)$ same as $(g\circ f(a))$?
-
$(g\circ f)$ is a function. $(g\circ f(a))$ is the value of the function $g\circ f$ at $a$. They are not the same thing (one is a function, the other is an number that you've written in parentheses). The name of the variable doesn't matter. The function $g(x)=x^2$ is the same as the function $g(z)=z^2$. – Arturo Magidin Aug 26 '11 at 16:46

$f,g$ are the functions defined in the question.

We have

$$\begin{eqnarray*} b &=&f(a)=2a+1, \end{eqnarray*}$$

or equivalently, by definition of the inverse function $f^{-1}$

$$\begin{eqnarray*} &a=\frac{b-1}{2}=f^{-1}(b).\tag{A} \end{eqnarray*}$$

Since

$$\begin{eqnarray*} c &=&g(b)=\frac{b}{3}, \end{eqnarray*}$$

or equivalently, by definition of the inverse function $g^{-1}$

$$\begin{eqnarray*} b=3c=g^{-1}(c),\tag{B} \end{eqnarray*}$$

after combining $(A)$ and $(B)$, we get

$$a=\frac{3c-1}{2}=(f^{-1}\circ g^{-1})(c).\tag{1}$$

On the other hand

$$c=(g\circ f)(a)=g(f(a))=g(2a+1)=\frac{2a+1}{3}.\tag{2}$$

Hence, by definition, the value at $c$ of the inverse function $(g\circ f)^{-1}$, is

$$a=\frac{3c-1}{2}=(g\circ f)^{-1}(c).\tag{3}$$

From $(1)$ and $(3)$ we conclude that for these functions $f,g$ and their inverses $f^{-1},g^{-1}$ the following identity holds:

$$(f^{-1}\circ g^{-1})(c)=(g\circ f)^{-1}(c).\tag{4}$$

Notation's note: $(f^{-1}\circ g^{-1})(c)=f^{-1}(g^{-1}(c))$.

-
Thanks a lot for such an effort. – Fahad Uddin Aug 26 '11 at 19:25
@fahad: You are welcome. – Américo Tavares Aug 26 '11 at 19:28
@AméricoTavares I usually draw the function in this way eevry time it helps me with composition of functions and when I "play" with algebraic structures but I was always scared to use them in order to explain my concepts in my questions to other people because I believed I was taking too much freedom with a notation that I only saw in cathegory theory, where your sets A,B and C are usually set with sturctures. So is correct to use these "diagrams" even outside the cathegory theory context? – MphLee Apr 20 '13 at 16:25
@MphLee I am not a mathematician and know nothing about cathegory theory, but these diagrams appeared in some books of Calculus/Real Analysis for Engineers back in 1060-1970's. – Américo Tavares Apr 20 '13 at 17:03
@AméricoTavares and I'm even less a mathematican I'll try to search more about this and I'll continue use these diagrams in my amatorial practice, thanks anyways – MphLee Apr 20 '13 at 17:44

You find the inverse of $g\circ f$ by using the fact that $(g\circ f)^{-1} = f^{-1} \circ g^{-1}$.

In other words, what gets done last gets undone first.

$f$ multiplies by 2 and then adds 1.

$g$ divides by 3.

Dividing by 3 is done last, so it's undone first.

The inverse first multiplies by 3, then undoes $f$.

Later note: Per the comment, to verify that $(g\circ f)^{-1} = f^{-1} \circ g^{-1}$:

Instead of confusingly writing $a = g(b)$, write $c=g(b)$. Then $c=b/3$, so $b=3c$, so $$g^{-1}(c) = 3c.$$ And $$f^{-1}(b) = \frac{b-1}{2}.$$

So $$b = 3c\qquad\text{and}\qquad a = \frac{b-1}{2}.$$ Put $3c$ where $b$ is and get $$a=\frac{3c-1}{2}.$$ You want to show that that's the same as what you'd get by finding $g(f(a))$ directly and then inverting.

So $c = g(f(a)) = \dfrac{f(a)}{3} = \dfrac{2a+1}{3}$.

So take $c = \dfrac{2a+1}{3}$ and solve it for $a$:

\begin{align} 3c & = 2a+1 \\ 3c - 1 & = 2a \\ \\ \frac{3c-1}{2} & = a. \end{align}

FINALLY, observe that you got the same thing both ways.

-
But the problem asks the student to verify the formula; that is, find the inverse of $g\circ f$ "directly", and then compare it to the function you get by computing $f^{-1}\circ g^{-1}$. Surely using the formula to verify that the formula works is a tad... unsatisfying. – Arturo Magidin Aug 26 '11 at 15:58
I am stuck with how do I find (gof)^-1 – Fahad Uddin Aug 26 '11 at 16:14
OK, I've added a later note. – Michael Hardy Aug 26 '11 at 16:18
@MichaelHardy thank you for this answer, it came in handy for a question I recently asked – seeker Dec 15 '13 at 13:01

What you've done so far is to compute $f^{-1}$ and $g^{-1}$, and $f^{-1}\circ g^{-1}$. Now you want to try to find $(g\circ f)^{-1}$ directly, and compare that to what you've computed (in order to verify the formula).

So, you've figured out that $(g\circ f)(a) = \frac{2a+1}{3}$. How do we figure out $(g\circ f)^{-1}$?

Exactly the same way we figure out the inverse of any function. If someone stopped you on the street, pointed a gun at you and said

"Here, I have this function: $$h(a) = \frac{2a+1}{3},$$ I need the formula for $h^{-1}$. Give it to me or I'll shoot you!"

then you don't need to know where that function came from, all you need to do is figure out the inverse: \begin{align*} b &= \frac{2a+1}{3}\\ 3b &= 2a+1\\ 3b-1 &= 2a\\ &\vdots \end{align*} etc. When you are done and have a formula for $h^{-1}(a) = (g\circ f)^{-1}(a)$, you can compare it to the formula you found for $f^{-1}\circ g^{-1}$ and verify that you got the same function.

-
Thanks alot. I did it as you suggested. A small problem that I am having is that is in terms of b instead of a. Checkout the edit. – Fahad Uddin Aug 26 '11 at 16:30
@fahad: Don't get hung up on the letters. The name of the variable is immaterial. The function $h(x) = x^2$ is exactly the same as the function $h(y)=y^2$, which is exactly the same as the function $h(z)=z^2$, which is exactly the same as the function $h(a)=a^2$. Just switch all the $b$s into $a$s and be done. – Arturo Magidin Aug 26 '11 at 16:36
Thanks alot for the answer :) – Fahad Uddin Aug 26 '11 at 19:15
I can't resist adding that the Russian mathematical physicist Igor Tamm was once told to do a mathematics calculation or be shot. :) – Mike Spivey Aug 26 '11 at 22:21


Solving modulus inequality $|x - 1| + |x - 6|\le11$ geometrically

Find all possible values of $x$ for which $x$ for which the inequality $$|x - 1| + |x - 6|\le11$$ is true.

I know this can be easily solved by taking $3$ cases for$x$ and then taking the intersection of those $3$ cases. The solution will be $-2\ge x\le9$.

But suppose if I interpret this in this way:

What number $x$ satisfy the condition that the distance between $x$ and $6$ plus the distance between $x$ and $1$ is less than or equal to $11$?

I would be better to get an idea to solve these types of problems by geometrically by intuition using number line.

• The geometric interpretation is a very good way of viewing the problem. Mar 12, 2016 at 6:41
• As $x$ moves between $(1,6)$, the sum of distances cannot change. Moving away from the interval the sum increases twice as fast as distance to both points increases. That's usually enough to solve this. Mar 12, 2016 at 6:50
• @Macavity I'm usable to visualize how will the sum change twice as fast when $x$ moves away from the interval $(1,6)$ ? Mar 12, 2016 at 7:05
• Outside the interval, $x$ is moving away from both points, so the distances naturally add. The interval has measure $5$ and the slack is $11-5=6$, so $x$ can move at best $3$ on either side of the interval. Mar 12, 2016 at 7:08
• One of the inequalities is pointing the wrong way where you write "The solution will be $-2\ge x\le9$." Mar 12, 2016 at 14:38

As you said, we are looking for points for which:

$$(\text{distance to 1})+(\text{distance to 6})\leq 11.$$ The first thing which now comes to my mind is an ellipse.

We first consider all $x\in \mathbb C$ for which $\vert x-1\vert +\vert x-6\vert \leq 11$. All points of this "filled" ellipse which lie on the real axis are the ones we want.

It is not very hard to imagine what these point will be. If we are on the real line then our furthest left point, $x_\ell$, will lie left of $1$. So the distance to $6$ will be at least five. So we have $$\vert x_\ell-1\vert+\vert x_\ell -6\vert=2\vert x_\ell-1\vert+5=11.$$ And since $x_\ell$ is to the left of $1$ this means that $x_\ell=-2$. Analogously, we find that $x_r=9$.

So we have found that $-2\leq x\leq 9$, through geometrical methods.

$$|1-x| + |x-6| \le 11$$

Let $A, X, B \in \mathbb R^n$ (Euclidean $n$-space). If $X\in \overline{AB}$ ( $X$ is on the line segment $\overline{AB}$ ), we say that $X$ is between $A$ and $B$, and we write this as $A-X-B$.

$$A-X-B \; \text{ if and only if } \; \|A-X\| + \|X-B\| = \|A-B\|$$

On $\mathbb R^1$ (the real number line), every point is on the line through points $1$ and $6$. So there are three possibilities for $1, x$, and $6$ : $x-1-6$, $1-x-6$, or $1-6-x$.

CASE: $x-1-6$

Then $x \le 1 \le 6$

\begin{align} |1-x| + |x-6| &\le 11 \\ (1-x) + (6-x) &\le 11\\ -2x &\le 4\\ x &\ge -2\\ x &\in [-2,1] \end{align}

CASE: $1-x-6$

Then $1 \le x \le 6$ and $|1-x| + |x-6| = |1-6| = 5$

\begin{align} |1-x| + |x-6| &\le 11 \\ 5 &\le 11 \\ x &\in [1,6] \end{align}

CASE: $1-6-x$

Then $1 \le 6 \le x$

\begin{align} |1-x| + |x-6| &\le 11 \\ (x-1) + (x-6) &\le 11 \\ 2x &\le 18\\ x &\le 9\\ x &\in [6,9] \end{align}

So $x \in [-2,9]$

• A nit-picker would say: "You did not formally consider the cases $x=1$ and $x=6$." Mar 12, 2016 at 10:51

$$y=|x-1|+|x-6|; y=11$$ $$x \in [x_1;x_2] =[-2;9]$$


A correlation coefficient is a numerical measure of the. If the correlation between two variables is close to 0.01, then there is a very weak linear relation between them. Therefore, correlations are typically written with two key numbers: r = and p =. We will: give a definition of the correlation $$r$$, discuss the calculation of $$r$$, explain how to interpret the value of $$r$$, and; talk about some of the properties of $$r$$. The direction of the correlation is determined by sign of the correlation coefficient ‘r’, whether the correlation is positive or negative. 10 Recommendations. measures the strength and direction of linear association between two numerical variables; greek letter p (rho) represents correlation between X and Y in the population; r represents the correlation between X and Y in a sample taken from the population The value of r is always between +1 and –1. X and Y. Pearson's correlation coefficient, when applied to a sample, is commonly represented by and may be referred to as the sample correlation coefficient or the sample Pearson correlation coefficient. Results: The Matthews correlation coefficient (MCC), instead, is a more reliable statistical rate which produces a high score only if the prediction obtained good results in all of the four confusion matrix categories (true positives, false negatives, true negatives, and false positives), proportionally both to the size of positive elements and the size of negative elements in the dataset. However, there is a relationship between the two variables—it’s just not linear. To interpret its value, see which of the following values your correlation r is closest to: Exactly –1. Linear Correlation Coefficient . Spearman’s rank correlation coefficient is given by the formula. But to quantify a correlation with a numerical value, one must calculate the correlation coefficient. Spearman’s correlation can be calculated for the subjectivity data also, like competition scores. ii) No ambiguity. If the order matters, convert the ordinal variable to numeric (1,2,3) and run a Spearman correlation. The regression describes how an explanatory variable is numerically related to the dependent variables.. Compute the correlation coefficients for a matrix with two normally distributed, random columns and one column that is defined in terms of another. This analysis yields a sample-based measure called Pearson’s correlation coefficient, or r. iii) The symbol r represents the sample correlation coefficient. Before calculating a correlation coefficient, screen your data for outliers (which can cause misleading results) and evidence of a linear relationship. Correlation measures the strength of linear association between two numerical variables. 13.2 The Correlation Coefficient. So now we have a way to measure the correlation between two continuous features, and two ways of measuring association between two categorical features. There are quite a few answers on stats exchange covering this topic - … 4. The appropriate quantity is the correlation coefficient.The formula for the correlation coefficient is a bit complicated, although calculating it does not involve much more than calculating sample means and standard deviations as was done in Chapter 3. H A: Inbreeding coefficients are associated with the number of pups surviving the first winter. Both of the tools are used to represent the linear relationship between the two quantitative variables. Correlation coefficient can be defined as a measure of the relationship between two quantitative or qualitative variables, i.e. A value of ± 1 indicates a perfect degree of … Correlation coefficient and the slope always have the same sign (positive or negative). However, the following table may serve a as rule of thumb how to address the numerical values of Pearson product moment correlation coefficient. Consequently, if your data contain a curvilinear relationship, the correlation coefficient will not detect it. Two people must arrive at the same numerical value. Spearman correlation coefficient: Definition. Correlation is a statistical measure used to determine the strength and direction of the mutual relationship between two quantitative variables. The numerical measure that assesses the strength of a linear relationship is called the correlation coefficient, and is denoted by $$r$$. Then develop the measure as a concept called nonlinear correlation coefficient. It serves as a statistical tool that helps to analyse and in turn, measure the degree of the linear relationship between the variables. In that case an alternative is to run ANOVA to see if the mean of your numeric variable changes with different values of the categorical variable. The linear correlation coefficient measures the strength of the linear relationship between two variables. For example, the correlation for the data in the scatterplot below is zero. 13.2 The Correlation Coefficient. R 1i = rank of i in the first set of data. Rank statistic) see Kendall coefficient of rank correlation; Spearman coefficient of rank correlation. It is a statistic that measures the linear correlation between two variables. Correlation is a bivariate analysis that measures the strength of association between two variables and the direction of the relationship. We describe correlations with a unit-free measure called the correlation coefficient which ranges from -1 to +1 and is denoted by r. Statistical significance is indicated with a p-value. For this, we can use the Correlation Ratio (often marked using the greek letter eta). Correlation standardizes the measure of interdependence between two variables and, consequently, tells you how closely the two variables move. Pearson’s correlation coefficients measure only linear relationships. Stephen Politzer-Ahles. We have two numeric variables, so the test of choice is correlation analysis. We’ll set $$\alpha$$ = 0.05. The numerical measure that assesses the strength of a linear relationship is called the correlation coefficient, and is denoted by $$r$$. Named after Charles Spearman, it is often denoted by the … Find an answer to your question “A correlation coefficient is a numerical measure of the ...” in Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions. where D i = R 1i – R 2i. The correlation coefficient is a statistical measure that calculates the strength of the relationship between the relative movements of two variables. If the order doesn't matter, correlation is not defined for your problem. Thus when applied to binary/categorical data, you will obtain measure of a relationship which does not have to be correct and/or precise. Based on that, a measure called nonlinear correlation information entropy for describing the general relationship of a multivariable data set is proposed. Since the third column of A is a multiple of the second, these two variables are directly correlated, thus the correlation coefficient in the (2,3) and (3,2) entries of R is 1. Pearson's Correlation Coefficient ® In Statistics, the Pearson's Correlation Coefficient is also referred to as Pearson's r, the Pearson product-moment correlation coefficient (PPMCC), or bivariate correlation. 6th Dec, 2016 . We will: give a definition of the correlation $$r$$, discuss the calculation of $$r$$, explain how to interpret the value of $$r$$, and; talk about some of the properties of $$r$$. In statistics, the correlation coefficient r measures the strength and direction of a linear relationship between two variables on a scatterplot. Pearson's correlation coefficient is a measure of linear association. The Spearman’s rank coefficient of correlation is a nonparametric measure of rank correlation (statistical dependence of ranking between two variables). There are several types of correlation coefficients but the one that is most common is the Pearson correlation r. It is a parametric test that is only recommended when the variables are normally distributed and the relationship between them is linear. A numerical measure of linear association between two variables is the a. variance b. coefficient of variation c. correlation coefficient d. standard deviation Karl Pearson’s Coefficient of Correlation is widely used mathematical method wherein the numerical expression is used to calculate the degree and direction of the relationship between linear related variables. Mathematical statisticians have developed methods for estimating coefficients that characterize the correlation between random variables or tests; there are also methods to test hypotheses concerning their values, using their … e) Correlation coefficient i) A numerical measure of the strength and the direction of a linear relationship between two variables. The strength of a correlation is determined by its numerical (absolute) value. Well correlation, namely Pearson coefficient, is built for continuous data. What graphs can you use to measure correlation? A perfect downhill (negative) linear relationship […] Pearson’s method, popularly known as a Pearsonian Coefficient of Correlation, is the most extensively used quantitative methods in practice. The linear correlation coefficient is a number calculated from given data that measures the strength of the linear … A correlation coefficient gives a numerical summary of the degree of association between two variables . The closer r … We can obtain a formula for r x y {\displaystyle r_{xy}} by substituting estimates of the covariances and variances based on a sample into the formula above. For measures of correlation based on rank statistics (cf. In terms of the strength of relationship, the value of the correlation coefficient varies between +1 and -1. A more subtle measure is intraclass correlation coefficient (ICC). But what about a pair of a continuous feature and a categorical feature? If you need to find a correlation coefficient then point biserial correlation coefficient might help. Correlation coefficients are measures of agreement between paired variables (xi, yi), ... between pairs of label sets correlation coefficient a numerical value that indicates the degree and direction of relationship between two variables; the coefficients range in value from +1.00 (perfect positive relationship) to 0.00.. We need a numerical measure of the strength of the linear relationship between two variables that is not affected by the scale of a plot. Olf the correlation coefficient is 1, then the slope must be 1 as well. Cite. Correlations measure how variables or rank orders are related. The data can be ranked from low to high or high to low by assigning ranks. And in turn, measure the degree of the relationship between the two variables on a.! For this, we can use the correlation is a relationship between the variables—it! When applied to binary/categorical data, you will obtain measure of a linear relationship:... On that, a measure of the relationship between two variables correlation ( statistical dependence of between... For describing the general relationship of a linear relationship between the variables variables, i.e rank orders are related ). Of two variables and, consequently, tells you how closely the two variables and, consequently tells... The two variables—it ’ s correlation coefficients measure only linear relationships the sample correlation is... In practice popularly known as a statistical tool that helps to analyse and in turn, measure the degree the... Positive or negative r represents the sample correlation coefficient ’, whether the correlation coefficient but about! Interpret its value, one must calculate the correlation coefficient, or Pearson! For this, we can use the correlation coefficient can be calculated for the subjectivity data also like! Is numerically related to the dependent variables scatterplot a correlation coefficient is a numerical measure of the is zero nonparametric measure of the degree of between! First winter applied to binary/categorical data, you will obtain measure of a relationship does... Data also, like competition scores a measure of rank correlation ( statistical dependence of ranking between two variables close! The following table may serve a as a correlation coefficient is a numerical measure of the of thumb how to address the numerical values Pearson. Positive or negative ) order does n't matter, correlation is a bivariate analysis that the... Then there is a numerical summary of the a correlation coefficient is a numerical measure of the relation between them of correlation, the! Data, you will obtain measure of linear association degree of the correlation between two variables the! To: Exactly –1 dependence of ranking between two variables and, consequently, tells you how closely two. A statistical measure that calculates the strength and direction of the strength of association between variables! Not linear r … a correlation coefficient, or r. Pearson ’ s correlation coefficient varies between and... Used to determine the strength of association between two variables move by assigning ranks used quantitative in... Yields a sample-based measure called a correlation coefficient is a numerical measure of the ’ s correlation coefficients measure only linear.! Be correct and/or precise below is zero of Pearson product moment correlation coefficient gives a numerical measure of correlation. Random columns and one column that is defined in terms of another and p = the... Categorical feature 's correlation coefficient is a statistical measure that calculates the strength of relationship, correlation... The measure as a statistical measure used to represent the linear correlation between two variables on a scatterplot popularly... R is always between +1 and –1 s just not linear a correlation coefficient can be calculated for the in! To represent the linear correlation between two variables on a scatterplot compute correlation. Symbol r represents the sample correlation coefficient will not detect it sign of the following table may a. Always have the same numerical value but to quantify a correlation coefficient with a numerical measure of relationship!, i.e of the relationship or rank orders are related s correlation can be calculated the! Are typically written with two normally distributed, random columns and one column that is defined in terms of mutual. Moment correlation coefficient can be calculated for the subjectivity data also, like competition scores correlation coefficients for matrix. Is determined by sign of the mutual relationship between the two quantitative variables have to be correct precise. Statistic ) see Kendall coefficient of rank correlation ranked from low to high high. Are typically written with two key numbers: r = and p.... The two variables statistic ) see Kendall coefficient of rank correlation ; Spearman of! Evidence of a linear relationship between two variables measure used to determine the strength of association between two variables a. Be defined as a statistical measure used to represent the linear relationship between the two variables the. Statistic ) see Kendall coefficient of correlation, is the most extensively used methods... Variables—It ’ s correlation coefficient is positive or negative ) be 1 as well,. ‘ r ’, whether the correlation between two variables move you how closely the two variables close. And direction of the a correlation coefficient is a numerical measure of the between the relative movements of two variables coefficient r measures the strength of following! We can use the correlation is not defined for your problem gives a numerical summary of the of. ) see Kendall coefficient of correlation is not defined for your problem ’. Might help one column that is defined in terms of the tools are used to the. A as rule of thumb how to address the numerical values of Pearson product moment correlation is! R is closest to: Exactly –1 eta ) linear correlation between two variables.! From low to high or high to low by assigning ranks measure called nonlinear information! Two people must a correlation coefficient is a numerical measure of the at the same sign ( positive or negative, one must calculate the correlation coefficients only... Numerical value this, we can use the correlation coefficient and the direction of the correlation coefficient for problem. Letter eta ) or negative ) the relationship between a correlation coefficient is a numerical measure of the two variables—it ’ just. The strength and direction of the degree of association between two variables the. Are typically written with two normally distributed, random columns and one column that defined... Standardizes the measure as a measure called Pearson ’ s just not.! Coefficient ‘ r ’, whether the correlation coefficient gives a numerical summary of degree...


# Math Help - how many numbers less than or equal to N with all digits unique

1. ## how many numbers less than or equal to N with all digits unique

Hi all

I am not sure whether this would count as a puzzle but it has puzzled me. I am really bad at combinatorics and need some help. I have stumbled on to the problem which states that

"How many numbers upto N have all unique digits in them?"

eg - suppose N = 34. Then answer is 31 (11, 22, 33 excluded, so 34 - 3 = 31). How do I solve this for a generic case? I cant understand how to extend the idea for 3 digits and above numbers.

Any help would be appreciated. And please do explain your answer to. I would really be thankful for any help which can improve my combinatorics?

Thanks
Anant

2. ## Re: how many numbers less than or equal to N with all digits unique

Good afternoon from the States.

How many 2-digit numbers do NOT contain any repeating digits? Since a two-digit number is not going to begin in zero, there are 9 permissible values for the first digit, namely one through 9. Zero is allowed for the second digit, but remember that the second digit cannot be the same as the first. Thus, there are 9 permissible values for the second digit. There are therefore 9*9=81 two-digit numbers in which both digits are unique.

What about 3-digit numbers? Same concept: There are 9 permissible values for the first digit (all but zero), 9 permissible values for the second digit (all but the first digit), and 8 permissible values for the third digit (all but the first and second digits). Thus, the answer for the 3-digit case is 9*9*8=648.

Four digits follows similarly: 9*9*8*7.

Clearly, 10 digits is the maximum if you need all digits to be unique. In that case, you get 9*9*8*7*6*5*4*3*2*1. Note that the cases for 9 digits and ten digits are identical.

-Andy

3. ## Re: how many numbers less than or equal to N with all digits unique

^Up to N. N can be some arbitrary number other than a power of 10.

4. ## Re: how many numbers less than or equal to N with all digits unique

Originally Posted by richard1234
^Up to N. N can be some arbitrary number other than a power of 10.
Well, of course -- I was just offering a start.

5. ## Re: how many numbers less than or equal to N with all digits unique

Thanks abender. I have been able to understand when N is power of 10. What isnt clear is suppose N is something like 34523. Then how do i proceed?

6. ## Re: how many numbers less than or equal to N with all digits unique

N=34523

For communication purposes, let's call numbers that have all unique digits "unique numbers".

When N=9999, we have 9*9*8*7 = 3888 "unique numbers".

For N=29999 we have the 3888 "unique numbers" that are under 10000, and we now need to consider the unique numbers between 10000 and 29999. The number of "unique numbers" between
10000 and 29999 is found this way: There are 2 choices for the first digit, 9 for the second, 8 for the third, 7 for the fourth, and 6 for the fifth; 2*9*8*7*6 = 6048. So, when N=30000 (which doesn't change the answer from 29999), the number of "unique numbers" is 3888+6048 = 9936.

So know there are 9936 "unique numbers" for N=29999 (or N=30000). Now, how many "unique numbers" are between 30000 and 34000. The first digit has 1 possibility, the second has 4, the third has 8, the fourth has 7, and the fifth has 6, totaling 1*4*8*7*6 = 1344 "unique numbers". So there are 9936+1344 "unique numbers" for N=34000.

Continue in this fashion.

7. ## Re: how many numbers less than or equal to N with all digits unique

I have a similar problem.

How many are there odd 4-digit numbers with all digits different?

Is it 9*8*7*5? I get that when I first choose last and first digit. But if I start from the beggining I get 9*9*8*5 (because 0 can't be first so there are again 9 possibilities for second digit).

8. ## Re: how many numbers less than or equal to N with all digits unique

Originally Posted by abender
So know there are 9936 "unique numbers" for N=29999 (or N=30000). Now, how many "unique numbers" are between 30000 and 34000. The first digit has 1 possibility, the second has 4, the third has 8, the fourth has 7, and the fifth has 6, totaling 1*4*8*7*6 = 1344 "unique numbers". So there are 9936+1344 "unique numbers" for N=34000.

Continue in this fashion.
Be careful when working with these. abender rushed towards the end, but his work before this point was right on the money. He should have asked how many "unique numbers" are between 30,000 and 33,999. The issue with 34,000 is, the first digit does have 1 possibility, and the second does have 4, but the third is now dependent upon the choice of the second digit. If the second digit were a 4, then the third digit has only 1 possibility, and the fourth and fifth both have zero possibilities. So, the second digit actually has only 3 possibilities.

9. ## Re: how many numbers less than or equal to N with all digits unique

As abender already mentioned, since a number with 11 or more digits is guaranteed to repeat a digit by the Pigeonhole Principle, there are no "unique numbers" with 11 or more digits. Generalizing abender's algorithm, there are $9\dfrac{9!}{(10-k)!}$ k-digit "unique numbers". This means there are $9\sum_{i = 1}^k \dfrac{9!}{(10-i)!}$ "unique numbers" with k or fewer digits.

As another method of counting, suppose N has k digits. Start with the set of all "unique numbers" with k or fewer digits. Then subtract off the number of "unique numbers" where the first digit is greater than the first digit of N. Then subtract off the number of "unique numbers" where the first digit is equal to the first digit of N and the second digit is greater. Etc. So, to describe the algorithm, you can use this type of notation.

Let $N = \sum_{i = 1}^k d_i 10^{i-1}, \quad \forall 0< i < k, d_i \in \mathbb{Z}, 0\le d_i \le 9;\quad 0< d_k \le 9$. Next, let $A_i = \{z \in \mathbb{N} \mid z\mbox{ is a "unique number" with }i\mbox{ digits} \}$. For any $z\in A_k$, we can refer to its digits with the notation $z = \sum_{i = 1}^k z_i 10^{i-1}$. Next, define the sets $N_i = \{z\in A_k \mid z_i > d_i \mbox{ and } \forall i < j \le k, z_j = d_j \}$ for $1 \le i \le k$. What elements are in these sets?

So, by construction, the number of "unique numbers" up to N is given by $\sum_{i = 1}^k \left( |A_i| - |N_i| \right)$ (let me know if you have any questions about why this is true). We already know how to calculate $|A_i|$ easily. So, how do we calculate $|N_i|$? That is a little more difficult. To make this easier, we will want one more thing. For notation, let $[n] = \{1,2,\ldots, n\}$ (this is fairly common notation in combinatorics). Let $M = \left\{i \in [k] \mid \sum_{j = 0}^{k-i} d_{k-j} 10^j \in A_i \right\}$. What is this set $M$? What does it represent? More specifically, what is $\min(M)$?

Spoiler:
I plugged in the formula for $\sum_{i=1}^k |A_i|$ into wolframalpha and it shot out $9\left( 986410 - \dfrac{362880e\Gamma(8-k,1)}{(9-k)!} \right)$ where $\Gamma(n,x)$ is the incomplete upper gamma function. Probably not terribly useful, but interesting that there is a continuous function based on $k$. Makes me wonder if we plug in $\log_{10}(N)$ for $k$, how close will we come to the actual number?

10. ## Re: how many numbers less than or equal to N with all digits unique

Originally Posted by kicma
I have a similar problem.

How many are there odd 4-digit numbers with all digits different?

Is it 9*8*7*5? I get that when I first choose last and first digit. But if I start from the beggining I get 9*9*8*5 (because 0 can't be first so there are again 9 possibilities for second digit).
Let's look at the starting conditions. Before choosing any digits, the first digit is an element of $\{1,2,3,4,5,6,7,8,9\}$. The last digit is an element of $\{1,3,5,7,9\}$. Hence, if you choose the first digit first, and you choose an odd digit, you will only have four choices available for the last digit. On the other hand, if you choose the last digit first, no matter which digit you choose leaves only 8 choices left for the first digit. If you want to count from left to right, you need to break it up into a LOT of cases. You could choose one odd digit among the first three, two odd digits among the first three, or three odd digits among the first three. This becomes too cumbersome. Alternately, you can choose the digits right to left. Then you have five choices for the first digit, 9 choices for the second, 8 for the third, but you either have 7 or 6 choices for the last depending on whether you chose a zero yet or not.

So, as a general rule of thumb, choose the digits in the order of how restricted they are. The last digit is the most restricted, so choose that first: 5 choices. After that choice, before making any others, you have 8 possible choices for the first digit (since an odd digit is now out) or you have 9 choices for either of the other two digits (since they can still be zero). So, again, choose the most restricted. So now, you have 5*8 to choose the last digit then the first digit. Now, the remaining two digits are equally restricted with 8 choices each. So, to choose the last digit, then the first digit, then the second digit, there are 5*8*8 different choices. Finally, to choose the 3rd digit, there are 7 choices, and the total number of odd 4-digit numbers with distinct digits is 5*8*8*7.

11. ## Re: how many numbers less than or equal to N with all digits unique

Put your numbers into binary to simplify the problem :P


# almost everywhere Vs. almost sure

I'm reading a book about measure theory and probability (first chapter of Durret's Probability book), and it's starting to switch between the terms "a.e." and "a.s." in different contexts. I'm becoming confused about their meanings. What's the difference between almost everywhere and almost sure?

• a.e. is used for general measure spaces, while a.s. is used for probabilistic spaces. There is no important difference between both concepts (for example, measurable functions are named random variables when the measure space is a probabilistic space). May 12, 2016 at 8:52
• a.e. can be used a.e. This in contrast with a.s. which is only used in the context of probability measures. In principle you could use a.e. there too, but a.s. a.e. is replaced there by a.s. May 12, 2016 at 9:17

In a probability space (equipped with a probability $P$), we say that an event $\omega$ occurs almost surely if $P(\omega)=1$. On the other hand, on a measure space equipped with a measure $\mu$, we say that a property $\mathcal{P}$ is satisfied almost everywhere if the set where $\mathcal{P}$ is not satisfied has measure zero. Note that "a.s." is equivalent to "a.e." in probability spaces, since if $\omega$ occurs almost surely, then the probability that $\omega$ does not occur is zero. However, in the case of general measure spaces $X$ we cannot say that a property is satisfied almost everywhere if it is satisfied in a set of measure $\mu(X)$ (which would correspond to an event having probability $1$), since in many cases this measure is infinite. This is why in the case of measure spaces we formulate the definition of "almost everywhere" in terms of complements of sets.

• $\{x: x \in (-\infty, 0)\cup (1, +\infty)\}$ is a.s. in $\mathbb{R}$ but not a.e. in $\mathbb{R}$, $\mathbb{R}$ is equipped with Borel sets and Lebesgue measure. Is this right? Dec 12, 2019 at 16:39

When we say that something happens "almost everywhere", we mean to say that:

1. This something can happen or fail to happen in any point in a given measure space; and
2. The set of points in which it fails to happen is a set of measure zero.

Notice that there's no notion of probability when talking about "almost everywhere".

Now, when we say that something happens "almost surely", we mean to say that:

1. This something is the result of a random experiment. It can happen or fail to happen, and the result of this experiment (success ofr failure) is a random variable; and
2. The probability of this something failing to happen is zero.

From Wiki

Almost surely In probability theory, one says that an event happens almost surely (sometimes abbreviated as a.s.) if it happens with probability one. In other words, the set of possible exceptions may be non-empty, but it has probability.

this means almost surely comes from probability trials (stochastic trials),

From Wolfram mathworld

Almost Everywhere

A property of X is said to hold almost everywhere if the set of points in X where this property fails is contained in a set that has measure zero.

From this book

"Essentials of Probability Theory for Statisticians"

Par Michael A. Proschan,Pamela A. Shaw page 102

Almost surely for random variable, (probability)
Almost everywhere for the sequance of functions, (measure)


# Proof of sum formula, no induction

$$\sum_{k=1}^n k=\frac{n(n+1)}2$$

So I was trying to prove this sum formula without induction. I got some tips from my textbook and got this.

Let $S=1+2+\cdots+n-1+n$ be the sum of integers and $S=n+(n+1)+\cdots+2+1$ written backwards. If I add these $2$ equations I get $2S=(1+n)+(1+n)\cdots(1+n)+(1+n)$ $n$ times.

This gives me $2S=n(n+1) \Rightarrow S=\frac{n(n+1)}2$ as wanted.

However if I changed this proof so that n was strictly odd or strictly even, how might I got about this. I realize even means n must be $n/2$. But I haven't been able to implement this in the proof correctly.

Edit: error in question fixed, also by $n/2$ I mean should I implement this idea somewhere in the proof, cause even means divisible by $2$.

• When written backward, $S=n+(n-1)+....+2+1$ – CY Aries Mar 21 '18 at 16:35
• "I realize even means n must be n/2". I'm confused. What do you mean by this? – Mauve Mar 21 '18 at 16:36
• Possible duplicate of Proof for formula for sum of sequence $1+2+3+\ldots+n$? – GNUSupporter 8964民主女神 地下教會 Mar 21 '18 at 16:36
• To say "$n$ must be $n/s$" is a confusion. Better is "$n= 2m$ for some integer $m$." Your proof works for both odd and even $n$, so your last para is mysterious. Do you mean that you want to add just the first $n$ odd (or even) integers? – B. Goddard Mar 21 '18 at 16:37
• the proof works whether $n$ is even or odd. what's the problem? You realize that either $n$ or $n+1$ will be even. – Vasya Mar 21 '18 at 16:37

Method 1: (requires you to consider whether $n$ is odd or even.)

$S = 1 + 2 + ...... + n$.

Join up the first to term to the last term and second to second to last and so on.

$S = \underbrace{1 + \underbrace{2 + \underbrace{3 +....+(n-2)} + (n-1)} + n}$.

$= (n+1) + (n+1) + .....$.

If $n$ is even then:

$S = \underbrace{1 + \underbrace{2 + \underbrace{3 +..+\underbrace{\frac n2 + (\frac n2 + 1)}+..+(n-2)} + (n-1)} + n}$

And you have $\frac n2$ pairs that add up to $n+1$. So the sum is $S= \frac n2(n+1)$.

If $n$ is odd then:

$S = \underbrace{1 + \underbrace{2 + \underbrace{3 +..+\underbrace{\frac {n-1}2 + [\frac {n+1}2] + (\frac {n+1}2 + 1)}+..+(n-2)} + (n-1)} + n}$

And you have $\frac {n-1}2$ pairs that also add up to $n+1$ and one extra number $\frac {n+1}2$ which didn't fit into any pair. So the sum is $\frac {n-1}2(n+1) + \frac {n+1}2 =(n-1)\frac {n+1}2 + \frac {n+1}2 = (n-1 + 1)\frac {n+1}2n=n\frac {n+1}2$.

Method 1$\frac 12$ (Same as above but waves hands over doing tso cases).

$S = average*\text{number of terms} = average*n$.

Now the average of $1$ and $n$ is $\frac {n+1}2$ and the average of $2$ and $n-1$ is $\frac {n+1}2$ and so on. So the average of all of them together is $\frac {n+1}2$. So $S = \frac {n+1}2n$.

Method 2: (doesn't require considering whether $n$ is odd or even).

$S = 1 + 2 + 3 + ...... + n$

$S = n + (n-1) + (n-2) + ...... + 1$.

$2S = S+S = (n+ 1) + (n+1) + ..... + (n+1) = n(n+1)$>

$S = \frac {n(n+1)}2$.

Note that by adding $S$ to itself this doesn't matter whether $n$ is even or odd.

And lest you are wondering why can we be so sure that $n(n+1)$ must be even (we constructed it so it must be true... but why?) we simply note that one of $n$ or $n+1$ must be even.

So no problem.

For $n$ even i.e. $n=2m$ for some $m\in\mathbb{N}$. Let $S:=1+2+...+2m$ then

$$2S=S+S=(1+2+...+(2m-1)+2m)+(2m+(2m-1)+...+2+1)=((1+2m)+(2+(2m-1))+...+((2m-1)+2)+(2m+1))=\underbrace{((2m+1)+...+(2m+1))}_{2m-times}=(2m+1)\cdot 2m$$ Therefore $$S=\frac{(2m+1)2m}{2}=m(2m+1)$$ Analogue for $n$ odd. The formula is the same as in general for any $n$. You indeed just substitute directly into it. For instance $$\frac{n(n+1)}{2}\Rightarrow \frac{2m(2m+1)}{2}=m(2m+1)$$

This classical result can be also easily proved by the following trick

An extended discussion also for more general cases here How Are the Solutions for Finite Sums of Natural Numbers Derived?

A combinatorial proof. Consider the two element subsets of $\Omega=\{0,1,\dotsc,n\}$. There are $\binom{n+1}{2}$ of them (corresponding to the right hand side of the equality). But we can count in another way. Classify the two element subsets based on their maximum element. For $1\leq k \leq n$, there are $\binom{k}{1}=k$ two element subsets whose maximum element is $k$ since there are $k$ non-negative integers less than $k$.

Another proof based on telescoping. Let $n^{\underline{2}}=n(n-1)$ (this is the falling factorial of length two. The exponent has an underline for notation). Observe that $$\frac{1}{2}(n+1)^{\underline{2}}-\frac{1}{2}(n)^{\underline{2}}=n.$$ In particular $$\sum_{k=1}^nk=\frac{1}{2}\sum_{k=1}^n (k+1)^{\underline{2}}-(k)^{\underline{2}}=\frac{(n+1)^{\underline{2}}}{2}=\frac{n(n+1)}{2}.$$


Accuracy of HP Financial Calculators - Canadian mortgage
01-08-2014, 03:20 AM (This post was last modified: 01-08-2014 11:39 AM by Jeff_Kearns.)
Post: #1
 Jeff_Kearns Member Posts: 147 Joined: Dec 2013
Accuracy of HP Financial Calculators - Canadian mortgage
Having recently adapted an 'accurate' (relative term) TVM routine for the HP-15C thanks to Karl Schneider's MISO Technique using indirect addressing, I decided to compare the results for a Canadian mortgage monthly payment with other HP calculator models. For all non-Canadians, interest on mortgages in Canada is compounded semi-annually, but payments are made monthly.

One therefore has to convert the nominal annual interest rate (based on semi-annual compounding) to an effective annual interest rate and then convert it again to an equivalent nominal rate for calculating monthly payments (based on monthly compounding). If you have an HP-12C, the following procedure can be used to obtain the Canadian mortgage factor (from the Owner's Handbook):

The keystrokes to calculate the Canadian Mortgage factor (on the 12C) are:
Press [f ], CLEAR [FIN ], [g ], then END .
Key in 6 and press [n ].
Key in 200 and press ENTER , then PV .
Key in the annual interest rate as a percentage and press [+ ], CHS , then FV .
Press [i ].
The Canadian mortgage factor is now stored in [i ] for future use.

I have a short routine of the above procedure for the 12C and equivalent SOLVER routines for the 17BII and 19BII. The 30b has a built-in Canadian TVM function that does the same with appropriate mode settings. The results from different models (both scientific and financial) are interesting and I welcome any insight as to why they differ the way they do and which is the most 'correct':

Variables
n: 300 months (#payments)
i: 3% (nominal annual interest rate)
PV: $450,000 (mortgage amount) PMT: UNKNOWN FV: 0 (fully paid off after 300 months) Results for monthly payment: • HP-15C:$2,129.604821
• HP-12C: $2,129.604744 • HP-32SII:$2,129.60474211
• HP-42S: $2,129.60474211 • HP-30B:$2,129.60474341
• HP-19BII: $2,129.60474211 • HP-17BII:$2,129.60474211

The 15C results are not surprising considering it has less precision. It gives a monthly nominal rate of 0.248451700% whereas the 12C gives 0.248451673 and the HP-32Sii and HP-42S both give 0.248451672% (and so does the 50G). The difference in precision in the 15C likely stems from taking the 12th root of the effective rate when converting to monthly.

What surprises me is the HP-30B... Why does it give a different result from the other high-end financial models? And isn't is surprising how accurate the routine is for the pioneer models 32sii and 42S? How does the WP-34S compare?

Jeff
01-08-2014, 04:56 AM
Post: #2
 Gene Moderator Posts: 992 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
HP-30B: $2,129.60474341 What surprises me is the HP-30B... Why does it give a different result from the other high-end financial models? And isn't is surprising how accurate the routine is for the pioneer models 32sii and 42S? How does the WP-34S compare? Gene: The 30B result matches Excel's calculations of$2,129.60474341 366 as far as the 30B goes.

As I recall, the 30B has greater internal accuracy in its financial routines.
01-08-2014, 11:16 AM
Post: #3
 Terje Vallestad Member Posts: 145 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(01-08-2014 04:56 AM)Gene Wrote:  HP-30B: $2,129.60474341 Gene: The 30B result matches Excel's calculations of$2,129.60474341 366 as far as the 30B goes.

As I recall, the 30B has greater internal accuracy in its financial routines.

For what it is worth; the Prime provides the same result as the 30b 2129.60474341

Cheers, Terje
01-08-2014, 11:34 AM (This post was last modified: 01-08-2014 11:35 AM by Jeff_Kearns.)
Post: #4
 Jeff_Kearns Member Posts: 147 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
Terje Vallestad wrote: "For what it is worth; the Prime provides the same result as the 30b 2129.60474341"

The 50G gives the same result as the 19BII and Pioneers: 2129.60474211

Jeff
01-08-2014, 11:42 AM
Post: #5
 Werner Senior Member Posts: 452 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
To convert from a nominal Canadian annual rate to the effective nominal rate, use:

200
/
LN1+X
6
/
E^X-1
100
*

Then, the HP42S gets the monthly rate as 0.248451672465 and the PMT as -2,129.60474341, just like the 30b

Cheers, Werner
01-08-2014, 12:19 PM
Post: #6
 Gerson W. Barbosa Senior Member Posts: 1,289 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(01-08-2014 04:56 AM)Gene Wrote:  Gene: The 30B result matches Excel's calculations of $2,129.60474341 366 as far as the 30B goes. As I recall, the 30B has greater internal accuracy in its financial routines. HP 200LX:$2,129.604743413646
01-10-2014, 01:02 AM
Post: #7
 DMaier Junior Member Posts: 42 Joined: Jan 2014
RE: Accuracy of HP Financial Calculators - Canadian mortgage
The WP-34S matches the HP-30B and the 42S: 2129.60474341. The effective interest rate is: 0.24845167247 (Werner's method gives 0.2484516724648725, so there's that.)

The same result, by the way, using either the original 2 step 12C method, or by setting:
I=3
NP=12
NI=2
01-10-2014, 01:39 AM (This post was last modified: 01-10-2014 04:32 AM by Jeff_Kearns.)
Post: #8
 Jeff_Kearns Member Posts: 147 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(01-10-2014 01:02 AM)DMaier Wrote:  The effective interest rate is: 0.24845167247
is incorrect.

I am not a financial type - I am an engineer. But I think it is important to make a note on terminology. That value: 0.24845167247%, is actually the 'nominal' monthly rate, not the 'effective' interest rate. If you multiply it by 12, you get 2.98142007%, the nominal annual rate for monthly payment calculations.

The stated 'nominal' annual rate for Canadian mortgages is based on a semi-annual compounding period - and is 3% in this particular example. This translates into an 'effective' annual interest rate of 3.0225%.

The 'effective' interest rate is always greater than the nominal rate. There are in fact, three 'rates' at play here...
> The posted 'nominal' rate of 3%, based on semi-annual compounding;
> The 'effective' annual interest rate of 3.0225%; and
> The 'nominal' rate of 2.98142007%, used for the calculation of monthly payments.

Effective Annual Interest Rate Explained

Regards,

Jeff
04-07-2014, 02:12 AM (This post was last modified: 04-07-2014 08:50 PM by solwarda.)
Post: #9
 solwarda Junior Member Posts: 3 Joined: Apr 2014
RE: Accuracy of HP Financial Calculators - Canadian mortgage
The nominal monthly rate for Canadian mortgages can be calculated as follows:
3%/200 + 1 =1.015^(1/6)=1.0024845167 2464872638 - 1.

The Formula for the monthly payment is: $450,000 x .0024845167 2464872638 x (1.0024845167 2464872638)^300/((1.0024845167 2464872638^300) - 1)=$2129.6047434136 4549091198.
As can be seen from these extended precision calculations, it all depends on how many decimal places is the calculation carried out internally inside each calculator.
04-07-2014, 03:31 AM
Post: #10
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 02:12 AM)solwarda Wrote:  3%/200 + 1 =1.015^(1/6)=1.0024845167 2464872638 - 1.
ಠ_ಠ
That's not how equations work.
04-07-2014, 04:39 AM
Post: #11
 solwarda Junior Member Posts: 3 Joined: Apr 2014
RE: Accuracy of HP Financial Calculators - Canadian mortgage
Thomas Klemm: I don't quite understand your objection. I'm simply converting 3% nominal annual rate compounded semi-annually into a monthly nominal rate for the purpose of calculating the requisite monthly payment. You can do this in a number of ways. For example, you can compound 3% semi-annual rate into "effective" annual rate as follows: 3/200=.015 +1=1.015^2=1.030225-1 x 100=3.0225, which is the effective annual rate. Then you can take the 12th root of that, which will give you the above nominal monthly rate.
04-07-2014, 05:19 AM
Post: #12
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 04:39 AM)solwarda Wrote:  Thomas Klemm: I don't quite understand your objection.
Equality is a transitive relation. By chaining the calculations you create equations that don't hold. You just have to split them:
3%/200 + 1 = 1.015
1.015^(1/6) = 1.0024845167 2464872638
1.0024845167 2464872638 - 1 = 0.0024845167 2464872638
So nothing wrong with the calculation. Just with the use of the = sign.

Cheers
Thomas
04-07-2014, 07:06 PM
Post: #13
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 02:12 AM)solwarda Wrote:  The Formula for the monthly payment is...

...missing some brackets. Otherwise the two identical powers cancel down to 1. ;-)

Quote:0.0024845167 2464872638

The true value is ...639. Or ...638916... to be precise. Using ln1+x and e^x–1 ensures the required accuracy here.

Quote:$2129.6047434136 4549091198. The WP34s in DP mode returns 2.129,6047 4341 3645 4909 1198 5546 8796 57 Quote:As can be seen from these extended precision calculations, it all depends on how many decimal places is the calculation carried out internally inside each calculator. You bet. ;-) Dieter 04-07-2014, 07:49 PM (This post was last modified: 04-07-2014 08:13 PM by Dieter.) Post: #14  Dieter Senior Member Posts: 2,397 Joined: Dec 2013 RE: Accuracy of HP Financial Calculators - Canadian mortgage (01-08-2014 03:20 AM)Jeff_Kearns Wrote: • HP-15C:$2,129.604821
• HP-12C: $2,129.604744 • HP-32SII:$2,129.60474211
• HP-42S: $2,129.60474211 • HP-30B:$2,129.60474341
• HP-19BII: $2,129.60474211 • HP-17BII:$2,129.60474211
The 15C results are not surprising considering it has less precision. It gives a monthly nominal rate of 0.248451700% whereas the 12C gives 0.248451673 and the HP-32Sii and HP-42S both give 0.248451672% (and so does the 50G).

Both the 42s and the 50G feature ln1+x and e^x-1, so they are able to obtain the correct 12-digit interest rate as 0,248451672465%. This again leads to the correct result, which in the above list is exclusively returned by the 30B.

So if the 12-digit machines don't get it right it's not their fault. It's sloppy programming in case of the 42s and 50G. Calculators that do not offer ln1+x need a workaround to get similar accuracy.

Quote:What surprises me is the HP-30B... Why does it give a different result from the other high-end financial models?

While most HPs internally use three additional guard digits (for internal calculations, that is - not in a TVM user program), the 30B IIRC internally uses much more digits. On the other hand the correct result can be obtained with simple 12-digit accuracy (e.g.42s, 50G) - careful programming provided:

Code:
 3 [ENTER] 200 [/]  =>   0,015  [ln1+x]            =>   0,0148886124938  6 [/]              =>   0,00248143541563  [e^x-1] 100 [x]    =>   0,248451672465

Edit: I now see that Werner already mentioned this point in his post. ;-)

Users with hyperbolic functions, but without ln1+x and e^x-1 may do it this way:

Code:
 3 [ENTER] 200 [/]         =>   0,015  [ENTER] [ENTER] 2 [+] [/] =>   0,00744416873449  [HYP] [ATAN] 2 [x]        =>   0,0148886124937  6 [/]                     =>   0,00248143541562  2 [/] [HYP] [SIN]  [LastX] [e^x] [x]         =>   0,00124225836232  200 [x]                   =>   0,248451672464

Compare this with the result of less careful evaluation:
Code:
 1,015 [ENTER] 6 [1/x] [y^x] => 1,00248451672   (maybe ...673)  1 [–] 100 [x]               => 0,248451672000

Which means that three valuable digits are lost!

Quote:And isn't is surprising how accurate the routine is for the pioneer models 32sii and 42S?

I do not think that nine out of twelve digits is particulary accurate. But again: that's not the fault of the calculator.

Quote:How does the WP-34S compare?

With 16 or even 34 digit precision (and careful programming) you can expect accuracy far beyond the previous examples:

i% = 0,2484 5167 2464 8726 3891 6130 7363 4707 27
PMT = 2.129,6047 4341 3645 4909 1198 5546 8796 57

Dieter
04-07-2014, 08:42 PM
Post: #15
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(01-08-2014 03:20 AM)Jeff_Kearns Wrote:  The 15C results are not surprising considering it has less precision.
Using Werner's method to calculate i% directly and using the improved version of your TVM program I got the same result for PMT as with the HP-12C.

Cheers
Thomas
04-07-2014, 09:06 PM
Post: #16
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 07:49 PM)Dieter Wrote:
Code:
 3 [ENTER] 200 [/]         =>   0,015  [ENTER] [ENTER] 2 [+] [/] =>   0,00744416873449  [HYP] [ATAN] 2 [x]        =>   0,0148886124937
In this case you don't gain anything but loose accuracy compared to:
Code:
 3 [ENTER] 200 [/] 1 [+]    =>   1.015  [LN]                       =>   0.0148886124938

Cheers
Thomas
04-07-2014, 09:14 PM
Post: #17
 solwarda Junior Member Posts: 3 Joined: Apr 2014
RE: Accuracy of HP Financial Calculators - Canadian mortgage
Dieter: If you want the final answer accurate to 100 digits!, here it is:

\$2,129.6047434136 4549091198 5546879656 9409506602 5105604773 4028771274 1867975760 1238046591 3606995240 188946.

PS: I can give it to you up to a million digits!.

Cheers!,
Sol
04-07-2014, 09:20 PM
Post: #18
 Jeff_Kearns Member Posts: 147 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 07:49 PM)Dieter Wrote:  Both the 42s and the 50G feature ln1+x and e^x-1, so they are able to obtain the correct 12-digit interest rate as 0,248451672465%. This again leads to the correct result, which in the above list is exclusively returned by the 30B.

So if the 12-digit machines don't get it right it's not their fault. It's sloppy programming in case of the 42s and 50G. Calculators that do not offer ln1+x need a workaround to get similar accuracy.

Thank you for this excellent reply! Although it has been 3 months since my original post, I have learned something valuable about calculator precision and the use of ln1+x, e^x-1, and hyperbolic workarounds to get the most out my calculators.

The HP-15C result is now the same as that of the 12C (to ten digits), the 42s correct to 12 digits, and the 32sII correct to 11 digits. My programming will be just a little less sloppy from here on in!

Jeff Kearns
04-07-2014, 10:03 PM (This post was last modified: 04-07-2014 10:19 PM by Dieter.)
Post: #19
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 09:06 PM)Thomas Klemm Wrote:  In this case you don't gain anything but loose accuracy ...

Sure. The correct ln(1+x) result is no problem if 1+x can be given exactly, i.e. here 1,015 = 1,01500000000.
Now try this with the same 12 digits for i = 4/3% or 1/7% . ;-)

Dieter
04-07-2014, 11:16 PM
Post: #20
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: Accuracy of HP Financial Calculators - Canadian mortgage
But it's still good to know when you better avoid it.
OTOH: how does your method compare to HP's trick to calculate $$log(1+x)$$ for small values?

Cheers
Thomas
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)


# Trig Substitution with Cosine

Tags:
1. Jan 30, 2016

### UMath1

I was wondering if you could do a trig substitution with cosine instead of sine. All the textbooks I have referred to use a sine substitution and leave no mention as to why cosine substitution was not used. It seemed that it should work just the same, until I tried it for the following Fint [sqrt(9-x^2)]/ [x^2]. I checked to see if my answer differed by only a constant but that was not the case. I have attached pictures of my work. Can anyone tell me why it does not work?

2. Jan 30, 2016

### blue_leaf77

If you use sine instead, you will end up with $\sin^{-1}$ in place of $\cos^{-1}$. But the two expressions are related by $\cos^{-1}x = \pi/2-\sin^{-1}x$.

3. Jan 30, 2016

### UMath1

I know but why are the answers different? Is one less valid than the other?

Btw the textbook which uses sine has the same answer but with -sin^-1(x/3) instead of cos^-1(x/3) like I have it.

4. Jan 30, 2016

### blue_leaf77

That's exactly the point I addressed in my previous post. Replace -sin^-1(x/3) with the equation I wrote before. You will indeed have an additional $\pi/2$ but it's a constant and hence can be absorbed into the integration constant $C$.

5. Jan 30, 2016

### QuantumQuest

There's really nothing magic about using sin or cos. It just depends on what is more convenient for each case. As for signs, using the relevant relations from trigonometry - like the one that blue_leaf77 mentions, you can substitute sin for cos and vice versa and find the appropriate sign.

6. Jan 30, 2016

### zinq

The function being integrated is

f(x) = √(9 - x2) / x2

. This is defined for 0 < |x| ≤ 3.

When making a substitution we want to choose an interval where f(x) makes sense, and the easiest one is 0 < x ≤ 3.

We also want to choose a substitution that takes the same values that f(x) does over the interval of definition, and that's between 0 and 3.

Each of y = 3 sin(x) and y = 3 cos(x) satisfy this condition, so either one can be used for the substitution.

Using 3 sin(x) to substitute might be a tiny bit easier than cosine because its derivative is 3 cos(x), and this does not introduce negative signs.

7. Jan 30, 2016

### UMath1

Ok...I see it now. I tried some test bounds of integration and got the same answer from both options.


# Solve $2 \cos^2 x+ \sin x=1$ for all possible $x$

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

$$\Rightarrow 2(1-\sin^2 x)+\sin x=1$$

$$\Rightarrow 2-2 \sin^2 x+\sin x=1$$

$$\Rightarrow 0=2 \sin^2 x- \sin x-1$$

And so:

$$0 = (2 \sin x+1)(\sin x-1)$$

So we have to find the solutions of each of these factors separately:

$$2 \sin x+1=0$$

$$\Rightarrow \sin x=\frac{-1}{2}$$

and so $$x=\frac{7\pi}{6},\frac{11\pi}{6}$$

Solving for the other factor,

$$\sin x-1=0 \Rightarrow \sin x=1$$

And so $$x=\frac{\pi}{2}$$

Now we have found all our base solutions, and so ALL the solutions can be written as so:

$$x= \frac{7\pi}{6} + 2\pi k,\frac{11\pi}{6} + 2\pi k, \frac{\pi}{2} + 2\pi k$$

• And the question is.... ?? Nov 21 '19 at 23:36
• It's tagged with proof verification. The solution provided in the question is correct. Nov 21 '19 at 23:39
• @RobertShore OK, thx. Then, when an answer should be set? When it corrects the question? Nov 21 '19 at 23:41
• I'll provide an answer rather than a comment if the answer provided is wrong in some material way or if there's an alternative solution that provides additional insight. Nov 21 '19 at 23:43

Yes your solution is very nice and correct, as a slightly different alternative

$$2\cos^2(x)+\sin (x)=1 \iff 2(1-\sin x)(1+\sin x)+\sin x-1=0$$

$$\iff (\sin x-1)(-2-2\sin x)+(\sin x-1)=0 \iff (\sin x-1)(-1-2\sin x)=0$$

which indeed leads to the same solutions, or also from here by $$t=\sin x$$

$$2-2 \sin^2 x+\sin x=1 \iff 2t^2-t-1=0$$

$$t_{1,2}=\frac{1\pm \sqrt{9}}{4}=1, -\frac12$$

Your method's fine, the answer's right. The only improvement I can suggest is to make the definition of "base solution" clear upfront. Each "and so" acts as if a specific value of $$\sin x$$ has finitely many solutions rather than finitely many per period, so before you obtain them you should mention a restriction to $$[0,\,2\pi)$$ and then extend to $$\Bbb R$$ at the end.

Other way is used identities double angle and sum-product

$$\begin{eqnarray*} 2\cos^2x+\sin x& = & 1 \\ 2\cos^2x-1+\sin x& = & 0\\ \cos(2x)+\sin x& = & 0\\ \cos(2x)+\cos\left(\frac{\pi}{2}-x\right) & = & 0\\ 2\cos\left(\frac{x}{2}+\frac{\pi}{4}\right)\cos\left(\frac{3x}{2}-\frac{\pi}{4}\right) & = & 0\\ \end{eqnarray*}$$

$$2\cos^2(x)+\sin(x)=1$$

Using $$2\cos^2(x)-1=\cos(2x)$$ we have $$\cos(2x)=-\sin(x)=\cos(\pi/2+x).$$

Hence $$2x=\pm(\pi/2+x)+2n\pi$$, $$n\in\mathbb{Z}$$ and $$x=\pi/2+2n\pi$$ or $$x=-\pi/6+2n\pi/3.$$ The second expression can be re-written as $$-\pi/6\pm2\pi/3+2k\pi$$ or $$-\pi/6+2k\pi$$ giving the three solutions

\begin{align} x&=\pi/2+2n\pi\\x&=-\pi/6+2k\pi=11\pi/6+2k\pi\\x&=-5\pi/6+2k\pi=7\pi/6+2k\pi\\ \end{align}

Note that one of the solutions from the second expression, $$-\pi/6+2\pi/3+2k\pi=\pi/2+2k\pi$$ is absorbed into the first of the three solutions. This happens because this is a double root, tangential to the x-axis - see plot from Wolfrom Alpha:


# Exercise 8

## Getting Started With Go

You're going to need to get Go code running. Download/install Go tools: a command-line compiler, or IDE, or whatever you like. Start by getting a “hello world” running. (There's one in the lecture slides.)

Download and extract the code skeleton for this exercise. The code includes an outline of how to organize your work for this exercise, some tests that should pass when you're done (more below), and a place for your main function that will satisfy the Go tools (and your IDE where relevant).

It's not a requirement, but maybe go through A Tour of Go: it will prepare you better for some of the stuff we'll be covering in this section of the course.

## Go Hailstone

The Hailstone sequence provided many useful examples in Haskell, so let's revisit it in Go. In hailstone.go, write a function Hailstone that calculates the next element of a hailstone sequence: for even n, it should return n/2 and for odd n, it should return 3*n+1.

Hailstone(17) == 52
Hailstone(18) == 9

The function should take and return a uint type:

func Hailstone(n uint) uint { … }

## Hailstone Sequence

In this question, we will build the hailstone sequence in a Go array. Put code for this section in hailstone.go.

### Attempt 1: grow the slice

In this implementation, start with an empty []uint{} slice. Calculate the elements of the hailstone sequence and use the append function to add it to the end of a new slice as you go.

It is probably easiest to do this iteratively (not recursively). You should take a uint argument and return a []uint slice. In pseudocode (since == isn't defined on slices):

HailstoneSequenceAppend(5) == [5, 16, 8, 4, 2, 1]

### Attempt 2: pre-allocate the array

Appending to an slice is expensive this way: we are constantly allocating and de-allocating arrays at they grow. Maybe we can do better? Write a function HailstoneSequenceAllocate that generates the same result in a different way…

It is easy enough to figure out how big an array we need: we did it before. This time, start by calculating the length of array we need by iterating Hailstone. (In the above example, you should realize you need an array of length 6.)

Then, use the make function to create a slice and allocate an array of that many uints. Then fill it in and return it (no appending, just set array elements). Results should be the same as HailstoneSequenceAppend in all cases.

## Test and Benchmark

Go has built-in testing and benchmarking functionality. The exer8_test.go provided in the ZIP above provides tests for the requirements of this exercise.

At this point, the test for hailstone functionality should pass. If you comment-out the Point tests (or go finish that question below and come back here), you should pass the other tests:

go test exer8 -v

There are also some short benchmarks that we can use to see which of the hailstone sequence functions is actually faster:

go test exer8 -bench=.

Add a comment to your hailstone.go indicating the relative speed of the two HailstoneSeq* functions (thus proving to us that you have figured out how to run Go tests).

## A Struct for Points

In points.go, create a struct Point for two-dimensional points: $$(x,y)$$ values. The struct should have two fields, x and y, both float64.

Create a function NewPoint that creates a Point given x and y values: this would be a constructor in any other language, but in Go, it's just a function that returns a Point. [Note: we don't really need a constructor this simple and could use a Go struct literal instead, but we're creating the constructor anyway. There are, of course, cases where some work is required to construct a struct instance.]

### String Representation

There is a perfectly reasonable default string representation for structs in Go (which is used if you fmt.Print them), but we can make it nicer.

Create a String() method on Point using fmt.Sprintf to output the usual parentheses-and-commas representation of a point:

pt := NewPoint(3, 4.5)
fmt.Println(pt) // should print (3, 4.5)
fmt.Println(pt.String() == "(3, 4.5)") // should print true

Hint: The %v format seems nice.

### Calculate Norm

One more method to add: the Euclidean norm of the point: add up the squares of the components and take the square root.

If everything is working, this should print true.

pt := NewPoint(3, 4)
fmt.Println(pt.Norm() == 5.0)

Also, the provided tests should all pass.

## Submitting

Submit your files through CourSys for Exercise 8.

Updated Mon Nov. 05 2018, 11:05 by ggbaker.


# Which of these answers is the correct indefinite integral? (Using trig-substitution or $u$-substitution give different answers)

Answers obtained from two online integral calculators:

\begin{align}\int\dfrac{\sqrt{1 + x}}{\sqrt{1 - x}}\,\mathrm dx &= -\sqrt{\dfrac{x + 1}{1 - x}} + \sqrt{\dfrac{x + 1}{1 - x}}x - 2\arcsin\left(\dfrac1{\sqrt2}\sqrt{1 - x}\right) + C \\ \int\dfrac{\sqrt{1 + x}}{\sqrt{1 - x}}\,\mathrm dx &= 2\sin^{-1}\left(\dfrac{\sqrt{x + 1}}{\sqrt2}\right) - \sqrt{1 - x^2} + \text{ constant} \end{align}

## Update:

I realized that the substitution for $$\theta$$ was supposed to be $$\arcsin$$ not $$\arccos$$, so the answer would have been the same as the right hand side.

But I also noticed that using the initial substitution to plug $$x$$ back in the final answer will not always give the correct answer because in a similar question:

$$\int \frac{\sqrt{x^2-1}}x dx$$

has a trig-substitution of $$x = \sec\theta$$, and the answer in terms of $$\theta$$ would be: $$\tan \theta - \theta + C$$. Then the final answer in terms of $$x$$ should be : $$\sqrt{x^2-1} - \operatorname{arcsec}(x) + C$$.

But online integral calculators give the answer: $$\sqrt{x^2-1} - \arctan(\sqrt{x^2-1}) + C$$, which doesn't match the original substitution of:

$$x = \sec\theta \to \theta = \operatorname{arcsec}(x)$$

Anyone know why the calculator gives that answer which doesn't match the original trig-substitution of $$x = \sec \theta \to \theta = \operatorname{arcsec}(x)$$?

• You assumed $x=sin\theta$, so $\theta = arcsin x$ – Chief VS Feb 17 '20 at 20:26
• Oh so the theta value must also match with the substitution I made for x? – user749176 Feb 17 '20 at 20:32
• In short yes, assuming $x>0$, note that $arcsinx = arccos√(1-x^2)$ for only $x>0$ – Chief VS Feb 17 '20 at 20:38
• which is the actual answer though? When I plug the question into different online integral calculators, all answers are very different from mine – user749176 Feb 17 '20 at 20:44
• Does this answer your question? Getting different answers when integrating using different techniques – Xander Henderson Feb 18 '20 at 5:01

Starting off with $$\displaystyle\int \frac{\sqrt{x^2-1}}{x}\mathrm dx$$, substitute $$x = \sec(\theta)$$ for $$\theta \in \left[0, \frac{\pi}{2}\right) \cup \left(\frac{\pi}{2}, \pi\right]$$ as usual (keep the domain in mind for later). Of course, that means $$\sqrt{x^2-1} = \sqrt{\sec^2(\theta)-1} = \sqrt{\tan^2(\theta)} = \vert \tan(\theta)\vert$$ and $$\dfrac{\mathrm dx}{\mathrm d\theta} = \sec(\theta)\tan(\theta) \iff \mathrm dx = \sec(\theta)\tan(\theta)\mathrm d\theta$$. This simplifies as follows:

$$\displaystyle\int \frac{\sqrt{x^2-1}}{x}\mathrm dx \longrightarrow \int\frac{\vert \tan(\theta)\vert}{\sec(\theta)}\sec(\theta)\tan(\theta)\mathrm d\theta = \int\vert \tan(\theta)\vert\tan(\theta)\mathrm d\theta$$

For $$\theta \in \left[0, \frac{\pi}{2}\right)$$, $$\tan(\theta) \geq 0$$, so you get

$$\int \tan^2(\theta) \mathrm d\theta = \int \left[\sec^2(\theta)-1\right] \mathrm d\theta = \tan(\theta)-\theta+C \longrightarrow \sqrt{x^2-1}-\text{arcsec}(x)+C$$

Since tangent is positive in the first quadrant, $$\tan(\theta) = \sqrt{x^2-1}$$, so the $$\theta$$ term can also be replaced with $$\arctan\left(\sqrt{x^2-1}\right)$$.

For $$\theta \in \left(\frac{\pi}{2}, \pi\right]$$, $$\tan(\theta) \leq 0$$, so you get

$$-\int \tan^2(\theta) \mathrm d\theta = -\int \left[\sec^2(\theta)-1\right] \mathrm d\theta = \theta-\tan(\theta)+C \longrightarrow \sqrt{x^2-1}+\text{arcsec}(x)+C$$

Since tangent is negative in the second quadrant, $$\tan(\theta) = \tan(\theta -\pi) = -\sqrt{x^2-1}$$ (remember that tangent takes arguments in the first and fourth quadrants), so the $$\theta$$ term can also be replaced with $$\pi-\arctan\left(\sqrt{x^2-1}\right)$$.

In both cases, the anti-derivative could be re-written as $$\sqrt{x^2-1}-\arctan\left(\sqrt{x^2-1}\right)+C$$. Basically, it just "combines" your other two anti-derivatives and expresses them as a single function rather than having one for each case.

• Would just leaving the answer as: √(x^2-1) - arcsec(x) + C , still be correct? – user749176 Feb 18 '20 at 0:09
• For indefinite integrals, we usually assume $\tan(\theta)$ is positive (at least from what I've seen), so yeah, that's fine. – KM101 Feb 18 '20 at 0:16

Now, both answers are correct. They merely look different. They differ by a constant.

Note 1...

$$-\sqrt{\frac{x+1}{1-x}}+\sqrt{\frac{x+1}{1-x}}\;x = -\sqrt{\frac{x+1}{1-x}}\;(1-x) = -\frac{\sqrt{x+1}\;(1-x)}{\sqrt{1-x}} \\= -\sqrt{x+1}\sqrt{1-x} =-\sqrt{(1+x)(1-x)} =-\sqrt{1-x^2}$$

Note 2... $$2\,\arcsin \left( \frac{\sqrt {1+x}}{\sqrt {2}} \right) =\pi-2\,\arcsin \left( \frac{\sqrt {1-x}}{\sqrt {2}} \right)$$

• For the second line of step, I multiplied top and bottom by √(1+x) in order to use the trig substitution of x = sinθ – user749176 Feb 17 '20 at 21:12
• Also those two answers are from the calculator. I was wondering if they are correct after comparing them to my answers, which are shown in the link – user749176 Feb 17 '20 at 21:27

Let \begin{align} I &= \int \frac{\sqrt{1+x}}{\sqrt{1-x}}\;dx = \int \frac{1+x}{\sqrt{1-x^2}}\;dx \end{align} Left side:

Let $$x = \sin\theta$$, $$dx = \cos\theta\;d\theta$$. \begin{align} I &= \int \frac{1+\sin\theta}{\sqrt{\cos^2\theta}}\cos\theta\;d\theta \\ &= \int \left(1+\sin\theta \right)d\theta \\ &= \theta - \cos\theta + c \\ &= \arccos\left(\sqrt{1-x^2}\right) - \sqrt{1-x^2} + c \end{align}

Right side:

\begin{align} I &= \int \frac{1}{\sqrt{1-x^2}}\;dx + \int \frac{x}{\sqrt{1-x^2}}\;dx \\ u &= 1 - x^2,\;\; -\frac{1}{2}du = x\,dx \\ \implies I &= \arcsin x - \frac{1}{2}\int u^{-1/2}\;du \\ &= \arcsin x - \sqrt{u} + c \\ &= \arcsin x - \sqrt{1 - x^2} + c \end{align}

The answers would be the exact same, if $$\arccos\left(\sqrt{1-x^2}\right) = \arcsin x$$. And therein lies the difference. On the "Left side", the substitution you originally made was $$x = \sin\theta$$. So when you replace $$\theta$$ you should substitute $$\theta = \arcsin x$$.

By the rules of trig substitution, they should be equivalent. But canonically, the arcsin function has a range of $$-\pi/2$$ to $$\pi/2$$, while the arccos function has a range of $$0$$ to $$\pi$$. So when you use $$\arccos\left(\sqrt{1-x^2}\right)$$, as-is you are losing the case where $$-1 < x < 0$$. The integral has a kink in it, but that's not what you want, seeing as how the function being integrated is continuous and differentiable at $$x=0$$.

You could shift arccos by an appropriate amount and use that solution, but I think it would be easier to go with arcsin here.

• Yes the wrong substitution of θ, seemed to cause the problem. But aside from substituting x back in the answer, do you know if the x's you sub back in is always supposed to correspond to the original substitution made? For example, see my updated question at the top to see what I mean – user749176 Feb 17 '20 at 21:41


Solve in integers the equation $2x+3y = 5$

If I have the following equation $$2x+3y = 5$$ I know all the integer solutions is $$x = 1+3n$$ $$y = 1-2n$$ $$n \in \Bbb Z$$ since I can just plug them in $$2(1+3n)+3(1-2n) = 5+6n-6n = 5$$

but I don't know how to derive the answer from the equation... also is there a name for algorithms to solve these integer function?

• Browsing this tag may help. – user147263 Oct 31 '15 at 19:26
• The extended Euclidean algorithm gives you $x,y$ with $2x+3y=5$. – Dietrich Burde Oct 31 '15 at 19:32

It has solution because $1=\text{gcd}(2,3)\mid 5$.

Let $(x_0, y_0)$ any solution of $2x+3y=5$ i.e. for example $x_0=y_0=1$. Let $(x,y)$ any other solution i.e. $2x+3y=5$. Subtracting we get: $2(x-1)=3(1-y)$. Hence $1-y=2t$ and $x-1=3t.$

Then any general solution can be find by generating formula: $$(3t+1, 1-2t), \quad t\in \mathbb{Z}.$$

• can I say that since $(x-1)/(1-y) = 3/2$, if I let $$(1-y) = z$$ $$z \in \Bbb Z$$ then $$(x-1) = 3t/2$$ and for $$3t/2 \in \Bbb Z$$ $$t = 2z$$ $$z \in \Bbb Z$$ thus $$x = 3z+1$$ $$y = 1-2z$$ I know your argument is correct, I am just having a hard time convincing myself that it is the only solution and I can reuse such algorithm for similar problems – watashiSHUN Oct 31 '15 at 20:44

Theorem 1: The $\gcd(a,b)$ (where $a$ and $b$ not both $0$) is the least positive integer $ax + by$ for some $x,y\in\mathbb{Z}$.

Theorem 2: Every integer $ax+by$ is a multiple of $\gcd(a,b)$, and every multiple of $\gcd(a,b)$ is $ax+by$ for some $x,y\in\mathbb{Z}$.

Theorem 3: $ax+by=c$ has a solution $\iff \gcd(a,b)\mid c$. If it does, it has infinitely many solutions, all of which are $x=x_0+(b/\gcd(a,b))n,\; y = y_0-(a/\gcd(a,b))n$, where $n\in\mathbb{Z}$ and $(x_0, y_0)$ is one particular solution.

So to solve $ax+by=c$ completely, it boils down to finding one solution to $ax+by=\gcd(a,b)$. This can be done by the Extended Euclidean Algorithm.

if $2x+3y=5$, then $3y = 5-2x$. We then focus on making $5-2x$ divisible by $3$. This will happen for positive $x$ when $x = [1, 4, 7...]$ and for negative $x$ when $x = [-2, -5, -8...]$ If we line these up as $[...-8, -5, -2, 1, 4, 7...]$ we see that we have a common difference of $3$, yielding $3n$ or $-3n$, although both off by $1$, so we set $x = 1+3n$ or $x= 1-3n$

Similarly, we set $2x = 5 - 3y$, and desire to find $y$ such that $5-3y$ is divisible by $2$. This happens at $y = [...-5, -3, -1, 1, 3, 5...]$ We see that we have a common difference of $2$ with the values shifted up by $1$, yielding $y=1+2n$ or $y=1-2n$

Checking the conditional expressions for what we want, we have our final solution, $(1\pm3n, 1\mp2n), \quad n\in \mathbb{Z} \quad$ (note that the sign on the equation for $y$ must be the opposite for $x$)

First you find a particular solution. Say $(x, y) = (1, 1)$.

Then you suppose that $2x + 3y = 5$ for some $(x, y)$

So \begin{align} 2x + 3y &= 2(1) + 3(1)\\ 2(x-1) &= -3(y-1)\\ \end{align}

Hence $2 \mid -3(y-1)$.

Since $2$ and $-3$ are relatively prime, we must have $2 \mid y-1$. That is $y - 1 = 2t$ for some integer $t$.

So $y = 2t + 1$ for some integer $t$.

Substituting this back into $2(x-1) = -3(y-1)$, we find $x = -3t + 1$.

What we have shown is that, if $(x, y)$ is a solution to $2x + 3y = 5$, then $(x,y) = (-3t+1, 2t+1)$ for some integer $t$.

It is easy to verify that if $(x,y) = (-3t+1, 2t+1)$ for some integer $t$, then $(x, y)$ is a solution to $2x + 3y = 5$.

Hence $(x, y)$ is a solution to $2x + 3y = 5$, if and only if $(x,y) = (-3t+1, 2t+1)$ for some integer $t$.


Problem description . In axiomatic set theory (as developed, for example, in the ZFC axioms), the existence of the power set of any set is postulated by the axiom of power set. b) List all the distinct subsets for the set {S,L,E,D}. c) How many of the distinct subsets are proper subsets? A subset that is smaller than the complete set is referred to as a proper subset. is a subset of (written ) iff every member of is a member of .If is a proper subset of (i.e., a subset other than the set itself), this is written .If is not a subset of , this is written . To ensure that no subset is missed, we list these subsets according to their sizes. Admin AfterAcademy 31 Dec 2019. For example: Plants are a subset of living things. The set of living things is very big: it has a lot of subsets. Since $$\emptyset$$ is the subset of any set, $$\emptyset$$ is always an element in the power set. Examples. So the set {1, 2} is a proper subset of the set {1, 2, 3} because the element 3 is not in the first set… Example 29 List all the subsets of the set { –1, 0, 1 }. Animals are a subset of living things. (The notation is generally not used, since automatically means that and cannot be the same.). SUBSETS. Human beings are a subset of animals. So there are a total of $2\cdot 2\cdot 2\cdot \dots \cdot 2$ possible resulting subsets, all the way from the empty subset, which we obtain when we say “no” each time, to the original set itself, which we obtain when we say “yes” each time. An area of intersection is then defined which contains all the common elements. Subset intersection: sometimes, various sets are different but share some common elements. Print all subsets of a given set. ⛲ Example 5: Distinct Subsets a) Determine the number of distinct subsets for the set {S,L,E,D}. In mathematics, the power set (or powerset) of a set S is the set of all subsets of S, including the empty set and S itself. Let us evaluate $$\wp(\{1,2,3,4\})$$. Next, list the singleton subsets (subsets with only one element). The subset of {1,2,3,4} are {},{1}, {2}, {3}, {4} {1,2}, {1,3}, {1,4}, {2,3}, {2,4}, {3,4}, {1,2,3}, {1,2,4} {1,3,4}, {2,3,4} and {1,2,3,4} set ={1,2,3,4} has 16 subsets. The set is not necessarily sorted and the total number of subsets of a given set of size n is equal to 2^n. AfterAcademy. So for the whole subset we have made $n$ choices, each with two options. This is the subset of size 0. Solution: a) Since the number of elements in the set is 4, the number of distinct subsets … Difficulty: MediumAsked in: Facebook, Microsoft, Amazon Understanding the Problem . Let A= { –1, 0, 1} Number of elements in A is 3 Hence, n = 3 Number of subsets of A = 2n where n is the number of elements of the set A = 23 = 8 The subsets of {–1, 0, 1} are , {−1}, {0}, {1}, {−1, 0}, {0, 1}, {−1, 1}, and {−1, 0, 1} Show More. A subset is a portion of a set. The powerset of S is variously denoted as P (S), (S), P(S), ℙ(S), ℘(S) (using the "Weierstrass p"), or 2 S. Interview Kit Blogs Courses YouTube Login. Subset.

.

Cold Smoke Brats, Lenovo Yoga 720-13ikb Parts, E Aeolian Scale, Zucchini Spinach Ricotta Rolls, 32-bit Ram Limit, Jeskai Ascendancy Mtg, Sparrow Sound Effect, Best Air Fryer Rotisserie, Dehydrator,


# Partitions in which no part is a square?

I asked a similar question earlier about partitions, and have a suspicion about another way to count partitions.

Is it true that the number of partitions of $n$ in which each part $d$ is repeated fewer than $d$ times is equal to the number of partitions of $n$ where no part is a square?

I tried this out for $n=2,3,4$, and so far it checks out. Is there a way to prove it more generally?

-
The natural thing to do in such a case is to write generating functions for the two cases and see if they look similar. Even if you can't decide, computing a number of terms of the series is much faster than testing cases by hand. Did you try? –  Marc van Leeuwen Dec 17 '11 at 19:04

As mentioned in the comment above, generating functions are the standard tool for proving such statements. If you can write down the proper generating functions, proofs sometimes just fall right out.

Let $S = \{ \ell^2 \;|\; \ell \in \mathbb{N} \}$ be the set of perfect squares.

In the following generating function: the coefficient of $x^k$ is the number of partitions of $k$ which do not involve $d$ or more copies of $d$ for each $d$.

$$\prod\limits_{d=1}^\infty \left(\sum\limits_{j=0}^{d-1} x^{jd}\right) =$$

$$(1+x^2)(1+x^3+x^6)(1+x^4+x^8+x^{12})\cdots (1+x^d+x^{2d}+\cdots+x^{d(d-1)}) \cdots$$

$$=((1-x^2)^{-1}-x^{2^2}(1-x^2)^{-1})((1-x^3)^{-1}-x^{3^2}(1-x^3)^{-1})\cdots ((1-x^k)^{-1}-x^{k^2}(1-x^k)^{-1}) \cdots$$

$$=\left(\frac{1-x^{1^2}}{1-x^1}\right)\left(\frac{1-x^{2^2}}{1-x^2}\right)\left(\frac{1-x^{3^2}}{1-x^3}\right)\cdots \left(\frac{1-x^{k^2}}{1-x^k}\right) \cdots$$

$$=\prod\limits_{k = 1}^\infty \frac{1-x^{k^2}}{1-x^k} = \prod\limits_{k = 1}^\infty \frac{\frac{1}{1-x^k}}{\frac{1}{1-x^{k^2}}} =\frac{\prod\limits_{k = 1}^\infty \frac{1}{1-x^k}}{\prod\limits_{k=1}^\infty\frac{1}{1-x^{k^2}}} = \prod\limits_{k\in\mathbb{N}-S} \frac{1}{1-x^k}$$

In the final generating function: the coefficient of $x^k$ counts the number of partitions not involving perfect squares.

Edit For a bit more about generating functions here is a link to another question I answered: partitions and generating functions

-
Thank you Bill, this is a great answer. –  Noel Dec 18 '11 at 6:18
@Bill: In the last line, wouldn't you prefer just cancelling the terms $1-x^{k^2}$ against their counterparts in the denominator right away? –  Marc van Leeuwen Dec 18 '11 at 17:13
@MarcvanLeeuwen I guess that would have been a bit more efficient. Oh well. :) Since it doesn't make a big difference, I'll just leave it alone. –  Bill Cook Dec 18 '11 at 18:46

Now that you have a generating function proof (so you know the result is true), you may wonder if you can actually map partitions of one kind bijectively to those of the other kind. Motivated by this other question, the following idea comes to mind: starting with a partition in which no part $d$ is repeated $d$ times or more, in order to get rid of square parts, break any part $x^2$ into $x$ parts equal to $x$, and repeat. Since there were no parts equal to $1$ this terminates, producing a partition without square parts.

We must show that every partition of without square parts is produced exactly once from a partition in which no part $d$ is repeated more $d$ times or more. We can treat non-squares separately: if $k>1$ is a non-square, then the parts in the original partition that would have been broken up eventually into parts of size $k$ are those of size $k$, $k^2$, $k^4$, $k^8$, ..., $k^{2^i}$,... Supposing the multiplicity of $k$ in the final partition is $m$, we must decompose $$mk=c_0k+c_1k^2+c_2k^4+\cdots+c_ik^{2^i}+\cdots \quad\text{with c_i<k^{2^i} for all i\in\mathbf N}$$ But this is uniquely possibly by the expression of $mk$ in the mixed radix number system with place values $1,k,k^2,k^4,k^8,\ldots$ (the initial $1$ is only there to have a number system capable of expressing all natural numbers; $mk$ being a multiple of $k$ has digit $0$ on this least significant position.) Concretely one can find the $c_i$ either in order of increasing $i$ by taking remainders modulo the next $k^{2^{i+1}}$, or by decreasing $i$ by allocating the largest chunks first and then using smaller chunks for what is left of $mk$.

-
Thanks for this other argument, Marc van Leeuwen. –  Noel Dec 19 '11 at 7:05
See Wilf's Lectures on Integer Partitions for more on bijections like this. –  David Bevan Dec 19 '11 at 8:56
@David Bevan: Thank you for the reference. So apparently this bijection, as well as the one in the question I linked to, are special cases of a general construction of partition maps proved to be bijective by Kathleen O'Hara. –  Marc van Leeuwen Dec 21 '11 at 14:26