homework: Proving n <= 2^(n/4)? [closed] - math

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
So I have an assignment question where I have to prove:
n^4 is in O(2^n)
Just by looking at the graphs of the functions I know that with c=1 and n[0] = 16 this is true.
While trying to prove it on paper I managed to reduce the inequality down to n <= 2^(n/4), however, I cannot figure out how to simplify this further or adequately prove from here that with n[0]=16 the big-O assertion holds.
Any help?

The title is incorrect, and the error is important.
You are not trying to prove that n ≤ 2n/4, you are trying to prove that n ∊ O(2n/4), which is a strictly weaker claim. It is impossible to prove that n ≤ 2n/4 because at n=2, the inequality is false.
By taking the logarithm of both sides, we can reduce the problem to that of showing that log n ∊ O(n), which is easy to show because d/dn log n ≤ 1 for n ≥ 1.

It is easy to prove that the inequality holds for n >= 16 using induction, no calculus required:
First, for n=16 you have 164=216.
If the inequality holds for n=k, for n=k+1 you have (k+1)4 = (####)·k4 < 2k4 &leq; 2·2k = 2k+1.
QED.
Since this is homework, I'll leave leave the crucial step, finding what goes in place of ####, to the reader.

Related

How can I proof a difficult big o notation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I can easily understand how to proof a simple big o notation like n5 + 3n3 ∈ O(n5).
But how can I proof something more complex like 3n or 2n ∉ O(nk)?
Use a proof by contradiction.
Let's prove that 2n ∉ O(n2). We assume the opposite, and deduce a contradiction from a consequence.
So: assumption: there exists M and n0 such that 2n < M n2 for all n >= n0.
Let x be an number such that x > 5, and x > n0 and 2x > 4 M. Do you agree that such a number must exist?
Finish off the proof by deducing a contradiction based on the inequality that 22x < 4 M x2 by assumption.
Now do the analogous proof for k = 3. Then do it for k = 4. Then generalize your result for all k.

What is "h" in numerical differentiation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
I would like to know what h from the numerical differentiation formulas is and how I can calculate it when I have a function.
I am speaking about this formulas:
f'(x0) = (f(x0 + h) - f(x0)) / h
f'(x0) = (f(x0) - f(x0 - h)) / h
f'(x0) = (f(x0 + h) - f(x0 - h)) / 2*h
I would really appreciate any kind of help!
In such formulae h is usually a "very small number", similar to epsilon in Calculus.
For example, the derivative of f at a is defined as:
Note how h is defined as approaching 0.
When programming, e.g. doing numerical gradient computation, it usually works to set h to something very small - many programming environments have an "epsilon" quantity; lacking that, you can just use a very small floating-point number.
Using the usual 8 byte floats, sensible values for h are 1e-8 for the first and second formula and 1e-5 for the third central difference quotient. This is valid for medium values of x, for larger x one would have to include the scale of x in some way.
In general, for a kth order difference quotient with error order p, the balance between floating point noise and numerical error is reached for h about pow(2e-16, 1.0/(p+k)).

Approximate the integral using Riemann sum [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to approximate an integral of a function f(x) from -inf to +inf using the Riemann sum.
integrand<-function(x){exp(x)/sum(exp(x))}
integrate(integrand,lower=-Inf,upper=Inf)
Error in integrate(integrand, lower = -Inf, upper = Inf) :
non-finite function value
The solution doesn't exist if that is your true function
You still haven't clarified the function that you want to integrate. Can you write the integral that you want to evaluate, in ordinary mathematical notation, forgetting about R for the moment?
Here's what you've written, and why it doesn't make sense:
x<- seq(-1000,1000, length=1000)
OK, now x is vector of length 1000: (-1000,-997.998,...,997.998,1000)
v <- sum(exp(x))
OK, now v is equal to the sum of exp evaluated for the values on the vector x. And, since exp(1000)=Inf, this means that, from the point of view of R, v is equal to infinity.
f <-(exp(x))/(v)
At this point, you have defined x to be a vector and v to be a scalar, so this expression will set f to be a vector of length 1000. However, since v is infinite, then every value on f is going to be either 0 or NaN.
This all means that
integrate(f, ???? )
is meaningless, because f is not a function.
If you can write, in ordinary mathematical notation, exactly what integral you want to evaluate, someone will probably be able to help you.

Finding Multiplier Matrix [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am trying to find unknown matrix multiply matrix with knowing matrix
A*c=b
where b is defined vector, A is defined matrix 8x8, c is unknown vector.
I know, I can not divide matrix but what is the solution for this situation ??
This is basically a system of simultaneous linear equations. You can solve it using Gaussian elimination.
As for matrix "division", what you really have in mind is an inverse matrix, i.e. a matrix A-1 such that
AA-1=A-1A=I
where I is the identity matrix. If A is invertible then A*c=b is equivalent to c=A-1b.
The answer by Adam is certainly correct, but you should know that calculating the inverse of the matrix might not be the best solution.
Another to look into is LU decomposition and forward-back substitution. It will be more computationally stable that full Gaussian elimination and calculating the inverse.
You solve the problem in steps like this:
Decompose A = LU; now you'll have LUc = b. L is lower triangular; U is upper triangular.
Let y = Uc; solve Ly = b for y.
Now that you have y, solve for the c vector you want: y = Uc.

Proving big O of statement [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am having a hard time proving that n^k is O(2^n) for all k. I tried taking lg2 of both sides and have k*lgn=n, but this is wrong. I am not sure how else I can prove this.
To show that nk is O(2n), note that
nk = (2lg n)k = 2k lg n
So now you want to find an n0 and c such that for all n ≥ n0,
2k lg n ≤ c 2n
Now, let's let c = 1 and then consider what happens when n = 2m for some m. If we do this, we get
2k lg n ≤ c 2n = 2n
2k lg 2m ≤ 22m
2km ≤ 22m
And, since 2n is a monotonically-increasing function, this is equivalent to
km ≤ 2m
Now, let's finish things off. Let's suppose that we let m = max{k, 4}, so k ≤ m. Thus we have that
km ≤ m2
We also have that
m2 ≤ 2m
Since for any m ≥ 4, m2 ≤ 2m, and we've ensured by our choice of m that m = max{k, 4}. Combining this, we get that
km ≤ 2m
Which is equivalent to what we wanted to show above. Consequently, if we pick any n ≥ 2m = 2max{4, k}, it will be true that nk ≤ 2n. Thus by the formal definition of big-O notation, we get that nk = O(2n).
I think this math is right; please let me know if I'm wrong!
Hope this helps!
I can't comment yet, so I will make this an answer.
Instead of reducing the equation like you have been trying to do, you should try to find an n0 and a M that satisfy the formal definition of big O notation found here: http://en.wikipedia.org/wiki/Big_O_notation#Formal_definition
Something along the lines of n0=M=k might work (I haven't written it out so maybe that doesn't work, thats just to give you an idea)

Resources