1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Curve fitting (Linearization) of functions (and thus graphs)

  1. Feb 27, 2016 #1
    Ok, first week of first year of undergraduate physics lab and they explain that we want all our graphs to be linear, and in order to do that we can change our x and y axes to be log(x) or y^2 or whatever. They did some simple examples such as y=(k/x)+c and explained that if the x axes is 1/x we get a linear graph.

    1. The problem statement, all variables and given/known data

    Homework time and they gave us: xy=a*exp(bxy) (where a,b are unknowns that we need to explain how we can figure them out using the to be linear function and the slope/intersection with y axes).

    The problem is I wasn't able to separate x from y and make it look like a linear function.

    Another question was bx = y/(a-y)
    Here I could separate x from y (it is already done when given) but I can't get a situation where they are separate and non aren't dependent on a or b (it is simple to get to y=bxa/(1+bx) but x is dependent on b so I can't redefine the x axes properly)

    I am sure I am misunderstanding something, or missing some kind of trick, but too many hours have been spent and I can't see it.
    Any help would be greatly appreciated! Thanks in advance for any input!
    2. Relevant equations
    ln and power rules

    3. The attempt at a solution
    I tried ln the equation and got to ln(xy)=ln(a*exp(bxy)) => ln(x)+ln(y)=ln(a)+bxy
    I've played around with this but always found myself back there. I can't seem to separate x and y so I can have an equation in the shape of y=mx+c (where I don't mind if y is ln(y) or even ln(y)/y or any kind of combination, and same goes for x, and m and c can be any combination of a and b).

    For bx=y/(a-y) I explained above my problem.

    Thanks again for any input or help, me and my friends are starting to climb on walls trying to figure out what we are missing.
  2. jcsd
  3. Feb 27, 2016 #2
    Can you redefine the vertical axis u = y/(a-y) ?
  4. Feb 27, 2016 #3
    Thanks for the fast reply!
    From my understanding I am not allowed use a or b in the definition of my axis. the y axis should be defined by y (in any form or way such as ln(y) or 1/y or y^2 or any combination and way of presenting y) and same goes for x. That is because a and b are unknowns that I will need to find using the final linear presentation of the function/graph.
  5. Feb 28, 2016 #4


    User Avatar
    Homework Helper

    You can not separate x and y but you need to define new X and Y with linear relationship between them. Taking the logarithm was a good idea: ln(xy)=ln(a)+b(xy) You can take X=xy and Y = ln(xy).

    Take the reciprocal of the equation: (1/b)(1/x) = (a-y)/y. Doing the division by y, you get (1/b) (1/x) = a(1/y)-1. What will be the new X and Y and the relation between them?
  6. Feb 28, 2016 #5
    Thanks ehild!

    I got to the equation you said but I didn't think I was allowed to say that the y axis was dependent on x and y together (and same goes for x axis).. I thought it was only allowed to be dependent on some form of y alone.. I knew I was misunderstanding something, you saved me so much frustration. Just want to make sure that you know that this (making the y axis be dependent on both x and y) is done in analyzing data in physics labs and such, or was this just something that seemed like it makes sense?

    I can't believe I didn't see that, thanks so much! Just to make sure, your meaning is for me to end up with
    and then Y=1/y and X=1/x right?

    Again thanks so much! I would be glad if you could just make me at ease and answer my first question in this reply (regaurding if you know that saying y axis is dependent on both xy is used in lab analysis or if it was just something you thought makes sense)..

    This subject fell a bit between the cracks because it is done under the lab staff, but they don't have a tutorial session or office hours or an easy way to ask them these things and it is wonderful to find a place where people can and are willing to help!
  7. Feb 28, 2016 #6


    User Avatar
    Homework Helper

    What else can you do? It is allowed to use any combination of x and y. I did lot of such things when in lab, long time ago. Presently, we just fit the original function to the measured data with a computer.

  8. Feb 28, 2016 #7
    Non-linear least squares has reduced linearizing to an academic exercise. In the test cases we've done with power laws, the uncertainties in the parameters obtained are usually smaller with an appropriate non-linear least squares fit.
  9. Feb 28, 2016 #8


    User Avatar
    Homework Helper
    Gold Member

    For the first relation, the most significant thing to me is that xy = C, a constant. So a plot of x against 1/y should be linear.

    After which, isn’t the given equation meaningless? I mean if xy is a constant, C then sure xy = kexy. the value of k is C/eC - this is not saying anything. (It took me a time to realise this). A plot of x against 1/y that turns out to be linear is saying something.

    For the second question your proposal is a reasonable answer - it is called 'the double reciprocal plot', is venerable, and you can find examples in probably hundreds of thousands of biochemistry publications.

    But although that is probably the required answer, reasonable and sanctioned by long practice, I also agree, well 77.5%, with echild and Dr Courtney.

    You could see the importance given to linearisation as a consequence of the limitation of technology in the past.

    People would obtain data and hope to fit it to some equation - in chemistry and biochemistry an equation rather similar to your second is common, I will put it in the form v = ay/(K + y) where y is the independent variable and v the dependent, measured variable. So they would measure v at various y (seven points each measurement repeated three times seem to have been considered the gold standard of workmanlikeness) and then to show conformity with the hypothetical equation, calculate using slide rule or tables, the table of transformed variables such as 1/v, 1/y. They would plot these points on graph paper and then with a ruler by hand and eye draw what seemed to them the best straight line. They did not have a hope of fitting anything but a straight line so they had to transform in this way. Primitive eh? But they did not have calculators to calculate least-squares fit, or maybe there was one three floors down, but they were frightened of it, and even more frightened by least-squares and statistics. But in their defence one should say that computers do not get much better than the human eye, nor do they incorporate the judgement of the person who has done the experiments. So they would draw these lines* - and the result was good enough to appear in a publication in a decent journal. Quite often they would not recalculate curve using the final parameters, equations and the original variables and plot those, they would publish only the linear plots of the transformed variables. It is some work to recalculate the curves with a sufficient number of points, and then it needs skill and steady hand to draw the curves through them. Often this this would be done by one highly prized technician in the department.

    The first technological imrovement to be adopted was - transparent plastic rulers! Then you could see the points covered by the ruler! But as time went on, the academic standards and demands of journals evolved. Statistics were demanded. I dare to say that this has often been something of a ritual, and replacing one kind of idealisation of data with another, even a judicious one with a blind one.

    As I said, human eye and judgement give pretty good linear fits. Instead the more important problem that was slow to be appreciated, in fact I don't know how widely it is to this day, is that plots like double reciprocal are distorting with imperfect (i.e. real) data. For example in the double reciprocal plot, even if proportional experimental error in the measurement of v is constant, and in fact it would often be greater at small v, the points at low v would have an unduly big influence on where you place the line in the linear fit. So what you really need is a properly weighted least-squares fit. But what are the right weights? Ideally you should have experiments or treat the data somehow to determine your 'error structure'. I don't think many people do this, and they use some rough and ready idea and they have of it, such as with the absolute error is constant, or that it is proportional to the dependent variable. Maybe getting better than that doesn't matter very often.

    Actually there was an interesting example of the distorting influence of the least accurate points in an anecdote-essay by Feynman called ‘The Seven Percent Solution’ (title taken from a Sherlock Holmes story).

    * I should say that there would usually be more than one independent variable, so you would be plotting a family of curves/lines. Many models would make predictions that these lines should intersect in a point or something, or then there would be a 'secondary plot' of say the several determined K's against the second independent variable.
    Last edited: Feb 29, 2016
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted