- #1

- 72

- 0

Seems simple enough, right?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Wiemster
- Start date

- #1

- 72

- 0

Seems simple enough, right?

- #2

- 907

- 2

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

- 1,233

- 18

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

- 72

- 0

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

- 1,233

- 18

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.

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:

- #6

- 72

- 0

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

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

- 907

- 2

- #8

- 240

- 2

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.

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

- 1,233

- 18

- #10

- 72

- 0

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

- #11

- 530

- 7

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

- 72

- 0

- #13

- 530

- 7

Do you want a function that's infinitely differentiable?

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

Last edited:

- #14

- 72

- 0

Do you want a function that's infinitely differentiable?

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

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

- 530

- 7

I now matched two exponential functions at x=x0

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

- #16

- 72

- 0

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

Yep, I gave up...

Share:

- Replies
- 3

- Views
- 2K