Write an equation based on data

  • Thread starter musicgold
  • Start date
  • Tags
    Data
In summary, the best way to solve problems involving finding the function that best describes a set of data points is to use a polynomial fitting method, such as the Lagrange polynomial method, which can handle any type of data points and return a polynomial that fits the data. Other methods, such as using Excel or fitting a linear trend line, may not be as effective in finding the best fitting function.
  • #1
musicgold
304
19
Hi,

I am trying to understand what is the best way to solve problems like the one below. I have a few data points and I need to which function best describes that data.

(x, y) = (-3, -32) (-2, 16) (-1, 8) (0,4) (1,2) (2, 1)

note that the y parameter in the first data point is -32 and not 32.Is there a process to solve such problems or do I have to guess the function?

Thanks.
 
Mathematics news on Phys.org
  • #2
put it on a graph and see what you get using excel
 
  • #3
There are, of course, an infinite number of functions whose graphs go through those points. The unique fifth degree polynomial that fits is the Lagrange polynomial:
[tex]-32\frac{(x+ 2)(x+ 1)(x)(x- 1)(x- 2)}{(-3+2)(-3+ 1)(-3)(-3- 1)(-3-2)}+ 16\frac{(x+ 3)(x+ 1)(x)(x- 1)(x- 2)}{(-2+3)(-2+ 1)(-2)(-2- 1)(-2-2)}+ 8\frac{(x+ 3)(x+ 2)(x)(x- 1)(x- 2)}{(-1+3)(-1+ 2)(-3)(-1-1)(-1-2)}+ 4\frac{(x+ 3)(x+ 2)(x+1)(x- 1)(x- 2)}{(0+3)(0+2)(-0+ 1)(0- 1)(0-2)}+ 2\frac{(x+3)(x+ 2)(x+ 1)(x)(x- 2)}{(1+ 3)(1+2)(1+ 1)(1)(1-2)}+ \frac{(x+ 3)(x+ 2)(x+ 1)(x)(x- 1)}{(1+ 3)(1+2)(-3+ 1)(-3)(-3-2)}[/tex]
 
  • #4
There are several methods for example Newton's forward difference interpolation which though quite difficult to do and limited in the fact that you have to have a constant difference between the terms it is very effective, because if the data points are from an arithmetic series it will give you an expression of the series. Above is an example of Lagrange's method which is far easier to do, less limited as the data points can be anything and returns a polynomial that works.
 
  • #5
1. As you've emphasized that the first data is in fact not an error it may not be helpful to point out that the last five data points are in the function: y = (2^(2-x)) , but if a piecewise function is an option than it's worth a thought.
2. Otherwise you can use excel as Woopydalan said. However adding a linear trend line will do you no good. If I remember correctly there is an option for fitting a polynomial of higher degrees. It may go up to a sixth degree polynomial.
3. The Lagrange polynomial method that HallsofIvy posted will definitely work...so actually forget what I said and just copy and paste that into wolfram alpha
 

FAQ: Write an equation based on data

How do I write an equation based on data?

To write an equation based on data, you need to first identify the variables and their corresponding values from the given data. Then, you can use the data points to form a linear or non-linear equation by using mathematical operations such as addition, subtraction, multiplication, and division.

What are the key components of an equation based on data?

The key components of an equation based on data are the variables, constants, and mathematical operations. Variables are represented by letters and can change in value, while constants are fixed values. Mathematical operations are used to manipulate the variables and constants to form the equation.

How do I choose which mathematical operations to use in my equation?

The choice of mathematical operations depends on the type of relationship between the variables in the data. For example, if the data shows a linear relationship, you can use addition and multiplication to form a linear equation. If the data shows a non-linear relationship, you may need to use more complex mathematical operations such as logarithms or exponents.

Can I use more than one equation to represent the data?

Yes, it is possible to use multiple equations to represent the data, especially if the relationship between the variables changes at different data points. In this case, you can use different equations for different sections of the data to accurately represent the relationship between the variables.

Can I use an equation to predict future data points?

Yes, if the equation is based on a reliable and accurate set of data, it can be used to make predictions for future data points. However, it is important to note that predictions are not always accurate and can be affected by external factors that may not have been included in the original data.

Similar threads

Replies
2
Views
996
Replies
19
Views
2K
Replies
3
Views
1K
Replies
4
Views
4K
Replies
2
Views
1K
Replies
27
Views
3K
Replies
5
Views
2K
Replies
6
Views
2K
Back
Top