# Plotting a graph to find unknowns

1. Jul 20, 2017

### Glenn G

1. The problem statement, all variables and given/known data
Plot a suitable graph, using your x and y data, to find the variables a and b.

2. Relevant equations
y = ax + bx^2

3. The attempt at a solution
This is clearly a quadratic, the best I can do is to play about with lns and I came out with
lny = lnax + lnbx^2
lny = ln(ab.x^3)
lny = 3ln(ab) + 3lnx

so plotting lny against lnx should give gradient 3 and from the intercept can get the product ab but not the individual values of a and b.
Other than taking two point from the graph and using simulataneous equations is there something I'm missing? Is there another graphical way to get at a and b?

Last edited by a moderator: Jul 20, 2017
2. Jul 20, 2017

### mjc123

1. y = ax + bx2
2. lny = ln(ax) + ln(bx2)
3. ln y = ln(abx3)
4. ln y = 3ln(ab) + 3 lnx

Of these steps, that between 2 and 3 is the ONLY one you got right. You correctly saw that lnA + lnB = ln(AB). But do you see why that makes the step from 1 to 2 wrong? ln(A+B) is not equal to lnA + lnB. (From 3 to 4, the cube only affects x, not ab.)

Can you think of a simple transformation of the initial equation that makes the RHS linear in x?

3. Jul 20, 2017

### Staff: Mentor

What data do you have? Your equation above is that of a parabola, so if your data points are on the parabola you can use two of the data points to form two equations in a and b, and then solve for these parameters.

Maybe it's because I just woke up, but I can't think of such a transformation.

4. Jul 20, 2017

### Glenn G

So I think then that if you had numerical data for x and y (from a practical) and then it was suggested the relationship was:
Y = ax + bx^2
Then there is nothing you could do to actually find out what the a and b was?
Cheers,
Glenn

5. Jul 20, 2017

### Glenn G

Lns not lbs. predictive text!

6. Jul 20, 2017

### Staff: Mentor

Did you read what I wrote earlier? Here it is again:

7. Jul 20, 2017

### Glenn G

Thanks Mark, missed that on my phone.
regards,
G.

8. Jul 20, 2017

### scottdave

If you are certain that it will fall into the format of y = ax + bx2, then take some of your (x,y) data points, then you will have 2 or more linear equations:
constant1 = a{constant2} + b{constant3},
constant4 = a{constant5} + b{constant6} etc.

9. Jul 20, 2017

### Staff: Mentor

This is essentially what I said in posts 3 and 6.
I would write the above two equations as
$y_1 = ax_1 + bx_1^2$
$y_2 = ax_2 + bx_2^2$
Assuming that $(x_1, y_1)$ and $(x_2, y_2)$ are actually points on the parabola, my two equations can be used to solve for a and b.

10. Jul 20, 2017

### scottdave

Using log on the vertical axis versus log on the horizontal axis is helpful when you have some data, which you believe fits the form:

y = Axn

It is especially helpful when you don't know the value of n. It is not necessary to be an integer, you could have y = (2.1)x1.5 for example.

then taking logs of both sides, you get log(y) = log(Axn) and then: log(y) = log(A) + log(xn) and finally:

log(y) = log(A) + n*log(x), so n is the slope of the graph, and log(A) is the intercept.

Often this would be done by getting some graph paper which already had log scales on both axes, and plotting the data directly.

11. Jul 21, 2017

### mjc123

What about y/x = a + bx ?

12. Jul 21, 2017

### Ray Vickson

People have asked you about the nature of your data, and you have refused to answer. That question is very important. If you have just two data points $(x_1,y_1)$ and $(x_2,y_2)$ you can set up and solve two equations to find $a$ and $b$; the equations you need to use have been written already by others.

However, if you have more than two data points, and if there are possibly some experimental errors in the data, that "solving" approach is in trouble. Suppose, for example, you had 10 data points $(x_1,y_1), (x_2,y_2), \ldots, (x_{10},y_{10})$. There may be no possible parabola that fits all of them; there are 45 different ways to choose two point from ten points, so there may be as many as 45 different "fits" to your data. Obviously, that makes no sense, so in such cases we seek a "compromise" fit, which may not go through any of the points exactly, but (hopefully) passes close to all of them. When you have data with experimental errors, that is the best you can hope for.

Anyway, in such cases we normally find the so-called "least-squares fit"; see, eg.,
http://mathworld.wolfram.com/LeastSquaresFitting.html .
You can find many other links by doing a Google search for "least squares fit", for example. Many of the links use at least a bit of Calculus, so I have not cited them herein. Of course, I could spend quite a lot of time writing it all out, but numerous people have done that already, and it is as easy for you to read material on other web sites as on this one.