From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

random numbers addition 1

You are mixing the wrong theory. We are dealing with probability theory. It has nothing to do with number theory. Terminolgy in certain subject is key in talking about this. Clustering you are talking about is not necessarialy inherent.

Message 31 of 38
(1,096 Views)

Of course 5 numbers will have a mean of .2.

 

Now you have to define what you mean by variance, and what you call high and what you call low.

 

Is your variance value based on standard deviation?  root sum square, root mean square?  Some other calculation of the results?

 

I don't know if you'll be able to force your random number generation to conform to your requirements.  I think you'll have to generate a set, calculate your variance by whatever the definition is.  If it passes your criteria, proceed.  If it fails, then generate another set and test the criteria again.

Message 32 of 38
(1,093 Views)

Thank you guys, I don't know which one I can consider as the best solution, Special thanks to RavenFan, he gave me a very nice inspiration and to altenbach who gives me the set that I want, I am satisfied with the generated numbers although I can find in which mathematical theory it is based (1/xi2)/(sum(1/Xi2)).

0 Kudos
Message 33 of 38
(1,074 Views)

@ziedhosni wrote:

... although I can find in which mathematical theory it is based (1/xi2)/(sum(1/Xi2)).


There is no theory. It just creates a set of random numbers with a non-even probability distribution to be normalized to a sum of 1.

Message 34 of 38
(1,066 Views)
nevermind, already answered
Message 35 of 38
(1,065 Views)

If we're talking really random numbers with those constraints, there is no certainty that their variance will be high. You could have two random sets (of course I picked these, but they have just as high a probability of happening as any other):

 

0.990, 0.001, 0.002, 0.003, 0.004 (s^2 = 0.195)

0.198, 0.199, 0.200, 0.201, 0.202 (s^2 = 0.00000250)

 

And as long as the OP hasn't constrained the set to exclude duplicates:

 

1.00, 0.00, 0.00, 0.00, 0.00 (s^2 = 0.2) maximum possible

0.20, 0.20, 0.20, 0.20, 0.20 (s^2 = 0) minimum possible

 

And don't tell me that these can't exist. I saw someone throw 4 boxcars (6-6) in a row at the craps table one night (probability 1,679,616 to 1 against), although nobody had the courage to bet on it and let it ride (for non-gamblers, that means bet your winnings from one roll on the next).

 

Cameron

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 36 of 38
(1,037 Views)

Actually my previous text was not displayed. I wanted to show you for interested people the VI I coded. Is there any critic or comment?

0 Kudos
Message 37 of 38
(1,004 Views)

Except for the fact that it will never reach a conclusion which satisfies your stated criteria, since there is no way that you'll get a standard deviation of 0.99 (or anything above 0.142857... for seven numbers) with seven elements adding up to 1.0, you have succeeded in wiring up a random number generator which indicates when the sum of a chosen number of numbers is less than 1.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 38 of 38
(992 Views)