JQuery Interest rate calculator woes -


i've come unstuck slider calculator, it's designed user work out payments on loan percentage interestrate. had original working fine after head scratching, calculated must have fluked it. need calculate interestrate or 199.9%.

any help?

$(function () { //first calculator slider $("#slider_low").slider({     range: "min",     value: 1000,     min: 500,     max: 5000,     step: 500,     slide: function (event, ui) {         $("#span_amount").html("£ " + ui.value);         $("#hdn_span_amount").val(ui.value);         total();     } }); $("#span_amount").html("£ " + $("#slider_low").slider("value")); $("#hdn_span_amount").val($("#slider_low").slider("value")); //end first calculator slider  //go month $("#slider_low_secondary").slider({     range: "min",     value: 12,     min: 3,     max: 36,     step: 3,     slide: function (event, ui) {         $("#months").html(ui.value + " months");         $("#hdn_span_month").val(ui.value);         total();     } }); $("#months").html($("#slider_low_secondary").slider("value") + " months"); $("#hdn_span_month").val($("#slider_low_secondary").slider("value")); //end go month  total();  //total  function total() {     var amountval = $("#hdn_span_amount").val();     var monthval = $("#hdn_span_month").val();     var interestrate = 0.108;     var setupfee = 69;     var interest = parseint(monthval * amountval * interestrate);      //$('#interest').html('�' + interest);     var totel = parseint(amountval) + parseint(interest) + parseint(setupfee);     totel = parseint(totel / monthval);     $('#total_amount').html("£ " + (totel.tofixed(0)));     $('#hdn_total_amount').val((totel.tofixed(0)));     }     //end total     }); 

it looks asking how calculate interest rate? formula

i = n(eln(r+1)/n-1)

where periodic interest rate, n number of periods, , r effective interest rate. effective interest rate is:

r = i/l

where total of interest payments , l original loan value.

you have calculated total amount of interest in interest variable, effective interest rate

interest/amountval 

so monthly interest rate

var monthlyrate = monthval * (math.exp(math.log(intest/amountval + 1)/monthval) - 1)  

multiply 12 apr

===edit===

i must apologize, not correct effective interest rate. please ignore answer , see other answer.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -