Tag Archives: TI nspire

Visualizing Volatility Sensitivity in Delta hedged gains with TI Nspire

The TI Nspire calculator is a great platform for visualizing data via interactive graphs. The built-in facility like input slider for variable value adjustment allowed dynamic visualization to complex equations, like the volatility sensitivity in delta-hedged gains used financial investment. Since this strategy involved a single call option, the volatility exposure equals the vega value of the option.

The following setup on the Nspire provided the functions to calculate the vega values.
vega1

This spreadsheet input screen stores the spot prices and the calculated Black Scholes vega values.
vega2

Finally, with the data plotting screen the graph of Delta hedged gains of volatility sensitivity is completed. An additional slider control can easily be added on it to adjust an offset variable so as to visualize scenarios under different spot price.
vega3

Advertisements

Cryptographic roots in Blockchain technology

The Blockchain is expected to be the revolutionary technology to take the centre stage in our society where the traditional ledger system once dominates, from bitcoin that emerged in the finance sector to fields where transactions are dependent on authenticity, be it a paper document from bank, an import / export data exchange, or even documents in judicial systems, it is important to understand the principles of its fundamental roots in cryptography.

For example, to ensure the rightful spending of currency in bitcoins, there are a lot of technology being in place on the virtual money market. One being the Elliptic Curve Cryptography that is based on mathematics to ensure the identity of parties involved in any bitcoin transactions.

blockchain1

Experimenting with convergence time in neural network models

After setting up Keras and Theano and have some basic benchmark on the Nvidia GPU, the next thing to get a taste of neural network through these deep learning models are to compare these with one to solve the same problem (an XOR classification) that run on a modern calculator, the TI Nspire, using the Nelder-Mead algorithm for convergence of neural network weights.

A sample of SGD settings in Keras Theano with 30000 iterations converged in around 84 seconds. While the TI Nspire  completed with comparable results in 19 seconds. This is not a fair game of course, as there are lots of parameters that can be tuned in the model.

keras-nspire4

 

Observations on effect of initial parameter of Nelder-Mead to solve linear problem

Out of curiosity a test program is created to iterate the initial parameters for the Nelder-Mead program in TI Nspire to see if there is any effects or patterns to the outcome of the algorithm. The Nelder-Mead program is to solve the following inequalities:

nmsimplexparmest1

The test case will iterate test variables x and y from 1 to 10, resulting in 100 tests. Absolute error value of the Nelder-Mead program result to the known optimal value (33) is plotted in the below chart.

nmsimplexparmest2

nmsimplexparmest3

Data input for ANOVA in TI nspire and R

In TI nspire CX, the application Lists & Spreadsheet provided a convenient Excel list interface for data input.

anova-datainput1

The data can also be named by columns and recalled from the Calculator application. Statistical functions can then be applied. Using a sample from the classical TI-89 statistics guide book on determining the interaction between two factors using 2-way ANOVA, the same output is obtained from the TI nspire CX.

anova-datainput2

anova-datainput3

anova-datainput4

In R, data are usually imported from CSV file using read.csv() command. There are also other supported formats including SPSS and Excel. For more casual data entry that command line input is suffice, raw data are usually stored into list variable using c() command. Working with ANOVA for data entry in this way is not as straightforward because dimension is required for the analysis on data stored in the list variable.

To accomplish the ANOVA, factor data types are used in conjunction with list variable. The below is the same TI example completed in R. Firstly we define the list variable in a fashion of the order by club (c1 = driver, c2 = five iron) then brand (b1-, b2-, b3-, with the last digit as the sample number), i.e.
{c1,b1-1}; {c1,b1-2}; {c1,b1-3}; {c1,b1-4};
{c1,b2-1}; {c1,b2-2};…
{c2,b1-1}; {c2,b1-2};…

Two Factor variables are then created, one for club (with twelve 1’s followed by twelve 2’s), and another for brand (1 to 3 each repeating four times for each sample, and then completed by another identical sequence).
anova-datainput-r1

These two Factor variables essentially represent the position (or index in array’s term) of the nth data value in respect of the factor it belongs to, and can be better visualized in the following table.
anova-datainput-r3

Finally, the 2-way ANOVA can be performed using the following commands.
anova-datainput-r2

Interaction plot in R.
anova-r-interactionplot1anova-r-interactionplot2

Real estate refinancing – example from HP 12C to TI Nspire

From the “HP 12C Platinum Solutions Handbook”, an example is given on calculation of refinancing an existing mortgage (on page 7). Since the HP 12C is a special breed specializing in financial calculations, much of the steps are optimized and is different from using financial functions available on other higher end calculators like the TI Nspire. In the following re-work of the same example, the Finance Solver is called from within the Calculator Page and the Vars are recalled for calculations.

refinance0

Monthly payment on existing mortgage received by lender calculation.
refinance1

Monthly payment on new payment calculation.
refinance2

Net monthly payment to lender, and Present value of net monthly payment calculation.
refinance3

Maximum likelihood for determining Weibull distribution parameters in TI Nspire CX CAS

Numerical method can be applied to determine the parameters for Weibull distribution,such as the Nelder-Mead method previously coded in the TI Nspire CX CAS. Steps below are to determine the maximum likelihood estimates for the 2-parameter Weibull distribution.

weibull2parm

On a sample data set with 120 data points, it took 27 minutes 17 seconds for an overclocked Nspire to complete the calculation, and 27 seconds on the PC version with an i5.