Problem Statement
Radioactive isotopes generally decay according to the following function, where e is the base of the natural logarithm (about 2.718281828459045), t is the amount of time that has elapsed since the organism died, and k is a constant that is different for each isotope:
final concentration = initial concentration * (e ^ (- t / k))
In the case of carbon-14, k = 8267, when time is measured in years.
In this problem, you will be given a measurement, concentration, from an ancient artifact representing (final concentration / initial concentration) * 10,000 (so 543 would mean that the ratio of the two concentrations was 0.0543). You will also be given an
For example, if concentration were 5000 and err were 100, then the lower bound on the age of the artifact would come from assuming the true ratio of concentrations was 0.51, and the upper bound on the age of the artifact would come from assuming that the ratio of concentrations was 0.49. For these two concentrations, we get ages of 5566.54 and 5897.26, respectively. Thus we would return {5566, 5898}
Definition
- Class:
- Carbon14
- Method:
- dateRange
- Parameters:
- int, int
- Returns:
- int[]
- Method signature:
- int[] dateRange(int concentration, int err)
- (be sure your method is public)
Notes
- Recall that ln(e^x) = x, where ln is the natural logarithm function.
Constraints
- concentration will be between 1 and 9999, inclusive.
- err will be between 0, inclusive, and min(concentration, 10000-concentration), exclusive.
- Neither the lower nor the upper bounds on the age will be within 1e-6 of an integer, prior to rounding.
Examples
5000
100
Returns: { 5566, 5898 }
The example from the problem statement.
5000
0
Returns: { 5730, 5731 }
With 0 error, we calculate the age of the artifact as 5730.25 years, giving us a lower bound of 5730 and an upper bound of 5731. For this reason, 5730 years is called the half-life of carbon-14 - after 5730 years, there is half as much of it as there was originally.
1
0
Returns: { 76141, 76142 }
3456
18
Returns: { 8740, 8827 }
9999
0
Returns: { 0, 1 }
5000
4999
Returns: { 0, 76142 }
527
93
Returns: { 22987, 25937 }
581
365
Returns: { 19494, 31705 }
871
756
Returns: { 15011, 36916 }
1045
1043
Returns: { 12949, 70412 }
1592
785
Returns: { 11877, 20809 }
1696
1060
Returns: { 10654, 22777 }
2178
404
Returns: { 11193, 14297 }
2536
1805
Returns: { 6898, 21626 }
2622
1749
Returns: { 6841, 20159 }
2713
1182
Returns: { 7794, 15515 }
3223
1244
Returns: { 6662, 13393 }
3316
911
Returns: { 7118, 11781 }
3365
487
Returns: { 7886, 10297 }
3519
139
Returns: { 8313, 8968 }
3700
3192
Returns: { 3077, 24635 }
3761
2031
Returns: { 4514, 14505 }
4119
1019
Returns: { 5505, 9683 }
4126
879
Returns: { 5721, 9300 }
4312
1359
Returns: { 4689, 10084 }
4394
2278
Returns: { 3345, 12840 }
4480
1649
Returns: { 4047, 10433 }
4598
1202
Returns: { 4503, 8929 }
4708
4010
Returns: { 1134, 22008 }
4839
4409
Returns: { 646, 26013 }
4950
4854
Returns: { 163, 38409 }
5006
2047
Returns: { 2886, 10068 }
5549
2640
Returns: { 1651, 10208 }
5633
2981
Returns: { 1233, 10973 }
5668
1038
Returns: { 3303, 6366 }
5891
320
Returns: { 3937, 4837 }
5941
1576
Returns: { 2359, 6854 }
6003
1573
Returns: { 2294, 6731 }
6081
2296
Returns: { 1464, 8032 }
6100
3622
Returns: { 233, 11534 }
6236
275
Returns: { 3547, 4277 }
6317
3234
Returns: { 379, 9728 }
6433
201
Returns: { 3392, 3910 }
6825
2486
Returns: { 590, 6903 }
7068
1805
Returns: { 988, 5307 }
7297
1919
Returns: { 674, 5128 }
7328
1935
Returns: { 632, 5105 }
7400
1749
Returns: { 735, 4719 }
7604
2222
Returns: { 145, 5122 }
7875
1358
Returns: { 659, 3540 }
8168
1010
Returns: { 709, 2765 }
8194
989
Returns: { 704, 2711 }
8562
920
Returns: { 439, 2224 }
8633
116
Returns: { 1104, 1328 }
1
0
Returns: { 76141, 76142 }