Post Reply 
Acron RPN announces v3.0 BETA
09-04-2017, 06:29 PM
Post: #11
RE: Acron RPN announces v3.0 BETA
I kinda glossed over the TVM financial toolbar in my last post, but I think it deserves a closer look. If you read though the reference documentation, you might have noticed that Acron RPN doesn't have any finical functions. So, how does this work?

There's an article in the October 1977 edition of Hewlett-Packard Journal on the math behind their financial calculators. Basically, they have an equation of five variables (n, I, PV, FV, and PMT). You fill in four values and solve for the fifth such that the whole expression equals zero.

Conveniently, Acron RPN already has MathZero for doing exactly that. If you look in the behavior section of ultimate.acronrpn, you can find that when you press the toolbar button to solve for one of those variables, it invokes a sequence of keypresses that create the generic TVM function on the stack, use MathZero to solve for the variable you want, stores the result of MathZero back into that variable, then deletes the TVM equation it authored. It isn't foolproof, but it is pretty impressive what you can create in your layout xml without changing the actual sourcecode.


Behavior for solving for FV (other variables are nearly identical):
Code:

    <button ref="finFV" event="longPress">
        <!-- Push the general TVM formula to the stack -->
        <StackBox.ClearConsole/>
        <variable_push ref="financeI_YR"/>
        <variable_push ref="financeP_YR"/>
        <MathDivide.Action/>
        <StackBox.Enter/>
        <StackBox.Digit1/>
        <MathAdd.Action/>
        <variable_push ref="financeN"/>
        <MathPower.Action/>
        <StackBox.Enter/>

        <variable_push ref="financePV"/>
        <MathMultiply.Action/>
        <StackBox.Swap2/>

        <StackBox.Digit1/>
        <MathSubtract.Action/>
        <StackBox.Roll3Up/>
        <MathDivide.Action/>
        <variable_push ref="financePMT"/>
        <MathMultiply.Action/>
        <MathAdd.Action/>

        <variable_push ref="financeFV"/>
        <MathAdd.Action/>

        <!-- Solve for FV -->
        <variable_push ref="financeFV"/>
        <StackBox.Digit0/>
        <MathZero.Action/>

        <!-- Clean Up-->
        <StackBox.UpArrow/>
        <StackBox.RightArrow/>
        <StackBox.Enter/>
        <variable_store ref="financeFV"/>
        <StackBox.Swap2/>
        <StackBox.Clear/>
    </button>
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Acron RPN announces v3.0 BETA - vanLudwig - 08-27-2017, 05:49 PM
RE: Acron RPN announces v3.0 BETA - vanLudwig - 09-04-2017 06:29 PM
RE: Acron RPN announces v3.0 BETA - Dieter - 09-07-2017, 06:51 AM
RE: Acron RPN announces v3.0 BETA - Dieter - 09-07-2017, 07:59 PM
RE: Acron RPN announces v3.0 BETA - Dieter - 09-07-2017, 06:29 PM
RE: Acron RPN announces v3.0 BETA - Dieter - 06-15-2018, 06:26 PM



User(s) browsing this thread: 1 Guest(s)