Finding the equation of a curved line

  • Context: Undergrad 
  • Thread starter Thread starter LT72884
  • Start date Start date
  • Tags Tags
    equation
Click For Summary
SUMMARY

This discussion focuses on methods for deriving the equation of a curved line, specifically a teardrop shape, without computer assistance. Key techniques mentioned include guessing a functional shape, using the Method of Least Squares for fitting data points, and employing polynomial equations for approximation. The participants emphasize the historical context of these methods, noting that engineers in the past relied on manual calculations and techniques such as matrix math and simultaneous equations to achieve curve fitting.

PREREQUISITES
  • Understanding of polynomial equations and their forms (e.g., linear, quadratic, quartic).
  • Familiarity with the Method of Least Squares for data fitting.
  • Basic knowledge of matrix math for solving systems of equations.
  • Experience with plotting functions and interpreting graphical data.
NEXT STEPS
  • Research the Method of Least Squares and its applications in curve fitting.
  • Explore polynomial regression techniques for fitting curves to data.
  • Learn about Bézier curve fitting and its historical significance in engineering.
  • Investigate manual methods for curve fitting, including simultaneous equations and matrix calculations.
USEFUL FOR

Engineers, mathematicians, and students interested in historical methods of curve fitting and those seeking to understand polynomial approximations without computational tools.

LT72884
Messages
335
Reaction score
49
Ok, so i have done many math classes, as i am an engineer, however, a theory class and proof class i h ave not done, except maybe one haha.

here is my question, if i draw some sort of curved line by hand, how do i find an equation for that?

for example, i draw half of a tear drop but along the horizontal (like the posted image). How would i find the equation of that line, preferably without a computer? im just wanting to see how this was done back in the past.

thanks

1696301354687.png
 
Mathematics news on Phys.org
LT72884 said:
Ok, so i have done many math classes, as i am an engineer, however, a theory class and proof class i h ave not done, except maybe one haha.

here is my question, if i draw some sort of curved line by hand, how do i find an equation for that?

for example, i draw half of a tear drop but along the horizontal (like the posted image). How would i find the equation of that line, preferably without a computer? im just wanting to see how this was done back in the past.

thanks

View attachment 332931
For this I would just guess a functional shape, with some constants to tweak it to fit data if you have it.

$$ y(x) = \sqrt{x} - x $$

Plot it?

Otherwise, you could use the data from the drawing to do Fourier Transform. They can draw anything with those.
 
  • Like
Likes   Reactions: LT72884 and FactChecker
erobz said:
For this I would just guess a functional shape, with some constants to tweak it to fit data if you have it.

$$ y(x) = \sqrt{x} - x $$

Plot it?

Otherwise, you could use the data from the drawing to do Fourier Transform. They can draw anything with those.
yeah, its coming up with the functional shape thats tough to do haha.

i mean, how did engineers do this in the past before computers did curve fitting?

thanks
 
LT72884 said:
yeah, its coming up with the functional shape thats tough to do haha.

i mean, how did engineers do this in the past before computers did curve fitting?

thanks
Computer programs that "curve fit" a data set still assume a functional form to do so. Are you asking what the computer program (like Excel) is doing under the hood? What people would have done manually at the time of its inception?

If so, that's likely the Method of Least Squares, If not I'm having trouble figuring out what is being asked exactly.
 
  • Like
Likes   Reactions: LT72884
erobz said:
Computer programs that "curve fit" a data set still assume a functional form to do so. Are you asking what the computer program (like Excel) is doing under the hood? What people would have done manually at the time of its inception?

If so, that's likely the Method of Least Squares, If not I'm having trouble figuring out what is being asked exactly.
yes, how is this done manually with no computer help.

also what is this least squares method?

thanks
 
LT72884 said:
yes, how is this done manually with no computer help.

also what is this least squares method?

thanks
1696375647202.png

The basic idea for the Method of Least Squares:

You have some data points ##( x_1,y_1),(x_2,y_2),(x_3,y_3)##

Say you want to fit a linear function of the form ##y = mx+b## to the data.

You have 2 parameter to adjust ##m##, and ##b## in that form ( If you want to try to fit a different form, like ##y = ax^2 + bx + c##, you have more free parameters that can be adjusted, etc..).

You begin by forming the total squared error. That is some measure of "how far"(just magnitude -hence the squaring) the ##y## value of the function is off from the data when it is evaluated at the independent coordinate of a particular point:

We would have above:

$$ f(m,b) = ( y_1 - (mx_1+ b))^2 + ( y_2 - (mx_2+ b))^2 + ( y_3 - (mx_3+ b))^2 $$

From there you optimize ##f(m,b)## using standard techniques from multivariable Calculus, namely:

$$ \frac{\partial f }{\partial m } = 0 $$

$$ \frac{\partial f }{\partial b } = 0 $$

Are solved simultaneously for the parameters ##m## and ##b## that minimize the sum of squared error i.e. ##f(m,b)##.

For a full explanation you'll be best to search the term "The Method of Least Squares", I just wanted to give you "the flavor" with a basic example.
 
Last edited:
  • Like
Likes   Reactions: LT72884
LT72884 said:
yeah, its coming up with the functional shape thats tough to do haha.
ha.

This is something that people unfamiliar with the problem you are trying to solve are least able to help you with. An understanding of the system may tell you that you are looking for a polynomial, or a trig function, or something else. All we can say is "Sure looks like a parabola."
 
erobz said:
View attachment 332963
The basic idea for the Method of Least Squares:

You have some data points ##( x_1,y_1),(x_2,y_2),(x_3,y_3)##

Say you want to fit a linear function of the form ##y = mx+b## to the data.

You have 2 parameter to adjust ##m##, and ##b## in that form ( If you want to try to fit a different form, like ##y = ax^2 + bx + c##, you have more free parameters that can be adjusted, etc..).

You begin by forming the total squared error. That is some measure of "how far"(just magnitude -hence the squaring) the ##y## value of the function is off from the data when it is evaluated at the independent coordinate of a particular point:

We would have above:

$$ f(m,b) = ( y_1 - (mx_1+ b))^2 + ( y_2 - (mx_2+ b))^2 + ( y_3 - (mx_3+ b))^2 $$

From there you optimize ##f(m,b)## using standard techniques from multivariable Calculus, namely:

$$ \frac{\partial f }{\partial m } = 0 $$

$$ \frac{\partial f }{\partial b } = 0 $$

Are solved simultaneously for the parameters ##m## and ##b## that minimize the sum of squared error i.e. ##f(m,b)##.

For a full explanation you'll be best to search the term "The Method of Least Squares", I just wanted to give you "the flavor" with a basic example.
Yep, this can always be done by hand, but the calculations (i.e. solving the linear system of ##n## equations) get exponentially more time consuming. I did that with ##n=2## (quadratic fit) and it took me four to five pages of writing.
The drop-like shape will probably require a quartic polynomial fit at least if you want a decent approximation.
Beware of Excel, as it shows very few sig figs in the fit formula. I had to wrote a vba macro (which uses matrix calculations) to get the coefficients with all the 15 sig figs manageable by Excel.
 
  • Like
Likes   Reactions: LT72884
  • #10
Also, choose the sampling points wisely (i.e. denser where your shape is steeper).
 
  • Like
Likes   Reactions: LT72884
  • #11
FranzS said:
Beware of Excel, as it shows very few sig figs in the fit formula. I had to wrote a vba macro (which uses matrix calculations) to get the coefficients with all the 15 sig figs manageable by Excel.
I don't know what version you are (were)running, but you can format the trendline label to show however many sig figs you want in the current Office 365 version.
 
  • #12
FranzS said:
The drop-like shape will probably require a quartic polynomial fit at least if you want a decent approximation.
It looked like a parabola to me so I digitized the curve and rotated the points until my spreadsheet maximized the R² value for a parabola. Almost perfect @ 127°.

rotated half drop 2023-10-04 at 09.29.23.png
 
  • #13
erobz said:
I don't know what version you are (were)running, but you can format the trendline label to show however many sig figs you want in the current Office 365 version.
Nice to know! I'll try that.
 
  • #14
OmCheeto said:
It looked like a parabola to me so I digitized the curve and rotated the points until my spreadsheet maximized the R² value for a parabola. Almost perfect @ 127°.

View attachment 333007
Nice intuition!
 
  • Like
Likes   Reactions: LT72884
  • #16
FranzS said:
Nice intuition!
Thanks!
I suppose if I were stuck on a deserted island without a laptop, I could solve for 3 points picked from the parabolish curve, and solve with simultaneous equations:

given​
given​
x​
y​
ax²​
bx​
c​
y​
-0.057​
-0.017​
0.0030​
-0.057​
1​
-0.017​
-0.41​
0.32​
0.17​
-0.41​
1​
0.320​
-0.60​
0.80​
0.36​
-0.60​
1​
0.798​
matrix math​
curve fit​
a​
1​
2.77​
2.68​
b​
1​
0.330​
0.295​
c​
1​
-0.00724​
-0.00571​
R² =​
0.9996​
0.9999​

Mathematically a bit less accurate, but visually identical.
 
  • #17
i have been messing around with desmos and started to add functions together. y=sqrt(x) -x -x^2 and things like this. but y=sqrt(x)-x produces a nice curve, then i went all fancy from an equation found in my airfoil design book. How the heck did they discover this equation back in the 50's before computers could do this? thats what i want to know? i feel so lazy when i use a PC haha

image
 
  • Like
Likes   Reactions: erobz

Similar threads

Replies
20
Views
2K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
14
Views
4K
Replies
2
Views
2K