Creating a custom function knowing horizontal limit and intersection?

ironhak

New member
Joined
Nov 12, 2021
Messages
7
Hello everyone, this is not an homework but rather a function I'm trying to build in order to get outputs from my input data, let me explain better.
Basically I've got some input data that need to be transformed, every input is >= a certain value that I'll call x (basically this value is the x-axis intersection), then I have a maximum value that can be given as an output (which is the horizontal limit). Here on the image you may understand better:
1636734098153.png
As you can see I want to input a certain value and get an output based on the function f(x). I'm just a math rookie student in economics so please keep it simple, I just need a function that I can put into excel, such as: cell A1 contain "0.001", cell A2 transform "0.001" to the output given the function.
I know this is a logarithmic function, I know how to calculate limits and intersection GIVEN the function, not the other way around... so that's the problem.
Also, I guess there is the steepness of the function which is something that I should be able to manage too with a given input.

So summarizing:
  • The function has an horizontal limit based on the value I choose.
  • The function has an x-axis intersection based on the value I choose.
  • The function reach the horizontal limit based on a "speed"/"steepness"/"elasticity" I choose.
  • To function return an y value when I insert an x input.
Hope this is achievable... thank you.
 
Hello everyone, this is not an homework but rather a function I'm trying to build in order to get outputs from my input data, let me explain better.
Basically I've got some input data that need to be transformed, every input is >= a certain value that I'll call x (basically this value is the x-axis intersection), then I have a maximum value that can be given as an output (which is the horizontal limit). Here on the image you may understand better:
View attachment 29681
As you can see I want to input a certain value and get an output based on the function f(x). I'm just a math rookie student in economics so please keep it simple, I just need a function that I can put into excel, such as: cell A1 contain "0.001", cell A2 transform "0.001" to the output given the function.
I know this is a logarithmic function, I know how to calculate limits and intersection GIVEN the function, not the other way around... so that's the problem.
Also, I guess there is the steepness of the function which is something that I should be able to manage too with a given input.

So summarizing:
  • The function has an horizontal limit based on the value I choose.
  • The function has an x-axis intersection based on the value I choose.
  • The function reach the horizontal limit based on a "speed"/"steepness"/"elasticity" I choose.
  • To function return an y value when I insert an x input.
Hope this is achievable... thank you.
Have you studied graphs of different types of functions - e.g. - quadratic (polynomial) function, Log function, exponential function, hyperbolic function, etc.?

Which function/s (it can be sum or product of those functions) does your graph resemble (approximately)?
 
Hi, thank's for reply. Well, you can see by yourself on the photo which function it resemble approximately, I would say it's a logarithimic.
 
I know this is a logarithmic function, I know how to calculate limits and intersection GIVEN the function, not the other way around... so that's the problem.
No, it will not be a logarithmic function; logs don't have a horizontal asymptote.

It could be exponential, or rational (e.g. a reciprocal function), or inverse secant, ... . That's your choice (probably after experimenting with several options). They will vary in precise shape, in ease of use, and in features. (For example, your graph as drawn, appearing to have a vertical tangent at the x-intercept, looks very much like an inverse secant, but if you don't really want that vertical tangent, that would be a very bad model!)

What you'd do is to choose a type of function and then transform it to get the intercept and asymptote you specify, then look at what parameters are free with which you can adjust rate of approach or other features. Each will be adjustable in different ways.

On the other hand, if you are trying to model some particular behavior, rather than just find some function with this general shape, then you might need to say more about what you are modeling.
 
Hi, thank's for reply.

As I told, I need it to be as simple as possibile. What I'm trying to achieve is just a simple function in order to mimize the values of the inputs. Don't know if you are familiar with financial markets, but I've my calculation which determines the stop-loss, but sometimes the value for the stop-loss is too large, so I would like to set a limit decreasing the variability of it when the input increase. Really it's just like the picture, it need to be as simple as that.

As I said I don't know much about math, I would like to have a function like:
z = horizontal limit
alpha = steepness
v = x axis intersection
x = input
y = output based on above parameters.

I know I'm over-simplifyng but I never studied deeply maths because my subjects never required so. Thank's for help and comprehension.
 
As Dr. Peterson says, there are several common functions that will have the general shape that you want. In choosing among them, one good idea is to try to formulate an economic rationale for why your function might be of that type or approximately of that type.
 
As Dr. Peterson says, there are several common functions that will have the general shape that you want. In choosing among them, one good idea is to try to formulate an economic rationale for why your function might be of that type or approximately of that type.
I don't have the competence to understand why a function would be better than another, please see my other reply (waiting to be approved).
 
I understand stop loss orders. I also understand limit orders generally.

My point is that the function is more likely to give reasonable estimates if it is based on some sort of logic, not some throw a dart at the wall approach..

Start by telling us what x and y measure. For example, is x the current spot price?

It would also help if you explained what the x-intercept and horizontal asymptote represent.

I repeat what Dr. Peterson said: there are different functions that will give that general shape; in fact, there are an infinite number of them, but only a few common ones. The more we understand what you are trying to model, the more likely that we can narrow down the type that is likely to be effective (if any of them are).

As you have drawn it, there seems to be a vertical asymptote as well.
 
I understand stop loss orders. I also understand limit orders generally.

My point is that the function is more likely to give reasonable estimates if it is based on some sort of logic, not some throw a dart at the wall approach..

Start by telling us what x and y measure. For example, is x the current spot price?

It would also help if you explained what the x-intercept and horizontal asymptote represent.

I repeat what Dr. Peterson said: there are different functions that will give that general shape; in fact, there are an infinite number of them, but only a few common ones. The more we understand what you are trying to model, the more likely that we can narrow down the type that is likely to be effective (if any of them are).

As you have drawn it, there seems to be a vertical asymptote as well.
Hi, thanks for reply.

Not intending to offend but you are complicating it way too much. Maybe it's my fault, I should be more clear, so let me paint the situation for you.

I have my indicator, at any given my moment my indicator say: e.g. "your stop loss value is 0.001 pips". How that 0.001 value is calculated is not relevant to our purposes. Anyway, sometimes the indicator say "your stop loss value is 0.1 pips" which, as you can see is a big value, but it will never give values lower than 0.000.9

So, now let's say that I don't want my stop losses values being bigger than 0.005 (horizontal limit), in this case I could just re-program my indicator in order to turn every value >0.005 into 0.005, in this case the function would have this shape:
1636741721904.png
In this case the steepness is simply given by the horizontal limit x=y. Now, I already coded this scenario and I was just curious about what would change if instead of this linear function I use a non-linear one like the drawing in the first post.

I think I've given a pretty clear explaination of the problem... I don't know what function would be the best and I don't know what kind of function I could use, hence this post. Hope your knowledge can help me and find out what's the best solution.

Thank's.
 
Thought I'd add an illustration to this discussion. In the attached graph there are two functions fitting your description (but I added another limitation setting the slope at 'v' to 1). One graph is for a rational function, another for an exponential. As you can see, the exponential one converges to the asymptotic value much faster.
 

Attachments

  • asymp2.png
    asymp2.png
    16.8 KB · Views: 3
I am not offended.

I will add only one other thought. For ANY smooth function over a relatively small interval, a linear function is a good approximation.
 
I am not offended.

I will add only one other thought. For ANY smooth function over a relatively small interval, a linear function is a good approximation.
Hi, thank you... so you are saying that result's I'm having with my linear function wont be much different from ones using a non-linear one?
If this is the case, then we can consider the topic closed.

Let me know, thank you.
 
In this case the steepness is simply given by the horizontal limit x=y. Now, I already coded this scenario and I was just curious about what would change if instead of this linear function I use a non-linear one like the drawing in the first post.

I think I've given a pretty clear explanation of the problem... I don't know what function would be the best and I don't know what kind of function I could use, hence this post. Hope your knowledge can help me and find out what's the best solution.
The trouble is, we can't say what's best without having some definition of "best". As you've been told, there are infinitely many ways to do this.

But if all you want is SOME smooth curve that fits the requirements and is easy to evaluate, I'd probably use the exponential. If the x-intercept is A and the asymptote is B, this would be [imath]y=B\left(1-e^{-k\left(x-A\right)}\right)[/imath], where k is a parameter you can adjust to change the slope.
 
I did not quite say that. If the interval you are looking at is relatively small (and it seems to be in a few thousandths), then a linear approximation will give about the same results as any smooth function. Of course, if the function jumps around all over the place (is not smooth in other words), then what I said is not true.

But the kind of curve that you are looking at and the scale that you are looking at, there will not be large differences versus a straight line.

Or you can take Dr. Peterson's advice.
 
I did not quite say that. If the interval you are looking at is relatively small (and it seems to be in a few thousandths), then a linear approximation will give about the same results as any smooth function. Of course, if the function jumps around all over the place (is not smooth in other words), then what I said is not true.

But the kind of curve that you are looking at and the scale that you are looking at, there will not be large differences versus a straight line.

Or you can take Dr. Peterson's advice.
Got it, thank you so much, I'll try both ways and see what's best.

Thank's everyone!
 
Top