Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 1009

# Exponential decay function

Hi all
I am looking for  an exponential decay function in Java

That will take the follwing values

t = time

but it is not working quite well

Thanks for input
0
ZURINET
• 4
• 4
• 3
1 Solution

Commented:
>>but it is not working quite well

What does that mean?
0

Author Commented:
I am having a different value ..
from the one calculated with MS excel
0

Commented:
Please show you defined it in Java
0

Author Commented:
With ms excel

I am getting the follwing result

at t=0:  Result = 5.00
at t=1: Result = 1.83
0

Author Commented:

``````public static double cal_radius(int t, double ini_Rad, double rad_decay){

}
``````
0

Commented:
btw Excel has been known to be buggy with calculations
0

Commented:
Waht is that you don't like about the result 1.83
it is 5.0 multiplied by e in power almost -1.0
so it will be 5 divided by 2.71...
Looks like reasonable number

0

Commented:

This is from Java:
1.8486172227202948
This is from Excel:
1.848617223

Seems the same for me
0

Commented:
By the way you should not have divided by t
you shoud have it mutpilied by t
0

Commented:
As time grows (-decay*t) becomes bigger by absolute vlaue negative number
and exp(-decay*t) becomes smaller so the fuunction shows decay
If you divide by t, it will be rather growt function
0

Author Commented:
Hi Yan

Thanks a lot..
That is what I missed all along..
0

## Featured Post

• 4
• 4
• 3
Tackle projects and never again get stuck behind a technical roadblock.