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

• Mar 30th 2013, 08:07 AM
Skrymir
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.
• Mar 30th 2013, 08:34 AM
Plato
Re: Function to transition between 2 points (gradually changing slope)
Quote:

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 $\displaystyle 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 $\displaystyle f'~\&~f''$ a points between those two points then maybe.
• Mar 30th 2013, 08:47 AM
Skrymir
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.
• Mar 30th 2013, 10:30 AM
Skrymir
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))
• Mar 30th 2013, 05:33 PM
hollywood
Re: Function to transition between 2 points (gradually changing slope)
First, you should realize that $\displaystyle A\log_b(x)=(A\log_b(e))\ln(x)$, so you really have only two independent parameters.

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

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

$\displaystyle f(x_1)=A\ln(x_1)+C$, so $\displaystyle 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