Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

My problem is that I have two functions that are described as follows:

x1 = 
  x[t] /. DSolve[{55 x''[t] + 100*n x'[t] + (5/22)*n x[t] == 5, x'[0] == 1/8, x[0] == 0}, 
    x[t], t][[1]]
x2 = 
  x[t] /. DSolve[{x''[t] + 1 == 0, x'[0] == 1/8, x[0] == 0}, x[t], t][[1]]

Variable n in function x1 ranges from 1 to 8. I want to find which n enables x1 to come as close to x2 as possible without falling below x2. Or stated otherwise, what is the highest n that ensures x1 > x2 at all times.

A plot of the functions reveals that most of the action takes place between t = 0 and t = 0.15. However, the curves are too close to each other to read the right n from my screen. I have been trying ways to calculate the difference with integration, solving and all types of manners for hours now, but I'm certain there must be an easier way to achieve this within Mathematica.

share|improve this question
    
When you say $x1$ to come close to $x2$ you mean for one point $t$ or in average? –  Spawn1701D Apr 26 '13 at 5:31
add comment

1 Answer 1

up vote 3 down vote accepted

For an n that "ensures x1 > x2 at all times", I think it may not be possible. Look at the plot below, it seems for t negative enough, x1 will eventually below x2 for all $1 \leq n \leq 8$:

Plot3D[
 Evaluate[x1 - x2], {t, -4, 1}, {n, 1, 8},
 PlotPoints -> 100,
 MeshFunctions -> {#1 &, #2 &}, Mesh -> {{0}, 20},
 MeshStyle -> {Directive[Red, Thick], Gray},
 BoundaryStyle -> Thick,
 ClippingStyle -> {Lighter[Blue, .7], Directive[{Lighter[Green, .5]}]},
 PlotRange -> {0, .1}, Lighting -> "Neutral",
 AxesLabel -> (Style[#, 20, Lighter[Blue], Bold] & /@ {t, n, "\!\(\*SubscriptBox[\(x\), \(1\)]\)-\!\(\*SubscriptBox[\(x\), \(2\)]\)"})]

plot

Edit

In case OP wants ask for additional constraint $0\leq t$, we can see from the plot below that the highest $n$ happens at the cross point indicated with purple crayon:

enter image description here

However, simply substituting $t=0$ into equation $x_1-x_2=0$ will not work, since x1 - x2 /. t -> 0 is always 0.

In order to help understanding what happened near the cross point, we can plot it out:

enter image description here

So the cross point we are interested in, that is, the $n$ we are looking for, makes the curvature of the curve $z = f(t) = x_1-x_2$ vanishing at $t=0$.

Function[{x, f}, D[f, {x, 2}]/(1 + D[f, x]^2)^(3/2)][t, x1 - x2] /. t -> 0 // FullSimplify

$$\frac{1}{22} (24-5 n)$$

So the highest $n$ that ensures $x_1 \geq x_2$ on $0\leq t$ near $0$ is $\frac{24}{5}=4.8$.


Another possible approach would be expanding $x_1-x_2$ near $t=0$

Series[x1 - x2, {t, 0, 3}]

$$\left(\frac{6}{11}-\frac{5 n}{44}\right) t^2+\left(\frac{25 n^2}{363}-\frac{107 n}{3872}\right) t^3+O\left(t^4\right)$$

and forcing the coefficients of terms with order $\leq 2$ vanishing, which gives the same answer $\frac{24}{5}$.


For verification, here we plot the line of equation $x_1-x_2=0$

ContourPlot[Evaluate[x1 - x2 == 0], {t, 0, 10^-4}, {n, 4.7995, 4.801},
 PlotPoints -> 200,
 ContourStyle -> Lighter[Blue, .6],
 FrameLabel -> (Style[#, 20, Bold] & /@ {t, n}),
 GridLines -> {None, {24/5}},
 GridLinesStyle -> Red]

enter image description here

share|improve this answer
    
He wants between $0<t<0.15$ –  Spawn1701D Apr 26 '13 at 5:30
    
@Spawn1701D I take that words of OP means the interval he considered in order to solve the problem, not the domain/constraint on t in the problem itself. –  Silvia Apr 26 '13 at 5:37
    
@Alex I'm not sure I catch up with you. Is x1-x2/.{ n-> .. , t -> .. } not enough? For the time domain, try FindRoot[x1 - x2 /. n -> #, {t, .1}] &[(*your n value greater than 24/5*)]. –  Silvia Apr 26 '13 at 8:07
    
@Alex Thanks for acceptance. Please see my edit. –  Silvia Apr 26 '13 at 8:13
    
Thank you for your help –  Alex Apr 26 '13 at 8:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.