Get the slope of a line in my example?

  • Context: High School 
  • Thread starter Thread starter xeon123
  • Start date Start date
  • Tags Tags
    Example Line Slope
Click For Summary

Discussion Overview

The discussion revolves around calculating the slope of a line represented by a set of values, specifically focusing on the relationship between input values and their corresponding outputs in a computational context. Participants explore the implications of these calculations and the assumptions behind them.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant presents a set of x and y values and seeks to calculate the slope using the formula m=y/x, assuming b=0.
  • Another participant suggests that a least squares fit would be a better method for determining the slope, though it may not yield a significantly different result.
  • A different participant questions the expectation of the slope being around 3, suggesting that it may be a result of roundoff error and emphasizes the importance of context in understanding the values.
  • Another participant challenges the assumption that slope values should be "reasonable," pointing out that slopes can vary widely depending on the line's orientation.
  • The original poster clarifies that the context involves two versions of a program, where one executes instructions three times more than the other, indicating that the slope should reflect this relationship.

Areas of Agreement / Disagreement

Participants generally agree that the slope is around 39000000 based on the provided values, but there is disagreement regarding the expectation of the slope being around 3. The discussion remains unresolved regarding the implications of the calculations and the assumptions made.

Contextual Notes

There are limitations regarding the assumptions made about the relationship between the x and y values, as well as the potential for roundoff errors or type-casting issues in the programming context. The discussion does not resolve these uncertainties.

Who May Find This Useful

This discussion may be useful for individuals interested in computational programming, data analysis, and the mathematical concepts of slope and linear relationships in data sets.

xeon123
Messages
90
Reaction score
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,
 
Physics news on Phys.org
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.
 
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.
 
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?
 
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.
 

Similar threads

  • · Replies 53 ·
2
Replies
53
Views
7K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K