Forum Discussion
MichaelBuzaki
12 years agoCommunity Member
Exponential Operator for Adjusting Variable
I am trying to add a calculation that would calculate the loan amount based on various variables. The equation is P * ((J) / (1-J)^n) . There is not an exponential operator and I do not see at the...
MichaelBuzaki
12 years agoCommunity Member
Hey Steve, thanks a lot for your help on this. My final equation was:
//grab the equation inputs from SL
var P=player.GetVar("LoanAmount");
var J=player.GetVar("InterestRate");
var n=player.GetVar("NumberOfMonths")
//run the calculation and push into the SL variable called output
//results=(Math.pow((1+J),-n));
results=P*(J/(1-(Math.pow((1+J),-n))));
player.SetVar("MonthlyPayment",results);
This is a great function and will allow a ton of flexibility from the base functions.
Related Content
- 3 months ago
- 4 months ago