Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline marks2c  
#1 Posted : 07 January 2023 01:08:49(UTC)
marks2c


Rank: Advanced Member

Groups: Registered
Joined: 01/04/2020(UTC)
Posts: 85
New Zealand
Location: Wellington

Was thanked: 4 time(s) in 3 post(s)
This matrix generator (thanks gUrrozEN) produces random 'equal-probability' values for a given center value and tolerance band.

I'm hoping to revise this to return values within a normal/Gaussian probability as illustrated:
Normal PDF.png
Random to Normal.sm (43kb) downloaded 3 time(s).

Any thoughts?

Edited by user 07 January 2023 03:37:44(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 07 January 2023 04:47:00(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: marks2c Go to Quoted Post
Any thoughts ?

Native Smath plugins generate uniform randoms.
The Central Theorem proves that enough uniform randoms
generate a Normal Distribution.
You simply need to bin in an histogram utility.
Is that is what you are looking for ?
Otherwise, I don't understand your request.
Cheers ... Jean.

Offline marks2c  
#3 Posted : 07 January 2023 08:07:39(UTC)
marks2c


Rank: Advanced Member

Groups: Registered
Joined: 01/04/2020(UTC)
Posts: 85
New Zealand
Location: Wellington

Was thanked: 4 time(s) in 3 post(s)
Thank you for the reply Jean.

I'm after a method or function that will return a random value with the probability that 68.2% of the time it will be within 1 sigma, and 95.4% of the time it will be within 2 sigmas, etc.

Edited by user 07 January 2023 11:35:10(UTC)  | Reason: Not specified

Offline Razonar  
#4 Posted : 07 January 2023 10:13:06(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. For 'convert' random uniform distributed numbers between 0 and 1 to another probability distribution, in your case, for get some normal distributed numbers you can use the inverses of the cdf distributions. You can check that here for 1000 numbers you have the desired mean and std deviation

Clipboard01.png

so, I guess that in your function rmat this is the function for normal distributed numbers

Clipboard02.png

random to nomral.sm (6kb) downloaded 8 time(s).

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 07/01/2023(UTC)
Offline marks2c  
#5 Posted : 07 January 2023 11:32:57(UTC)
marks2c


Rank: Advanced Member

Groups: Registered
Joined: 01/04/2020(UTC)
Posts: 85
New Zealand
Location: Wellington

Was thanked: 4 time(s) in 3 post(s)
Thanks Alvaro, very greatly appreciated.

For me, the sample file has a problem:
Syntax Error.png
Offline Razonar  
#6 Posted : 07 January 2023 11:55:38(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. I mean: substitute that M[i,j] into your rmat(...) function for get normal distributed numbers with the rmat algorithm instad uniform distributed ones.

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 07/01/2023(UTC)
Offline Jean Giraud  
#7 Posted : 07 January 2023 17:22:38(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: marks2c Go to Quoted Post
Thank you for the reply Jean.

I'm after a method or function that will return a random value with the probability that 68.2% of the time it will be within 1 sigma, and 95.4% of the time it will be within 2 sigmas, etc.

I don't understand completely ... sorry.
However, from a native random sigma, you can solve for a desired other one.
Cheers, be good Down Under ... Jean.

sigma.PNG

Random NORMAL Histogram Copy.sm (45kb) downloaded 3 time(s).

Offline marks2c  
#8 Posted : 07 January 2023 21:44:13(UTC)
marks2c


Rank: Advanced Member

Groups: Registered
Joined: 01/04/2020(UTC)
Posts: 85
New Zealand
Location: Wellington

Was thanked: 4 time(s) in 3 post(s)
Thank you both. Alvaro: perfect, thank you.

Here is the working update:

20230109 Random Normal Distribution.png

20230109 Random to Normal.sm (55kb) downloaded 8 time(s).

Edited by user 09 January 2023 06:48:25(UTC)  | Reason: Updated with the finished item.

Offline marks2c  
#9 Posted : 09 January 2023 07:41:49(UTC)
marks2c


Rank: Advanced Member

Groups: Registered
Joined: 01/04/2020(UTC)
Posts: 85
New Zealand
Location: Wellington

Was thanked: 4 time(s) in 3 post(s)
See the updated post above.
Offline Jean Giraud  
#10 Posted : 09 January 2023 18:44:09(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: marks2c Go to Quoted Post
See the updated post above.


20230109 Random to Normal_1.sm (82kb) downloaded 7 time(s).

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.