solving recurences [closed] - math

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
T(n)=T(n-1) + lgn
My approach is:
Substituting n-1,n-2,n-3
Finally we get,
T(n)=T(1) + lg 2 +lg 3 and so lg n
=> T(n) = lg(2*3*4*5 n)
Hence T(n)=lg(n!).
But they give the answer as nlgn.

Is this a problem for computing complexity? If so then both you and "they" are correct.
O(lg(n!)) = O(lg(n^n)) = O(n lg(n))
More rigorously, from Stirling formula:
lg(n!) = n lg(n) - n + O(ln(n))
Therefore
O(lg(n!)) = O(n lg(n)) + O(n) + O(ln(n)) = O(n lg(n))

Related

How to solve nonlinear equations in R [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
For example, I try to solve for x: 12*exp(-2x/4)=0.5, or x^2+3x^4+9x^5=10, is there any method in R to solve such equations?
Try with uniroot function
r1 <- uniroot(function(x) 12*exp(-x/2) - 0.5, c(-1000, 1000))
r2 <- uniroot(function(x) x^2 + 3*x^4 + 9*x^5 - 10, c(-1000, 1000))
r1$root
[1] 6.356108
r2$root
[1] 0.943561
You have to define:
a function of the type f(x) = 0 (and remove the second member of equality)
an interval within which to search for the solution

How to solve a general recurrence? [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
Is there a way to solve a general recurrence relation of the form
a(n)=a(n-1) * a(n-2)....
I mean I can use the matrix method to solve a relation of the form
F(n)=a1*F(n-1) + a2*F(n-2).......+ ak*F(n-k)
but what to do when there is a '*' sign instead of '+'
Use logarithms:
a(n) = a(n-1) * a(n-2) * a(n-3) * ....
Take log of both sides:
log(a(n)) = log(a(n-1) * a(n-2) * a(n-3) * ...)
Use the fact that log(a * b) = log(a) + log(b) to split up the factors:
log(a(n)) = log(a(n-1)) + log(a(n-2)) + log(a(n-3)) + ...
Now, if you just say that F(n) = log(a(n)) then this equation looks just like your second equation. Use the matrix method to solve for log(a(n)):
log(a(n)) = X
Which leaves:
a(n) = e ^ X
(Assuming you take natural logarithms)

Solving Vector Multiplication (general problem) [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 trying to solve a Mathematical equation in one of my geometric modelling problem.
Let's say if I have 2 vectors, A and B, and I have the following equation:
A x B = c (c is a scalar value).
If I know the coordinate of my vector B (7/2, 15/2); and I know the value of c, which is -4.
How can I calculate my vector A, to satisfy that equation (A X B = c) ?
The problem is underdetermined; there isn't a unique such A. I assume that by "multiplication" you mean the cross product.
A = (x,y)
B = (7/2, 15/2)
A×B = x(15/2) - y(7/2)
-4 = (15x-7y)/2
15x - 7y = -8
This gives a line along which points A=(x,y) can lie. Specifically, for any real number t,
x = -1 + 7t
y = -1 + 15t
gives a solution.

how to solve IVP using separable variable [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
the question is:
x dy/dx = 2y ; y(0)=0
because when i solve this problem the integration constant 'c' gets zero... and i have to find its value in order to calculate a solution to given IVP
Unless I'm mistaken, this question gives c = 0 for y(0) = 0
x*dy/dx = 2y
x*dy = 2y*dx
dy / 2y = dx / x
ln(2y) = ln(x) + c
e^(ln(2y)) = e^(ln(x) + c) = e^ln(x)*e(c)
2y = x + c
solving for y(0) = 0 gives c = 0, as you stated.
Why do you think c must not be 0?

I want to calculate this Integral to solve one important differential equation in general relativity [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 12 years ago.
Improve this question
∫▒fdf/√(f(f^3 a+6bf+3c))
a, b, c are constant
The program is:
Integrate[x/Sqrt[x (x^3 a + 6 b x + 3 c )], x]
As per Mathematica output:
(2*(EllipticF[ArcSin[Sqrt[(x*(-R[1] + R[3]))/((x - R[1])*R[3])]],
((R[1] - R[2])*R[3])/(R[2]*(R[1] - R[3]))] -
EllipticPi[R[3]/(-R[1] + R[3]),
ArcSin[Sqrt[(x*(-R[1] + R[3]))/((x - R[1])*R[3])]],
((R[1] - R[2])*R[3])/(R[2]*(R[1] - R[3]))])*(x - R[1])^2*
Sqrt[(R[1]*(x - R[2]))/((x - R[1])*R[2])]*R[3]*
Sqrt[x*R[1]*(x - R[3])*(-R[1] + R[3]^2)])/
(Sqrt[x*(3*c + 6*b*x + a*x^3)]* (R[1] - R[3]))
Where:
Root[n]
Is the n root of the polynomial
p[u]=3 c + 6 b u + a u^3
Additionally, you may try this in Wolfram Alpha to get the indefinite integral, or definite ones. But I really think that if you are solving one important differential equation in general relativity and don't tried Mathematica and/or Wolfram Alpha, you may be a) Trolling or b) In great trouble

Resources