Monthly Archives: November 2015

R on BeagleBoard with LCD and Android UI

After the successful installation of R in BeagleBoard XM, it is natural to come up with a concept of a calculator running R. The ingredients are simple: a small form factor BeagleBoard, a LCD screen, a simple keypad. R can run on Android but as a keypad passionate, no touch screen is better than the feel of real key punch.

As a proof of concept and also a weekend project, the R on the BeagleBoard is “bridged” across an Apache web server (also on the BB), to be accessed by an Android app which act as input device for R commands. Result returned from R is then forwarded to an 16×2 LCD screen from a previous IoT prototype with TI MSP430 MCU and a TP Link portable router with OpenWRT.


A little delay, but works.

The Android app is done in MIT App Inventor. It is a very nice graphical, easy to use, completely web based application to build Android app. No typing of code is required.


Overclocking Casio fx-9860gII to the max with portable power bank

As discovered previously the overclocking program ftune performed better when USB cable is plugged in, it was not sure back then whether the data link or the extra power supply contributed to the performance boost. It is now confirmed power supply alone will do the trick.

The test is carried out using a Casio Basic program running a parameter searching for a logistic regression equation using the Nelder-Mead algorithm. A portable power bank is plugged to the USB port of the Casio fx-9860gII with ftune.

The tested portable USB power bank comes with 4000mAh capacity and 1A output, and is fully charged. There are 4 blue LED indicator lights.

The power bank is turned on.

The test result shown that the program run with power bank finished in 46 seconds, and the one without finished in 93 seconds.

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.


Monthly payment on existing mortgage received by lender calculation.

Monthly payment on new payment calculation.

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

Statistical test on C code performance

While curious on how C code are optimized by compiler on mathematical functions, two implementations of the standard normal distribution are compared in terms of performance. The aim is to provide insight on how the generated machine code performs, without having to actually inspecting them. The function is an approximation function coded in standard C. It should be noted that both functions implement the same approximation, but the actual equation is a little bit different in terms of number of multiplication operator. The first implementation is with less multiplication operators:

While the second one is a modified version with more multiplication operators, e.g. expanding k5 to k*k*k*k*k.

A scaffolding test rig is used to loop 10 million times, within it, the approximation function is called from 0 to 1 in steps of 0.1. Visual Studio is used for the code compilation, and 20 samples are collected from each of the two functions. For the analysis, the TI-84 Pocket SE is used to carry out 2-sample T test in the procedure below:


By evaluating the p-value, It looks like the first version of more compact C code performed better and perhaps there is little the compiler can help here.

How old are they?

On a local newspaper yesterday, this question is reported to be controversial for primary school examination since it is too difficult. It goes like this. There are two people and the older one said:

“When I was at your age, you were only 5.
When you become as old as I am now, I will become 71.”
The question is, how old are these two people?

It turns out, according to the newspaper, the question is not aimed at simultaneous equation at all, but to solve the problem by graphically dividing lines in proportion.

To solve in an overkill fashion by Nspire:

And this is also a refresher on how to solve simultaneous equations on TI-84 series using the rref function (reduced row echelon form). Define the equations in form of matrix (as [A] below), and then run the rref() function on it. The result matrix contained the solution to the problem.

And just in case Excel is the only tool available, no worry, its solver will get you covered (!).agequestion4

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.


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.