Numerical solutions for initial value problems and root finding

14 replies · 3K views · last reply
Robb
Messages
225
Reaction score
8

Homework Statement


[/B]
It's been a couple of years since differential equations so I am hoping to find some guidance here. This is for numerical analysis.
Any help would be much appreciated.

Printed textbook problem 14 on page 11, with typos fixed. Part (a) asks to show Newton's law leads to the IVP dv/dt = -kv^2, v(0) = v0, and solve it for v(t). Part (b) asks to solve v(t) = dx/dt with x(0) = x0. Part (c) asks to estimate k with a root-finding technique using x0 = 10 m, v0 = 10 m/s, and x = 37 m at t = 3 s.


Homework Equations

The Attempt at a Solution


Handwritten notes deriving velocity from F = ma with dv/dt = -kv^2, v(0) = v0, separating variables to get v(t) = -ktv^2 + C and evaluating at t = 0 to give C.
 
No. When you go from[tex]\frac{dv}{dt} = -k v^2[/tex]
to:[tex]\int dv = -\int k v^2 dt[/tex]
you can't simply integrate the right side as though v is a constant, because v depends on t, and you don't know the functional dependence of v on t. What you need to do is collect the terms in v on one side and the terms in t on the other side so you have: [tex]\int \frac{dv}{v^2} = -k \int dt[/tex]Try going from there.
 
-1/v = -kt
v = 1/kt

or is this more accurate: v(t) = 1/kt ?
 
Last edited:
What about the constant of integration and the initial conditions?
 
phyzguy said:
What about the constant of integration and the initial conditions?

Shoot, I forgot about the constant of integration: v(t) = 1/kt + C
As for the initial conditions I guess I'm not sure. v(0) = v(o). Doesn't this imply division by zero (v(0) = 1/k(0))?
 
Robb said:
Shoot, I forgot about the constant of integration: v(t) = 1/kt + C

No! You need to add the constant of integration when you integrate, before you invert both sides.
 
Robb said:
Shoot, I forgot about the constant of integration: v(t) = 1/kt + C
As for the initial conditions I guess I'm not sure. v(0) = v(o). Doesn't this imply division by zero (v(0) = 1/k(0))?

No: as phyzguy said, the correct statement is ##-1/v = -kt + C##.
 
Robb said:
Yep, I got that. So, v(0) = -1/C

Yes, so keep going. Now you should be able to answer the other questions.
 
I now have to approximate the root of K. I'm not sure how to find a starting bracket. I know one way is to turn the equation F(k)=27k - ln abs(30k + 1) into two equations; y = 27k, y = ln abs(30k + 1). I've graphed it but the only intersection I can find is at the point (0,0), which we do not want. Any words of wisdom? Thanks!

Handwritten derivation solving the initial value problem dv/dt = -kv^2 with v(0) = v0 by separation of variables, arriving at v(t) = v0 / (k v0 t + 1).


Handwritten derivation solving an initial value problem: separation of variables with u-substitution u = kt V0 + 1, leading to x(t) = (1/k) ln|kt V0 + 1| + C, and the initial condition x(0) = X0 = 10 cm giving x(t) = (1/k) ln|kt V0 + 1| + 10.


Handwritten derivation on lined paper: x(t) = (1/k) ln|10kt + 1| + 10 is the position function; substituting t = 3 and x = 37 gives 27k - ln|30k + 1| = 0.
 
I suggest using Newton's method to find the value of K. It works for finding roots of an equation of the form F(x) = 0. Here you have F(k) = 27k - ln(30k+1) = 0. Start with a guess for k (I tried k = 1) and iterate until it stops changing. What value do you find for k?
 
Robb said:
I now have to approximate the root of K. I'm not sure how to find a starting bracket. I know one way is to turn the equation F(k)=27k - ln abs(30k + 1) into two equations; y = 27k, y = ln abs(30k + 1). I've graphed it but the only intersection I can find is at the point (0,0), which we do not want. Any words of wisdom? Thanks!

View attachment 211441

View attachment 211443

View attachment 211444

I refuse to look at your posted images, but am willing to comment on typed material.

In this case you want to find the intersection of the two curves ##f(k) = 27 k## and ##g(k) = \ln |30 k + 1|##. For ##k \geq 0## (actually, for ##k \geq -1/30##) you can remove the absolute-value signs in ##g(k)##. We have ##f'(0) = 27## and ##g'(0) = 30##. Since ##f(0)=g(0)=0## and ##g## has higher initial slope, ##g(k)## will exceed ##f(k)## intially. However, since ##g(k)## is a strictly concave function on ##(0,\infty)## (i.e., ##g''(k) < 0## for ##k > 0##), and since ##g## does not grow very fast, the two graphs must cross again exactly once at some value of ##k > 0##. However, that ##k## will be very small, because already by ##k = 1## we have ##f \gg g##. As phyzguy suggested, you can use Newton's method, but another way that looks promising is to expand ##g(k)## as an order-2 Maclauren series of the form ##g(k) \approx 30 k - c k^2## and then solve the resulting quadratic equation.

The graph of ##g(k)## for ##k < -1/30## is a mirror-image of that for ##k > -1/30##, so as ##k## decreases below -1/30 the graph rises up again (from ##-\infty##) and eventually becomes positive once more. That means that there must be a second root at a value ##k < -1/30##.
 
Note that the value for k you are searching for must be positive, otherwise the projectile will accelerate without limit.
 
Robb said:
much appreciated.

For what it is worth: you can solve the equation in terms of the so-called Lambert W- function and so can get an immediate numerical value if you use a computer algebra system such as Maple or Mathematica. You can also get a symbolic and numerical solution using the free on-line program Wolfram Alpha.