Function to transition between 2 points (gradually changing slope)

Skrymir

New member
Joined
Mar 30, 2013
Messages
3
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.
 
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.
This should be fun.

Since the slope is decreasing, you should have a function that approaches horizontal at large x. A square-root function would do that, or (1 - e^-x). Either of those starts from f(x_0) = 0 at some time in the past .. do you have any feeling for what you want x_0 to be? You could try

\(\displaystyle \displaystyle f(x) = A\ \left( 1 - \mathrm e^{-\alpha \ (x - x_0)} \right) + C \)

\(\displaystyle \displaystyle f'(x) = A\ \alpha \ \mathrm e^{-\alpha \ (x - x_0)} \)

which has four parameters to set by your four given values.
 
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.
.
An infinite number of functions will do the trick.The real question is what does your mental model indicate to you would be appropriate. Polynomials are particularly easy to work with, but may not make sense based on external considerations. The simplest polynomial available for this problem is a cubic. (The minimum degree of the polynomial is one less than the number of constraints imposed on the function.)
.
\(\displaystyle Let\ x_0 = m,\ x_1 = n,\ f(n) = p,\ f’(n) =q, f(m) = r,\ and\ f’(m) = s.\)
.
\(\displaystyle \alpha m^3 +\beta m^2 + \gamma m + \delta = p.\)
.
\(\displaystyle 3 \alpha m^2+ 2 \beta m + \gamma = q.\)
.
\(\displaystyle \alpha n^3 +\beta n^2 + \gamma n + \delta = r.\)
.
\(\displaystyle 3 \alpha n^2+ 2 \beta n + \gamma = s.\)
.
But m, n, p, q, r, and s are known. So the four equations above become linear equations in alpha, beta, gamma, and delta, which can be solved algebraically. For each constraint that you add to your function, the degree of the polynomial goes up by one.
 
Last edited:
This should be fun.

Since the slope is decreasing, you should have a function that approaches horizontal at large x. A square-root function would do that, or (1 - e^-x). Either of those starts from f(x_0) = 0 at some time in the past .. do you have any feeling for what you want x_0 to be? You could try

\(\displaystyle \displaystyle f(x) = A\ \left( 1 - \mathrm e^{-\alpha \ (x - x_0)} \right) + C \)

\(\displaystyle \displaystyle f'(x) = A\ \alpha \ \mathrm e^{-\alpha \ (x - x_0)} \)

which has four parameters to set by your four given values.

I think I will this...

xo may be difficult as it is unlikely to be my "true" xo which is another Given in the model.
This how the model is set up:

I have 3 different flat percentages based on income range. The percentages estimate the amount of available funds directed to certain types of family spending. And am trying to estimate these amounts for families of different sizes.

I have an equivalence scale which I use to get and overall average % (~15%-40% depending on family size), but based on family spending trends I have modified this flat % into 3 separate flat %s

My "true" xo is a given amount (a type of reserve amount) where below that point it is assumed that there is no available money for these expenditures.

The first percentage is quite high, but is only in effect while total income is quite low (55%-70% of available funds over this span).

The second flat percentage is a return to the overall average from this increased range of spending. This percentage is lower (12%-35%) than the overall average and acts over a larger range of incomes (4 times run of the first flat percentage).

I need a fairly quick transition between these to different slopes.

The final flat percentage is again lower (~1/2 of the overall average or 7.5%-20%) but I don't want values to reach this flat % until income has doubled from the from the previous calculation point.

That means my second transition is quite gradual.

One of my first attempts was to try and develop a single equation that fit all my calculation points, but that wasn't really feasible, so I changed my approach to the separate flat percentages and transitioning between them.

I'm hoping what ever method I use I can use it for both transitions.

Because of how the model is set up it will be unlikely that both will have the same xo point, but if i can substitute a known point for xo that could work.

Thanks again if you have any more suggestions based on this more thorough information let me know.
 
I will look into this option as well as my first attempt was with polynomials. My problem was that I wanted to plug this all into excell and duplicate the process for several different conditions. Trying to set up a matrix of equations in excell wasn't very easy.

.
An infinite number of functions will do the trick.The real question is what does your mental model indicate to you would be appropriate. Polynomials are particularly easy to work with, but may not make sense based on external considerations. The simplest polynomial available for this problem is a cubic. (The minimum degree of the polynomial is one less than the number of constraints imposed on the function.)
.
\(\displaystyle Let\ x_0 = m,\ x_1 = n,\ f(n) = p,\ f’(n) =q, f(m) = r,\ and\ f’(m) = s.\)
.
\(\displaystyle \alpha m^3 +\beta m^2 + \gamma m + \delta = p.\)
.
\(\displaystyle 3 \alpha m^2+ 2 \beta m + \gamma = q.\)
.
\(\displaystyle \alpha n^3 +\beta n^2 + \gamma n + \delta = r.\)
.
\(\displaystyle 3 \alpha n^2+ 2 \beta n + \gamma = s.\)
.
But m, n, p, q, r, and s are known. So the four equations above become linear equations in alpha, beta, gamma, and delta, which can be solved algebraically. For each constraint that you add to your function, the degree of the polynomial goes up by one.
 
I will look into this option as well as my first attempt was with polynomials. My problem was that I wanted to plug this all into excell and duplicate the process for several different conditions. Trying to set up a matrix of equations in excell wasn't very easy.
First off, if you can pick the degree of the polynomial you want, then you can solve it generically by hand. This will give you alpha, beta, etc. in terms of m, n, and so on, which translate readily into excel formulas. Second, (this assumes I have understood your response to Dr. Phil), you seem to be making an assumption that greatly complicates your work. It appears to me as though you are trying to create differentiable functions that splice together smoothly at transition points. I have played around with such models in the past and have found that they usually are not worth the trouble. It may be much easier to create a set of functions that together constitute a step-wise continuous function, but do not constitute a universally differentiable function. To be less abstract, at your transition points, marginal expenditures are equal according to the functions on either side of the transition point, but the rate of change of expenditure versus income on either side of the transition point do not change smoothly. The whole idea of applying continuous functions in economics is counter-factual anyway (did anyone ever pay a price that was an irrational number). Assuming continuous and infinitely differentiable functions is a fiction designed to make models tractable. If one of those counter-factual assumptions creates mathematical difficulties, eliminate it.
 
Top