What is the function of this behaviour?

Djangotango

New member
Joined
Mar 21, 2022
Messages
6
Hi all, this is my first post over here. Maybe I lost some principles of math. For sure I can write the equation of a function through 2 points or something else more advanced. But right now I am finding problems to write the function for this trend.

IMG20220321102720.jpg
The data are X0, X1, Yd and Epsilon. I know that the function reaches Yd with an exponential trend and that it does it during the first 10% of all the function. Later it remains constant for the 80% and then it decrease with another exponential.
Is there someone able to help me to write it, please? How is it if I want to replace the exp with a log?
I would like also to understand it in order to modify it if I need it. thank you so much to everyone who will try to give me the disponibility.
 
Hi all, this is my first post over here. Maybe I lost some principles of math. For sure I can write the equation of a function through 2 points or something else more advanced. But right now I am finding problems to write the function for this trend.

View attachment 31753
The data are X0, X1, Yd and Epsilon. I know that the function reaches Yd with an exponential trend and that it does it during the first 10% of all the function. Later it remains constant for the 80% and then it decrease with another exponential.
Is there someone able to help me to write it, please? How is it if I want to replace the exp with a log?
I would like also to understand it in order to modify it if I need it. thank you so much to everyone who will try to give me the disponibility.
Let's focus on just that first exponential part. As I read this, you have two points on the curve: [imath](x_0, 0)[/imath] and [imath](x_0+(x_1-x_0)/10, y_d)[/imath]. Does that sound right?

But what do you mean by "exponential"? Assuming you mean some transformation of [imath]y=e^x[/imath], you might be thinking of [imath]y=a+be^{cx}[/imath].

Given the two points, you can obtain two equations (by replacing x and y with a given pair), which is not enough to solve for all three parameters, so you will have an extra degree of freedom to play with in choosing how fast the curve will rise.

You can do something similar with the end segment of the graph.

But what is "disponibility"? I can't think what that might be a typo for!
 
Good morning @Dr.Peterson, First of all with "disponibility" I mean the availability to reply and to get interested in my problem. Thus, Thank you twice.

Coming back to my problem...Yes, you understood well, that are the right coordinates. And you understood well also about the exponential.
I don't know which number I have to insert in y=a+be^(cx) if I want that the function goes from (x0,0) till (x0+(x1-x0)/10, yd) in exactly 10% of the distance x1-x0.

Maybe I am redundant but my problem is that I am not able to let the exponential start and finish in 2 proper points, in a proper way. Indeed, using geogebra for example, The function of an exponential is infinite:
exp.PNG

I can write the function of a straight line between 2 points, but I am not able to do the same stuff with an exponential and to connect it to a phase where the function is constant and then again an inverse exponential.
IMG20220322091200.jpg

Are you able then to help to create this last image? Thank You
IMG20220321102720.jpg
 
Good morning @Dr.Peterson, First of all with "disponibility" I mean the availability to reply and to get interested in my problem. Thus, Thank you twice.
Thanks. It wasn't in my dictionary, so I thought it was a typo (even though it seemed like a possible word); now I see that it is a word, but very rare, and "Generally an error made by non-native speakers. Availability is about 5,000 times more common."

Coming back to my problem...Yes, you understood well, that are the right coordinates. And you understood well also about the exponential.
I don't know which number I have to insert in y=a+be^(cx) if I want that the function goes from (x0,0) till (x0+(x1-x0)/10, yd) in exactly 10% of the distance x1-x0.
You seem to be misunderstanding me. The expression x0+(x1-x0)/10 is the 10% point; I've already taken that into account.

More important, I don't see that you have tried following my suggestion:
you have two points on the curve: [imath](x_0, 0)[/imath] and [imath](x_0+(x_1-x_0)/10, y_d)[/imath].

you might be thinking of [imath]y=a+be^{cx}[/imath].

Given the two points, you can obtain two equations (by replacing x and y with a given pair), which is not enough to solve for all three parameters, so you will have an extra degree of freedom to play with in choosing how fast the curve will rise.
As an example, if you want it to rise from 0 to 100 as x goes from 180 to 240 (that is, if 240 is the 10% point), then the two points are (180, 0) and (240, 100), so the two equations you get are

[imath]0=a+be^{180c}[/imath]​
[imath]100=a+be^{240c}[/imath]
You can eliminate a by subtracting the equations, and then you will have one equation in b and c. You might arbitrarily choose a value for c and solve for b, then graph it and see if it looks good enough; or you might choose another point that should be on the graph (e.g. (210, 30)) and get a third equation from that; or whatever else might determine the curvature of the function. The point is that you need some extra information to determine all three parameters. This is not like a straight line, of which there is only one between two given points.
 
You're right, disponibility is only in my dictionary. Availability is the right word. Thank you for that again. Which is the extra info that you need? I can choose with some criteria my x0, my x1, my yd. I can obtain x during the time. I would like to create Y(x) considering that the speed of raising up of the exponential is to be that one that allows reaching the yd in the 10% of x1-x0. Maybe I miss something but I ask u to have patience about it. Thank You.
 
Which is the extra info that you need? I can choose with some criteria my x0, my x1, my yd. I can obtain x during the time. I would like to create Y(x) considering that the speed of raising up of the exponential is to be that one that allows reaching the yd in the 10% of x1-x0. Maybe I miss something but I ask u to have patience about it. Thank You.
At this point, I just want to see you try something, so that you can discover for yourself what issues arise. You need to understand fully that there will be more information needed, because I can't know what information you might have available, or what criteria you might have for a good solution.

If nothing else, pick some specific numbers, as in my example, and try graphing with different values of the free parameter, so you can see what it looks like. (I'm not free to do all that right now.)
 
I still don't understand what is the third variable in the reality. By the way, I tried a different method and it works. I mean that I created an exponential that passes through 2 points. I am thinking that I would like to add at this function the peculiarity to switch at a certain point (X10%) to a constant and then again became an exponential.
I know that what I am asking is a function defined in more intervals. My question, indeed, is if there is a strategy to create a unique function without adding the condition of x<x10% or x>x10%. Thank you for the spent time. I am not pretending anything, I know that you could be busy as everybody. Thank you so much.
 

Attachments

  • IMG20220323092641.jpg
    IMG20220323092641.jpg
    4.9 MB · Views: 2
I know that what I am asking is a function defined in more intervals. My question, indeed, is if there is a strategy to create a unique function without adding the condition of x<x10% or x>x10%.
I'll try to get back to this a little later when I have time; but I need to ask about this.

If you're saying that you don't want a piecewise function, but a single expression, then that can only make things harder, not easier. I would not consider it unless you are programming this in a language that lacks conditional statements.
 
I'll try to get back to this a little later when I have time; but I need to ask about this.

If you're saying that you don't want a piecewise function, but a single expression, then that can only make things harder, not easier. I would not consider it unless you are programming this in a language that lacks conditional statements.
You understood well. I am programming. Adding conditional statements will make the program "slower". I would like to optimize it but I don't know how to create a single expression. I appreciate any tips. Thank you.
 
You understood well. I am programming. Adding conditional statements will make the program "slower". I would like to optimize it but I don't know how to create a single expression. I appreciate any tips. Thank you.
No, a single expression will not speed it up. Conditional statements, in any language I know, are quick. What language is this?

The typical way to fake a piecewise function without conditionals is to use absolute values, or some other function that is supported that has a similar effect; and the workaround requires awkward combinations of functions.
 
I still don't understand what is the third variable in the reality. By the way, I tried a different method and it works. I mean that I created an exponential that passes through 2 points.
Here is an example of two different exponential functions through the same two points; you would need to decide what in your application determines the extra parameter in the function.

1648045951186.png
 
Goodmornind @Dr. Petereson. The difference between your 2 lines is the speed of raising up. At this moment I don't need it but it is very interesting.
By the way The language is C++ and for sure I know that the conditional statements are quick. In my case, where I have to put 3 conditional statements inside one big conditional statement, considering the presence of other more in all code, I am asking myself if a unique expression could manage the speed or the optimization. Why do you think that it is not useful? Thank You.
 
Goodmornind @Dr. Petereson. The difference between your 2 lines is the speed of raising up. At this moment I don't need it but it is very interesting.
Well, you have to make some choice; if it doesn't matter to you, you've still implicitly made a choice somehow (maybe by using a 1 somewhere by default), and you will have to decide whether the result is suitable for your purpose (which we don't know).

By the way The language is C++ and for sure I know that the conditional statements are quick. In my case, where I have to put 3 conditional statements inside one big conditional statement, considering the presence of other more in all code, I am asking myself if a unique expression could manage the speed or the optimization. Why do you think that it is not useful? Thank You.
Have you ever done it before? I have, and I know from experience that it's not worth the effort just to show you how bad it would be. Trust me. Or do it yourself and discover how ugly it gets.

At best, you can use inherently piecewise functions like max and min, or absolute value, as a way to hide the piecewise nature of the function; but the same work has to be done, and often more, depending on the details of the implementation. And the resulting code is unreadable to boot. Nothing can be more efficient, or clear, than a simple "if".

For example, for your problem, you could simply calculate all three values for any x (two exponentials and a constant) and take the minimum! But I hope you can see that that would take about twice as much computing as the piecewise version. And that's the best I can think of.
 
Top