Category Archives: TI-84 Plus Pocket SE

Performance testing the Movidius Neural Compute Stick

The Movidius Neural Compute Stick is great for visual recognition projects with low power consumption and small form factor requirements. A basic introduction is covered in the previous installment, and it is time for a little more field tests on performance.

The first test is calculator, one is Texas Instruments TI84 Plus Pocket SE and the other a Casio fx-4500PA. Both are recognized as hand-held computer with fairly high confidence.movtest1movtest2

Second test is a luxury watch photo, recognized as an analog clock.movtest3

The final test is a feather. At some point the stick returned a 100% confidence. The result is correct.movtest4

This neural computing module did a good job with amazing results as a development kit which is also great for hobby projects. As the technology on hardware AI acceleration matures, we may one day see its integration with CPU to make it ubiquitous product available on the market.

Advertisements

LU decomposition in TI-84

As an extension to a previous entry on doing LU decomposition in Nspire and R, the TI-84 is covered here. There is no built-in function like in the Nspire for this, but there are many programs available online, with most of them employing a simple Doolittle algorithm without pivoting.

The non-pivoting program described here for the TI-84 series is with a twist. No separate L and U matrix variables are used and the calculations are done in place with the original input matrix A. The end result of both L and U are also stored in this input matrix. This is made possible by the property of the L and U matrices in this decomposition are triangular. Therefore, at the little price of some mental interpretation of the program output, this program will take up less memory and run a little faster than most simple LU decomposition programs online for the same class of calculator. From a simple benchmark with a 5 x 5 matrix, this program took 2 seconds while another standard program took 2.7 seconds.

The input matrix A.
lu84-1

Results are stored in the same matrix.
lu84-2

L, U, and verification.
lu84-3

Optimizing optimization code in TI-84 program

As shown in a previous installment on running the Nelder-Mead optimization of the Rosenbrock function in TI-84, its hardware is not up to the challenge for problems of this kind. It is however an interesting case to learn from this program that took a considerable amount of time (in minutes), when most TI-84 programs complete in seconds, to grasp the technique in writing optimized code.

The problem used in the setting is the Rosenbrock function:
nelder-mead-84-code-optimization3

Two techniques were used to try to optimize the code. The first one is to in-line the function (in this case the Rosenbrock function). In the original version this function is stored in a string value to be evaluated whenever necessary by using the TI-84 expr() function. The idea from common in-lining is borrowed to see if it works in TI-84. As shown in line 44 below, the Rosenbrock function replaced the original expr() function call.

nelder-mead-84-code-optimization2b

Another technique is to remove unnecessary comments. For most modern languages this is never considered a problem but for simple calculators it is speculated valuable processing time may be spent on processing comments that contribute nothing to the algorithm.
nelder-mead-84-code-optimization1

Both programs returned the same results. To compare the gain in speed, the same set of initial parameters and tolerance were used in both the original and code-optimized program. Surprisingly, the inline method does not yield any gain while removing all those “:” that were used for indentation does improve the speed. The average of the original program is 183 seconds while the program with cleaned code is only 174 seconds, which is around 95% of the run time of the original program.
nelder-mead-84-code-optimization4

 

 

 

Coefficient of determination for Multiple linear regression in TI-84 Plus

After determining the parameters of multiple linear regression in TI-84 (which do not have any direct built-in function support of this calculation), the coefficient of determination can also be easily calculated using the rich set of list functions supported by TI-84. Following the previous example, the dependent variable is in Sales list, the other two independent variables are Size and Dist lists.

The Yhat list is to be prepared first. This lists store the predicted values using the regression parameters determined in the previous installment.
mreg84rsq3amreg84rsq3

Next, the mean of Y and Yhat are calculated and stored to a handy list S.

mreg84rsq2

Furthermore, three lists SYY, SYhYh, SYYh are calculated respectively.

mreg84rsq4mreg84rsq3e

mreg84rsq6mreg84rsq5

mreg84rsq8mreg84rsq7

The result is obtained by the formula below.
mreg84rsq9

Graphical visualization of data distribution in TI-84 and R

For visualizing data distribution, the TI-84 Stat plot can provide some insights. Using the same data set as in the previous installment on Shapiro-Wilk test, TI-84 Stat plot is a quick and convenient tool.

shapiro84-graphplot2 shapiro84-graphplot1

In R, the command qqnorm() will show the following plot for the same data.

shapiro84-graphplot3

P value of Shapiro-Wilk test on TI-84

In previous installment, the Shapiro-Wilk test is performed step by step on the TI-84.

To calculate the p-value from this W statistic obtained, the following steps can also be done on the TI-84 using some standard statistics function. Note that the approximation below are for the case 4 ≤ n ≤ 11.

The mean and standard deviation are derived using the below equations.
shapiro84-pvalue1

The W statistic is assigned from the correlation calculation results, and another variable V is calculated for the transformed W.
shapiro84-pvalue2

Finally, the standardized Z statistic and p-value is calculated using the mean, standard deviation, and the transformed W value.
shapiro84-pvalue3 shapiro84-pvalue4