Ask your own question, for FREE!
Mathematics 22 Online
OpenStudy (anonymous):

From successive sums of 12 uniform random variables (i.e., use the BASIC system RND() function) use the Central Limit Theorem and BASIC to generate a long sequence (>1000) of Normal random variables with zero mean and unity variance. Calculate the mean and variance for N=10,000 observations.

OpenStudy (anonymous):

just want to understand the general idea of what the teach is asking

OpenStudy (anonymous):

so basically create 1000 normal random variables using z = RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() -6

OpenStudy (anonymous):

add them all up and find the average

OpenStudy (anonymous):

from this, calculate the variance? why is it that you have 1000 pieces of sample data and 10,000 observations???

OpenStudy (anonymous):

im in this class too i did something like this 08 N=10000 09 for J = 1 to N 10 for I = 1 to 12 11 x = 0 20 X = X + rnd(1) 30 next I 40 SUM = SUM + X - 6 41 AVG = SUM / N 50 print sum 60 print N 70 print AVG

OpenStudy (anonymous):

hey sorry was looking at a another page

OpenStudy (anonymous):

thats not right though

OpenStudy (anonymous):

wait so you just do this for 10,000 numbers?

OpenStudy (anonymous):

why does he have >1000

OpenStudy (anonymous):

greater than 1000 is 10000

OpenStudy (anonymous):

its unclear

OpenStudy (anonymous):

yeah, not sure why he wrote it that way

OpenStudy (anonymous):

are you in the 1pm class?

OpenStudy (anonymous):

yes

OpenStudy (anonymous):

ahh nice, i usually sit towards the back

OpenStudy (anonymous):

grr this assignment is killing me. usually have everything done way ahead of schedule but had a bunch of other stuff due, so i'm struggling with finishing this last minute

OpenStudy (anonymous):

how did you set up problem 2?

OpenStudy (anonymous):

im in the same boat. although i'm a lifelong procrastinator.

OpenStudy (anonymous):

lol

OpenStudy (anonymous):

on your program i think you have it set up right except for lines 11 - 30

OpenStudy (anonymous):

you should do RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() + RND() - 6

OpenStudy (anonymous):

set that = to X

OpenStudy (anonymous):

im testing it now, definite logic error

OpenStudy (anonymous):

ah wait nm, you had it right. but yeh just add 10000 of them up then divide

OpenStudy (anonymous):

import java.util.*; import java.lang.Math; public class NormalRNDVars { public static void main(String[] args) { Random rand = new Random(); double rnd = rand.nextDouble(); double z[] = new double[1002]; double average = 0, sum = 0, sample = 0; //Calculate normal random variable for(int i=1; i<=1000; i++) { z[i] = rnd + rnd + rnd + rnd + rnd + rnd + rnd + rnd + rnd + rnd + rnd + rnd - 6; } //Add all of the normal random variables for(int i=1; i<=1000; i++) { sum += z[i]; } //Calculate and print the average average = sum / 10000; System.out.printf("Average: %f\n", average); for(int i=1; i<=1000; i++) { sample += Math.pow(z[i] - average, 2); } sample = sample / (1000 - 1); System.out.printf("Variance: %f\n", sample); } }

OpenStudy (anonymous):

if that helps

OpenStudy (anonymous):

gotta catch a bus, cya in class

OpenStudy (anonymous):

bye

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!