Jump to content

Bug/Documentation Error in Continuous Random VI: Gamma Random


X___

Recommended Posts

The Gamma Random generator has two parameter inputs in addition to the number of sample: b and c

According to the help, which I paste here for the record:

 

image.png.878c44b0fda28fdee8c508c1b15fdf26.png

 

b is the scale parameter and c the shape parameter of the Gamma distribution.

However, if you do that, the generated RV are bogus, because it turns out that b is the shape parameter and c is the scale parameter, as defined for instance on Wikipedia:

image.png.2bb4987d9a0e7af6e99662e1297d9ef2.png

This can be easily verified by generating a large number of RV and comparing their normalized histogram with the functional form above.

 

Tested in LabVIEW 2021 SP1f3 on Windows 10 64 bit

 

Link to comment

A somewhat related bug in this function is that for certain parameters, it will fail to compute a random variable and instead of returning an error, will return "NaN" for the values and an error code of 0. So not only do you have to use a custom code handling snippet (no error cluster output as those things date back from Colonel Kodosky times), but also check for NaN outputs.

In any case, NaN output is clearly not a valid one, because it is due to a failure of finding a solution to CDF(x) = cte in this subVI:

image.png.198c80d6957c01b4ff5cf8d0a77d13fd.png

where the unconnected error from the subVI is clearly non zero when there is a failure to find a solution (positive/negative bracket for the root):

image.png.5f0e52ac838d94661cd2b58f7fe96366.png

Since I am not planning to go past LabVIEW 2021, I can fix that in my repo, but this is a remnant of olden times which will keep biting the likes of SpaceX, Blue Origin and others, who are planning to send human to Mars (hopefully this nonsense will stop earlier rather than later).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.