Hey guys so I am messing around with log base e and I have been getting a different calculator answer compared to the compiler.
1 2 3 4 5 6 7 8 9 10 11
double rm1,rm2, t1,t2, om1,om2;
rm1=om1*exp(-0.00012*t1);
om1=100;
t1=1000;
rm2=om2*exp(-0.00012*t2);
om2=250;
t2=275;
output<<"\nThe amount of remaining material after 1000 years is: "<<rm1<<endl;
cout<<"\nThe amount of remaining material after 1000 years is:" <<rm1<<endl;
output<<"\nThe amount of remaining material after 275 years is: "<<rm2<<endl;
cout<<"\nThe amount of remaining material after 275 years is:" <<rm2<<endl;
I'm only giving partial code because the other stuff is correct and is part of a different problem. Basically, the compiler is giving me 1.69813e-313 while my calculator is giving me 88.69204367. The second part of the equation gives a different compiler answer to my calculator as well.
The equation is: remaining material = (original material)*e^-0.00012t1
Anyone know why my calculator and compiler answer are different?
Ah... I'm an idiot. Of course. You're setting the values for your om1, t1, om2, and t2 after you're using them. When you use them in your equation, they contain garbage, not the values you wanted to be used. I think you can figure out how to fix the problem.