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.

I have a continuous, differentiable, monotonic, bounded function called F[t]. If t -> Infinity then F[t] -> c. I know c, and I want to find the smallest t value called t*, that suffices F[t]=c (I am sure there is one).

Could somebody give me some hints about which functions to use for this task? Since I am afraid that FindRoot does not work in this case, because even if I know that there is a given T that T is smaller than t*, starting FindRoot from T as center won't give me the nearest solution, only a solution somewhere near T (Or am I wrong?). And neither does Solve work, because F[t] is not injective.

share|improve this question
2  
Is there any way to share the function F[t]? –  tkott May 9 '12 at 10:28
1  
I'm a bit confused. For a monotonic, continuous, differentiable function F with supremum c all values F[t] are less then c. Or am I missing something? Could you show the definition of F? –  Peter Breitfeld May 9 '12 at 10:45
    
@PeterBreitfeld See an example of monotonic, continuous, differentiable function F in my answer. –  Artes May 9 '12 at 10:55
    
@Artes Ok that is what we call a "weak" monotonic function. –  Peter Breitfeld May 9 '12 at 11:07
1  
@PeterBreitfeld Well, I supposed that my function had been only monotonic, and not strictly monotonic, and that is why I thought there were no contradictions in my questions. But after your comment I thought it over again, and I realized that you were right, and the function is strictly monotonic. That is my problem is now a simple one, because I will only choose an epsilon that suits my purposes. And it was an interpolating function, so I should have had to suspect, that it cannot be simply monotonic, as Mark McClure mentioned. –  Rieux May 9 '12 at 11:27

1 Answer 1

up vote 11 down vote accepted

Briefly, one can use :

Reduce[ D[ F[x], x] == 0, x, Reals]

or if the function is not strictly monotonic one should select the maximal element out of the result in the boolean form, e.g.

Max @ (( List @@ Reduce[ D[ F[x], x] == 0, x, Reals] // Quiet)[[All, 2]])

The major problem is to provide some examples to demonstrate how it works. Since there have been none I will give the following :

Ex. 1. a class of $C^{1}$ functions

We define a family of differentiable i.e. $C^{1}$ functions F numbered with an eps parameter :

P[x_] := a x^3 + b x^2 + c x + d
W[x_, eps_] := P[x] //. Flatten @ Solve[{ #^2 == P[#], 1 == P[1], 2 # == P'[#], 1 == P'[1]}, 
                                        {a, b, c, d}]& @ (1 - eps)
Z[x_, eps_] := P[x] //. Flatten @ Solve[{ # == P[#], 2 == P[2], 1 == P'[#], 0 == P'[2]},
                                        {a, b, c, d}]& @ (2 - eps)
F[x_, eps_] := Piecewise[{ { x^2, 0 < x < 1 - eps}, 
                           { W[x, eps], 1 - eps <= x < 1}, 
                           { x, 1 <= x < 2 - eps}, 
                           { Z[x, eps], 2 - eps <= x < 2},
                           { 2, x >= 2} } ]

This definition is slightly involved because it is constructed with a few pieces of differentiable functions. The result fulfills the requirements. We introduced auxiliary functions P, W and Z to define F (monotonic, differentiable, and constant after x exceeds a certain point x0, (here x0 == 2)).
Now we can test the result for any eps (every eps > 0 define a differentiable function F[x, eps] ), e.g.

 Manipulate[ Plot[ F[x, eps], {x, 0, 2.3}, PlotRange -> {0, 2.3}] // Quiet, {eps, 0, 1}]

or showing a graph of F[x, eps] with a running parameter eps on the background of graphs for various eps :

    Animate[ 
        Show[ Plot[ Evaluate @ Table[ F[x, ep], {ep, 0, 1, 0.1}], {x, 0, 2.3}, 
                    PlotRange -> {0, 2.1}, ImageSize -> {650, 450}] // Quiet, 
              Plot[ F[x, eps], {x, 0, 2.3}, PlotRange -> {0, 2.1}, 
                    PlotStyle -> Thick, ImageSize -> {650, 450}] // Quiet, 
              Graphics[{ PointSize[0.015], Magenta,
                         Point @ {{1 - eps, F[1 - eps, eps]}, {2 - eps, F[2 - eps, eps]}}}]
            ],  {eps, 0, 1}]

enter image description here

Reduce[ D[F[x, 0.4], x] == 0, x, Reals] // Quiet
Max @ ( List @@ Reduce[ D[ F[x, 0.4], x] == 0, x, Reals] // Quiet)[[All, 2]]
 x <= 0 || x > 2.
 2.

The answer is x == 2.

Edit

We would like to test the method when the interesting point changes its location, therefore we add another class of functions to demonstrate the reliability of the approach based on Reduce.

Ex. 2. a class of $C^{\infty}$ functions

We construct a family of G functions numbered with an eps parameter, but this family is smooth (i.e. $C^{\infty}$) and the gluing point x == x0 is movable :

G[x_, eps_] := 
    Piecewise[{ {1 - eps^2/10 - eps Exp[-(1/(1 - 1/eps - x))], x < 1 - 1/eps},
                {1 - eps^2/10, x >= 1 - 1/eps} }]

This family of functions G is not analytic of course, (precisely, the only point where the functions are not analytic is x == 1 - 1/eps), however they are still smooth, i.e. we can find their derivatives of any order in x == 1 - 1/eps, for any eps, e.g.

Limit[ Table[ D[G[x, eps], {x, n}], {n, 1, 10}], x -> 1 - 1/eps, Direction ->  1]
Limit[ Table[ D[G[x, eps], {x, n}], {n, 1, 10}], x -> 1 - 1/eps, Direction -> -1]
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

thus its expansion in a Taylor series around x0 == 1 - 1/eps is constant unlike the function itself for x <= x0.

We can test that for any eps we get the correct result :

Manipulate[{Reduce[ D[ G[x, eps], x] == 0, x] // Quiet, 1 - 1/eps}, {eps, 0.1, 1}]

enter image description here

and we make a plot of a few functions :

GraphicsColumn[
    {Plot[ Evaluate @ Table[ G[x, eps], {eps, 0.2, 1.1, 0.1}], {x, -5, 2}, 
           PlotStyle -> Thick, PlotRange -> All, PerformanceGoal -> "Speed"], 

     Plot[ Evaluate @ Table[ G[x, eps], {eps, 0.5, 0.9, 0.1}], {x, -5, 2},  
           PlotStyle -> Thick, PlotRange -> {{-1.5, 0.1}, {0.9, 0.98}}, 
           PlotPoints -> 200, MaxRecursion -> 8]}]

enter image description here

share|improve this answer
    
Wow! Terrific! Thank you, Artes! I think I got my answer. But, to tell you the truth, I have missed sg indeed, and so my function is unfortunately strictly monotonic. Your construction is simply brilliant. –  Rieux May 9 '12 at 11:13
    
@Rieux I added another example of functions to demonstrate that the approach with Reduce is sufficient for the task in the question. –  Artes May 15 '12 at 18:55

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.