Finding the equation of a curve

  • Context: Undergrad 
  • Thread starter Thread starter Alex
  • Start date Start date
  • Tags Tags
    Curve
Click For Summary

Discussion Overview

The discussion revolves around methods for finding the equation of a curve given a set of points. Participants explore various approaches to curve fitting, including polynomial fitting, spline functions, and least squares methods, while also considering the implications of choosing different functional forms.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants suggest starting with a scatterplot to identify a suitable functional form for the data.
  • It is noted that an infinite number of curves can fit a finite set of points, leading to the necessity of defining conditions for the desired curve.
  • One approach discussed is using polynomial functions, specifically a polynomial of degree n-1, which uniquely fits n points.
  • Others propose spline functions as an alternative to polynomials, citing their piece-wise nature as beneficial for certain applications.
  • Some participants mention the least squares method as a way to find a curve that is "close" to the data points rather than passing through all of them.
  • A participant expresses uncertainty about whether the least squares method would meet their requirement of passing through every point.
  • There are suggestions to explore existing software, such as MS Excel, for curve fitting, though concerns are raised about the need for user-defined regression types.
  • One participant requests an example of finding the equation of a sine curve for specific points and expresses difficulty recalling the process from previous studies.
  • A later reply indicates that the participant may have found a resource that meets their needs.

Areas of Agreement / Disagreement

Participants do not reach a consensus on a single method for curve fitting, as multiple approaches are discussed, and some express uncertainty about the suitability of certain methods for their specific needs.

Contextual Notes

Participants highlight the importance of defining conditions for the curve and the implications of choosing different functional forms, as well as the limitations of existing software options for curve fitting.

Alex
Messages
42
Reaction score
0
How would I go about finding the equation of a curve given an arbitrary number of points? Please don't give me a full explanation if you don't want to, just the name of a process by which I could do this would be fine.
 
Mathematics news on Phys.org
You first have to choose a functional form to which to fit your points. In order to choose wisely, you should produce a scatterplot and try to find a functional form that looks close. For instance if in your data table the value of the dependent variable plunges downward for very small positive values of the dependent variable, and the function increases monotonically, then you might try to fit a log function to the data.

So howsabout you post your data set?
 
Given any finite set of points, there exist an infinite number of curves that will pass through those points so you have to decide what conditions you want to put on the curve you are looking for. Google on "curve fitting" and you will see some options.
If you are looking for a function of the form y= f(x), then putting the x and y values of n points into that equation will give you n equations which you could solve for n unknowns. In particular, a polynomial of degree n-1 will have n coefficients so given n points, there always exists a unique polynomial of degree n-1 passing through those points. Those tend to be very "wavy" so many applications use a "spline" function instead- a function that is "piece-wise" polynomial. Google on "spline functions-" in particular you might look at
http://www.cse.unsw.edu.au/~lambert/splines/


On the other hand, the best choice may not be a curve that actualy passes through the points but one that is "close" in some sense. For that, you might use a "least squares" method. Google on "least squares". Mathworld has this:
http://mathworld.wolfram.com/LeastSquaresFitting.html
 
Last edited by a moderator:
Tom Mattson said:
You first have to choose a functional form to which to fit your points. In order to choose wisely, you should produce a scatterplot and try to find a functional form that looks close. For instance if in your data table the value of the dependent variable plunges downward for very small positive values of the dependent variable, and the function increases monotonically, then you might try to fit a log function to the data.
So howsabout you post your data set?

Well that's the thing - I don't have a data set. I'm trying to write a program that will return an equation to a set of data that I input. I suppose I could write one to graph the data and estimate the family of that function based on that - as you mentioned - but I thought there might be an easier way.
 
HallsofIvy said:
Given any finite set of points, there exist an infinite number of curves that will pass through those points so you have to decide what conditions you want to put on the curve you are looking for. Google on "curve fitting" and you will see some options.
If you are looking for a function of the form y= f(x), then putting the x and y values of n points into that equation will give you n equations which you could solve for n unknowns. In particular, a polynomial of degree n-1 will have n coefficients so given n points, there always exists a unique polynomial of degree n-1 passing through those points. Those tend to be very "wavy" so many applications use a "spline" function instead- a function that is "piece-wise" polynomial. Google on "spline functions-" in particular you might look at
http://www.cse.unsw.edu.au/~lambert/splines/
On the other hand, the best choice may not be a curve that actualy passes through the points but one that is "close" in some sense. For that, you might use a "least squares" method. Google on "least squares". Mathworld has this:
http://mathworld.wolfram.com/LeastSquaresFitting.html


I checked the least squares method before I posted here but I wasnt sure if it would be quite right. I just skimmed over it, but I got the impression that the least squares method gave a "line of best fit" result. I need a function that will pass through every one of my points.

I'll check out spline functions. Thanks
 
Last edited by a moderator:
Alex said:
Well that's the thing - I don't have a data set. I'm trying to write a program that will return an equation to a set of data that I input.

You should probably look at an already existing program that can do this. By far the most ubiquitous one is MS Excel. It will fit your data to a curve, but the user has to choose what kind of regression he wants before anything can happen. As HallsofIvy said, there are an infinite number of curves that will fit the data, so the user must make a decision.
 
Tom Mattson said:
You should probably look at an already existing program that can do this. By far the most ubiquitous one is MS Excel. It will fit your data to a curve, but the user has to choose what kind of regression he wants before anything can happen. As HallsofIvy said, there are an infinite number of curves that will fit the data, so the user must make a decision.

I've tried to search for an already existing program to do this but I've found nothing that is open-source or easily incorporatable in a c program.

Maybe you could help me with an example? Ie: How would I go about finding the equation of a sin curve for the points [(1,7), (2,21), (3, -14),]? Also how would I choose a regression for that curve? I'm sure that I did this in calculus back in high school but I can't really remember the process.
 
Last edited:

Similar threads

  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 18 ·
Replies
18
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K