Simplex Algorithm on the Casio 9860GII

With matrix capable calculator, simplex algorithm for common maximization problem can be solved easily like in the TI-84.

The Casio 9860GII is also equipped with equivalent matrix operations to solve the same problem.

Rank function in TI Nspire for Wilcoxon signed rank test

The Wilcoxon signed rank test is a non-parametric method for t-test under situation where normal distribution cannot be assumed on the sample data.

There is no built-in function for this hypothesis test in the TI Nspire, but the process is straight forward. During the calculation of the W statistic, a ranking process is required on the sorted input list. For ties, the handling is to assign the average value of the span of the tie. It is easy to create the ranking list using the built-in newlist() function, but for assigning this particular ranking rule, a program is created to facilitate.

The core part of this program is to iterate through an input list (assumed sorted with the SortA function), and the check if there is duplicates using the countIf() function.

The sample usage in calculator is easy.

P-Value of 2-way ANOVA in TI Nspire

The TI Nspire CX provided very convenient facility to perform 2-way ANOVA analysis. The P-values are displayed in the spreadsheet as well as being stored in designated variables that can be recalled from the calculator screens and other applications.

As shown above, the last two equations are refresher of how the P-values are determined from the F statistics.

Graphical representation can also be plotted in the Graph application. With the aid of the Integral tool, the shaded area in the below example represents the area from 0 to the F statistics. Recall that the whole area under the curve is 1, the P-value from F statistics to infinity is then 1 – 0.961 = 0.039

Date arithmetic in TI Nspire

The TI Nspire CX (and also 83, 84, 89 series) provided a useful date function, dbd(), for finding the number of days between two input dates. However, after nothing turn up searching for function to perform days addition, a quick and dirty program is developed by taking advantage of this built-in function.

The program takes two parameters: a date and the number of day to add, and basically brute force a range of dates to check if the dbd() function returns a value equals that of the intended number of days to add. The program assumed the format DDMM.YY, while the built-in dbd() function accepts format in either DDMM.YY or MM.DDYY.

Calculating prediction interval in multiple regression using Mahalanobis distance

In TI Nspire, the prediction interval can easily be obtained from the Statistic function Confidence Interval > Multiple Reg Interval.

On the result section, the lower and upper prediction intervals are displayed for convenient reference.

Alternatively, using Mahalanobis distance, this prediction interval value can be calculated as in below.

\$1.3 billion Powerball Odds

As reported in news the prize of Powerball grows to \$1.3 billion. The last change of the rule of the game increased the odds, which is believed to be the cause for accumulation of jackpot since November. Using TI-84, the odds for the old and new rules are calculated below using the nCr() function. Old odds is 1 in 175 million while under the new rule it is now 1 in 292 million.

Black-Scholes formula in TI-84 Solver

Came across a ten-year old article from TI on working with the Black-Scholes pricing model in TI-84. In it, a couple of examples are given to utilize various features of the TI-84 to work with the equation to derive an European call option in the Black-Scholes model. One of these method being invoking the Solver.

Entering the equation again is considered quite cumbersome, and it is not quite sure how to archive the Solver equation for later use. After a couple of tries, it become obvious that the Solver wouldn’t work with a function stored in String at all. Fortunately alternative method is found to somehow persist the equation for later use.

The trick is to make use of the following build-in functions available in the TI-84:

• String>Equ()
• expr()

By making use of these two functions, the Solver will be able to handle the Black-Scholes equation which is stored in String properly. Firstly the equation must be stored in a String, and then by making use of String>Equ() function, the equation will be able to persist in one of the equation variables. In this form, the Solver will be happy to work with it in its entirety, which means all variables are considered. The equation stored in Str0 is converted to function Y0, and is then processed properly by the Solver as shown in the below screens. For persisting, this can be done in a program including the definition of the Black-Scholes formula itself.

Extracting Black-Scholes implied volatility in Nspire

The Black-Scholes model is an important pricing model for options. In its formula for European call option, the following parameters are required to create a function in the TI Nspire CX:

• s – spot price
• k – strike price
• r – annual risk free interest rate
• q – dividend yield
• t – time to maturity
• v – volatility

Now that the standard Black-Scholes formula is ready, a common method to derive the implied volatility numerically is to determine a value such that the squared loss function between observed price and calculated Black-Scholes price is zero. To derive this volatility, root finding method like the Newton-Raphson method can easily be implemented with advanced calculators like the TI Nspire. In fact, there is no need to code this feature by utilizing the built-in zeros() function of the CX CAS. This function solve for the selected variable from the input expression so that the result is zero, which is exactly what is needed in this case. The function implied_vola() below is coded to do the squared loss function, which is then passed into the CAS built-in zeros() function. Notice a warning of “Questionable accuracy” is reported for the zeros() function.

Doing the Newton-Raphson method is simple enough with the Nspire Program Editor. The program below bs_call_vnewtrap() takes a list of Black-Scholes parameters (including the s,k,r,q,t,v), an initial guess value of implied volatility, and the call price of the standard Black-Scholes formula. The last parameter is a precision control (value of zero default to a pre-set value). The last two attempts calling this function shown below depicts the effect of the precision control in this custom root-finding program.