X___ Posted June 7 Report Share Posted June 7 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: 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: 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 Quote Link to comment
X___ Posted June 7 Author Report Share Posted June 7 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: 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): 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). Quote Link to comment
X___ Posted June 7 Author Report Share Posted June 7 Another fun bug of this function is that it arbitrarily cuts off generation at 10,000: Why not? It always spices up debugging... (the revision history shows: rev. 2 Sun, Sep 25, 1994 12:46:16 PM greggf) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.