LFD Book Forum (http://book.caltech.edu/bookforum/index.php)
-   Homework 4 (http://book.caltech.edu/bookforum/forumdisplay.php?f=133)

 jcmorales1564 04-29-2013 10:05 AM

Quote:
 Originally Posted by yaser (Post 10649) Your answer should agree with the given answer to two-decimal-digit accuracy as stated in the problem, or else be considered "none of the above."
Thank you, professor. I responded a few minutes ago, apparently just at the same time that you did. I had not seen your reply.

Juan

 Elroch 04-30-2013 09:27 AM

One absurdly simple way to get a handle on the plausibility of the result all of us doubted is to see what the range of possible slopes is, and guess it might be near the middle.

Observe that if two points are very near the origin, the slope can be but no higher. If they are at the furthest extremes, the slope can be zero, but no lower. The mean of this range of possible slopes is 1.57. :)

 GB449 09-09-2013 09:53 PM

Quote:
 Originally Posted by IsidroHidalgo (Post 10646) I think you have a typo, is'n it? For me :clueless:
I have simulated 100K points using this formula for slope and taken the average. I have run this a number of times but each time I get a different slope all of which are small numbers like +/- 0.00X

The random points (x1, y1) and (x2, y2) I generated are all between -1 and 1. Is the slope I am getting small because the random numbers are between -1 and 1? After all, I am dividing by 100K.

Here's the code
double slope = ((x1*y1) + (x2*y2)) / ((x1*x1) + (x2*x2));

I sum the slopes for each point and compute average
AverageSlope = SumSlope / (double) NoOfPoints;

All times are GMT -7. The time now is 03:20 AM.