# Math Help - Function to transition between 2 points (gradually changing slope)

1. ## Function to transition between 2 points (gradually changing slope)

Hi, I'm new here and I'm not sure if this is the right section or not if it is in the wrong section please let me know and I'll post it there instead.

I have been racking my brain with this for a couple days and am embarrassed that I can't figure it out (at one point I considered myself good at this kind of thing)... Just so you know this is NOT Homework, but a personal project of mine that I have been working on. The field is economics and expenditure models.

I am looking for a f(x) that can be determined given a set of knowns at two different points:

@ x1, f(x1) and f '(x1) are know and
@ x2, f(x2) and f '(x2) are also known

relationship between the two points -- x2>x1, f(x2)>f(x1), f '(x2)<f '(x1)

My though was to use a function in the form of f(x) = A logb(x) - C, but I could not get it to work.

2. ## Re: Function to transition between 2 points (gradually changing slope)

Originally Posted by Skrymir
I have been racking my brain with this for a couple days and am embarrassed that I can't figure it out (at one point I considered myself good at this kind of thing)... Just so you know this is NOT Homework, but a personal project of mine that I have been working on. The field is economics and expenditure models.
I am looking for a f(x) that can be determined given a set of knowns at two different points:
@ x1, f(x1) and f '(x1) are know and
@ x2, f(x2) and f '(x2) are also known
relationship between the two points -- x2>x1, f(x2)>f(x1), f '(x2)<f '(x1)
If I follow what you say, then there is no way to do that.
The function between $x_1~\&~x_2$ could be very well behaved (even linear) of it could behave very wildly.

Now if you were to know something about the $f'~\&~f''$ a points between those two points then maybe.

3. ## Re: Function to transition between 2 points (gradually changing slope)

I am trying to "smooth" out the corners on an expenditure model relating to family spending, and convert 3 flat percentages into a series of decaying rates with no abrupt change in slope.

I have three sections of the model where spending is assumed to be linear, but at different rates (or slopes) relating to income level (Low Income rate>Middle Income Rate>High Income rate). The model does not start at zero but at a point >0.

I hope that clarifies what I am trying to do.

4. ## Re: Function to transition between 2 points (gradually changing slope)

I should add that a log function is appropriate as the over model trends that way. My first attempt was trying to set up a single equation to fit the entire system but I wasn't able to do that either.

So:
f '(x) ~ 1/(x*ln(b))
f ''(x) ~ -1/(x2*ln(b))

5. ## Re: Function to transition between 2 points (gradually changing slope)

First, you should realize that $A\log_b(x)=(A\log_b(e))\ln(x)$, so you really have only two independent parameters.

So you're given values for $x_1$, $x_2$, $f(x_1)$, $f(x_2)$, $f'(x_1)$, and $f'(x_2)$ and you would like to fit a function of the form $f(x)=A\ln(x)+C$ to them. It turns out that you really only need one set $x_1$, $f(x_1)$, $f'(x_1)$ to determine A and C.

$f'(x)=\frac{A}{x}$ so $A=x_1f'(x_1)$

$f(x_1)=A\ln(x_1)+C$, so $C=f(x_1)-A\ln(x_1)$

So hopefully when you use those three to determine A and C, the other three also work. If not, you'll need a new model.

- Hollywood