Get the slope of a line in my example?

In summary, the conversation discusses how to find the slope of a straight line using the equation y=mx+b and the given values of x and y. The results show a slope of around 39000000, which is expected. The conversation also mentions the context of the problem and the possibility of roundoff error. The original expectation of a slope of 3 is incorrect, as it is not a reasonable value and does not match the given values. The conversation further explains the problem and its solution.
  • #1
xeon123
90
0
Hi,

I've these values:

Code:
# x     y=f(x)
50      1957768251
100     3915542997
150     5873311096
500     19577709464
1000   39155455160
1500   58686574963
2000   78292255800
2500   97888617384
3000   117466340329
3500   137044056081
4000   156491263529
4500   176177759312

These values represents a straight line in a graph. Using the equation y=mx+b, and assuming b=0, I would like to know the slope of the straight line. Since, it's the m variable that gives me the slope, so,

[itex]m=\frac{y}{x}[/itex]Applying this equation, I get the results:

Code:
39155365
39155429
39155407
39155418
39155455
39124383
39146127
39155446
39155446
39155444
39122815
39150613

With these results, the slope is around 39000000? Shouldn't I get a more reasonable value, like 3?

What is the slope?

Thanks,
 
Mathematics news on Phys.org
  • #2
39000000 looks about right. The better way to do this is a least squares fit, but it won't give you a radically different result.
 
  • #3
The slope is nowhere near 3. How did you get the y-values? Without knowing what you did to get these values, I would guess that it's roundoff error. But it looks like the slope is around 39000000 as you said.

Just out of curiousity, what's the context of this problem? It would be more helpful if we knew what you were trying to do.
 
  • #4
Why do you expect the slope to be around 3? do you know something we don't?

First of all...if you think that slope values should be reasonable, you are mistaken...think about it, a line that is vertical has a slope of infinite!

Second, if you know ahead of time what you are looking for and know that the slope should be around 3...then, you may have a type-cast-ing problem or printing problem or something...what kind of environment/programming language are you using to do this work? are you performing a REAL calculation and assigning this to an INTEGER variable? or what?
 
  • #5
f(x) is the time spent in executing the whole computer program.
To understand my problem, I must explain the program.

I've 2 versions of a program. The difference between them is that one of them execute 3 times more than one of them.

For example, in program one, it accepts the input 50 and returns the solution at a time t.
[itex]t=f(x)[/itex]

The program two, it accepts the input 50, and execute the same instructions 3 times before return a result.
[itex]t'=3f(x)[/itex]

Now I get it what's my problem. I'm just putting part of the results, I must put the rest of the results to get the value that I want, which is 3.

Thank you for your answers.
 

Related to Get the slope of a line in my example?

1. What is the slope of a line?

The slope of a line is a measure of its steepness or incline. It represents how much the line rises or falls over a given horizontal distance.

2. How do I calculate the slope of a line?

The slope of a line can be calculated by dividing the change in the y-coordinates by the change in the x-coordinates between two points on the line. This can be written as (y2 - y1) / (x2 - x1).

3. What is the significance of the slope of a line?

The slope of a line can tell us important information about the relationship between two variables. It can indicate whether the variables are positively or negatively correlated, and the steepness of the slope can provide insight into the strength of the relationship.

4. Can the slope of a line be negative?

Yes, the slope of a line can be negative. This indicates a negative correlation between the variables, meaning that as one variable increases, the other decreases.

5. How can I interpret the slope of a line?

The slope of a line can be interpreted as the rate of change between the two variables. For example, a slope of 2 means that for every 1 unit increase in the x variable, the y variable increases by 2 units. It can also be interpreted as the rise over run, representing how much the line is changing vertically for each unit of horizontal change.

Similar threads

  • General Math
Replies
5
Views
2K
Replies
12
Views
2K
Replies
2
Views
1K
Replies
4
Views
1K
Replies
4
Views
1K
  • General Math
Replies
28
Views
4K
  • General Math
Replies
4
Views
4K
Replies
5
Views
1K
Replies
3
Views
1K
Replies
2
Views
1K
Back
Top