Message Boards Message Boards

0
|
2283 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Custom function not working as expected

Posted 3 years ago

The following code has some bug. As I've written it bellow, when calculating d using whatever variation of Rad (RadM, RadR, RadH...) the result is the same, although the values are different.

In[281]:= sp[val1_, val2_] := Sqrt[((2*Variance[val2]) + (2*Variance[val1]))/6]

In[282]:= d[val1_, val2_] := (Mean[val2] - Mean[val1])/sp[val1, val2]

In[283]:= sp[RadM, RadH]

Out[283]= 0.621

In[286]:= d[RadM, RadH]

Out[286]= 4.97[{7.3, 6.8, 8.2}, {10, 9.4, 11}]

The output value (check the above 2 lines) is 4.97 with the values used to derived that result written in brackets. If I chance from RadH to RadR for example, the second set of values (10, 9.4, 11) changes. But the final result, 4.97, never does.

The same in picture mod, if the code is not clear. the code and results

POSTED BY: Ion Ganea
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract