I am doing a program that calculates radio activity at a previous point in time based on measured radioactivity.
However if the half-life is very large compared with the elapsed time I get a 0.00
as the answer which then leaves me with A= Ao
at least until (times[i]-times[0])
gets large.
For example if (times[i]-times[0]) = 5
and Thalflife = 6540
I want to get 0.00076452599
however I get 0.0
is double the wrong type to use or is it the /
command that is giving me the problem?
private double[]theoreticalVals(double activity) {
/* below is an implementation of the activity decay
* calculation formula A= Ao/2^(t/Thalflife)
* An array of values will be returned.
* The times array defines the length of the array and gives the point in time values
*/
double Ao= activity;
double [] vals = new double[times.length];
double a;
vals[0]=Ao; //initial activity
for(int i = 1; i<times.length;i++){
a =(times[i]-times[0])/Hf; //
double lowerhalfterm = Math.pow(.5,a); // 2-(^(t/Thalflife))
vals[i]= Ao/lowerhalfterm;
} // A=Ao/2^(t/Thalflife)
return vals;
}