# Which single-valued differentiable function between 0 and 1 satisfies

1. Oct 23, 2009

### Wiemster

I look for a function u(x) with u(0)=0 and u(1)=1, which is single-valued and differentiable on the entire interval x= [0,1] and allows one to choose the derivatives u'(0) and u'(1) through two free parameters.

Seems simple enough, right?

2. Oct 23, 2009

### hamster143

u(x) = x + A*sin(pi*x) + B*sin(2*pi*x)

u'(0) = 1 + pi*A + 2*pi*B
u'(1) = 1 - pi*A + 2*pi*B

A = (u'(0) - u'(1)) / (2*pi)
B = (u'(0) + u'(1) - 2) / (4*pi)

3. Oct 23, 2009

### mikeph

u(x) = ax^3 + bx^2 + cx + d?

u(0) = 0 --> d = 0
u(1) = 1 --> a + b + c = 1 so c = 1-a-b

so your function is:

u(x) = ax^3 + bx^2 + x(1-a-b) -----------(*)

Say you need the derivatives to arbitrarily be p and q at x = 0 and 1 respectively,

u'(x) = 3ax^2 + bx + 1 - a - b

so u'(0) = p, u'(1) = q mean that:

1 - a - b = p ---------------(1)
3a + b + 1 - a - b = q ------(2)

(1) means we can fix b = 1 - a - p, substitution into (2) means:

3a + (1 - a - p) + 1 - a - (1 - a - p) = q
3a + 1 - a - p + 1 - a - 1 + a + p = p
2a + 1 = q

So for any two gradients you need, (p,q) at the points (0,1), your parameters (a,b) in the function (x) given above (*) are ((q-1)/2, 1 - (q-1)/2 - p).

I think this works...

4. Oct 23, 2009

### Wiemster

Thank you both very much, and both solutions indeed do the job. However I must say I made a mistake in saying that I wanted the function to be single-valued.

What I actually want is that the function is monotonic, so that it only increases from x=0 to 1. Both proposed solutions do not always satisfy this criterion, sadly enough. Can a function be devised which is monotonic?

5. Oct 23, 2009

### mikeph

I don't think this is possible in the case u'(1) < 0 or u'(0) < 0.

For u(x) to be continuous, the limit must equal the value, so lim(u) as x goes to zero from above must be zero. However if you specify a negative gradient at this point, it implies that within a neighbourhood around 0, u is negative for at least some range x in (0,epsilon), and if u is negative for some x in [0,epsilon), but u(1) = 0 and u(x) is continuous, then there must be a second value, say a, for which u(a) = 0 in the range (epsilon,1)- so since u(0) = u(a) it cannot be monotonic.

Been a long time since I've done real analysis so I feel this is quite a shaky proof.

Last edited: Oct 23, 2009
6. Oct 23, 2009

### Wiemster

You're right! So I am indeed only interested in functions with u'(0) and u'(1) between 0 and 1. I understand I change the problem all the time, apparently I didn't think it through all the way.

I was thinking that an error function erf((x-m)/s) does part of the trick, when properly shifted and rescaled. But then there is the problem of finding m and s in terms of u'(0) and u'(1), which probably cannot be done analytically. And more problematically, u'(0) and u'(1) cannot be chosen independently anymore, I guess.

So maybe there is a simpler function that can do the trick and which does allow one to easily adjust u'(0) and u'(1)?

7. Oct 23, 2009

### hamster143

Yes, that's only possible if both derivatives are nonnegative, for obvious reasons. Much trickier to do, too. It seems that we have to consider several distinct cases depending on values of u'(0) and u'(1). For example, when they are both greater than 1, we can construct the necessary function out of x^a and 1-(1-x)^b. Can't think of a good function that works for all values.

8. Oct 23, 2009

### elibj123

you can simply say that a single-valued function is monotonous=>u' keeps its sign on [0,1].
also u(1)>u(0) => u' must be positive on [0,1].

9. Oct 23, 2009

### mikeph

Can't a u(x) = a*sin(b*x + c) + d function satisfy this? I don't have the time to prove it, but for any positive gradients I can imagine a simple manipulation of the frequency/amplitude satisfying this...

10. Oct 23, 2009

### Wiemster

With this choice you cannot get u'(1)>1, without losing monotonicity on [0,1] I think.

11. Oct 25, 2009

### bpet

This is a tough one. In probabilistic speak, you want to construct a distribution on [0,1] with a continuous density function that is prescribed at 0 and 1.

I take it you want the mass to shift smoothly around [0,1] as the parameters vary. What about making the density a piecewise linear function, e.g. with a W shape?

u'(0)=a
u'(x1)=0
u'(1/4)=0
u'(1/2)=c
u'(3/4)=0
u'(x2)=0
u'(1)=b

x1=min(1/4,1/a)
x2=max(3/4,1/b)

choose c so that total area is 1, i.e. c = 4-2.a.x1-2.b.(1-x2)

12. Oct 25, 2009

### Wiemster

With piecewise functions it should indeed be much more easy to escape from Runge's phenomenon, I would however be interested in finding a single (i.e. without Heaviside step functions) elementary function that is able to satisfy my demands.

13. Oct 26, 2009

### bpet

Do you want a function that's infinitely differentiable?

You'll be hard pressed to find one simpler to compute.

Last edited: Oct 26, 2009
14. Oct 26, 2009

### Wiemster

It does not necessarily have to be infinitely differentiable. I now matched two exponential functions: u1(x) = a1*exp(b1*x)+c1 and u1(x) = a2*exp(b2*x)+c2 at x=x0. The constants a1,a2 and c1,c2 follow from u(0)=0, u(1)=1, u1(x0) = u2(x0), u2(x0)=u2(x1). The three constants b1, b2 and x0 can then be used to influence the shape. This is fine for my purposes. But thanks anyway for your suggestions.

15. Oct 26, 2009

### bpet

That would still be a piecewise function wouldn't it?

16. Oct 27, 2009

### Wiemster

Yep, I gave up...

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook