Search

Prerequisites: Futurama Editor Tutorial 1.

Minimum Futurama Version to be used: 3.2

Learning goal: In this exercise we’ll delve deeper into the world of the Futurama objects by creating a more complex formula in particular an annuity. We'll not discuss the theory behind this formula. For this we refer to actuarial literature; we'll limit ourselves to the formula itself. Combined with Futurama Web the calculation could be part of a website, in which the user can enter certain parameters and see the result on screen by a mere click on a button.

  • In the Windows Explorer create in the Futurama directory a new directory called "Annuity". This is the directory where our project will be stored.
  • Open the Futurama Editor.
  • Create a new document and give it the name 'Prenumerando annuity'.
  • Save this document as "calc.xml" in the directory "Annuity".
  • In the Design window do a right-click. Select New » Node. Rename the node 'Formulas'.
  • Create in the document another Node and name this one 'Variables'.
  • Select the Node 'Variables', select the Design window an do a right-click.
  • Define a Fixed, name this Fixed 'Duration' and make it’s type Long.
  • In the property "Text", enter the value 5.
  • Define another Fixed, name it 'Interest', make it’s type Double and enter the value 0,04 in the property "Text".

The screen should now look as below:

The formulas for calculating an annuity are as below:

Annuity = (1-V^Duration)/Interest

where

V = 1/(1+Interest)

  • Select the node 'Formulas', select the Design-window and do a right-click.
  • Define a Formula, give it the name 'V' and indicate that it is a Double with the property 'Type'.

'V' has an argument, namely 'Interest'. The value of this argument determines the value of 'V'. Therefore we first have to add this argument.

  • Click on the button  to the right of property "Arguments". The following Argument Collection Editor screen appears:

  • Click on Add. This action will add a new argument called 'New Item':

 

  • Change 'New Item' to 'interest' and denote it’s of type Double. Click on OK.
  • You can see in the Results Window in the tab Arguments that the argument 'interest' has appeared.
  • We can now use 'interest' in our Formula. Click on the button to the right of the property "Text".
  • Click on "Selecteer een formule" and select Math » Divide. The following screen appears:

 

Both the Numerator and the Denominator have three input fields. The first one is plus/minus sign. The second indicates the integer part of the number. The third indicates the decimal part of the number.

  • Set the Numerator equal to 1 by manipulating the buttons to the right of the second input field. You can also type it directly into the field.
  • For the Denominator we’ll have to use a Formula once again. Click on Fixed and select Formula. The symbol appears.
  • Click on the button to the left of . This opens another Define Formula window, identical to the screen in which we are creating our division.
  • Click on "Selecteer een formule" and select Math » Add double. We could have chosen for Math » Add long, but we want to make the formula 1 + 'interest' and 'interest' is a Double.

Two input fields appear for the two numbers that have to be subtracted: Number1 and Number2.

  • Number1 is een Fixed. Give it the value "1".

Number2 will be the argument 'interest' that we created before.

  • Click on and select Argument » interest. The sumbol appears.
  • The formula is now finished. Click twice on OK to close all screens.

In the Result Window we can now test Formula 'V'.

  • Go to the tab "Arguments" and give argument 'interest' value 0,04.
  • Now click on the tab "Result" and verify that 1/(1+0,04) is indeed 0,961538.

With the formula for 'V' created, we can now create the Formula for the annuity.

  • In the node 'Formulas' make a new Formula. Call it 'Annuity'. The type is Double once again.

This formula depends, as we’ve seen in the definition above, on the duration and the value of 'V'. 'V' is already available, but for the duration we’ll have to create a new argument.

  • Create analogous to the argument 'interest' an argument 'duration' of type Long.

Now we can create the annuity.

  • Click on 3puntjes to the right of property "Text" and choose the Formula Math » Divide.
  • The Numerator consists of the interest. Define here a Reference to the Fixed 'interest' in the node 'Variables'. Click on OK.
  • The Denominator will be a Formula. Choose Math » Subtract Double.
  • Make Number1 a Fixed with value '1'.
  • Number2 will be a Formula. Choose Math » Power Double.
  • Number will be a Reference. Define a Reference to the Formula 'V' which is also in the 'Formulas'. The following screen will pop up:

In "Arguments" we now have to indicate what the value of the argument 'interest' should be. We can fill in a Fixed value, a Reference, another Formula etc.

  • Define here a Reference to the Fixed 'interest' in the node 'Variables'. Click on OK.
  • Power will be the duration. Click on the button and select Argument » duration. The symbol appears.
  • Click on OK to close all screens.

In the Result Window we can test the formula 'Annuity'.

  • Go to the tab "Arguments" and give the Argument 'duration' the value 5.
  • Click on the tab "Result" and verify that the annuity equals 4,45182233.

Now with all the formulas in place, we can model the result.

  • Create in the root document a Reference and name it 'Result'.
  • Define for the property “Text” a Reference to the Formula 'Annuity'.

A screen similar to the ones encountered before will pop up.

  • Create in the argument 'duration' a Reference to the Fixed 'Duration' in the node 'Variables'. Click on OK.
  • Verify that the value of 'Result' equals 4,45182233.

The Futurama Editor should now look like the one below:

Alternative solutions:

Like with so many things there are more possible solutions than the one that is given above. We could also have made one single Formula for the annuity with two arguments 'interest' and 'duration'. This would have made the Formula 'V' obsolete, but would have resulted in a Formula that would be more difficult to read and interpret.

In our Formula 'V' we could also have relinquished the use of the arguments 'interest' and use a Reference to the Fixed 'Interest' instead. Analogous we could have defined a Reference to the Fixed 'Duration' in de formule 'annuity' instead of using the argument 'duration'.

The advantage of using arguments, however, is the reusability. If we want to calculate a second annuity with another interest and/or duration and we would have worked with References, then we would have to copy the entire annuity formula and have the new one refer to the other interest and/or duration. If, on the contrary, we use arguments, we can simply define a new Reference to the original existing annuity formula and use a Reference to the other interest and/or duration as its arguments.

A complete example of this exercise can be downloaded here: An annuity. Note that this example is created in version 3.2 of Futurama. Opening this example in a newer version of Futurama will prompt Futurama to update the example to the newer version. Click OK when this message appears.