# a pyramid

• August 24th 2008, 01:57 AM
perash
a pyramid
Consider a pyramid with a square base. The side length of the
base is 2 units and the height of the pyramid is 1 unit. Imagine
placing a cube inside this pyramid (resting on the base of the
pyramid) such that each of the four top corners of the cube is
touching each of the 4 slanted edges of the pyramid .
Find the dimensions of the cube. That is, find the value, in
units, of the length of one edge of the cube.
• August 24th 2008, 03:27 AM
ticbol
Quote:

Originally Posted by perash
Consider a pyramid with a square base. The side length of the
base is 2 units and the height of the pyramid is 1 unit. Imagine
placing a cube inside this pyramid (resting on the base of the
pyramid) such that each of the four top corners of the cube is
touching each of the 4 slanted edges of the pyramid .
Find the dimensions of the cube. That is, find the value, in
units, of the length of one edge of the cube.

So the the top four corners of the cube are along the slanted edges of the pyramid. Then the four edges of the base of the cube are parallel to the edges of the base of the pyramid each to each.

View the figure from the top, or on the top. We will get a vertical cross-section along one of the equal diagonals of the base of the pyramid.
The diagonal of the pyramid is 2sqrt(2) units long...by Pythagorean theorem.
The diagonal of the cube, whose edge is, say, x units long, is x*sqrt(2) units long.

Now view that said cross-section vertically, or from the side, or from one of the un-cut corner of the base of the pyramid.
The figure is that of an isosceles triangle whose base is 2sqrt(2) units long, and whose height is 1 unit long.
Inside it is a rectangle whose base is x*sqrt(2) units long, and whose height is x units long.
Above the rectangle is a smaller isosceles triangle whose base is x*sqrt(2) and whose height is (1-x) units long.
The two isosceles triangles are similar, and so, proportional.
By proportion,
2sqrt(2) /1 = x*sqrt(2) /(1-x)
2 = x /(1-x)
2(1-x) = x
2 -2x = x
2 = x +2x
x = 2/3 unit long ---------------answer
• August 24th 2008, 05:16 AM
Soroban
Hello, perash!

I used the same approach as ticbol, but got a different answer.

Quote:

Consider a pyramid with a square base. The side length of the base is 2 units
and the height of the pyramid is 1 unit. Imagine placing a cube inside this pyramid
(resting on the base of the pyramid) so that each of the four top corners of the cube
is touching each of the 4 slanted edges of the pyramid.

Find the dimensions of the cube.
That is, find the value, in units, of the length of one edge of the cube.

Looking down on the pyramid, we see:
Code:

      *-----------*       | *      * |       |  *  *  |       |    *    | 2       |  *  *  |       | *      * |       *-----------*             2
The diagonal of this square is $2\sqrt{2}$

Slice the pyramid along a diagonal and we have this cross-section:
Code:

    -                *     :              * | *     :            *  |  *     :          *-----+-----*     1        * |    |    | *     :      *  |    |    |  *     :    *    |    |  2x|    *     :  *      |    |    |      *     - *---------*-----*-----*---------*       :      √2      :  x  :  √2-x  :
The lower-right right triangle is similar to the largest right triangle.

We have: . $\frac{2x}{\sqrt{2}-x} \:=\:\frac{1}{\sqrt{2}} \quad\Rightarrow\quad 2\sqrt{2}x \:=\:\sqrt{2} - x$

. . $2\sqrt{2}x + x \:=\:\sqrt{2} \quad\Rightarrow\quad (2\sqrt{2}+1)x \:=\:\sqrt{2} \quad\Rightarrow\quad x \:=\:\frac{\sqrt{2}}{2\sqrt{2}+1}
$

The side of the cube is: . $2x \;=\;\frac{2\sqrt{2}}{2\sqrt{2} + 1} \;=\;\frac{2(4-\sqrt{2})}{7}$

• August 24th 2008, 04:58 PM
ticbol
Quote:

Originally Posted by Soroban
Hello, perash!

I used the same approach as ticbol, but got a different answer.

Looking down on the pyramid, we see:
Code:

      *-----------*       | *      * |       |  *  *  |       |    *    | 2       |  *  *  |       | *      * |       *-----------*             2
The diagonal of this square is $2\sqrt{2}$

Slice the pyramid along a diagonal and we have this cross-section:
Code:

    -                *     :              * | *     :            *  |  *     :          *-----+-----*     1        * |    |    | *     :      *  |    |    |  *     :    *    |    |  2x|    *     :  *      |    |    |      *     - *---------*-----*-----*---------*       :      √2      :  x  :  √2-x  :
The lower-right right triangle is similar to the largest right triangle.

We have: . $\frac{2x}{\sqrt{2}-x} \:=\:\frac{1}{\sqrt{2}} \quad\Rightarrow\quad 2\sqrt{2}x \:=\:\sqrt{2} - x$

. . $2\sqrt{2}x + x \:=\:\sqrt{2} \quad\Rightarrow\quad (2\sqrt{2}+1)x \:=\:\sqrt{2} \quad\Rightarrow\quad x \:=\:\frac{\sqrt{2}}{2\sqrt{2}+1}
$

The side of the cube is: . $2x \;=\;\frac{2\sqrt{2}}{2\sqrt{2} + 1} \;=\;\frac{2(4-\sqrt{2})}{7}$

I'm sorry to comment, since perash or anybody did not comment, but the cube should appear as a rectangle, not a square, in your diagram. The length of the base now of the rectangle should be (2x)sqrt(2). Not 2x as is in your diagram. You sliced along a diagonal of the base of the pyramid, remember.
• August 26th 2008, 03:17 AM
Soroban
Hello, ticbol!

Another blunder . . . *blush*

Quote:

The cube should appear as a rectangle, not a square, in your diagram.
The length of the base now of the rectangle should be (2x)sqrt(2).
Not 2x as is in your diagram.
You sliced along a diagonal of the base of the pyramid, remember.

Absolutely right!

I'll try to correct my work and get back soon . . .


# How to know if the angle is positive or negative in inverse trigonometry

I have been doing this problem this problem:

$$Cos[Tan^{-1}(-\frac{2}{3})]$$ So I was instructed to draw a triangle to guide me so I did

Now once I drew my triangle I found the hypotenuse, which is $$\sqrt{13}$$

And then I was able to obtain the answer to this expression which I got:

$$\frac{2\sqrt{13}}{13}$$

However, I am told I drew the triangle wrong, it is actually -2 (negative) and (3) positive. Why is it that the triangle is wrong? I was told the actual answer is

$$\frac{3\sqrt{13}}{13}$$

Arctan has a range of $\frac{-\pi}{2}\le{y}\le\frac{\pi}{2}$. Now let $arctan\frac{-2}{3}=y$. This implies $tany=\frac{-2}{3}$. Because tan is negative, we know y must lie in quadrant IV. It cannot lie in quadrant I because tan is positive in quadrant I. Therefore we draw our angle as you have above. Now, note that $tan\theta=\frac{opposite}{adjacent}$. Therefore, you should have $-2$ where $3$ is in your picture, and you should have $3$ where $-2$ is. Your line should be drawn to the coordinate $(3,-2)$. Now, we find the hypotenuse as you have already done using the Pythagorean Theorem. We find that it is $\sqrt{13}$ as you've noted. Now, because we are finding $cos(arctan\frac{-2}{3})$, we will use the fact that $cos\theta=\frac{adjacent}{hypotenuse}$. So, this gives $\frac{3}{\sqrt{13}}$. Rationalizing we have $\frac{3\sqrt{13}}{13}$
• Yes, tangent is negative in quadrant IV and II, but the range for arctan is limited to $\frac{-\pi}{2}\le{y}\le\frac{\pi}{2}$ so our angle cannot lie in quadrant II. It must lie in either quadrant I or IV. And since it is negative, it must lie in quadrant IV. – MathGuy Jan 27 '17 at 3:04
• Yes, the ranges are different though depending on the inverse trig function. For arcsin the range is $\frac{-\pi}{2}\le{y}\le\frac{\pi}{2}$, for arccos the range is $0\le{y}\le\pi$ and for arctan the range is $\frac{-\pi}{2}\le{y}\le\frac{\pi}{2}$ – MathGuy Jan 27 '17 at 3:12


# Further question on My Fractions problem

#### tmt

##### Active member
I have a separate question on the same problem from my prior post.

I need an equation for a tangent which has a slope of 5/6 and passes through (1,3)

y-3 = 5/6(x-1)

I simplify this to

y= 5/6x +13/6

However the answer given is y = 7/6(x) + 13/6

Where am I going wrong?

Yours,

Timothy

#### MarkFL

Staff member
Your line has the required slope, while the given answer has the wrong slope. It is most likely a typo somewhere, either in the statement of the problem or the given answer. Can you post the original problem in its entirety?

#### tmt

##### Active member
PROBLEM 11 : Find an equation of the line tangent to the graph of x2 + (y-x)3 = 9 at x=1 . '

This is the end of the answer:

Thus, the slope of the line tangent to the graph at (1, 3) is

$m = y' = \displaystyle{ 3 (3-1)^2 - 2(1) \over 3 (3-1)^2 } = \displaystyle{ 10 \over 12 } = \displaystyle{ 5 \over 6 }$ ,

and the equation of the tangent line is

y - ( 3 ) = (5/6) ( x - ( 1 ) ) ,

or

y = (7/6) x + (13/6) .

I suspect it is a typo in the answer. Here is the link for the full answer.

https://www.math.ucdavis.edu/~kouba...soldirectory/ImplicitDiffSol.html#SOLUTION 11

#### MarkFL

Staff member
Okay, I see now...I assumed the slope was given as 5/6. Let's take a look at the problem. We are given the curve:

$$\displaystyle x^2+(y-x)^3=9$$

So, implicitly differentiating with respect to $x$, we find:

$$\displaystyle 2x+3(y-x)^2\left(\frac{dy}{dx}-1 \right)=0$$

Solving for $$\displaystyle \frac{dy}{dx}$$, we find:

$$\displaystyle \frac{dy}{dx}=1-\frac{2x}{3(y-x)^2}$$

Now, when $x=1$, we find from the original curve:

$$\displaystyle 1^2+(y-1)^3=9$$

$$\displaystyle y=3$$

And so we find the slope at the given point is:

$$\displaystyle \left.\frac{dy}{dx} \right|_{(x,y)=(1,3)}=1-\frac{2(1)}{3(3-1)^2}=1-\frac{2}{12}=\frac{5}{6}$$

Hence, using the point-slope formula, we obtain the tangent line:

$$\displaystyle y-3=\frac{5}{6}(x-1)$$

$$\displaystyle y=\frac{5}{6}x+\frac{13}{6}$$

Here is a plot of the curve and the tangent line:

#### Deveno

##### Well-known member
MHB Math Scholar
PROBLEM 11 : Find an equation of the line tangent to the graph of x2 + (y-x)3 = 9 at x=1 . '

This is the end of the answer:

Thus, the slope of the line tangent to the graph at (1, 3) is

$m = y' = \displaystyle{ 3 (3-1)^2 - 2(1) \over 3 (3-1)^2 } = \displaystyle{ 10 \over 12 } = \displaystyle{ 5 \over 6 }$ ,

and the equation of the tangent line is

y - ( 3 ) = (5/6) ( x - ( 1 ) ) ,

or

y = (7/6) x + (13/6) .

I suspect it is a typo in the answer. Here is the link for the full answer.

https://www.math.ucdavis.edu/~kouba...soldirectory/ImplicitDiffSol.html#SOLUTION 11
I concur that both you and MarkFL are correct, the link you provided has a typo in the very last line (it is correct until that), and the correct tangent line has the equation:

$y = \dfrac{5}{6}x + \dfrac{13}{6}$


Find all values of $k$ for $kx^2+(k+2)x-3=0$ with positive roots.

$$kx^2+(k+2)x-3=0$$

This quadratic has roots which are real and positive.

Find all possible values of $k$.

$$Δ = (k+8)^2-60$$ $$==> (k+8)^2-60>0$$ $$k>2\sqrt{15}\ - 8$$ and $$k<-2\sqrt{15}\ -8$$

However this didn't look right. Any suggestions?

Edit: I think I might have figured it out.

Since we know,

$$k\not= 0$$ $$\frac{-3}{k}>0$$ $$\therefore k<0$$

What I got earlier was not wrong, but rather incomplete.

$$k<-2\sqrt{15} -8$$ This can be ruled out since, $$k<0$$ $$\therefore 2\sqrt{15} -8 < k < 0$$

If someone could please still check my work that would be nice.

• I appreciate the advice, I had already tried something but was not sure if it was the correct "path" for this problem so I didn't show it. – StrBoP Jul 9 '18 at 18:48
• You're welcome. Note that positive numbers are always real, so the "real" in "real and positive" is redundant. – Shaun Jul 9 '18 at 18:54
• Do you mean $(k+2)^2$? – Chris2018 Jul 9 '18 at 18:59
• No, I can show more work if you'd like. But after simplifying to a greater extent you get a quadratic, Since that quadratic wasnt factorable I completed the square and then I got that. Sorry if I confused you. – StrBoP Jul 9 '18 at 19:02

Hint:

Using Vieta's formulas, you can see that the multiplication of the roots of a quadratic $ax^2+bx+c$ is given by $\frac{c}{a},$ which is equal to $\frac{-3}{k}$ in your case.

Since both roots are positive, this means that $\frac{-3}{k}$ must be positive and $k$ must be negative. Also, the sum of the roots (given by $-\frac{b}{a}$) must be positive too: $-\frac{k+2}{k} > 0$.

Since we already know that $k$ is negative, we get $-(k+2) < 0 \iff -2 < k$. Hence, $-2<k<0$ so far.

Now in order for this quadratic to have real roots, its discriminant must be non-negative. After you write it down, you see that you should solve the inequality $$(k+2)^2-4k(-3) =(k+2)^2+12k \geq 0$$ to find the range of values for $k,$ and then intersect it with $$-2 < k <0$$ at the end.

$$(k+2)^2+12k \geq 0 \iff k\geq \sqrt{60}-8 \text{ or } k\leq -8 -\sqrt{60}$$

Intersecting this range with $-2 < k < 0$ gives $\sqrt{60}-8 \leq k<0$.

• Might also be helpful to quote Vieta's formulas. – TheSimpliFire Jul 9 '18 at 18:47
• A positive product of the roots is not enough. – Bernard Jul 9 '18 at 18:51
• @stressed out , Thank you for the help – StrBoP Jul 9 '18 at 18:59
• How do you get $-(k+2) < 0 \iff 2 < k$? $$-(k+2) < 0 \implies -2 < k$$ From this it does not follow that $2 < k$ – gd1035 Jul 9 '18 at 19:05
• @stressedout Sorry for bothering once again, but I checked at the back of the book and the answer read: -8 +√60 </ k < 0 – StrBoP Jul 9 '18 at 19:05

You have three conditions to check:

1. This equation has real roots. It means it is a quadratic equation ($k\ne 0$) and its discriminant should be positive: $$\Delta=(k+2)^2+12k=k^2+16k+4=(k+8)^2-60>0,$$ so either $k<-8-2\sqrt{15}\:$ or $\:k>-8+2\sqrt{15}$.
2. The roots must have the same sign, i.e. their product $-\dfrac 3k>0$, which means $\:\color{red}{k<0}$.
3. This sign must be positive. If the roots have the same sign, this sign is also the sign of their sum $\:-\dfrac{k+2}k$, which is the sign of the product $-k(k+2)$. To sum it up, we need to have $k(k+2)<0$, which happens if and only if $\: \color{red}{-2<k<0}$.

Now note that$\:-8-2\sqrt{15}<-2$, and as $\;3<\sqrt{15}<4$ we have $\:-2<-8+2\sqrt{15}<0\:$.

Thus eventually the solutions are $$-8+2\sqrt{15}<k<0.$$

• The maniac downvoter struck gain! – Bernard Jul 9 '18 at 23:10


# Find $\sum_{m=0}^n\ (-1)^m m^n {n \choose m}$

I'm going to university in October and thought I'd have a go at a few questions from one of their past papers. I have completed the majority of this question but I'm stuck on the very last part. In honesty I've been working on this paper a while now and I'm a bit tired so I'm probably giving up earlier than I usually would.

I won't write out the full question, only the last part:

Let $$S_r(n) = \sum_{m=0}^n\ (-1)^m m^r {n \choose m}$$ where r is a non-negative integer . Show that $S_r(n)=0$ for $r<n$. Evaluate $S_n(n)$.

I have shown that $S_r(n)=0$ for $r<n$ by taking $(1+z)^n= \sum_{m=0}^n\ z^m {n \choose m}$, letting $D_r(f(z))=z\frac d{dz}(z\frac d{dz}...(\frac d{dz}(f(z)))...)$ where $z\frac d{dz}$ is applied $r$ times and applied it to both sides. The left hand side gives a polynomial, degree n which has factor $(1+z)$ for all $r<n$ and the right hand side gives $\sum_{m=0}^n\ z^m (m)^r {n \choose m}$. Setting $z=-1$ yields the required result.

There is some build up to this, so I'm fairly certain that this was the intended method.

I'm stuck however on the very last part. I have tried finding a form for $D_r((1+z)^n)$, but I'm fairly sure that this isn't the correct approach, as the wording of the question implies that $S_n(n)$ needs to be considered separately.

I'm surprised that I didn't find that this question had already been asked, so apologies if it has been.

Thank you.

• Looks like a close relative of Stirling numbers of the second kind. Please see Wikipedia. – André Nicolas Jul 7 '16 at 22:01
• Ok thanks, will do – Aka_aka_aka_ak Jul 7 '16 at 22:12
• You are welcome. Note the close relationship to the number of onto functions. The calculation you carried out successfully (and that I would have trouble with) can be bypassed once we note there are $0$ onto functions from an $r$-element set to an $n$-element set if $r\lt n$. – André Nicolas Jul 7 '16 at 22:23

The following relation encapsulates the Stirling number semantics:

$$m^r = r! [z^r] \exp(mz).$$

$$S_r(n) = r! [z^r] \sum_{m=0}^n {n\choose m} (-1)^m \exp(mz) = r! [z^r] (1-\exp(z))^n.$$

Now observe that

$$1-\exp(z) = - z - \frac{z^2}{2} - \frac{z^3}{6} -\cdots$$

which means that $(1-\exp(z))^n$ starts at $[z^r]$ where $r=n$ with coefficient $(-1)^n$, producing for the sum the value

$$(-1)^n\times n!$$

and the coefficients on $[z^r]$ with $r\lt n$ are zero.

The general form of the summation

$$\sum_{m=0}^n(-1)^mm^n\binom{n}m\;,\tag{1}$$

with the alternating sign and the binomial coefficient $\binom{n}m$, suggests that it can be interpreted as an inclusion-exclusion calculation. However, the $m=0$ term is $0$, from which we begin by subtracting a positive quantity $\binom{n}1=n$, which is a bit odd for such a calculation. This suggests letting $k=n-m$ and rewriting as

$$\sum_{k=0}^n(-1)^{n-k}(n-k)^n\binom{n}{n-k}=(-1)^n\sum_{k=0}^n(-1)^k\binom{n}k(n-k)^n\;,$$

where the righthand side has been arranged to look like a more or less typical inclusion-exclusion calculation. The factor $(n-k)^n$ is the one that isn’t part of the inclusion-exclusion machinery. It has a natural interpretation as the number of functions from $[n]$ to $[n]$ whose ranges are disjoint from some $k$-element subset of $[n]$. If for each $k\in[n]$ we let $F_k$ be the set of functions from $[n]$ to $[n]$ whose ranges do not contain $k$, we have

$$\left|\bigcap_{k\in I}F_k\right|=(n-|I|)^n$$

whenever $\varnothing\ne I\subseteq[n]$, so

\begin{align*} \left|\bigcup_{k=1}^nF_k\right|&=\sum_{\varnothing\ne I\subseteq[n]}(-1)^{|I|-1}\left|\bigcap_{k\in I}F_k\right|\\ &=\sum_{\varnothing\ne I\subseteq[n]}(-1)^{|I|-1}(n-|I|)^n\\ &=\sum_{k=1}^n(-1)^{k-1}\binom{n}k(n-k)^n\;. \end{align*}

This is the number of functions from $[n]$ to $[n]$ that are not surjective, i.e., the number that aren’t bijections. It follows that the number of bijections from $[n]$ to $[n]$ is

$$n^n-\sum_{k=1}^n(-1)^{k-1}\binom{n}k(n-k)^n=\sum_{k=0}^n(-1)^k\binom{n}k(n-k)^n\;.$$

On the other hand, we know that there are $n!$ bijections from $[n]$ to $[n]$, so

$$\sum_{m=0}^n(-1)^mm^n\binom{n}m=(-1)^n\sum_{k=0}^n(-1)^k\binom{n}k(n-k)^n=(-1)^nn!\;.$$

Note that the same basic argument handles the previous part of the problem. The factor $(n-k)^n$ is replaced by $(n-k)^r$, the number of functions from $[r]$ to $[n]$ whose ranges are disjoint from some specified $k$-element subset of $[n]$. The expression

$$\sum_{k=0}^n(-1)^k\binom{n}k(n-k)^r$$

counts the surjective functions from $[r]$ to $[n]$, and if $r<n$, this is of course $0$.

All of this is very closely related to the Stirling numbers of the second kind.

• @BrianMScott: Very nice and clearly written exposition. (+1) – Markus Scheuer Jun 30 '18 at 16:51


# Least Squares Solver

Define least squares. In order for the solution to represent sensible pixel values, restrict the solution to be from 0 through 1. 1 Introduction. Students, teachers, parents, and everyone can find solutions to their math problems instantly. The numerical instability and performance are issues of larger problems and general setting. This example shows how to solve a nonlinear least squares problem in two ways. While symbolically correct, using the QR decomposition instead is numerically more robust. - linear_least_squares. Solve least-squares (curve-fitting) problems. Sitio Espejo para América Latina. Linear regression calculator Two-dimensional linear regression of statistical data is done by the method of least squares. Linear Regression calculator uses the least squares method to find the line of best fit for a sets of data X and Y or the linear relationship between two dataset. Let us understand What is Linear Regression and how to perform it with the help Ordinary Least Squares (OLS) estimator with an example. 1 Solving Least Squares Systems: SVD Approach One way to solve overdetermined systems is to use the Singular Value Decomposition of a matrix. solver to vary the values for A, C and k to minimize the sum of chi squared. LMS incorporates an. Solve any equations from linear to more complex ones online using our equation solver in just one click. Linear vs. From the geometric perspective, we can deal with the least squares problem by the following logic. Enter the statistical data in the form of a pair of numbers, each pair is on a separate line. Algorithm 1 Least-squares sub-problem input: H 2 CN ⇥N, q 2 CN, P 2 RM ⇥N, d 2 CM for each receiver (j )(rowinP) in parallel do H⇤ w j = p⇤ j {solve 1 PDE} end for W =[w 1 w 2w m] {distributed matrix} S =(I M + 2 W⇤ W)1 {adjust using Algorithm 2 (optional)} for source (i) in parallel do y i =(I N 2 WSW⇤)(q i + 2 Wd i) Hu i = y i {solve 1 PDE} end for output: u. The main purpose is to provide an example of the basic commands. Recall the formula for method of least squares. Microsoft Excel provides a tool called Solver that handles this prob-lem in a manner that is transparent to the user. Now click on ﬁSolveﬂ. Find a linear least squares fit for a set of points in Visual Basic. In this section w e brie y presen t the most cited w orks in ellipse tting and its closely related problem, conic tting. Least squares fit is a method of determining the best curve to fit a set of points. This article demonstrates how to generate a polynomial curve fit using. When we pass this (near) optimal solution to NL2SOL it will have an easy task. Nonlinear Least Squares Data Fitting D. 1 Introduction More than one explanatory variable In the foregoing chapter we considered the simple regression model where. An apparatus is available that marks a strip of paper at even intervals in time. Most math majors have some exposure to regression in their studies. Least-squares imaging and deconvolution using the hybrid norm conjugate-direction solver Yang Zhang and Jon Claerbout ABSTRACT To retrieve a sparse model, we applied the hybrid norm conjugate-direction (HBCD) solver proposed by Claerbout to two interesting geophysical problems: least-squares imaging and blind deconvolution. Learn more about least squares, curve fitting, optimization, nonlinear, fitting. A number of methods may be employed to solve this problem. In some applications, it may be necessary to place the bound constraints $$l \leq x \leq u$$ on the variables $$x$$. solve_least_squares_lm This is a function for solving non-linear least squares problems. First, least squares is a natural approach to estimation, which makes explicit use of the structure of the model as laid out in the assumptions. lstsq for the "direct" appraoch (as far as I know this uses SVD by standard, but I also tried all the other LINPACK options that scipy offers) $\endgroup$ – Bananach Oct 25 '16 at 19:14. Linear vs. C2, and D2) and then use Solver to find the least-squares parameters A, B, and C. MATH 3795 Lecture 9. You can perform least squares fit with or without the Symbolic Math Toolbox. This is a solved. You can vote up the examples you like or vote down the ones you don't like. The following is a sample implementation of simple linear regression using least squares matrix multiplication, relying on numpy for heavy lifting and matplotlib for visualization. Least squares regression analysis or linear regression method is deemed to be the most accurate and reliable method to divide the company’s mixed cost …. A least squares model contains a dummy objective and a set of linear equations: sumsq. 3 The Role of The quantities generated by the Lanczos process from (2. If it is not in the range, then it is the least squares solution. Loading Least-Squares Regression Line. The nonlinear problem is usually solved by iterative. SPGL1: A solver for sparse least squares. This is a mean estimated from a linear model. An issue came up about whether the least squares regression line has to pass through the point (XBAR,YBAR), where the terms XBAR and YBAR represent the arithmetic mean of the independent and dependent variables, respectively. This x is called the least square solution (if the Euclidean norm is used). Nonlinear least-squares solves min(∑||F(x i ) – y i || 2 ), where F(x i ) is a nonlinear function and y i is data. Answer to 4. The most expensive phase is the LSQR phase. solve a non-linear least squares problem. This page gathers different methods used to find the least squares circle fitting a set of 2D points (x,y). The equation for least squares solution for a linear fit looks as follows. Yanbo Liang (JIRA) Sun, 03 Jan 2016 18:05:30 -0800. In fact, I used this kind of solution in some situations. Define least squares. Factoring-polynomials. LEAST SQUARES and NORMAL EQUATIONS Background Overdetermined Linear systems: consider Ax = b if A is m n, x is n 1, b is m 1 with m > n. The least squares approach to regression is based upon minimizing these difference scores or deviation scores. Polynomials Least-Squares Fitting: Polynomials are one of the most commonly used types of curves in regression. For a general problem you wouldn't use this, of. so somewhere I'm doing something wrong. Let [] ∀k∈ℕ be a dispersion point in. Triangle Calculator. Nonlinear Least-Squares Fitting. Now that we have determined the loss function, the only thing left to do is minimize it. Given a matrix equation Ax=b, the normal equation is that which minimizes the sum of the square differences between the left and right sides: A^(T)Ax=A^(T)b. Least-Squares Line Least-Squares Fit LSRL The linear fit that matches the pattern of a set of paired data as closely as possible. Introduction¶. This influence is exaggerated using least squares. solver to vary the values for A, C and k to minimize the sum of chi squared. Therefore the least squares solution to this system is: xˆ = (A TA)−1A b = −0. 00000 Covariance matrix of Residuals 0. solve a non-linear least squares problem. Dr Gregory Reeves 26,616 views. To solve least squares problems based on PDE models requires sophisticated numerical techniques but also great attention with respect to the quality of data and identiﬁability of the parameters. 33 so this is our prediction. ‘huber’ : rho(z) = z if z <= 1 else 2*z**0. But how does this relate to the least-squares problem, where there are multiple measurements? Is the problem I am trying to solve essentially the same, except that the number of measurements is one? And in that case, is using Ceres Solver's non-linear least squares solver really necessary? Thanks!. The following is a sample implementation of simple linear regression using least squares matrix multiplication, relying on numpy for heavy lifting and matplotlib for visualization. Also tells you if the entered number is a perfect square. It estimates the value of a dependent variable Y from a given independent variable X. An online LSRL calculator to find the least squares regression line equation, slope and Y-intercept values. least squares solution). Node 13 of 18 Node 13 of 18 The Mixed Integer Linear Programming Solver Tree level 1. Order fractions from least to greatest or from greatest to least. The computational burden is now shifted, and one needs to solve many small linear systems. I'd like to know how to solve the least squares non linear regression in java only by passing a matrix A and a vector b like in python. Heh--reduced QR left out the right half of Q. SOLVING DIFFERENTIAL EQUATIONS WITH LEAST SQUARE AND COLLOCATION METHODS by Katayoun Bodouhi Kazemi Dr. 00004849386 0. The Excel Solver can be easily configured to determine the coefficients and Y-intercept of the linear regression line that minimizes the sum of the squares of all residuals of each input equation. Certain types of word problems can be solved by quadratic equations. In this lesson, we will explore least-squares regression and show how this method relates to fitting an equation to some data. There are many possible cases that can arise with the matrix A. The best-fit line, as we have decided, is the line that minimizes the sum of squares of residuals. Anyway, if you want to learn more about the derivation of the normal equation, you can read about it on wikipedia. The solve() method finds a vector x such that Σ i [f i (x)] 2 is minimized. Severely weakens outliers influence, but may cause difficulties in optimization process. When we used the QR decomposition of a matrix to solve a least-squares problem, we operated under the assumption that was full-rank. We have our explanatory variable x, that gets multiplied by this slope beta 1, and we also have an intercept where the line intersects the y axis. solve a non-linear least squares problem. A linear fit matches the pattern of a set of paired data as closely as possible. Given a set of samples {(x i,y i)}m i=1. lstsq in terms of computation time and memory. Triangle Calculator. Square of Matrix Calculator is an online tool programmed to calculate the square of the matrix A. This is a standard least squares problem and can easily be solved using Math. There are many possible cases that can arise with the matrix A. Since this system usually does not have a solution, you need to be satisfied with some sort of approximate solution. For any given. The GLS estimator can be shown to solve the problem which is called generalized least squares problem. y_i=A{x_i}^b When I solve for A two different ways I am getting different answers. The Least-Squares Method requires that the estimated function has to deviate as little as possible from f(x) in the sense of a 2-norm. Find answers to Weighted least Squares Excel from the expert community at Experts Exchange Also, when I load the solver case from R77:R96, the resulting. Method of Least Squares. ) Developer's Guide to Excelets/Sinex. Least–squares Solution of Homogeneous Equations supportive text for teaching purposes Revision: 1. The most widely used approximation is the least squares solution, which minimizes. The data, the interpolating polynomial (blue), and the least-squares line (red) are shown in Figure 1. * odinsbane/least-squares-in-java * NonLinearLeastSquares (Parallel Java Library Documentation) * NonlinearRegression (JMSL Numerical Library) Some related discussion here: Solving nonlinear equations. 5 Example 3: The orbit of a comet around the sun is either elliptical, parabolic, or hyperbolic. This is the general form of the least squares line. The calculator will generate a step by step explanation along with the graphic representation of the data sets and regression line. LLS is actively maintained for the course EE103, Introduction to Matrix Methods. Least Squares Regression Line of Best Fit. Other JavaScript in this series are categorized under different areas of applications in the MENU section on this. Octave also supports linear least squares minimization. Since it's a sum of squares, the method is called the method of least squares. They are connected by p DAbx. Lecture 11, Least Squares Problems, Numerical Linear Algebra, 1997. We present an algorithm for adding rows with a single nonzero to A to improve its conditioning; it attempts to add as few rows as possible. 00000241437 0. 1 Introduction A nonlinear least squares problem is an unconstrained minimization problem of the form minimize x f(x)= m i=1 f i(x)2, where the objective function is deﬁned in terms of auxiliary functions {f i}. To perform WLS in EViews, open the equation estimation dialog and select a method that supports WLS such as LS—Least Squares (NLS and ARMA), then click on the Options tab. Least Squares with Examples in Signal Processing1 Ivan Selesnick March 7, 2013 NYU-Poly These notes address (approximate) solutions to linear equations by least squares. Last edited by shg; 10-23-2017 at 01:01 PM. 20 - PhET: Free online. R factor can be used in LSQR (an iterative least-squares solver [29]) to eﬃ-ciently and reliably solve a regularization of the least-squares problem. The CVX Users’ Guide, Release 2. I am using python linalg. The results showed. Which Matlab function should I use?. A linear fit matches the pattern of a set of paired data as closely as possible. Least Squares Optimization The following is a brief review of least squares optimization and constrained optimization techniques,which are widely usedto analyze and visualize data. For treatment A, the LS mean is (3+7. Because nonlinear optimization methods can be applied to any function, for the relation between two variables, it finds functions that best fit a given set of data points from a list of more than 100 functions, which include most common and interesting functions, like gaussians, sigmoidals, rationals. AutoCorrelation (Correlogram) and persistence - Time series analysis. NET: Description: This example shows how to find a linear least squares fit for a set of points in Visual Basic. Least Squares. But, this OLS method will work for both univariate dataset which is single independent variables and single dependent variables and multi-variate dataset. 7 Least squares approximate solutions. Quadratic Regression Calculator. * odinsbane/least-squares-in-java * NonLinearLeastSquares (Parallel Java Library Documentation) * NonlinearRegression (JMSL Numerical Library) Some related discussion here: Solving nonlinear equations. In the process of solving a mixed integer least squares problem, an ordinary integer least squares problem is solved. Free Modulo calculator - find modulo of a division operation between two numbers step by step This website uses cookies to ensure you get the best experience. For details, see First Choose Problem-Based or Solver-Based Approach. Next, we develop a distributed least square solver over strongly connected directed graphs and show that the proposed algorithm exponentially converges to the least square solution provided the step-size is sufﬁciently small. Let [] ∀k∈ℕ be a dispersion point in. This is why some least-squares solvers do not use the normal equations under the hood (they instead use QR decomposition). See Input Data for the description of how to enter matrix or just click Example for a simple example. Spark MLlib currently supports two types of solvers for the normal equations: Cholesky factorization and Quasi-Newton methods (L-BFGS/OWL-QN). The method of iteratively reweighted least squares (IRLS) is used to solve certain optimization problems with objective functions of the form of a p-norm: ∑ = | − |, by an iterative method in which each step involves solving a weighted least squares problem of the form: (+) = ∑ = (()) | − |. This function outperforms numpy. BLENDENPIK: SUPERCHARGING LAPACK'S LEAST-SQUARES SOLVER 5 de ned in the prof. R factor can be used in LSQR (an iterative least-squares solver [29]) to eﬃ-ciently and reliably solve a regularization of the least-squares problem. A necessary and sufficient condition is established on the graph Laplacian for the continuous-time distributed algorithm to give the least squares solution in the limit, with an exponentially fast convergence rate. Quadratic regression is a type of a multiple linear regression. The use of linear regression, or least squares method, is the most accurate method in segregating total costs into fixed and variable components. The least squares regression line ; The least squares regression line whose slope and y-intercept are given by: where , , and. Subsequently, Avronetal. This is done by finding the partial derivative of L, equating it to 0 and then finding an expression for m and c. Since this thesis is closely related to the least-squares adjustment problem and will actually present a new approach for solving this problem, let us first have a closer look at the classical approach. Least Squares with Examples in Signal Processing1 Ivan Selesnick March 7, 2013 NYU-Poly These notes address (approximate) solutions to linear equations by least squares. e the sum of squares of residuals is minimal under this approach. Ordinary Least Squares (OLS) regression (or simply "regression") is a useful tool for examining the relationship between two or more interval/ratio variables. This problem is called a least squares problem for the following reason. On input, the field x must be filled in with an initial estimate of the solution vector, and the field tol must be set to the desired tolerance. Solve word problems involving quadratic equations. find_min_box_constrained (using lbfgs_search_strategy(10)) performed poorly as it can be trapped on a boundary. where A is an m x n matrix with m > n, i. So really, what you did in the first assignment was to solve the equation using LSE. On a similar note,. This influence is exaggerated using least squares. i) (circles) and least-squares line (solid line) but we will see that the normal equations also characterize the solution a, an n-vector, to the more general linear least squares problem of minimizing kAa ykfor any matrix Athat is m n, where m n, and whose columns are linearly independent. Enter your data as (x,y) pairs, and find the equation of a line that best fits the data. Scramble Squares® Puzzle. least_squares(). Suppose that a matrix A is given that has more rows than columns, ie n, the number of rows, is larger than m, the number of columns. Quadratic Regression Calculator. Nonlinear Least Squares Data Fitting D. Main ideas 2. TI-89 graphing calculator program for calculating the method of least squares. This document is intended to clarify the issues, and to describe a new Stata command that you can use (wls) to calculate weighted least-squares estimates for problems such as the Strong interaction'' physics data described in Weisberg's example 4. Also lets you save and reuse data. 00097402530 0. Line of Best Fit (Least Square Method) A line of best fit is a straight line that is the best approximation of the given set of data. Constructing a Least-Squares Graph Using Microsoft Excel. Part of our free statistics site; generates linear regression trendline and graphs results. To compare fractions the calculator first finds the least common denominator (LCD), converts the fractions to equivalent fractions using the LCD, then. By using this website, you agree to our Cookie Policy. Visit Stack Exchange. Type doc lsqnonlin for more details. The method of least squares - using the Excel Solver Michael Wood 5 advertising. For this, we're going to make use of the property that the least squares line always goes through x bar, y bar. The method of least squares calculates the line of best fit by minimising the sum of the squares of the vertical distances of the points to th e line. 0 released December 2019 This latest release of SPGL1 implements a dual root-finding mode that allows for increased accuracy for basis pusuit denoising problems. The Linear Least Squares Regression Line method is the accurate way of finding the line of best fit in case it's presumed to be a straight line that is the best approximation of the given set of data. since gradient descent is a local optimizer and can get stuck in local solution we need to use. Added Dec 13, 2011 by scottynumbers in Mathematics. When we used the QR decomposition of a matrix to solve a least-squares problem, we operated under the assumption that was full-rank. The center of the part and center of rotation are offset. Question: 4. How to Calculate Absolute Value. powered by $$x$$ y $$a 2$$ a b . "Solver" is a powerful tool in the Microsoft Excel spreadsheet that provides a simple means of fitting experimental data to nonlinear functions. The Least Squares Regression Line is the line that makes the vertical distance from the data points to the regression line as small as possible. Number of Data Points: X Data Points:. solve a non-linear least squares problem. Spark MLlib currently supports two types of solvers for the normal equations: Cholesky factorization and Quasi-Newton methods (L-BFGS/OWL-QN). The full documentation is available online. In the present instance solving for the node weights is not really viable for the following reason: in the actual, real-life setting the only decision variable (which I have control over & need to solver for) are the instrument weights = units of instruments (cells I11:I15). Algorithm 1 Least-squares sub-problem input: H 2 CN ⇥N, q 2 CN, P 2 RM ⇥N, d 2 CM for each receiver (j )(rowinP) in parallel do H⇤ w j = p⇤ j {solve 1 PDE} end for W =[w 1 w 2w m] {distributed matrix} S =(I M + 2 W⇤ W)1 {adjust using Algorithm 2 (optional)} for source (i) in parallel do y i =(I N 2 WSW⇤)(q i + 2 Wd i) Hu i = y i {solve 1 PDE} end for output: u. Effective use of Ceres requires some familiarity with the basic components of a non-linear least squares solver, so before we describe how to configure and use the solver, we will take a brief look at how some of the core optimization algorithms in Ceres work. LinearLeastSquares. It can be manually found by using the least squares method. That is, Octave can find the parameter b such that the model y = x*b fits data (x,y) as well as possible, assuming zero-mean Gaussian noise. The least-squares line or regression line can be found in the form of y = mx + b using the following formulas. When we pass this (near) optimal solution to NL2SOL it will have an easy task. The Least Squares Regression Calculator is biased against data points which are located significantly away from the projected trend-line. 1 Linear Least Squares Problem. You must select the Solver Add-in and then press the OK button. Use the EXCEL SOLVER program to minimise S by varying the paramters "a" and "b" This will produce estimates of a and b that give the best fitting straight line to the data. It will b e sho wn that the direct sp eci c least-square tting of ellipses. (A for all ). This page allows performing nonlinear regressions (nonlinear least squares fittings). Let [] ∀k∈ℕ be a dispersion point in. Nonlinear Least Squares Data Fitting D. By using this website, you agree to our Cookie Policy. The generalized least squares problem. It is used to study the nature of the relation between two variables. Let , , and be defined as previously. This article introduces the method of fitting nonlinear functions with Solver.  Used to determine the “best” line. The least squares criterion is a formula used to measure the accuracy of a straight line in depicting the data that was used to generate it. Least-Squares Fitting of Data with Polynomials Least-Squares Fitting of Data with B-Spline Curves. In the present instance solving for the node weights is not really viable for the following reason: in the actual, real-life setting the only decision variable (which I have control over & need to solver for) are the instrument weights = units of instruments (cells I11:I15). LEAST MEAN SQUARE ALGORITHM 6. Use our online quadratic regression calculator to find the quadratic regression equation with graph. LinearAlgebra namespace in C#. The applications of the method of least squares curve fitting using polynomials are briefly discussed as follows. 0 released December 2019. 00000088820 0. A least squares model contains a dummy objective and a set of linear equations: sumsq. Least squares means are adjusted for other terms in the model (like covariates), and are less sensitive to missing data. The CVX Users’ Guide, Release 2. Given a set of data, we can fit least-squares trendlines that can be described by linear combinations of known functions. com A collection of really good online calculators for use in every day domestic and commercial use!. Lecture 11, Least Squares Problems, Numerical Linear Algebra, 1997. Trouble may also arise when M = N but the matrix is singular. The first step. using least squares minimization. To show the powerful Maple 10 graphics tools to visualize the convergence of this Polynomials. The best-fit line, as we have decided, is the line that minimizes the sum of squares of residuals. Wow, there's a lot of similarities there between real numbers and matrices. CPM Student Tutorials CPM Content Videos TI-84 Graphing Calculator Bivariate Data TI-84: Least Squares Regression Line (LSRL). Regression Using Excel's Solver. However, if users insist on finding the total least squares fit then an initial approximation is still required and the linear least squares approach is recommended. That closed-form solution is called the normal equation. overdetermined system, least squares method The linear system of equations A =. For details, see First Choose Problem-Based or Solver-Based Approach. Question: 4. Least squares means are adjusted for other terms in the model (like covariates), and are less sensitive to missing data. Enter two data sets and this calculator will find the equation of the regression line and corelation coefficient. Sum of squares is used in statistics to describe the amount of variation in a population or sample of observations. 1 Introduction. , there are more equations than unknowns, usually does not have solutions. Click the button labeled “Click to Compute”. They are connected by p DAbx. Linear least-squares solves min||C*x - d|| 2 , possibly with bounds or linear constraints. Each node has access to one of the linear equations and holds a dynamic state. When radians are selected as the angle unit, it can take values such as pi/2, pi/4, etc. The method of least squares - using the Excel Solver Michael Wood 5 advertising. Years after 1900 50 60 70 80 90 100 Percentage 29. Estimating an ARMA Process Overview 1. Loading Unsubscribe from Adrian Lee? Least Squares Linear Regression - EXCEL - Duration: 10:55. No Bullshit Guide To Linear Algebra, 2017. Added Dec 13, 2011 by scottynumbers in Mathematics. (We use the squares for much the same reason we did when we defined the variance in Section 3. Alternative solution methods. See LICENSE_FOR_EXAMPLE_PROGRAMS. The data, the interpolating polynomial (blue), and the least-squares line (red) are shown in Figure 1. LMS incorporates an. First, least squares is a natural approach to estimation, which makes explicit use of the structure of the model as laid out in the assumptions. The solutions. org are unblocked. The linear least-squares problem occurs in statistical regression analysis; it has a closed-form solution. Example 2 in the KaleidaGraph Quick Start Guide shows how to apply a Linear curve fit to a Scatter plot. Check Minitab for definition of influential points. Linear regression calculator Two-dimensional linear regression of statistical data is done by the method of least squares. Quadratic Regression Calculator. Trouble may also arise when M = N but the matrix is singular. The method of iteratively reweighted least squares (IRLS) is used to solve certain optimization problems with objective functions of the form of a p-norm: ∑ = | − |, by an iterative method in which each step involves solving a weighted least squares problem of the form: (+) = ∑ = (()) | − |. To approximate a Points Dispersion through Least Square Method using a Quadratic Regression Polynomials and the Maple Regression Commands. In fact, I used this kind of solution in some situations. lsqnonneg applies only to the solver-based approach. Number of Data Points: X Data Points:. The help qr command in Matlab gives the following information: >> help qr QR Orthogonal-triangular decomposition. lstsq in terms of computation time and memory. I tried the following set-up: - Given is a vector of original exposure across a range of seven nodes (C8:I2) - The aim is to replicate this exposure at each point as close as possible from a set of 5 instruments. solve public void solve() Solve this nonlinear least squares minimization problem. 4 Linear Least Squares. Least squares regression analysis or linear regression method is deemed to be the most accurate and reliable method to divide the company’s mixed cost …. In this case, solving the normal equations (5) is equivalent to. If the system matrix is rank de cient, then other methods are. Enter the fraction separated by comma and press the calculate button. solve a non-linear least squares problem. Regression Using Excel's Solver. powered by. Given a set of data, we can fit least-squares trendlines that can be described by linear combinations of known functions. Check Minitab for definition of influential points. to solve multidimensional problem, then you can use general linear or nonlinear least squares solver. (3) Solve the diagonal system Σˆw = Uˆ∗b for w. The original domain is. It is called “least squares” because we are minimizing the sum of squares of these functions. I If m= nand Ais invertible, then we can solve Ax= b. The limitations of the OLS regression come from the constraint of the inversion of the X’X matrix: it is required that the rank of the matrix is p+1, and some numerical problems may arise if the matrix is not well behaved. Free online LCM calculator. Leykekhman - MATH 3795 Introduction to Computational MathematicsLinear Least Squares { 11. For this purpose, the initial values of A, B, and C in cells F2-F4 should be those found by Solver in the previous run. 1 Linear Least Squares Problem. If you're seeing this message, it means we're having trouble loading external resources on our website. For details, see First Choose Problem-Based or Solver-Based Approach. Note: this method requires that A not have any redundant rows. Note: Be sure that your Stat Plot is on and indicates the Lists you are using. Nonlinear Regression. Linear Least Squares Regression Line Calculator - v1. Contribute to kashif/ceres-solver development by creating an account on GitHub. Linear regression line calculator to calculate slope, interception and least square regression line equation. The second one is the Levenberg-Marquardt method. Enter the number of data pairs, fill the X and Y data pair co-ordinates, the least squares regression line calculator will show you the result.


# Count arrays with size n, sum k and largest element m

I'm trying to solve pretty complex problem with combinatorics.

Namely, we have given three numbers N, K, M. Now we want to count how many different arrays of integers are there with length N, sum K and all the elements in the range [1, M]

Constraints:

• 1 <= N <= 100
• 1 <= K <= 100
• 1 <= M <= 100

Example

Let's say N = 2, K = 5, M = 3. This means that we want to count arrays of integers of size 2 with sum of all elements equal to 5 and elements in range [1, 3]. There are total of 2 arrays: {2, 3} and {3, 2}. Please note that the order of the elements also matters, {2, 3} is not equal to {3, 2}

Second example: N = 4, K = 7, M = 3. We want to count arrays of length 4, sum of 7 and elements in range [1, 3].

There are total of 16 possible way of arrays: (1,1,2,3), (1,1,3,2), (2,1,1,3), (3,1,1,2), (2,3,1,1), (3,2,1,1), (1,2,3,1), (1,3,2,1), (1,2,1,3), (1,3,1,2), (1,2,2,2), (2,1,2,2), (2,2,1,2), (2,2,2,1)

What I have tried

I know that one solution is to generate all possible arrays, but such algorithm in best case will work in complexity O(N!) which is far too big for N = 100. I started thinking about solving this with three-dimensional dynamical programming, but I cannot find the relations between the states.

I'm thinking about this way: Let f(i, j, l) be the number of arrays of length i, sum j, and largest element l. We can see that for i = 0 f(i,j,l) = 0, so this is I think the base case. Also f(1, 1, 1) = 1 is another base case.

Now I cannot find the relations between the states. Can you give me some hints how to find the relations between the states. Thanks in advance.

• Nice problem. Can you credit the source where you encountered the problem? – D.W. Jul 25 '17 at 16:11
• The problem is from one macedonian site for training, and the problem in original is in macedonian, but i can give you the test cases if you want them – someone12321 Jul 25 '17 at 16:30

You can use dynamic programming. For each $0 \leq i \leq N$ and $0 \leq s \leq K$, count the number of arrays of length $i$, consisting of numbers in the range $\{1,\ldots,M\}$, which sum to exactly $s$. The running time is $O(NK)$.

Explicitly, denoting the array by $a$, we have $a(0,0) = 1$, $a(0,s) = 0$ otherwise, and $$a(i,s) = \sum_{t=1}^M a(i-1,s-t),$$ where $a(i-1,r) = 0$ if $r < 0$.

As Hendrik Jan mentions in the comments, we can improve on this $O(NKM)$ algorithm by using the recursion $$a(i,s) = a(i,s-1) - a(i-1,s-1-M) + a(i-1,s-1),$$ with suitable base cases.

Alternatively, we can obtain an explicit expression: the answer is the coefficient of $x^K$ in the generating function $$(x + \cdots + x^M)^N = x^N \left(\frac{1-x^M}{1-x}\right)^N.$$ In other words, we are looking for the coefficient of $x^{K-N}$ in $$\left( \sum_{i=0}^N (-1)^i \binom{N}{i} x^{iM} \right) \left( \sum_{j=0}^\infty \binom{j+N-1}{N-1} x^j \right),$$ which has the closed form $$\sum_{i=0}^{\min(N,\lfloor (K-N)/M\rfloor)} (-1)^i \binom{N}{i} \binom{K-iM-1}{N-1}.$$

• The numbers $a(i,s)$ represent a matrix of solutions for "fixed" $M$. The numbers $a(i,s)$ are a "running sum" of $M$ consecutive elements from the previous row. So, can't the complexity be improved to $O(NK)$, as $a(i,s) = a(i,s-1) + a(i-1,s-1) - a(i-1,s-M-1)$? give or take typo's. – Hendrik Jan Jul 25 '17 at 1:22
• @HendrikJan Yes, that's right! I missed this somehow. – Yuval Filmus Jul 25 '17 at 5:12

You actually don't need the largest element l in your recursive function. It doesn't make such sense to use it, since the largest number in an array has no influence on the other numbers.

In most (all?) dynamic programming problems you have to think about the last step / the last part. For f(i, j) you have an array with i numbers. You can imagine, that in the last step you added the last number to the array. So before you added the last number, the array only consists of i-1 numbers.

Now, if the added number was 1, then there are f(i-1, j-1) many arrays. If the added number was 2, then there are f(i-1, j-2) many arrays. And so on...

Add all those possibilities up, and you end up with f(i, j).

I don't pretend this is the most efficient solution. Neither it has a strong theoretical merit, but you can still find it useful to verify your results. Here's a small program in Prolog, (using SWI Prolog for constraint satisfaction part), which can calculate or verify your guess:

% -*- mode: prolog; prolog-system: "swi" -*-
:- use_module(library(clpfd)).

sums(K, [], K).
sums(A, [X | Xs], K) :-
indomain(A),
indomain(X),
B is A + X,
sums(B, Xs, K).
sums([X | Xs], K) :- sums(X, Xs, K).

nmk_problem_helper(N, K, M, List) :-
indomain(N),
indomain(M),
indomain(K),
length(List, N),
List ins 1..M,
sums(List, K).

nmk_problem(N, K, M, Arrays) :-
findall(X, nmk_problem_helper(N, K, M, X), Arrays).

nmk_problem_all_helper(List) :-
[N, M, K] ins 1..100,
indomain(N),
indomain(M),
indomain(K),
length(List, N),
List ins 1..M,
sums(List, K).

nmk_problem_all(Arrays) :-
findall(X, nmk_problem_all_helper(X), Arrays).

Example usage:

?- nmk_problem(4, 7, 3, X).
X = [[1, 1, 2, 3], [1, 1, 3, 2], [1, 2, 1, 3], [1, 2, 2, 2], [1, 2, 3, 1], [1, 3, 1|...], [1, 3|...], [2|...], [...|...]|...].


# Multiple answers to $\int \sqrt{4t - t^2} \, \textrm{d} t$

I'm trying to understand why I'm getting different answers when taking different approaches to integrating

$$\int \sqrt{4t - t^2} \, \textrm{d} t$$

First, I tried substituting $\sqrt t = 2 \sin \theta$:

$$\begin{eqnarray} \int \sqrt{t}\sqrt{4 - t} \, \textrm{d} t &=& \int 2 \sin \theta \cdot \sqrt{4 - 4 \sin^2 \theta} \cdot 8 \sin \theta \cos \theta \, \textrm{d} \theta \\ &=& 32 \int \sin^2 \theta \cos^2 \theta \, \textrm{d} \theta \\ &=& 4 \int 1 - \cos 4 \theta \, \textrm{d} \theta \\ &=& 4 \theta - \sin 4 \theta + C \\ &=& 4 \theta - 4 \sin \theta \cos^3 \theta + 4 \sin^3 \theta \cos \theta + C \\ &=& 4 \arcsin \frac{\sqrt{t}}{2} + \frac{1}{2} (t - 2)\sqrt{4t - t^2} + C \\ \end{eqnarray}$$

Second, I tried completing the square and substituting $t - 2 = 2 \sin \theta$:

$$\begin{eqnarray} \int \sqrt{4 - (t^2 - 4t + 4)} \, \textrm{d} t &=& \int \sqrt{4 - (t - 2)^2} \, \textrm{d} t \\ &=& \int \sqrt{4 - 4 \sin^2 \theta} \cdot 2 \cos \theta \, \textrm{d} \theta \\ &=& 4 \int \cos^2 \theta \, \textrm{d} \theta \\ &=& 2 \int 1 - \cos 2 \theta \, \textrm{d} \theta \\ &=& 2 \theta + \sin 2 \theta + C \\ &=& 2 \theta + 2 \sin \theta \cos \theta + C \\ &=& 2 \arcsin \left(\frac{t - 2}{2}\right) + \frac{1}{2}(t - 2)\sqrt{4t - t^2} + C \\ \end{eqnarray}$$

The second answer is the same as in the book but I don't understand why the first approach gives the wrong answer.

• Here's one sticking point: $1-\cos 4\theta = 8\sin^2\theta\cos^2\theta.$ – Cameron Williams Mar 2 '16 at 0:52
• @CameronWilliams, good catch, I'll update my first answer. – Chewers Jingoist Mar 2 '16 at 0:56
• Both answers are correct: if you let $f(t)=4\sin^{-1}\frac{\sqrt{t}}{2}-2\sin^{-1}\frac{t-2}{2}$, then $f^{\prime}(t)=0$ so $f(t)$ is a constant. – user84413 Mar 2 '16 at 1:08
• @user84413, when I differentiate $f(t)$ I get $\frac{4}{\sqrt{4 - t}} - \frac{2}{\sqrt{4 - (t - 2)^2}} = \frac{4}{\sqrt{4 - t}} - \frac{2}{\sqrt{4t - t^2}}$. Could you elaborate on how you get $0$? – Chewers Jingoist Mar 2 '16 at 1:21
• In the first term, I think you will get $4\frac{1}{\sqrt{1-t/4}}\frac{1}{4\sqrt{t}}=\frac{2}{\sqrt{4t-t^2}}$ – user84413 Mar 2 '16 at 1:33

$$\arcsin\left(\frac t2-1\right) = 2\left(\arcsin\frac{\sqrt t}2 -\frac\pi4\right).\tag{*}$$
Proof: Write $\theta:=\arcsin\frac{\sqrt t}2$. Then $\sin^2\theta=\frac t4$ and $\cos^2\theta=1-\frac t4$, and using the angle-difference identities, $$\sin\left(\theta-\frac\pi4\right)=\frac1{\sqrt 2}(\sin\theta-\cos\theta)\tag1$$ while $$\cos\left(\theta-\frac\pi4\right)=\frac1{\sqrt 2}(\sin\theta+\cos\theta).\tag2$$ Therefore $$\sin2\left(\theta-\frac\pi4\right)=2\sin\left(\theta-\frac\pi4\right)\cos\left(\theta-\frac\pi4\right) \stackrel{(1),(2)}=\sin^2\theta-\cos^2\theta =\frac t4-\left(1-\frac t4\right)=\frac t2-1.$$ Therefore both sides of (*) have the same sine. Similarly you can show that both sides have the same cosine.
• Where does $2$ come from at the start of your last line in $sin 2(\theta - \frac{\pi}{4})$? And what does the $(1),(2)$ mean? – Chewers Jingoist Mar 2 '16 at 1:31
• @ChewersJingoist, the $2$ in $sin2(\theta - \frac{\pi}{4})$ comes from the identity $sin2x=2sinxcosx$. – Alexander Maru Mar 2 '16 at 1:39
If $$\sin\theta = \dfrac{\sqrt t}2,$$ then $$\sin\left(\dfrac\pi2-2\theta\right) = \cos2\theta = 1-2\sin^2\theta = \dfrac{2-t}2,$$ $$2\theta = \dfrac\pi2-\arcsin\dfrac{2-t}2 = \dfrac\pi2+\arcsin\dfrac{t-2}2,$$ $$\theta = \dfrac\pi4+\dfrac12\arcsin\dfrac{t-2}2,$$ $$\boxed{\arcsin\dfrac{\sqrt t}2 = \dfrac12\arcsin\dfrac{t-2}2+\dfrac\pi4}$$ So the first answer is correct too


GMAT Question of the Day: Daily via email | Daily via Instagram New to GMAT Club? Watch this Video

 It is currently 06 Apr 2020, 08:05

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# If the curve described by the equation y = x2 + bx + c cuts the x-axis

Author Message
TAGS:

### Hide Tags

GMAT Club team member
Status: GMAT Club Team Member
Affiliations: GMAT Club
Joined: 02 Nov 2016
Posts: 5385
GPA: 3.62
If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

10 Aug 2018, 10:08
1
00:00

Difficulty:

55% (hard)

Question Stats:

63% (02:11) correct 37% (01:56) wrong based on 82 sessions

### HideShow timer Statistics

If the curve described by the equation $$y = x^2 + bx + c$$ cuts the $$x$$-axis at $$-4$$ and $$y$$ axis at $$4$$, at which other point does it cut the $$x$$-axis?

A. -1
B. 4
C. 1
D. -4
E. 0

_________________
Intern
Joined: 07 May 2018
Posts: 3
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

10 Aug 2018, 10:49
+1 for A? I plugged in the other points to come up with an equation...not sure if I went about it the right way
Director
Status: Learning stage
Joined: 01 Oct 2017
Posts: 954
WE: Supply Chain Management (Energy and Utilities)
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

10 Aug 2018, 22:08
1
If the curve described by the equation y = x^2 + bx + c cuts the x-axis at -4 and y axis at 4, at which other point does it cut the x-axis?

A. -1
B. 4
C. 1
D. -4
E. 0

Given, $$y = x^2 + bx + c$$, cuts the x-axis at two points. One intersection point with x-axis is given. We need to find out the other point of intersection. In other words, 1 root of the quadratic equation is given, what is the value if the other root?

a) At (-4,0), $$0=(-4)^2+b*(-4)+c$$ Or, 4b-c=16
b) At (0,4), $$4=0^2+b*0+c$$ Or, c=4
So, 4b-4=16 Or, b=5.
Now, we have the equation of the curve, $$y=x^2+5x+4$$, which has the roots: -4 and -1.
So, other other root is -1.

Ans. (A)
_________________
Regards,

PKN

Rise above the storm, you will find the sunshine
CAT Forum Moderator
Joined: 29 Nov 2018
Posts: 280
Concentration: Marketing, Strategy
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

02 Jan 2019, 09:53
2
If the curve described by the equation y = x^2 + bx + c cuts the x-axis at -4 and y axis at 4, at which other point does it cut the x-axis?

A -1
B 4
C 1
D -4
E 0

y = x^2 + bx + c is a quadratic equation and the equation represents a parabola.
The curve cuts the y axis at 4.
The x coordinate of the point where it cuts the y axis = 0.
Therefore, (0, 4) is a point on the curve and will satisfy the equation.
4 = 0^2 + b(0) + c
Or c = 4.

The product of the roots of a quadratic equation is c/a
In this question, the product of the roots = 4/1 = 4.

The roots of the quadratic equation are the points where the curve cuts the x-axis.
The question states that one of the points where the curve cuts the x-axis is -4.
So, -4 is one of roots.
Let r2 be the second root of the quadratic equation.
So, -4 * r2 = 4
or r2 = -1.

The second root is the second point where the curve cuts the x-axis, which is -1.

If you liked the question and explanation, please do hit the kudos button
Intern
Joined: 30 May 2017
Posts: 16
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

02 Jan 2019, 10:34
When x=-4 y=0
so 16 -4b +c=0
When x=0, y = 4
so c=4
16-4b+c=20-4b=0
b= 5

the equation can be written as y=(x+4)(x+1)

y is equal to zero when x=-1 (Answer A)
Math Expert
Joined: 02 Sep 2009
Posts: 62542
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

03 Jan 2019, 02:15
cfc198 wrote:
If the curve described by the equation y = x^2 + bx + c cuts the x-axis at -4 and y axis at 4, at which other point does it cut the x-axis?

A -1
B 4
C 1
D -4
E 0

y = x^2 + bx + c is a quadratic equation and the equation represents a parabola.
The curve cuts the y axis at 4.
The x coordinate of the point where it cuts the y axis = 0.
Therefore, (0, 4) is a point on the curve and will satisfy the equation.
4 = 0^2 + b(0) + c
Or c = 4.

The product of the roots of a quadratic equation is c/a
In this question, the product of the roots = 4/1 = 4.

The roots of the quadratic equation are the points where the curve cuts the x-axis.
The question states that one of the points where the curve cuts the x-axis is -4.
So, -4 is one of roots.
Let r2 be the second root of the quadratic equation.
So, -4 * r2 = 4
or r2 = -1.

The second root is the second point where the curve cuts the x-axis, which is -1.

If you liked the question and explanation, please do hit the kudos button

_______________
Merging topics.
_________________
Non-Human User
Joined: 09 Sep 2013
Posts: 14467
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis  [#permalink]

### Show Tags

22 Feb 2020, 15:03
Hello from the GMAT Club BumpBot!

Thanks to another GMAT Club member, I have just discovered this valuable topic, yet it had no discussion for over a year. I am now bumping it up - doing my job. I think you may find it valuable (esp those replies with Kudos).

Want to see all other topics I dig out? Follow me (click follow button on profile). You will receive a summary of all topics I bump in your profile area as well as via email.
_________________
Re: If the curve described by the equation y = x2 + bx + c cuts the x-axis   [#permalink] 22 Feb 2020, 15:03
Display posts from previous: Sort by


# Laplace equation with mixed boundary conditions

I try to solve Laplace equation in 2D on square [2,3]x[2,3], with mixed boundary conditions, I did:

ClearAll[y, x1, x2];
pde = Laplacian[y[x1, x2], {x1, x2}];
bc = {y[x1, 2] == 2 + x1, y[x1, 3] == 3 + x1};
sol = NDSolve[{pde ==
NeumannValue[-1, x1 == 2] + NeumannValue[1, x1 == 3], bc},
y, {x1, 2, 3}, {x2, 2, 3}]

Plot3D[Evaluate[y[x1, x2] /. sol], {x1, 2, 3}, {x2, 2, 3},
PlotRange -> All, AxesLabel -> {"x1", "X2", "y[x1,x2]"},
BaseStyle -> 12]

The exact solution is y=x1+x2, the problem is the results is not high accurate when I evaluate the error.

• The exact solution is y=x1+x2 Are you sure about this? How does this solution satisfy the Neumann boundary conditions? – Nasser Jun 25 at 20:09
• @Nasser Erm. The function does satisfy the Neumann boundary condition: Its derivative in x1-direction is 1 and the sign flops stems from the fact that Neumann conditions are phrased in terms of outward normals... No? – Henrik Schumacher Jun 25 at 23:34
• @user62716 Using NeumannValue requires one to do integration by parts and one has to be careful about the signs. Try switching the sign of the Laplacian to pde = -Laplacian[y[x1, x2], {x1, x2}];. Then it should work. – Henrik Schumacher Jun 25 at 23:40
• @HenrikSchumacher is NeumannValue[-1, x1 == 2] different from saying that $\frac{\partial y}{\partial x_1}$ evaluated at $x_1=2$ is $-1$? And since the claim is that the solution is $y=x_1+x_2$ then $\frac{\partial y}{\partial x_1}=1$ this is evaluated at $x=2$ is $1$ and not $-1$?. How do you translate NeumannValue[-1, x1 == 2] to normal derivative then? I just did direct translation. May be we need a whole new topic on this. On top of all of this, moving NeumannValue from RHS to LHS changes the solution. I never liked NeumannValue and prefer to use normal derivatives... – Nasser Jun 26 at 0:46
• @Nasser $\frac{\partial y}{\partial \nu} (2,x_2) = - \frac{\partial y}{\partial x_1} (2,x_2)$ because the outward normal at the point $(2,x_2)$ is $\nu = (-1 , 0)$. But I agree that NeumannValue is a bit counter intuitive, but it makes perfect sense in regard of the weak formulation that is used in FEM. – Henrik Schumacher Jun 26 at 4:59

Relatively recently, Wolfram has created a nice Heat Transfer Tutorial and a Heat Transfer Verification Manual. I model with many codes and I usually start the Verification and Validation manual and build complexity from there. It is always embarrassing to build a complex model and find that your setup does not pass verification.

The Laplace equation is special case of the heat equation so we should be able to use a verified example as a template for a properly constructed model.

For NeumannValue's, if the flux is into the domain, it is positive. If the flux is out of the domain, it is negative.

At the tutorial link, they define a function HeatTransferModel to create operators for a variety of heat transfer cases that I shall reproduce here:

ClearAll[HeatTransferModel]
HeatTransferModel[T_, X_List, k_, ρ_, Cp_, Velocity_, Source_] :=
Module[{V, Q, a = k},
V = If[Velocity === "NoFlow",
Q = If[Source === "NoSource", 0, Source];
If[FreeQ[a, _?VectorQ], a = a*IdentityMatrix[Length[X]]];
If[VectorQ[a], a = DiagonalMatrix[a]];
a = PiecewiseExpand[Piecewise[{{-a, True}}]];
Inactive[Div][a.Inactive[Grad][T, X], X] + V - Q]

If we follow the recipe of tutorial, we should be able to construct and solve a PDE system free of sign errors as I show in the following workflow.

(* Create a Domain *)
Ω2D = Rectangle[{2, 2}, {3, 3}];
(* Create parametric PDE operator *)
pop = HeatTransferModel[y[x1, x2], {x1, x2}, k, ρ, Cp, "NoFlow",
"NoSource"];
(* Replace k parameter *)
op = pop /. {k -> 1};
(* Setup flux conditions *)
nv2 = NeumannValue[-1, x1 == 2];
nv3 = NeumannValue[1, x1 == 3];
(* Setup Dirichlet Conditions *)
dc2 = DirichletCondition[y[x1, x2] == 2 + x1, x2 == 2];
dc3 = DirichletCondition[y[x1, x2] == 3 + x1, x2 == 3];
(* Create PDE system *)
pde = {op == nv2 + nv3, dc2, dc3};
(* Solve and Plot *)
yfun = NDSolveValue[pde, y, {x1, x2} ∈ Ω2D]
Plot3D[Evaluate[yfun[x1, x2]], {x1, x2} ∈ Ω2D,
PlotRange -> All, AxesLabel -> {"x1", "x2", "y[x1,x2]"},
BaseStyle -> 12]

You can test that the solution matches that exact solution over the entire range:

Manipulate[
Plot[{x1 + x2, yfun[x1, x2]}, {x1, 2, 3}, PlotRange -> All,
AxesLabel -> {"x1", "y[x1,x2]"}, BaseStyle -> 12,
PlotStyle -> {Red,
Directive[Green, Opacity[0.75], Thickness[0.015], Dashed]}], {x2,
2, 3}, ControlPlacement -> Top]

• Dear Tim Laska, thank you for your great help, can we evaluate the error and plot it? – user62716 Jun 26 at 9:47
• I did it plot = Plot3D[ Abs[yfun[x1, x2] - (x1 + x2)], {x1, x2} [Element] [CapitalOmega]2D, PlotRange -> All, AxesLabel -> {"x1", "x2", "y[x1,x2]"}, PlotLabel -> err] – user62716 Jun 26 at 10:03
• Dear Tim Laska, I have other problem, Poisson equation with variable coefficients,shall post it in new question or here? – user62716 Jun 26 at 11:48
• @user62716 You should open a new question as it appears that you have. I will try to take a look at your other question when I can. – Tim Laska Jun 26 at 13:45
• Thank you Tim, I will be waiting. Best regards – user62716 Jun 26 at 13:50

By reversing the sign of the derivative on the left side from that given in NeumannValue, this can be solved by Mathematica analytically as well.

ClearAll[y, x1, x2];
pde = Laplacian[y[x1, x2], {x1, x2}] == 0;

bc = {y[x1, 2] == 2 + x1,
y[x1, 3] == 3 + x1,
Derivative[1, 0][y][2, x2] == 1,
Derivative[1, 0][y][3, x2] == 1};

solA = DSolve[{pde, bc}, y[x1, x2], {x1, x2}];
solA = solA /. {K[1] -> n,Infinity -> 20};
solA = Activate[solA];

Plot3D[y[x1, x2] /. solA, {x1, 2, 3}, {x2, 2, 3}, PlotRange -> All,
AxesLabel -> {"x1", "X2", "y[x1,x2]"}, BaseStyle -> 12]

The BC as given above are correct, and Mathematica's analytical solution is correct also, but I agree it can be simpler.

There might be a way to simplify the infinite Fourier sum given, but I could not find it.

To show the above formulation is correct, here is Maple's solution, using same B.C. Maple as above to give the simpler form of the solution, which is $$y=x_1+x_2$$.

restart;
pde:=VectorCalculus:-Laplacian(y(x1,x2),[x1,x2])=0;
bc:=y(x1,2)=2+x1,y(x1,3)=3+x1,D[1](y)(2,x2)=1,D[1](y)(3,x2)=1;
sol:=pdsolve([pde,bc],y(x1,x2))

We just have to remember, that negative NeumannValue on left edge, means positive derivative on that edge.

• Dear Nasser, thank you for your comments, the normal derivative at left side is -1 not 1, the above analytic solution is complicated since the exact is just y=x1+x2....thanks – user62716 Jun 26 at 9:38
• the normal derivative at left side is -1 not 1 no. It is +1. you set NeumannValue to be -1. Since NeumannValue points outwards, then this means the deivative is +1. Since -1 outwards, means +1 inwards. In addition, if you change the derivative (not NeumannValue) in the code I posted from +1 to -1 you will see the solution is no longer y=x1+x2 but becomes non-linear. You can compare this solution with the numerical solution. Do you see any difference? I agree the solution has complicated Fourier series sum, but this is what Mathemtica gave for the analytical solution. – Nasser Jun 26 at 10:01
• Dear Nasser, I still can not understand you, @Nasser ∂y∂ν(2,x2)=−∂y∂x1(2,x2) because the outward normal at the point (2,x2) is ν=(−1,0) so it is -1 on the left outwards. – user62716 Jun 26 at 11:16
• Dear Nasser, the code of Tim Laska is working, I highly appreciate you and you always help me and provide perfect answer. – user62716 Jun 26 at 11:19
• @user62716 you can see from the solution itself, i.e. from just looking at the plot, that the derivative is positive on the left edge. No math is needed if we look at the solution. The slope is moving upwards. So positive slope. You can also see from Maple solution I posted, that I used positive derivative to get same solution $x_1+x_2$ right there. NeumannValue is not the same as derivative. That is what the whole confusion was about. – Nasser Jun 26 at 11:33


# Scientific Notation ... is a way to express very small or very large numbers.   ... is most often used in "scientific" calculations where the analysis.

## Presentation on theme: "Scientific Notation ... is a way to express very small or very large numbers.   ... is most often used in "scientific" calculations where the analysis."— Presentation transcript:

Scientific Notation ... is a way to express very small or very large numbers. ... is most often used in "scientific" calculations where the analysis must be very precise. ... consists of two parts*: (1) a number between 1 and 10                                    and (2) a power of 10. *a large or small number may be written as any power of 10; however, CORRECT scientific notation must satisfy the above criteria.

is correct scientific notation
3.2 x 1013 is correct scientific notation Remember that the first number MUST BE greater than or equal to one and less than 10. 23.6 x 10-8 is not correct scientific notation

To Change from Standard Form to Scientific Notation:
1 Place decimal point such that there is one non-zero digit to the left of the decimal point. 2 Count number of decimal places the decimal has "moved" from the original number.  This will be the exponent of the 10. 3 If the original number was less than 1, the exponent is negative; if the original number was greater than 1, the exponent is positive.

Examples: Given: 4,750,000 use: 4.75 (moved 6 decimal places)
answer:  4.75 X 106 The original number was greater than 1 so the exponent is positive. Given:  use: 7.89 (moved 4 decimal places) answer:  7.89 x 10-4 The original number was less than 1 so the exponent is negative.

To Change from Scientific Notation to Standard Form:
1 Move decimal point to right for positive exponent of 10. 2 Move decimal point to left for negative exponent of 10.

Examples: Given: 1.015 x 10-8 answer: 0.00000001015 (8 places to left)
Negative exponent move decimal to the left. Given:  x 103 answer:  5,024   (3 places to right) Positive exponent move decimal to the right.

To Multiply and/or Divide using Scientific Notation:
1 Multiply/divide decimal numbers with each other. 2 Use exponent rules to "combine" powers of 10. 3 If not "correct" scientific notation, change accordingly.

Given:                                                    Method:                                                                                Answer:                  Correct Scientific Notation

Express in correct scientific notation:
Part 1: Express in correct scientific notation: 1.  61,500 2.  3.  321 4.  64,960,000 5.

Part 2: Express in standard form: 1.  1.09 x 103 2.  x 108 3.  x 10-4 4.  x 10-2 5.  x 102

Multiply or divide as indicated and
Part 3: Multiply or divide as indicated and express in correct scientific notation: 1.                                        2.                   3.                                        4. 5.

Download ppt "Scientific Notation ... is a way to express very small or very large numbers.   ... is most often used in "scientific" calculations where the analysis."

Similar presentations


# Function transformations question - vertical or horizontal transformation

I have got a very simple problem. I have an exercise:

If $\ f(x) = 2x^2 − 4$, give the function which shows the graph of $\ f(x)$ after vertical stretch of scale factor $\ 0.5$ followed by a translation $\binom{-4}{0}$

The answer that I get is $\ f(x)=x^2+8x+14$, but the answer given is $\ f(x)=8x^2+64x+124$. In my opinion, the answer that is given can certainly be achieved, but using horizontal translation instead of vertical. After drawing a graph of my function and the given function I noticed that in my case the function is compressed (its "branches" are closer to the x - axis than the original one) - as it should be, as scale factor is less than 1.

Am I wrong there, or is something wrong with answers? I would not have asked the question, but I noticed that there is at least one more question about which I am uncertain as much as about this one, thus, I need to find out the real answer.

• $x^2+8x+14=((x+4)^2-4)/2$ is correct. Reusing the symbol $f(x)$ to mean different things leads to confusion.
– user574889
Jul 17, 2018 at 13:49
• @cactus, sorry, did not think about changing it to something else. Thanks for the answer! That means that there are 3 mistakes in a row in the exercises... Jul 17, 2018 at 13:52

You are right.

We are looking for the function \begin{align}\frac12f(x+4)&=\frac12(2(x+4)^2-4)\\&=(x+4)^2-2\\ &=x^2+8x+14 \end{align}

Of course, there is a possibility that you course is asking the wrong question as well.

• Thanks for the answer! That means that there are 3 mistakes in a row in those exercises... I will accept the answer soon. Jul 17, 2018 at 13:53

$$f(x)=2(x^2-4)$$ Vertical stretching with scale $1:2$: $$f_1(x)=0.5 f(x)=x^2-4$$ Translation by a vector $[-4,0]$: $$f_2(x)=f_1(x-(-4))+0=(x+4)^2-2=x^2+8x+14$$

Thus your solution seems to be fine.

The textbook solution might be created by taking a stretching factor $4$ and translation $[-4,12]$


# what is 1^21 + 2^21 + 3^21 + ....... + 18^21 in mode 19?

#### ketanco

##### New member
what is 1^21 + 2^21 + 3^21 + ....... + 18^21 in mode 19?

i can only think about individually calculating equivalents in mode 19 and then adding them up but there must be a better way then finding equivalents of exponentials of numbers from to 1 to 18, as this question is expected to be solved in around 2 minutes or less...

#### Olinguito

##### Well-known member
By Fermat’s little theorem, $1^{18},2^{18},\ldots,18^{18}\equiv1\pmod{19}$. Hence
$$\begin{array}{rcl}1^{21}+\cdots+18^{21} &\equiv& 1^3+\cdots+18^3\pmod{19} \\\\ {} &=& (1+\cdots+18)^2\pmod{19} \\\\ {} &=& \left(\dfrac{18}2\cdot19\right)^2\pmod{19} \\\\ {} &\equiv& 0\pmod{19}.\end{array}$$

Staff member

#### Olinguito

##### Well-known member
Hey Olinguito , how does it follow that:

$1^3+\cdots+18^3\pmod{19} = (1+\cdots+18)^2\pmod{19}$

Doesn’t $a=b$ imply $a\pmod n=b\pmod n$ (taking the modulus to be between $0$ and $n-1$)?

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Doesn’t $a=b$ imply $a\pmod n=b\pmod n$ (taking the modulus to be between $0$ and $n-1$)?
After staring at the following picture long enough, I finally realized why $a=b$.

I think it's a different theorem though (Nicomachus's theorem).

Btw, couldn't we instead observe that:
$$1^3+2^3+...+17^3+18^3\equiv 1^3+2^3+...+(-2)^3+(-1)^3 \equiv 0 \pmod{19}$$

#### Olinguito

##### Well-known member
Btw, couldn't we instead observe that:
$$1^3+2^3+...+17^3+18^3\equiv 1^3+2^3+...+(-2)^3+(-1)^3 \equiv 0 \pmod{19}$$
That’s an excellent observation!

#### ketanco

##### New member
After staring at the following picture long enough, I finally realized why $a=b$.

I think it's a different theorem though (Nicomachus's theorem).

Btw, couldn't we instead observe that:
$$1^3+2^3+...+17^3+18^3\equiv 1^3+2^3+...+(-2)^3+(-1)^3 \equiv 0 \pmod{19}$$
yes this is how they xpected us to solve i think... this must be the answer. thanks


# $W^{\bot}$ is a subspace of $U^{\bot}$?

Let $U$ and $W$ be subspaces of an inner product space $V$. If $U$ is a subspace of $W$, then $W^{\bot}$ is a subspace of $U^{\bot}$?.

I don't find the above statement intuitively obvious. Could someone provide a proof?

-

## 2 Answers

If you're orthogonal to everything in a set, then you're also orthogonal to everything in every subset of that set.

Put another way: Elements of $W^\perp$ have to be orthogonal to more vectors than elements of $U^\perp$; they have to be orthogonal to the vectors in $U$ and the vectors in $W\setminus U$ (if any). Therefore there are less of them than if we took the vectors that only have to satisfy the property of being orthogonal to vectors in $U$. (More restrictions$\implies$ Fewer vectors satisfying the restrictions.)

-
And that since you know that $U^\perp,W^\perp$ are subspaces (hopefully) of $V$ then it suffices to show containment. – Alex Youcis Nov 6 '11 at 22:30
So shouldn't it be $U^{\bot}$ is a subspace of $W^{\bot}$ ? That is my confusion. – Mark Nov 6 '11 at 22:33
@Mark: No. If you're orthogonal to everything in $W$, i.e., if you're in $W^\perp$, then you're also orthogonal to everything in a subset of $W$ such as $U$, i.e., you're in $U^\perp$. For a concrete example, think of $\mathbb R^3$ with standard dot product, let $U$ be the span of $(1,0,0)$, and let $W$ be the span of $\{(1,0,0),(0,1,0)\}$. If you have to be orthogonal to both $(1,0,0)$ and $(0,1,0)$, then you are in particular orthogonal to $(1,0,0)$, so $W^\perp\subset U^\perp$. – Jonas Meyer Nov 6 '11 at 22:35
Oh right, I had this at the back of my head, but was unable to explain it clearly. Now I understand, thanks. – Mark Nov 6 '11 at 22:54

It should be intuitive, already at the level of logic:

To be in $W^\perp$, you have to satisfy a certain condition $P(w)$ (namely: 'be orthogonal to $w$') for each and every element $w\in W$.

So given a subset $U\subseteq W$, to be in $U^\perp$ means you have to satisfy $P(w)$ merely for all $u\in U$.

Thus you have to satisfy less properties to be in $U^\perp$, thus it is easier to be in $U^\perp$, thus $U^\perp$ is larger: $W^\perp\subseteq U^\perp$.

It should also be intuitive geometrically: consider $\mathbb{R}^3$, let $U$ be the $x$-axis, and $W$ the $x,y$-plane. Then $U^\perp$ is the $y,z$-plane, and $W^\perp$ is the $z$-axis.

//Edit: I was slow so I missed Joans Meyer's edit, which kind of makes my answer redundant.

-


# Pearson correlation between a variable and its square

Here is my R code to get familiarised with Pearson's correlation. I generate values of $X$ from 1 to 100, then find the correlation between $X$ and $X^2$:

x=1:100
y=x
for(i in 1:100) {y[i]=x[i]*x[i]}
cor.test(x,y, type="pearson")

I get this result :

Pearson's product-moment correlation

data:  x and y
t = 38.668, df = 98, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9538354 0.9789069
sample estimates:
cor
0.9687564

$r$ seems high to me.

My question is: what exactly does the $r$ coefficient quantify? Does it only quantify the closeness of the relationship between $X$ and $Y$ variable to a linear relationship ?

Or is it also suited to quantify the intensity of a relationship between $X$ and $Y$ broadly speaking (whether this relationship is close to linearity or not)?

My last question is: are there other correlation test better suited than Pearson's test to quantify the intensity of the relationship between two given variables when the kind (linear, quadratic, exponential, etc.) of this relationship is not known a priori or is Pearson's test sufficient to do this kind of job?

• Welcome to our site! You don't need to put "thanks in advance" comments at the end of your questions - in fact we prefer it if you don't, since it means more for future readers to read through. – Silverfish Aug 13 '17 at 9:28
• Not an answer to your statistical question, but you mind find it helpful to know that you don't need to use a for loop in your R code, you can just do x=1:100; y=x^2; cor(x,y) or even cor(1:100, (1:100)^2) – Silverfish Aug 13 '17 at 9:29
• @Silverfish indeed, this is illustrated in the first two lines of code in my answer as well – Glen_b -Reinstate Monica Aug 13 '17 at 9:50

You are curious about whether your value of $r$ is "too high" — it seems you think that, as $X$ and $X^2$ do not have an exactly linear relationship, then the Pearson's $r$ should be rather low. The high $r$ is not telling you that the relationship is linear, but it is telling you that the relationship is rather close to being linear.

If you are specifically interested in the case where $X$ is uniform, you might want to look at this thread on Math SE on the covariance between a uniform distribution and its square. You are using discrete uniform distribution $1,2,\dots,n$ but if you rescaled $X$ by a factor of $1/n$, and hence rescaled $X^2$ by a factor $1/n^2$, the correlation would be unchanged (since correlation is not affected by rescaling by a positive scale factor). You would now have a discrete uniform distribution with equal probability masses on $\frac{1}{n}, \frac{2}{n}, \dots, \frac{n-1}{n}, 1$. For large values of $n$, this approximates a continuous uniform distribution (also called "rectangular distribution") on $[0,1]$.

By an argument analogous to that on the Math SE thread, we have:

$$\operatorname{Cov}(X,X^2) = \mathbb{E}(X^3)-\mathbb{E}(X)\mathbb{E}(X^2) = \int_0^1 x^3 dx - \int_0^1 x dx \cdot \int_0^1 x^2 dx$$

This integrates to $\frac{1}{4} - \frac{1}{2} \cdot \frac{1}{3} = \frac{1}{12}$.

We also have $\operatorname{Var}(X) = \mathbb{E}(X^2)-\mathbb{E}(X)^2 = \frac{1}{3} - \left(\frac{1}{2}\right)^2 = \frac{1}{12}$.

Similarly we find $\operatorname{Var}(X^2) = \mathbb{E}(X^4)-\mathbb{E}(X^2)^2 = \frac{1}{5} - \left(\frac{1}{3}\right)^2 = \frac{4}{45}$.

Hence, if $X \sim U(0,1)$, then:

$$\operatorname{Corr}(X,X^2) = \frac{\operatorname{Cov}(X,X^2)}{\sqrt{\operatorname{Var}(X) \cdot \operatorname{Var}(X^2)}} = \frac{\frac{1}{12}}{\sqrt{{\frac{1}{12}}\cdot{\frac{4}{45}}}} = \frac{\sqrt{15}}{4}$$

To seven decimal places, this is $r = 0.96824583$, even though the relationship is quadratic rather than linear. Now you have taken a discrete uniform distribution on $1, 2, \dots, n$ rather than a continuous one, but for the reasons explained above, increasing $n$ will produce a correlation closer to the continuous case, so that $\sqrt{15}/4$ will be the limiting value. Let us confirm this in R:

corn <- function(n){
x = 1:n
cor(x,x^2)
}

> corn(2)
[1] 1
> corn(3)
[1] 0.9897433
> corn(4)
[1] 0.984374
> corn(5)
[1] 0.9811049
> corn(10)
[1] 0.9745586
> corn(100)
[1] 0.9688545
> corn(1e3)
[1] 0.9683064
> corn(1e6)
[1] 0.9682459
> corn(1e7)
[1] 0.9682458

That correlation of $r=0.9682458$ may sound surprisingly high, but if we inspected a graph of the relationship between $X$ and $X^2$ it would indeed appear approximately linear, and this is all that the correlation coefficient is telling you. Moreover, we can see from our table of output from the corn function that increasing the value of $n$ makes the linear correlation smaller (note that with two points, we had a perfect linear fit and a correlation equal to one!) but that although $r$ is falling, it is bounded below by $\sqrt{15}/4$. In other words, increasing the length of your sequence of integers makes the linear fit somewhat worse, but even as $n$ tends to infinity your $r$ never becomes worse than $0.9682\dots$.

x=1:100; y=x^2
plot(x,y)
abline(lm(y~x))

Perhaps visually you are still not convinced that the correlation looks as strong as the calculated coefficient suggests — clearly the points are below the line of best fit for low and high values of $X$, and above it for intermediate $X$. If it can't capture this quadratic curvature, is the line really such a good fit to the points?

You may find it helpful to compare the overall variation of the $Y$ coordinates about their own mean (the "total variation") to how much the points vary above and below the regression line (the "residual variation" that the regression line was unable to explain). The fraction of the residual variation over the total variation tells you what proportion of the variation was not explained by the regression line; the proportion of variation that is explained by the regression line is then one minus this fraction, and is called the $R^2$. In this case, we can see that the variation of points above and below the line is relatively small compared to the variation in their $Y$ coordinates, and so the proportion unexplained by the regression is small and the $R^2$ is large. It turns out that for a simple linear regression, $R^2$ is equal to the square of the Pearson correlation. In fact $r=\sqrt{R^2}$ if the regression slope is positive (an increasing relationship) or $r=-\sqrt{R^2}$ if the slope is negative (decreasing).

We had a large $R^2$ so our correlation is large also. This is the sense we mean when we state that "a Pearson correlation near $\pm 1$ indicates the linear fit is good" — not that our straight regression line captures the true nature of the relationship between $X$ and $Y$, and so there is no curvature and no discernible pattern in the residual variation, but instead that the line provides a good approximation to the true relationship, and that the proportion of residual variation (i.e. that part left unexplained by the linear model) is small.

Note that had you chosen a discrete uniform on e.g. $-100, -99, \dots, 99, 100$ and rescaled that to being between $[-1,1]$ and you would have found a covariance and correlation of zero, as happens in the linked Math SE thread. There is neither an increasing nor decreasing relationship.

x=-100:100; y=x^2
plot(x,y)
abline(lm(y~x))

As an exercise to think through, what would be the correlation between $-1, -2, -3, \dots, -n$ and its squares? You can easily write some R code to confirm your guess.

If all you care about is the existence of an increasing or decreasing relationship, rather than the extent to which it is linear, you can use a rank-based measure such as Kendall's tau or Spearman's rho, as mentioned in Glen_b's answer. For my first graph, which had a perfectly monotonic increasing relationship, both methods would have given the highest possible correlation (one). For the second graph, which is neither increasing nor decreasing, both would give a correlation of zero.

The Pearson correlation measures the closeness to a linear relationship. If $X$ is positive, then the correlation between $X$ and $X^2$ is often fairly close to 1.

If you want to measure the strength of monotonic relationship, there are a number of other choices, of which the two best known are the Kendall correlation (Kendall's tau), and the Spearman correlation (Spearman's rho)

 x=1:100
cor(x,x^2,method="pearson")
[1] 0.9688545
cor(x,x^2,method="kendall")
[1] 1
cor(x,x^2,method="spearman")
[1] 1

I'd add that looking at the correlation of non-random values isn't necessarily where I'd start - it can be useful when exploring edge cases, however.

For the Pearson correlation you may find it useful to consider playing about with the rho and n values here:

n=100
rho=0.6
x=rnorm(100)
z=rnorm(100)
y=rho*x + sqrt(1-rho^2)*z
plot(x,y)
cor(x,y)

(In particular, you might try varying rho from close to -1 up to close to 1)

You may also find these discussions of correlation useful for getting a handle on what correlations do and don't do:

Why zero correlation does not necessarily imply independence

Does the correlation coefficient, r, for linear association always exist?

If A and B are correlated with C, why are A and B not necessarily correlated?

How would you explain covariance to someone who understands only the mean?

Pearson's or Spearman's correlation with non-normal data

How to choose between Pearson and Spearman correlation?

Kendall Tau or Spearman's rho?

If linear regression is related to Pearson's correlation, are there any regression techniques related to Kendall's and Spearman's correlations?


# Differentiation under integral sign

1. Jan 17, 2010

### neelakash

1. The problem statement, all variables and given/known data

I have to evaluate the numerical value of the derivative of the following integral for x=1

$$\int_{0}^{\ ln\ x}\ e^{\ -\ x\ (\ t^2\ -\ 2)}\ dt$$

2. Relevant equations

The formula for differentitation under integral sign.

3. The attempt at a solution

The upper limit term is straightforward:it is

$$\frac{\ 1}{\ x}\ e^{\ -\ x[\ (\ ln\ x)^{\ 2}\ -\ 2]}$$

The other part is

$$\int_0^{\ ln\ x}\frac{\partial}{\partial\ x}\ e^{\ -\ x(\ t^2\ -2)}\ dt\ =\ -\ e^{\ -\ 2\ x}\ [\int_0^{\ ln\ x}\ t^2\ e^{\ -\ x\ t^2}\ dt\ -\ 2\int_0^{\ ln\ x}\ e^{\ -\ x\ t^2}\ dt\ ]$$

The later can be evaluated and I got the following:

$$\ -\ e^{\ -\ 2\ x}\ [\frac{\ -(\ ln\ x)\ e^{\ -\ x(\ ln\ x)^2}}{\ 2\ x}\ +\int_0^{\ x(\ ln\ x)^2}\frac{\ e^{\ -\ u}}{4x\sqrt{ux}}\ du\ -\int_0^{\ x(\ ln\ x)^2}\frac{\ e^{\ -\ u}}{\sqrt{ux}}\ du}]$$

I found the result as above.However,the two integrals neither cancel with each other nor can be evaluated.Can anyone please check and tell what should be done further.

Neel

Last edited: Jan 17, 2010
2. Jan 17, 2010

### rasmhop

Let,
$$F(x) = \int_{0}^x e^{-e^x (t^2 - 2)} \text{ d}t$$
so you want to find the derivative of F(ln(x)) which you can do using the chain rule.

3. Jan 18, 2010

### neelakash

Does not help;it ultimately reduces to what I have got...

The thing lies in putting the limits without explicitly solving the final two inntegrals.They give zero.

4. Jan 18, 2010

### D H

Staff Emeritus
I helped neelakash with this problem on another forum (http://www.sciforums.com/showthread.php?t=99010). As he arrived at the correct answer there, I have no qualms posting the solution here for future reference by others.

neelakash did use the appropriate technique for differentiating under the integral sign, the Leibniz Integral Rule:

$$\frac{d}{dx}\int_{a(x)}^{b(x)} f(t,x)\,dt = \int_{a(x)}^{b(x)} \frac{\partial} {\partial x} f(t,x)\,dt + f(b(x),x)\frac{db(x)}{dx} - f(a(x),x)\frac{da(x)}{dx}$$

In this particular problem,

$$f(t,x) = \exp\left(-x(t^2-2)\right),\quad a(x)=0, \quad b(x)=\ln x$$

The partial derivative of f(t,x) wrt x is

$$\frac{\partial}{\partial x}f(t,x) = -(t^2-2) \exp\left(-x(t^2-2)\right)$$

Applying the Leibniz Integral Rule,

$$\frac{d}{dx}\left(\int_0^{\ln x} \exp\left(-x(t^2-2)\right)\,dt\right) = -\left(\int_0^{\ln x} (t^2-2) \exp\left(-x\bigl(t^2-2)\right) \,dt\right) + \exp\left(-x(\ln^2x-2)\right)/x$$

There is a sign error in the original post (that exp(-2x) should be an exp(2x)). Additionally, neelakash carried the integration a step too far. That integral on the right-hand side is evaluable in terms of the error function erf(x).

However, there is no reason to do this. neelakash finally saw the "Oh, SNAP!" light that makes this problem particularly easy. From that other forum,

5. Jan 18, 2010

### rasmhop

You're right, I'm sorry for the wrong suggestion. Anyway try substituting x=1 in the terms you found. The integrals should disappear due to ln(x)=0 and the upper limit term should become e^2.

6. Jan 18, 2010

### HallsofIvy

When x= 1, ln(x)= ln(1)= 0 so x ln(x)= 1(0)= 0. Both integrals are from 0 to 0 and so are qual to 0.

7. Jan 18, 2010

### neelakash

Yes,we need not carry out the integral explicitly as the answer comes from observation.