Financial interest calculation

Friends fastsnip-frnds1 at yahoo.com
Sat Dec 18 15:43:47 EST 2004


On Saturday 18 December 2004 14:02, saher edris wrote:
> Hi Terry,
>
> After testing the Julian day calculation in U.S. Naval observatory website
> http://aa.usno.navy.mil/data/docs/JulianDate.html
>
> and comparing the results for both formula's i was surprised to get on both
> of them incorrect
>
> results for the date (24/06/2002)  .... using your formula i got
> "2452408.98" in Julian format

assuming by 24/06/2002 you mean:
	year == 2002
	month == 6
	day == 24 
	(otherwise your date makes no sense to me)

	Using the computation as prescribed in gnucash, I obtain:
	JDN == 2,452,450

	Using the prescribed USNO web site above, they report the JDN for that date
	as 2452450 exactly the same as computed using the algorithm I submitted to
	gnucash in the financial package.

	How you get 2452408 is far beyond my ability to understand since :

	JDN == 2452408 corresponds to a date of
	year == 2002
	month == 5 (May)
	day == 13 (Monday)

	This is the date computed using the algorithm I submitted to gnucash in the
	financial package and the date reported back by USNO at the web site
	prescirbed above for that JDN.


So, to date my tests using the algorithm as submitted to gnucash agree exactly 
with the USNO web sites.

I would strongly suggest that you do some extensive debugging on your 
implementation of the calculations of the JDN <--> date computations as I 
submitted them to gnucash. You obviously have some serious errors in your 
implementation. The implementation as sumbitted to gnucash has proven correct 
every time (correct as in agreeing with other authoritative sources).

If you want another algorithm for JDN <--> date go to the web site you cite 
above, in your browser click on the appropriate option to view the page 
source. At the top of the source page you will find the two functions used to 
compute JDN from date and date from JDN. They even cite the reference for the 
computations. Thus, we have two different computations (mine as submitted to 
gnucash and the USNO) obtaining identical results.



>
> using the other formula i got "2452439.41"
>
> regarding the fin.c code for the financial calculator i went through it
> several times but the
>
> equations  that  are not clear to me for example i have a deal that has the
> following parameters :
>
> financed amount        3076.5
> payment term           60 months
> future value               4440
>
> no grace period ..... does it affect the calculation if it is existed ?
>
> using the following equations would you mind mapping those parameters to
> any of them
>
> explaining why you choose specific one that the others

You need 5 variables for financial computations:
	1. interest rate
	2. number of payment periods
	3. present value
	4. periodic payment
	5. future value

given any four, the fifth may be computed from the given four.

You have specified 3: 

	1. present value, you have called it  "financed amount"
	2. number of payment periods, you have called it "payment term"
	3. future value

You have specified no interest rate or periodic payment. If you specify one or 
the other of this pair, you can then compute the other. BUT you MUST specify 
at least one of the pair to have a solvable situation.


>
>
>
>  *       if PMT*FV >= 0, then PV case         what does this condition mean
> ? *       if PMT*FV <  0, then FV case            what does this condition
> mean ?

Let me ask a very simple question:

	Do you understand mathematics???

PMT*FV >= 0 means exactly the following: If I multiply the periodic payment 
times the future value and the resulting value is greater than or equal to 
zero, then I have what is called for convenience, the "PV Case" (or Present 
Value Case).

PMT*FV <  0 means exactly the following: If I multiply the periodic payment 
times the future value and the resulting value is less than zero, then I have 
what is called for convenience, the "FV Case" (or Future Value Case).

Depending on the outcome of that computation I select one case or the other 
for the inital guess used to compute the interest. Since the equation for 
interest computation cannot be solved explicitly algebraically, we must use 
an iterative solution to find an answer. That simply means that we guess at a 
solution and then use that guess to "seed" our computations and then compare 
the result to an explicit condition. If the test fails, then we use the 
result to  "iterate" another computation and test again. If your initial 
"guess" was "good", the sequence of computations will converge to the desired 
result. If the initial guess was not "good" the sequence of computations will 
diverge, i.e., get further and further apart. The latter case is not good. In 
order to facilitate making a "good" initial guess, we use a little 
mathematical "gimmick" to arrive at that guess. The "gimmick" should ideally 
do two things: 1. give a result that will converge to the desired answer and 
2. reduce the number of times we have to compute and test. The reason for the 
test for PV Case and FV Case is to do just that: give us an initial guess to 
a solution that will give us a valid answer and do so with the fewest 
possible computations.

If the above doesn't really help, then I suggest you go study mathematics. 
After you have sufficient grounding/background in mathematics, the above 
conditions , the simple explanation and the following computations will make 
sense to you.

Trying to accomplish the above through question and answer with email over the 
internet can be done, but it would be far more efficient for you to find a 
mathematics tutor near you to accomplish that task. And considerably less 
frustrating to you and those you attempt to question.

I highly recommend the study of mathematics for at least 2 reasons:
1. It provides a firm basis for logical thinking
2. trying to understand any physical (and many, if not all, biological) 
science or engineering discipline without mathematics is an exercise in 
futility.

Good Luck in your endeavers,
Terry




>
>
> How the guessing part is being handled here ?
>  *
>  *     PV case:
>  *                | n*PMT + PV + FV |
>  * 16)     i[0] = | ----------------|
>  *                |      n*PV       |
>  *
>  *              = abs[(n*PMT + PV + FV)/(n*PV)]
>  *
>  *     FV case:
>  *         a) PV != 0
>  *
>  *                    |      FV - n*PMT           |
>  * 17)         i[0] = |---------------------------|
>  *                    | 3*[PMT*(n-1)^2 + PV - FV] |
>  *
>  *                  = abs[(FV-n*PMT)/(3*(PMT*(n-1)^2+PV-FV))]
>  *         b) PV == 0
>  *
>  *                    |      FV + n*PMT           |
>  * 18)         i[0] = |---------------------------|
>  *                    | 3*[PMT*(n-1)^2 + PV - FV] |
>  *
>  *                  = abs[(FV+n*PMT)/(3*(PMT*(n-1)^2+PV-FV))]
>
>
>
> Regards
>
> Saher Edris
>
>
>
>
> Friends <fastsnip-frnds1 at yahoo.com> wrote:
>
> On Saturday 18 December 2004 08:52, saher edris wrote:
> > I could like some clarification regarding ... how Newton's Raphson is
> > being used in calculating the nominal interest rate from given parameters
> > like "p.v. , payment term,f.v."
> >
> >
> > Regards
> >
> > Saher Edris
>
> Please examine the file "src/calculation/fin.c". In particular read the
> comment lines starting at line 475 and continuing to line 528. These lines
> explain the calculation of interest from the other four parameters.
>
> I am sure that if you read the comment lines starting at line 24 and
> continuing through line 1,130, they will explain most of the questions you
> might have about the financial calculator computations. I tried to explain
> as much as possible in the comment lines about not only the code, but the
> logic behind the code and the financial calculation assumptions.
> Approximately half of the file is comments on the financial equations, how
> they are coded and their use.
>
> Have you been able to compare your JDN modification against the USNO
> computation and/or against the other test dates I sent?
>
> Terry

-- 
++++++++++++++++++++++++++++++++++++++++++++++++++++++
======================================================
******************************************************

"A human being is part of the whole called by us the 
Universe. We experience ourselves, our thoughts and 
feelings as something separated from the rest --a kind 
of optical delusion of consciousness.
This delusion is a kind of prison for us, restricting 
us to our personal desires and to affection for a few 
persons nearest us. Our task must be to free ourselves 
from this prison by widening our circle of compassion 
to embrace all living creatures, and the whole of 
nature in its beauty."

Albert Einstein.
                  
"We can't solve problems by using the same kind of 
thinking we used when we created them." 
--Albert Einstein

******************************************************

We have the best government money can buy, and it has.

Terry Boldt.     

******************************************************

You must decide: 

Are you a body with a soul or a soul with a body?

Terry Boldt

******************************************************

When you change the way you look at things, 
the things you look at change.

******************************************************
Paraphrasing Ben Franklin:

Those who sacrifice freedom for safety, have neither.

The exact quote:               

They that can give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety.
  Benjamin Franklin (1706 - 1790),
  US author, diplomat, inventor, physicist, politician, & printer
  Historical Review of Pennsylvania, 1759

******************************************************
A thought often repeated becomes an act, an act often
repeated becomes a habit, a habit often repeated,
a character and a settled character molds the very
destiny of man.

Man is the master of his own destiny.

"The Voice of Babaji", Page 236
******************************************************
What man thinks, that he becomes

Upanishad
******************************************************
Common sense is so very extraordinary 
for being for so very uncommon.

Terry Boldt
******************************************************
To say what is real,
Must be exactly what we feel,
To speak of the truth,
And be open this way,
Is to say what you mean,
And mean what you say.

Pearl Boldt
******************************************************
"If you don't know, you cannot teach, except by faith.
And faith implies doubt. Doubt and the resulting
repression of doubt breed fanaticism and intolerance.
Worse, they breed ignorance pretending to infallibility,
which breeds charlatans and blind followers."

"Muddy Tracks", Frank DeMarco, page xxv
******************************************************
"for without time,no thought of anything is possible;
without space, no conception of anything is possible and
without causation no consideration of anything is possible. And
again, time space and causation generally appear inter-related
in our consciousness not dependent of one another.
So the mind lives, moves and has its existence in these
three notions, which are necessarily finite, owing to
their perceptional value and without which we cannot think,
conceive or imagine anything. Deprived of these three,
the constitution of the mind breaks down."

"The Voice of Babaji", Page 442-443
******************************************************
"The definition of and the mystery and meaning of faith,
will open like a flower, only while sitting in silence.
Faith in something greater than oneself is tantamount to
a veil being withdrawn from the depths and distances
glimmering within, and a feeling of eternal hunger for
peace and fullness, for all that the distracted world
of today denies. It is not possible to discover the Real
and abide in it, except by our own experience."

"The Voice of Babaji", Page 444
******************************************************
******************************************************




More information about the gnucash-devel mailing list