Calculating errors after curve fitting (linearizing) graphs

In summary: The Attempt at a SolutionI think I need to take the log of the error instead of the ln. So the values I calculated to be ln(x) are also wrong, as I need to split the ln(x-Δx) to ln(x+Δx) to look like y +-Δy (where y is some form of x, like ln(x)) in order to get the new values and errors, and not just take ln of the value.In summary, the person is trying to curve fit data and is having trouble understanding why their errors are so unproportionate to their values and much larger than them. They are also
  • #1
Orha
24
0

Homework Statement


I did a lab this week measuring periods of swings of a simple pendulum. We need to curve fit the equation T=k*l^n and we got ln(T)=n*ln(l)+ln(k), and we need to plot the data we collected into the linear graph, meaning out y axes is ln(T) and our x axes is ln(l). So far all is well and good, I took ln's of all my data and ploted it into the graph which is more or less linear.

My problem is that my errors are so small, one of them is 0.5*10^(-3) (=0.0005), that when I ln it I get -7.6. At the same time when I ln my data I get values between -0.05 and -0.8. looking at the ln graph I understand why this happens, but it doesn't make sense that my errors would be so unproportionate to my values (and much larger than them), and I am not sure it makes sense to have a negative error, does it? Does having a negative error have any significance? Because in my head all it does is change the signs from "value +- negative error" to "value -+ positive error") which would mean that in this case I have an error of 7.6 on a value that is 0.8 which again, makes no sense..

Do I just keep the errors as they were before?

I am sure I am doing something wrong, or at least understanding the results wrong, but I have no idea what I am suppose to do..

Any help would be greatly appreciated, thanks for your time!

Homework Equations


Non really, I changed T=k*l^n to ln(T)=n*ln(l)+ln(k) and am trying to fit the errors..

The Attempt at a Solution


I had a thought that maybe I need to do the opposite, and put my errors to an exponent, but I couldn't really understand why that would be and in any case that didn't give me good results either as the error valuse I got were close to 1 which is still a problem..
 
Physics news on Phys.org
  • #2
What exactly do you mean by the 'error' here? I would have thought you meant the extent to which one of the ln(T) misses the straight line fit, but then I do not understand why you would be taking the log of that,
 
  • #3
Thanks for the response, sorry that I wasn't precise.
The error I mean is the one derived by the measurement tool. In this case we used a meter ruler to measure the length of the ruler and a stopwatch to measure the time. The error for the meter ruler is 0.5mm = 0.0005m and for the stopwatch it is 0.001s.
The problem is that the length measured are between 0.450m to 0.952m, and in order to curve fit the graph I need to take their ln, which is between -0.799m to -0.049m. If I take the ln of the error of the ruler (0.0005) I get -7.600m.

I don't know if I am doing something wrong, or just misunderstanding something, but it doesn't make sense to me that measuring something to be -0.049 could have an error of -7.600. Also, this only occurred to me as I am writing this now, how can I claim to measure a negative number (after curve fitting)?
 
  • #4
Orha said:
Thanks for the response, sorry that I wasn't precise.
The error I mean is the one derived by the measurement tool. In this case we used a meter ruler to measure the length of the ruler and a stopwatch to measure the time. The error for the meter ruler is 0.5mm = 0.0005m and for the stopwatch it is 0.001s.
The problem is that the length measured are between 0.450m to 0.952m, and in order to curve fit the graph I need to take their ln, which is between -0.799m to -0.049m. If I take the ln of the error of the ruler (0.0005) I get -7.600m.

I don't know if I am doing something wrong, or just misunderstanding something, but it doesn't make sense to me that measuring something to be -0.049 could have an error of -7.600. Also, this only occurred to me as I am writing this now, how can I claim to measure a negative number (after curve fitting)?
This still does not explain why you want to take the log of the error. If the error in a measurement x is +/-Δx then the logarithm is from ln(x-Δx) to ln(x+Δx).
 
  • #5
Ok, I think I am starting to understand.. but then now I really don't know what to do.
So you are saying the logarithm is from ln(x-Δx) to ln(x+Δx). So the values I calculated to be ln(x) are also wrong, as I need to split the ln(x-Δx) to ln(x+Δx) to look like y +-Δy (where y is some form of x, like ln(x)) in order to get the new values and errors, and not just take ln of the value to get my new value and ln of my error to get my new error.
But then I don't have any way to split up the ln in order to have my Δy separate from my y, so how can I get values and errors to plot?

Why do I get the feeling I am over complicating this?
 
  • #6
Orha said:
Ok, I think I am starting to understand.. but then now I really don't know what to do.
So you are saying the logarithm is from ln(x-Δx) to ln(x+Δx). So the values I calculated to be ln(x) are also wrong, as I need to split the ln(x-Δx) to ln(x+Δx) to look like y +-Δy (where y is some form of x, like ln(x)) in order to get the new values and errors, and not just take ln of the value to get my new value and ln of my error to get my new error.
But then I don't have any way to split up the ln in order to have my Δy separate from my y, so how can I get values and errors to plot?

Why do I get the feeling I am over complicating this?
What is the derivative of ln? Apply a Taylor expansion.
 
  • #7
Sorry if this is starting to get too much.. my intent really isn't to have you solve the problem for me, but I still not 100% sure of things, for reasons that have a bit less to do with physics maybe.
Using Taylor expansions I think I understand how you mean to solve it and what to generally do, and it makes sense but what bugs me is:

- This is the second lab of a first year undergraduate degree, semester started a month ago and we did not study Taylor series yet (we are very far from it).
- My lab instructor told me that in order to get the values I need to simply ln the values I had. My mistake was forgetting to ask him what to do with the errors during the lab session. After your explanation you convinced me that he might have been incorrect, but I would like to think he knows what he is talking about (I think he is doing his PhD).

I thank you so much for your time and effort, ideally I would ask my lab instructor these questions but they made it very clear to us that we can't as questions after exiting the lab and we must try to deal with it ourselves.

Is there maybe something else I can do that isn't a Taylor expansion?
 
  • #8
Orha said:
Sorry if this is starting to get too much.. my intent really isn't to have you solve the problem for me, but I still not 100% sure of things, for reasons that have a bit less to do with physics maybe.
Using Taylor expansions I think I understand how you mean to solve it and what to generally do, and it makes sense but what bugs me is:

- This is the second lab of a first year undergraduate degree, semester started a month ago and we did not study Taylor series yet (we are very far from it).
- My lab instructor told me that in order to get the values I need to simply ln the values I had. My mistake was forgetting to ask him what to do with the errors during the lab session. After your explanation you convinced me that he might have been incorrect, but I would like to think he knows what he is talking about (I think he is doing his PhD).

I thank you so much for your time and effort, ideally I would ask my lab instructor these questions but they made it very clear to us that we can't as questions after exiting the lab and we must try to deal with it ourselves.

Is there maybe something else I can do that isn't a Taylor expansion?
Well, it's only the first couple of terms you need, which are pretty standard. ##f(x+\Delta x) = f(x)+\Delta x f'(x)## (I don't know the latex for approximately equals.) You can justify that simply by thinking about the slope of the ln curve at x.
 
  • #9
I have an Idea (I am sorry I am resisting your Taylor expansion, its just I know that it's not what they want us to do..)

If I calculate ln(x-Δx) and ln(x+Δx) and take the average that should bring me my new linearized x value, I will call it y, no? And then I can take that y value and subtract from it ln(x-Δx) and get my Δy,no?

I mean its not a fun thing to do for 20 different calculations, but it should work, shouldn't it?
 
  • #10
Orha said:
I have an Idea (I am sorry I am resisting your Taylor expansion, its just I know that it's not what they want us to do..)

If I calculate ln(x-Δx) and ln(x+Δx) and take the average that should bring me my new linearized x value, I will call it y, no? And then I can take that y value and subtract from it ln(x-Δx) and get my Δy,no?

I mean its not a fun thing to do for 20 different calculations, but it should work, shouldn't it?
Isn't that the same as ##\frac 12 (ln(x+\Delta x)-ln(x-\Delta x))##?
 
  • #11
Actually, I'm not sure why are are trying to find these error terms. Is it to plot error bars on the graph?
 
  • #12
You are right I I think, the value will be (ln(x+Δx)+ln(x-Δx))/2 and the error will be |(ln(x+Δx)+ln(x-Δx))/2-ln(x-Δx)|=|(ln(x+Δx)-ln(x-Δx))/2|
That saves calculations, thanks!

And yes, we need to say what the errors are for each measurement and then graph it with error bars.
 
  • #13
Orha said:
You are right I I think, the value will be (ln(x+Δx)+ln(x-Δx))/2 and the error will be |(ln(x+Δx)+ln(x-Δx))/2-ln(x-Δx)|=|(ln(x+Δx)-ln(x-Δx))/2|
That saves calculations, thanks!

And yes, we need to say what the errors are for each measurement and then graph it with error bars.
Why would the value not still be just ln(x)? There is no requirement for the value to be half way between the error bars. You could just plot the error bars as ln(x+Δx) and ln(x-Δx).
 
  • #14
haruspex said:
There is no requirement for the value to be half way between the error bars

There isn't? How can the value not be half way between the error bars?
I assumed that it has to be in the middle and thus because ln(x+Δx) doesn't equal ln(x) + ln(Δx) then the value of the middle point would not be ln(x).
I thought I understood it but now that you are saying it doesn't have to be in the middle I think I understood it wrong.. Now what I understand is that I take ln of whatever I need and I get the result and I plot it, so the value x is now ln(x) and the errors are ln(x+Δx) and ln(x-Δx). (I realize this is exactly what you wrote).

This all makes sense for graphing, but then if the bottom and top error aren't the same then can I not write the value in the linearization in the shape of y+-Δy? do I not have a Δy? How do I write the value (and not graph it)?
 
  • #15
Orha said:
There isn't? How can the value not be half way between the error bars?
I assumed that it has to be in the middle and thus because ln(x+Δx) doesn't equal ln(x) + ln(Δx) then the value of the middle point would not be ln(x).
I thought I understood it but now that you are saying it doesn't have to be in the middle I think I understood it wrong.. Now what I understand is that I take ln of whatever I need and I get the result and I plot it, so the value x is now ln(x) and the errors are ln(x+Δx) and ln(x-Δx). (I realize this is exactly what you wrote).

This all makes sense for graphing, but then if the bottom and top error aren't the same then can I not write the value in the linearization in the shape of y+-Δy? do I not have a Δy? How do I write the value (and not graph it)?
Are you saying that you are also required to fill these numbers into a table, and you only have two entries per data point, one for the value and one for the error?
 
  • #16
Yes, I am also required to fill it into a table. Up until now (meaning in the previous lab, because this is only the second one we are doing) we have been told the format of a measurement is x±Δx so I assumed that both the upper and lower error bounds have to be the same..
 
  • #17
Orha said:
Yes, I am also required to fill it into a table. Up until now (meaning in the previous lab, because this is only the second one we are doing) we have been told the format of a measurement is x±Δx so I assumed that both the upper and lower error bounds have to be the same..
In general, error bars can be asymmetric. Google that.
But in the present case the asymmetry will not be great, so you can fudge it to achieve symmetry. It probably will not matter much if you do what you described, adjusting the data point to be in the middle, but I would rather adjust the error bars slightly.
 
  • #18
Thanks so much! I am looking up uneven error bars and I also came across a pdf from the University of Washington which explains it fairly well..

You have been so helpful! Thanks again!
 

1. What is curve fitting?

Curve fitting is a method used in data analysis to find a mathematical model that best fits a set of data points. This is done by adjusting the parameters of the model to minimize the difference between the predicted values and the actual data points.

2. Why is it important to calculate errors after curve fitting?

Calculating errors after curve fitting allows us to determine the accuracy of the model and the reliability of the fitted parameters. It also helps us to assess the goodness of fit and make any necessary adjustments to improve the model.

3. What is linearizing a graph?

Linearizing a graph is a technique used to transform a non-linear relationship between two variables into a linear one. This is done by applying mathematical operations such as logarithms, exponentials, or power functions to one or both of the variables.

4. How do you calculate errors after curve fitting?

To calculate errors after curve fitting, you need to first determine the residual, which is the difference between the predicted values and the actual data points. Then, you can calculate the sum of squared residuals (SSR) and the sum of squared errors (SSE). The root mean square error (RMSE) and coefficient of determination (R^2) can also be calculated to assess the accuracy of the model.

5. What are the most common types of errors in curve fitting?

The most common types of errors in curve fitting are systematic errors and random errors. Systematic errors are consistent and predictable, and they occur due to flaws in the experimental setup or measurement techniques. Random errors, on the other hand, are unpredictable and can occur due to natural variations in the data or human error.

Similar threads

  • Introductory Physics Homework Help
Replies
12
Views
616
  • Introductory Physics Homework Help
Replies
6
Views
785
  • Introductory Physics Homework Help
Replies
7
Views
2K
  • Introductory Physics Homework Help
Replies
7
Views
919
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • Introductory Physics Homework Help
Replies
15
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
8
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
4K
  • Introductory Physics Homework Help
Replies
12
Views
736
Back
Top