Solving for a General Formula in Two Series of Numbers

  • Thread starter Thread starter bobie
  • Start date Start date
  • Tags Tags
    Series
AI Thread Summary
The discussion revolves around finding a general formula for a set of two rows of numbers, where the second row is derived from the first. Participants suggest plotting the data to identify potential relationships and recommend using nonlinear fitting methods to estimate constants in a proposed formula. One user discovers a simple formula, y = (x+1)/x, which aligns with another user's findings, emphasizing the importance of converting decimals to exact rationals for clarity. There are suggestions for using tools like Wolfram Alpha and Excel for graphing the data points, with advice to start by plotting points manually for better understanding. The conversation highlights the iterative nature of mathematical exploration and the value of visual representation in identifying patterns.
bobie
Gold Member
Messages
720
Reaction score
2

Homework Statement


This is not homework, just an exploration
we have two rows of numbers
2 1.5
1.8 1.5555..
1.6 1.625
1.5 1.6666..
1 2
.8 2.25
.6 2.6666..
.5 3
.4 3.5
.2 6
.1 11
we want to find a general formula /operation that gets the second row
how do we proceed? only by trials and errors?is it better to multiply first row by 10?or the second so to get integers?

Is there anyone that can solve this problem?
Thanks
 
Last edited:
Physics news on Phys.org
Although you can always find a function through any finite number of data points that will "predict" the next number, I fail to see a sensible pattern in these ones. Maybe you can plot them and advise what kind of relationship you are looking for... is it supposed to be a straight line, or an exponential, or a polynomial? Do you want an exact fit or a "close" fit? Depending on where you got the number from, is there any a priori expectation (of, for example, linearity)?
 
bobie said:

Homework Statement


This is not homework, just an exploration
we have two rows of numbers
2 1.5
1.8 1.5555..
1.6 1.625
1.5 1.6666..
1 2
.8 2.25
.6 2.6666..
.5 3
.4 3.5
.2 6
.1 11
we want to find a general formula /operation that gets the second row
how do we proceed? only by trials and errors?is it better to multiply first row by 10?or the second so to get integers?

Is there anyone that can solve this problem?
Thanks

The standard way to deal with such questions is to plot y (the second number) in terms of x (the first number), or to plot x in terms of y. The form of the graph should suggest a type of formula y = f(x) or x = f(y) that will give you what you want.

In this case it looks like a formula of the form
y = a + \frac{b}{x^c}
should work. Here, a, b and c are some unknown constants that need to be estimated from the data. There are a number of standard methods that can be used to find "good" values of a, b and c. In this case the use of a nonlinear least-squares package yields a good answer. I just used the Maple 'NonlinearFit" package, but I would bet that Wolfram Alpha also has a similar package available for free on-line use. Alternatively, you could use the EXCEL Solver to solve the nonlinear optimization problem that you get from the least-squares formulation.

I won't spoil your fun by giving you the answer; I think you will learn more by playing around with this problem yourself.

Added note: in this problem it is very useful to use exact rationals instead of decimals; for example, write 1.5555... as 1 + 5/9 = 14/9, etc. Do this for both x and y.
 
Last edited:
  • Like
Likes 1 person
Ray Vickson said:
In this case it looks like a formula of the form
y = a + \frac{b}{x^c}

I won't spoil your fun by giving you the answer; I think you will learn more by playing around with this problem yourself.
.

Thanks, Ray, I found the solution, it was rather easy but doesn't match your formula
mine is :y = \frac{x+1}{x} , what is yours?
Can you suggest how to ask for a graph at Wolfram?
 
bobie said:
Thanks, Ray, I found the solution, it was rather easy but doesn't match your formula
mine is :y = \frac{x+1}{x}
It does if you plug in the right values for Ray's a, b and c.
 
  • Like
Likes 1 person
bobie said:
Thanks, Ray, I found the solution, it was rather easy but doesn't match your formula
mine is :y = \frac{x+1}{x} , what is yours?
Can you suggest how to ask for a graph at Wolfram?

I get y = 1 + (1/x), exactly the same as you. It is obvious once you convert the x,y data to rational numbers. As for graphing via Wolfram: I am the wrong person to ask.
 
  • Like
Likes 1 person
bobie said:
Can you suggest how to ask for a graph at Wolfram?

Wolfram... what?

Alpha can just get "(x+1)/x" and it will do some graphics.

Mathematica Code:
Plot[(x+1)/x, {x, .01, 3}]
DiscretePlot[(x + 1)/x, {x, 0.1, 10., 0.1}]

Simple Mathematica code, some lines run on alpha.
I am not good at asking Alpha things.
 
Last edited:
  • Like
Likes 1 person
mafagafo said:
Wolfram... what?

Alpha can just get "(x+1)/x" and it will do some graphics.

Mathematica Code:
Plot[(x+1)/x, {x, .01, 3}]
DiscretePlot[(x + 1)/x, {x, 0.1, 10., 0.1}]

Simple Mathematica code, some lines run on alpha.
I am not good at asking Alpha things.

I think he probably wanted a way to do a plot of some given points (x1,y1), (x2,y2), ..., (xn,yn), rather than a plot of a specific formula. He could do it easily in EXCEL, for example, and of course, also in full-power Mathematica (or Maple or ... ), and he could also go out and buy some graph paper and do the whole thing by hand.
 
  • Like
Likes 1 person
Ray may be right.

In Alpha:
(2, 1.5) (1.8, 1.5555) (1.6, 1.625) (1.5, 1.6666) (1, 2) (.8, 2.25) ... (you can go a long way, I think)
Will give you a Cartesian coordinate system with the points on it.
 
  • Like
Likes 1 person
  • #10
Last edited:
  • #11
bobie said:
Thanks, Ray
I tried at w.alpha, this me dots that look like a/x^2,is that right?
http://www.wolframalpha.com/input/?...,6.0625)(.6,6.583)(.4,7.825)(.2,10.95)(.1,17)

this is more difficult
2.0 5.125
1.8 5.1944444...
1.6 5.28125
1.5 5.3333333
1. 5.75
.8 6.0625
.6 6.583
.5 7
.4 7.825
.2 10.75
.1 17
I suppose the key lies in the 2 integers :17 and 7 ?
can you help me with this?

Thanks

Show your work first, as required by PF rules.
 
  • #12
The nearest I found is 5 + .75/x^2 but works only for 1 and 1.5 and then makes a curve
 
  • #13
bobie said:
The nearest I found is 5 + .75/x^2 but works only for 1 and 1.5 and then makes a curve

You need to show what you did; that is, not just the answer, but how you got it. That is important, because we need to know your thinking in order to be able to help.
 
  • #15
bobie said:
I thought it was a quadratic, but I added 5 and 8 and now it looks like a hyperbole
http://www.wolframalpha.com/input/?...,6.0625)(.6,6.583)(.4,7.825)(.2,10.95)(.1,17)
but I cannot find any a= xy
I just proceed by trials and error, I am a beginner , if you cannot help, it's ok.

Always start by plotting the points. You can do it easily in EXCEL or any other, comparable spreadsheet. A very good alternative is to go to a stationary store and buy some graph paper; then you can plot points manually, using nothing fancier than a pencil. I am 100% serious---that's my advice.
 
  • #16
I agree with Ray to some degree. Using Alpha for point plotting (if more than 3 or 4) is not wise. Use any spreadsheet graphing if you don't use Mathematica, Matlab or any other mathematical software.
If you don't have Microsoft Excel download LibreOffice (or buy Excel, whatever).
 

Similar threads

Replies
3
Views
2K
Replies
2
Views
2K
Replies
10
Views
2K
Replies
4
Views
2K
Replies
3
Views
2K
Replies
7
Views
4K
Replies
3
Views
3K
Back
Top