Finding the equation of a curved line

  • I
  • Thread starter LT72884
  • Start date
  • Tags
    equation
  • #1
LT72884
323
48
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
  • #2
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 LT72884 and FactChecker
  • #4
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
 
  • #5
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 LT72884
  • #6
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
 
  • #7
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 LT72884
  • #8
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."
 
  • #9
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 LT72884
  • #10
Also, choose the sampling points wisely (i.e. denser where your shape is steeper).
 
  • Like
Likes 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 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 erobz

1. How do you find the equation of a curved line?

To find the equation of a curved line, you can use the general form of a quadratic equation, which is y = ax^2 + bx + c. By plugging in the coordinates of points on the curve, you can solve for the coefficients a, b, and c.

2. Can you find the equation of a curved line with only two points?

No, you need at least three points to find the equation of a curved line. With two points, you can only determine a straight line, not a curve.

3. What is the difference between a linear equation and a curved line equation?

A linear equation represents a straight line, while a curved line equation represents a curve. Linear equations have a constant slope, while curved line equations have varying slopes.

4. Can you use software to find the equation of a curved line?

Yes, there are many software programs available that can help you find the equation of a curved line. These programs use algorithms to fit a curve to your data points and provide you with the equation.

5. How can I verify if the equation of a curved line is accurate?

You can verify the accuracy of the equation of a curved line by plotting the curve and comparing it to your original data points. If the curve fits the data points well, then the equation is likely accurate.

Similar threads

  • General Math
Replies
18
Views
2K
  • General Math
Replies
12
Views
1K
Replies
6
Views
3K
Replies
7
Views
3K
Replies
3
Views
1K
Replies
2
Views
905
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • General Math
Replies
11
Views
1K
  • Programming and Computer Science
Replies
4
Views
339
Back
Top