Author | Topic: APR Routine | |
---|---|---|
Carmelo Rioflorido | APR Routine on Sat, 15 Oct 2005 23:54:49 -0700 Has anyone able to create an xBase++ routine on finding the value of 'a' in this type of equation? 'a' is the value that is converted to APR (annual percentage rate = a x 1200). wher N should be greater than 1. This requires iterative calculation using the Newton-Raphson method. Thanks, Carmelo clip_image002.gif | |
Clifford Wiernik | Re: APR Routine on Tue, 18 Oct 2005 09:27:33 -0500 Carmelo Rioflorido wrote: > Has anyone able to create an xBase++ routine on finding the value of 'a' > in this type of equation? 'a' is the value that is converted to APR > (annual percentage rate = a x 1200). > > wher N should be greater than 1. > > > This requires iterative calculation using the Newton-Raphson method. > > Thanks, > Carmelo Think iterative is the only method available. You can calculate for principal, payment amount and number of payments directly, but not interest rate. | |
Carmelo Rioflorido | Re: APR Routine on Tue, 18 Oct 2005 21:18:05 -0700 Hi Clifford, Thanks for the response. Desperation is a good motivator. I was able to create a routine using the iteration process. Because it is in Clipper form, it is crude but it works for me. If some people are interested and would like to convert my routine into xBase++, please let me know. Thanks, Carmelo "Clifford Wiernik" <cwsoft@charter.dot.net> wrote in message news:YQuOMA$0FHA.3104@S15147418... > Carmelo Rioflorido wrote: > > > Has anyone able to create an xBase++ routine on finding the value of 'a' > > in this type of equation? 'a' is the value that is converted to APR > > (annual percentage rate = a x 1200). > > > > wher N should be greater than 1. > > > > > > This requires iterative calculation using the Newton-Raphson method. > > > > Thanks, > > Carmelo > Think iterative is the only method available. You can calculate for > principal, payment amount and number of payments directly, but not > interest rate. | |
Clifford Wiernik | Re: APR Routine on Wed, 19 Oct 2005 20:20:07 -0500 Carmelo Rioflorido wrote: > Hi Clifford, > > Thanks for the response. Desperation is a good motivator. I was able to > create a routine using the iteration process. Because it is in Clipper > form, it is crude but it works for me. > > If some people are interested and would like to convert my routine into > xBase++, please let me know. > > Thanks, > Carmelo > > > "Clifford Wiernik" <cwsoft@charter.dot.net> wrote in message > news:YQuOMA$0FHA.3104@S15147418... > >>Carmelo Rioflorido wrote: >> >> >>>Has anyone able to create an xBase++ routine on finding the value of 'a' >>>in this type of equation? 'a' is the value that is converted to APR >>>(annual percentage rate = a x 1200). >>> >>> wher N should be greater than 1. >>> >>> >>>This requires iterative calculation using the Newton-Raphson method. >>> >>>Thanks, >>>Carmelo >> >>Think iterative is the only method available. You can calculate for >>principal, payment amount and number of payments directly, but not >>interest rate. > > > I use a routine from my clipper app in my xbase++ app also. Didn't require any special conversion. Basically works by starting with a work interest rate and computation of present value. If not equal, takes 1/2 of the current high/low interest marks and computes again. It continues until the difference is less than your precision. If working with $, then less that 0.01. That is your interest rate. | |
Carmelo Rioflorido | Re: APR Routine on Wed, 19 Oct 2005 23:28:55 -0700 Hi Clifford, Thanks for the hint. Here's what I did. ............ r = nIntrate/1200 a := r && starting point where APR is assumed to be always greater than the regular interest rate. X := 0 Y := 0 nLoan := 0 nMonthly := 0 nLoan = nLife + nDisable + nProperty + nMoneyreceived + nPaid nMonthly =( (nLoan + nPrepaidINt) r (1 + r)^nPaynum)/ ((1+r)^nPaynum - 1) set decimals to 3 set escape on stopkey := inkey(0) do while STOPKEY <> K_ESC X = a * (1 + a)^nPaynum Y = (nMonthly * ( (1 + a)^nPaynum -1))/nLoan APR = a * 1200 this portion to dazzle my client how my program do the calculation tone(100,1) clrbox() clrbot() @ 24,0 say " Please Wait! Calculating APR. If X becomes Greater than Y, Press [Esc] Key to Exit." + space(40) color "w+/b" @ 20,1 say "X = " + str(round(x,3)) color "gr+/n" @ 21,1 say "Y = " + str(round(y,3)) color "gr+/n" @ 22,1 say "APR = " + str(a * 1200,6,3) color "gr+/n" if round(X,3) == round(Y,3) exit endif a += .001 enddo ........ Carmelo "Clifford Wiernik" <cwsoft@charter.dot.net> wrote in message news:twPeJRR1FHA.2944@S15147418... > Carmelo Rioflorido wrote: > > > Hi Clifford, > > > > Thanks for the response. Desperation is a good motivator. I was able to > > create a routine using the iteration process. Because it is in Clipper > > form, it is crude but it works for me. > > > > If some people are interested and would like to convert my routine into > > xBase++, please let me know. > > > > Thanks, > > Carmelo > > > > > > "Clifford Wiernik" <cwsoft@charter.dot.net> wrote in message > > news:YQuOMA$0FHA.3104@S15147418... > > > >>Carmelo Rioflorido wrote: > >> > >> > >>>Has anyone able to create an xBase++ routine on finding the value of 'a' > >>>in this type of equation? 'a' is the value that is converted to APR > >>>(annual percentage rate = a x 1200). > >>> > >>> wher N should be greater than 1. > >>> > >>> > >>>This requires iterative calculation using the Newton-Raphson method. > >>> > >>>Thanks, > >>>Carmelo > >> > >>Think iterative is the only method available. You can calculate for > >>principal, payment amount and number of payments directly, but not > >>interest rate. > > > > > > > I use a routine from my clipper app in my xbase++ app also. Didn't > require any special conversion. Basically works by starting with a work > interest rate and computation of present value. If not equal, takes 1/2 > of the current high/low interest marks and computes again. It continues > until the difference is less than your precision. If working with $, > then less that 0.01. That is your interest rate. | |
Terry Wolfe | Re: APR Routine on Thu, 20 Oct 2005 14:21:58 -0400 Carmelo: Avoid the posibility of an over-run: if round(X,3) >= round(Y,3) exit endif Terry "Carmelo Rioflorido" <unisoft@cox.net> wrote in message news:OYKArBU1FHA.1256@S15147418... > Hi Clifford, > > Thanks for the hint. Here's what I did. > > ............ > r = nIntrate/1200 > a := r && starting point where APR is assumed to be always > greater than the regular interest rate. > X := 0 > Y := 0 > nLoan := 0 > nMonthly := 0 > nLoan = nLife + nDisable + nProperty + nMoneyreceived + nPaid > nMonthly =( (nLoan + nPrepaidINt) r (1 + r)^nPaynum)/ > ((1+r)^nPaynum - 1) > > set decimals to 3 > set escape on > stopkey := inkey(0) > do while STOPKEY <> K_ESC > X = a * (1 + a)^nPaynum > Y = (nMonthly * ( (1 + a)^nPaynum -1))/nLoan > APR = a * 1200 > this portion to dazzle my client how my program do the > calculation > tone(100,1) > clrbox() > clrbot() > @ 24,0 say " Please Wait! Calculating APR. If X becomes Greater > than Y, Press [Esc] Key to Exit." + space(40) color "w+/b" > @ 20,1 say "X = " + str(round(x,3)) color "gr+/n" > @ 21,1 say "Y = " + str(round(y,3)) color "gr+/n" > @ 22,1 say "APR = " + str(a * 1200,6,3) color "gr+/n" > > if round(X,3) == round(Y,3) > exit > endif > a += .001 > enddo > ........ > > Carmelo | |
Carmelo Rioflorido | Re: APR Routine on Thu, 20 Oct 2005 21:07:36 -0700 Thanks Terry, I will incorporate your suggestion. Carmelo "Terry Wolfe" <wolfes@frontiernet.net> wrote in message news:$Fy%23mMa1FHA.7860@S15147418... > Carmelo: > > Avoid the posibility of an over-run: > > if round(X,3) >= round(Y,3) > exit > endif > > Terry > > "Carmelo Rioflorido" <unisoft@cox.net> wrote in message > news:OYKArBU1FHA.1256@S15147418... > > Hi Clifford, > > > > Thanks for the hint. Here's what I did. > > > > ............ > > r = nIntrate/1200 > > a := r && starting point where APR is assumed to be always > > greater than the regular interest rate. > > X := 0 > > Y := 0 > > nLoan := 0 > > nMonthly := 0 > > nLoan = nLife + nDisable + nProperty + nMoneyreceived + nPaid > > nMonthly =( (nLoan + nPrepaidINt) r (1 + r)^nPaynum)/ > > ((1+r)^nPaynum - 1) > > > > set decimals to 3 > > set escape on > > stopkey := inkey(0) > > do while STOPKEY <> K_ESC > > X = a * (1 + a)^nPaynum > > Y = (nMonthly * ( (1 + a)^nPaynum -1))/nLoan > > APR = a * 1200 > > this portion to dazzle my client how my program do the > > calculation > > tone(100,1) > > clrbox() > > clrbot() > > @ 24,0 say " Please Wait! Calculating APR. If X becomes Greater > > than Y, Press [Esc] Key to Exit." + space(40) color "w+/b" > > @ 20,1 say "X = " + str(round(x,3)) color "gr+/n" > > @ 21,1 say "Y = " + str(round(y,3)) color "gr+/n" > > @ 22,1 say "APR = " + str(a * 1200,6,3) color "gr+/n" > > > > if round(X,3) == round(Y,3) > > exit > > endif > > a += .001 > > enddo > > ........ > > > > Carmelo > > | |
Jose Luis Otermin | Re: APR Routine on Mon, 24 Oct 2005 17:26:43 -0300 Hi Carmelo, > If some people are interested and would like to convert my routine into > xBase++, please let me know. I am interested in your routine. Please let me know if you need something else I could do for you in return (Let's talk about programming ). Best regards, Jos Luis Otermin oterminATciudad.com.ar Enjoy the growing Xbase++ repository http://ar.groups.yahoo.com/group/XFreeProject/join |