Cody

# Problem 8047. Weighted Gold/Silver Standard

Solution 1946059

Submitted on 23 Sep 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
HY = 2014; HV = 1270; wt = 0.5; CV_corr = 1270; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 224

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test1 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

2   Pass
HY = 500; HV = 50; wt = 0.5; CV_corr = NaN; assert(isnan(gold_silver_weighted_standard(HY,HV,wt)))

i = 1×0 empty double row vector CV = NaN

3   Pass
HY = 2500; HV = 5000; wt = 0.5; CV_corr = NaN; assert(isnan(gold_silver_weighted_standard(HY,HV,wt)))

i = 1×0 empty double row vector CV = NaN

4   Fail
HY = 2010; HV = 1000; wt = 0.5; CV_corr = 990.29; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 220

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test4 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

5   Fail
HY = 2005; HV = 1000; wt = 0.5; CV_corr = 2725.7; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 215

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test5 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

6   Fail
HY = 2000; HV = 1000; wt = 0.5; CV_corr = 4178.23; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 210

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test6 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

7   Fail
HY = 1995; HV = 1000; wt = 0.5; CV_corr = 3502.87; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 205

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test7 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

8   Fail
HY = 1990; HV = 1000; wt = 0.5; CV_corr = 3632.31; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 200

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test8 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

9   Fail
HY = 1950; HV = 1000; wt = 0.5; CV_corr = 31027.07; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 160

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test9 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

10   Fail
HY = 1900; HV = 1000; wt = 0.5; CV_corr = 46146.07; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 110

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test10 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

11   Fail
HY = 1850; HV = 1000; wt = 0.5; CV_corr = 37986.86; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 60

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test11 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

12   Fail
HY = 1800; HV = 1000; wt = 0.5; CV_corr = 40484.63; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 10

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test12 (line 2) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

13   Fail
HY = 2000; HV = 1000; wt = randi(10)/10; switch (wt*10) case 0 CV_corr = 4534.09; case 1 CV_corr = 4462.92; case 2 CV_corr = 4391.75; case 3 CV_corr = 4320.57; case 4 CV_corr = 4249.4; case 5 CV_corr = 4178.23; case 6 CV_corr = 4107.05; case 7 CV_corr = 4035.88; case 8 CV_corr = 3964.7; case 9 CV_corr = 3893.53; case 10 CV_corr = 3822.36; end assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 210

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test13 (line 27) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

14   Fail
HY = 1800; HV = 1000; wt = randi(10)/10; switch (wt*10) case 0 CV_corr = 65497.68; case 1 CV_corr = 60495.07; case 2 CV_corr = 55492.46; case 3 CV_corr = 50489.85; case 4 CV_corr = 45487.24; case 5 CV_corr = 40484.63; case 6 CV_corr = 35482.02; case 7 CV_corr = 30479.41; case 8 CV_corr = 25476.8; case 9 CV_corr = 20474.19; case 10 CV_corr = 15471.58; end assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

i = 10

Unrecognized function or variable 'a'. Error in gold_silver_weighted_standard (line 8) CVS = round(1270*SR(a)*HV/GV(i)/66.38,2); Error in Test14 (line 27) assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)