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'm having trouble solving this expression:
(x - 1)(7x + 6) 7
----------------- + -------
(x - 1)(x + 1)^2 (x + 1)
What's the steps to solve this?
I know you expand (x + 1)^2 to (x + 1)(x + 1) and that you need to find a common denominator before adding the numerators together.
Thanks.
(x-1)(7x+6)(x+1) + 7(x-1)(x+1)^2 14x+13
-------------------------------- = ---------
(x - 1)(x + 1)^3 (x+1)^2
The common denominator is found by multiplying the denominators of the question. That is (x-1)(x+1)^2 * (x+1). You then multiply (x-1)(7x+6) with (x+1) and 7 by (x-1)(x+1)^2 and add them to obtain the numerator.
Step 1 - Since (x-1) is on both the numerator and the denominator of the first fraction, remove those:
(7x + 6) 7
---------- + -------
(x + 1)^2 (x + 1)
Next, (x + 1)^2 equals (x + 1)(x + 1). This tells you to multiple (x + 1) to your right hand fraction:
(7x + 6) 7(x + 1)
--------------- + --------------
(x + 1)(x + 1) (x + 1)(x + 1)
No that you have a common denominator, add your numerators together:
(7x + 6) + 7(x + 1) = (7x + 6) + (7x + 7) = 14x + 13
So your final result looks like this:
14x + 13 14x + 13
-------------- = --------------
(x + 1)(x + 1) (x + 1)^2
Hope this helps -- good luck!
Related
The documentation to this packages is available here, but for me it is impossible to transfer my real-valued 3 objective function to a form that it works.
I'm trying to solve it with the nsga2 function - and I think nsga3 should work the same way?!
My objective functions, which I want to minimize, are:
f1 <- 1640.2823 + 2.3573285*x[1] + 2.3220035*x[2] +4.5688768*x[3] + 7.7213633*x[4] + 4.4559504*x[5]
f2 <- 6.5856 + 1.15*x[1] - 1.0427*x[2] + 0.9738*x[3] + 0.8364*x[4] - 0.3695*x[1]*x[4] + 0.0861*x[1]*x[5] + 0.3628*x[2]*x[4] - 0.1106*x[1]^2 - 0.3437*x[3]^2 + 0.1764*x[4]^2
f3 <- -0.0551 + 0.0181*x[1] + 0.1024*x[2] + 0.0421*x[3] - 0.0073*x[1]*x[2] + 0.024*x[2]*x[3] - 0.0118*x[2]*x[4] - 0.0204*x[3]*x[4] - 0.008*x[3]*x[5] - 0.0241*x[2]^2 + 0.0109*x[4]^2
And x has to be between one and three (these are the constraints)
1 <= x[i] <= 3
I appreciate any hints... so many thanks in advance!
I want to show that the recursion of quicksort run on best time time on n log n.
i got this recursion formula
M(0) = 1
M(1) = 1
M(n) = min (0 <= k <= n-1) {M(K) + M(n - k - 1)} + n
show that M(n) >= 1/2 (n + 1) lg(n + 1)
what i have got so far:
By induction hyposes
M(n) <= min {M(k) + M(n - k - 1} + n
focusing on the inner expresison i got:
1/2(k + 1)lg(k + 1) + 1/2(n - k)lg(n - k)
1/2lg(k + 1)^(k + 1) + 1/2lg(n - k)^(n - k)
1/2(lg(k + 1)^(k + 1) + lg(n - k)^(n - k)
1/2(lg((k + 1)^(k + 1) . (n - k)^(n - k))
But i think im doing something wrong. i think the "k" should be gonne but i cant see how this equation would cancel out all the "k". So, probably, im doing something wrong
You indeed want to get rid of k. To do this, you want to find the lower bound on the minimum of M(k) + M(n - k - 1). In general it can be arbitrarily tricky, but in this case the standard approach works: take derivative by k.
((k+1) ln(k+1) + (n-k) ln(n-k))' =
ln(k+1) + (k+1)/(k+1) - ln(n-k) - (n-k)/(n-k) =
ln((k+1) / (n-k))
We want the derivative to be 0, so
ln((k+1) / (n-k)) = 0 <=>
(k+1) / (n-k) = 1 <=>
k + 1 = n - k <=>
k = (n-1) / 2
You can check that it's indeed a local minimum.
Therefore, the best lower bound on M(k) + M(n - k - 1) (which we can get from the inductive hypothesis) is reached for k=(n-1)/2. Now you can just substitute this value instead of k, and n will be your only remaining variable.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
Consider the following recurrence relation.
T(n) = 5 if n <= 2
T(n-1) + n otherwise
Closed form solution for T(n) is
I got solution as n(n+1)/2 + 7 for all the values. But in my university exam they gave the solution n(n+1)/2 + 2. However this solution doesn't terminate at 5 for values n<2. Can some body please explain ?
Let's solve it; first let's expand in telescopic sums:
T(k) = T(k)
T(k + 1) = T(k) + k + 1
T(k + 2) = T(k + 1) + k + 2 = T(k) + k + 1 + k + 2
...
T(k + m) = T(k) + k + 1 + k + 2 + ... + k + m =
= T(k) + mk + 1 + 2 + ... + m =
= T(k) + mk + (1 + m) * m / 2
...
Now we have
T(k + m) = T(k) + mk + (1 + m) * m / 2
Let k = 2:
T(m + 2) = T(2) + 2m + (1 + m) * m / 2 = 5 + 2m + (1 + m) * m / 2
Finally, let m + 2 = n or m = n - 2:
T(n) = 5 + 2 * (n - 2) + (n - 1) * (n - 2) / 2 = n * (n + 1) / 2 + 2
We have
T(n) = n * (n + 1) / 2 + 2 when n > 2
T(n) = 5 when n <= 2
As a simple non-rigorous reasoning exercise, we known that T(n) = T(n-1) + n yields the sum of the first n numbers: S(n) = n * (n + 1) / 2
Now, when n=2, S(2) = 3, so the value of 5 is actually an increment by 5 - S(2) = 2. So we could say:
T(n) = S(n) + (5 - S(2)) for n >=2
or
T(n) = S(n) + 2 for n >= 2
T(n) = 5 for n <= 2
Note that at n=2, the two relations are identical.
When solving a regular maximum weighted matching problem in GLPK, one would provide a DIMACS file and call glp_asnprob_lp with GLP_ASN_MMP. However, this will set all the constrains to <= 1, for example
Subject To
r_1: + x(1,9) + x(1,10) + x(1,12) <= 1
r_2: + x(2,10) + x(2,12) + x(2,13) <= 1
r_3: + x(3,11) + x(3,13) <= 1
r_4: + x(4,9) + x(4,12) + x(4,14) <= 1
I want each node to have a higher capacity (say 10), hence the constrains would be:
Subject To
r_1: + x(1,9) + x(1,10) + x(1,12) <= 10
r_2: + x(2,10) + x(2,12) + x(2,13) <= 10
r_3: + x(3,11) + x(3,13) <= 10
r_4: + x(4,9) + x(4,12) + x(4,14) <= 10
How do I go about it? I really don't want to have to build my own matrix.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have been trying to solve this recurrence for almost 2 hours but could not get the answer...
Let:
T(n)= kn+T(n/2) for n>1 and T(1)=1 where n = 2^k for some integer k
Show that T(n)= O(n)
(I'm assuming the k in T(n) = kn + T(n / 2) is not the same as the k in n = 2^k. If that's wrong, I'll update this.)
If you just need an asymptotic bound, then you can use the Master Theorem. Your recurrence is
T(n) = T(n / 2) + kn
So a = 1, b = 2, and c = 1. Therefore, since logb a = 0 < 1, the Master Theorem causes this to solve to Θ(n).
If you need an exact value, you can use the iteration method to get a good guess. I'm assuming T(1) = 1.
T(n) = T(n / 2) + kn
= (T(n / 4) + kn/2) + kn
= T(n / 4) + kn + kn/2
= (T(n / 8) + kn / 4) + kn + kn / 2
= T(n / 8) + kn + kn / 2 + kn / 4
...
= T(n / 2i) + kn(1 + 1/2 + 1/4 + ... + 1/2i)
This terminates when i = log2 n, at which point we get
T(n) = T(1) + kn(1 + 1/2 + 1/4 + ... + 1/n)
= 1 + kn(1 + 1/2 + 1/4 + ... + 1/n)
= 2kn
So the exact figure should be (modulo math errors) 2kn, agreeing with the result from the Master Theorem.
Hope this helps!