Get the slope of a line in my example?

1. Jul 11, 2011

xeon123

Hi,

I've these values:

Code (Text):

# 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,

$m=\frac{y}{x}$

Applying this equation, I get the results:

Code (Text):

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,

2. Jul 11, 2011

pmsrw3

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. Jul 11, 2011

gb7nash

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. Jul 11, 2011

gsal

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. Jul 12, 2011

xeon123

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.
$t=f(x)$

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

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.