Cody

# Problem 8047. Weighted Gold/Silver Standard

Solution 2166622

Submitted on 20 Mar 2020 by Nikolaos Nikolaou
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   Pass
HY = 2014; HV = 1270; wt = 0.5; CV_corr = 1270; assert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)<5e-2)

NS = 66.3800 NG = 1 CV2 = 1270 CV1 = 1270 CV = 1270

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

CV = NaN

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

CV = NaN

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

NS = 49.4214 NG = 0.7445 CV2 = 945.5400 CV1 = 1.0350e+03 CV = 990.2900

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

NS = 136.0987 NG = 2.0503 CV2 = 2.6039e+03 CV1 = 2.8475e+03 CV = 2.7257e+03

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

NS = 199.7858 NG = 3.0097 CV2 = 3.8224e+03 CV1 = 4.5341e+03 CV = 4.1782e+03

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

NS = 193.9818 NG = 2.9223 CV2 = 3.7113e+03 CV1 = 3.2944e+03 CV = 3.5029e+03

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

NS = 207.2585 NG = 3.1223 CV2 = 3.9653e+03 CV1 = 3.2993e+03 CV = 3.6323e+03

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

NS = 1.3469e+03 NG = 20.2901 CV2 = 2.5768e+04 CV1 = 3.6286e+04 CV = 3.1027e+04

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

NS = 1.6125e+03 NG = 24.2917 CV2 = 3.0850e+04 CV1 = 6.1442e+04 CV = 4.6146e+04

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

NS = 759.5549 NG = 11.4425 CV2 = 1.4532e+04 CV1 = 6.1442e+04 CV = 3.7987e+04

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

NS = 808.6643 NG = 12.1823 CV2 = 1.5472e+04 CV1 = 6.5498e+04 CV = 4.0485e+04

13   Pass
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)

NS = 199.7858 NG = 3.0097 CV2 = 3.8224e+03 CV1 = 4.5341e+03 CV = 3.8224e+03

14   Pass
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)

NS = 808.6643 NG = 12.1823 CV2 = 1.5472e+04 CV1 = 6.5498e+04 CV = 1.5472e+04