convert data points into equation

7777ft

New member
Joined
May 31, 2019
Messages
8
Line segment A starts at (0, 80) and ends at (28000, 80). The equation is \(\displaystyle y=80\).
Line segment B starts at (28000, 80). It has a rise of -2, and a run of 1000; hence a slope of -1/500. This equation is \(\displaystyle y=\frac{-x}{500}+136\). This segment ends when y becomes negative.

The two lines resemble a hockey stick. Can these two equations be concatenated into one neat and tidy equation, and how would it be done?
 

tkhunny

Moderator
Staff member
Joined
Apr 12, 2005
Messages
10,028
1) Not usually.
2) Depends on what you mean by "neat and tidy".
3) There are any number of averaging or weighting methods.
4) What do you have against the piecewise definition you have already stated?
 

LCKurtz

Junior Member
Joined
May 3, 2019
Messages
69
And why such large numbers to get that shape? And your second segment doesn't "end when y becomes negative".
 

topsquark

Full Member
Joined
Aug 27, 2012
Messages
408
Line segment A starts at (0, 80) and ends at (28000, 80). The equation is \(\displaystyle y=80\).
Line segment B starts at (28000, 80). It has a rise of -2, and a run of 1000; hence a slope of -1/500. This equation is \(\displaystyle y=\frac{-x}{500}+136\). This segment ends when y becomes negative.

The two lines resemble a hockey stick. Can these two equations be concatenated into one neat and tidy equation, and how would it be done?
As tkhunny says "not usually." However there are curve fitting techniques that might be useful, though often messy. The general approach that I've seen takes your two lines and links them together by fitting a conic section (usually a parabola) between the two lines. The problems come in:
1) You have to pick two arbitrary points on each line to fit your parabola
2) The parabola's major axis is at an angle to the +x axis making the equation for the parabola icky.
3) The parabola has to be tangent to the lines at the points you have chosen.
4) If you don't like the results after graphing you have to start all over again.
5) This method does not always work well.
6) This method is ridiculously time consuming.
7) When you are done you still don't have a single equation, just three equations you put together piece-wise.

Failing the parabola, circles and ellipses also work.

-Dan
 

7777ft

New member
Joined
May 31, 2019
Messages
8
4) What do you have against the piecewise definition you have already stated?
For the problem I'm trying to solve, I was hoping there would be an easy way to concatenate the segments into a single equation for calculating its derivative. Since that's not possible, my approach is wrong.
 

7777ft

New member
Joined
May 31, 2019
Messages
8
And why such large numbers to get that shape? And your second segment doesn't "end when y becomes negative".
The large numbers are from a problem. You get what you get.
Lines continue on forever. Line segments have a definite beginning and ending. The second segment can't have negative y-values because negative quantities of objects are not possible.
 

7777ft

New member
Joined
May 31, 2019
Messages
8
As tkhunny says "not usually." However there are curve fitting techniques that might be useful, though often messy. The general approach that I've seen takes your two lines and links them together by fitting a conic section (usually a parabola) between the two lines. The problems come in:
1) You have to pick two arbitrary points on each line to fit your parabola
2) The parabola's major axis is at an angle to the +x axis making the equation for the parabola icky.
3) The parabola has to be tangent to the lines at the points you have chosen.
4) If you don't like the results after graphing you have to start all over again.
5) This method does not always work well.
6) This method is ridiculously time consuming.
7) When you are done you still don't have a single equation, just three equations you put together piece-wise.

Failing the parabola, circles and ellipses also work.

-Dan
Over kill for the trivial-ish problem I'm attempting. Thanks for the suggestion. I'm sure it'll be useful at some point in the future.
 

Dr.Peterson

Elite Member
Joined
Nov 12, 2017
Messages
4,110
For the problem I'm trying to solve, I was hoping there would be an easy way to concatenate the segments into a single equation for calculating its derivative. Since that's not possible, my approach is wrong.
Making a single equation would actually make it harder to find the derivative. The equation would most naturally involve absolute values. The derivative will inherently be discontinuous, and in fact will be 0 for x less than 28000 and -1/500 after that -- that is, your description already contained the derivative, whereas a single equation would hide it.
 

LCKurtz

Junior Member
Joined
May 3, 2019
Messages
69
LCKurtz said:
And your second segment doesn't "end when y becomes negative"
The large numbers are from a problem. You get what you get.
Lines continue on forever. Line segments have a definite beginning and ending. The second segment can't have negative y-values because negative quantities of objects are not possible.
You said the second part of the formula had a rise of -2 and a run of 1000. I was just trying to point out to you that the second segment ends well before y becomes negative.
Another suggestion: Why not explain to us what problem you are actually trying to solve.
 

7777ft

New member
Joined
May 31, 2019
Messages
8
Why not explain to us what problem you are actually trying to solve.
I've solved the problem, and the solution is actually easy. Initially I over thought the problem, which led me to geometry. The solution has nothing to do with geometry.

The problem is here, if anyone is feeling adventurous. Resist the urge to peek at the solution.
 

Dr.Peterson

Elite Member
Joined
Nov 12, 2017
Messages
4,110
That problem has nothing to do with the question you asked; it is also rather poorly written.

This shows one of the reasons we ask you to show the entire problem you are working on, not just the piece you think you need help with. Quite often people are on the wrong track, and asking only about that wastes everyone's time.
 
Top