Monthly Archives: April 2016

3D graphing on TI Nspire and TI-89 Titanium

The TI Nspire provided a very rich set of 3D graphing capability including function and parametric plotting. Thanks to the hardware upgrade from its predecessor, the real time rotation and animations are more than satisfying most of the time. Samples below can be created and visualized on the Nspire with a few inputs. It is quite nostalgic to see these wireframes for us who had been through the 90s when CAD software was in its infancy on the road to being readily commercialized!3dnspire

Speaking of the predecessors of the Nspire, the Titanium is the first to offer built-in 3D plotting capability in the TI lines of calculators. To this day I still find it interesting to plot some surface that it seems impossible to plot in the Nspire, like the combinatorics function shown below. The same function in the 3D graph on TI Nspire simply resulted in syntax error, but is evidently possible on the Titanium, not only with a functioning plot as shown in graph below, but also the correct trace values in the graph trace function.

3d89b

3d89a

3d89d

The following window setting is the optimal for such graph.

3d89c

Exploring maximum likelihood using graphs in TI Nspire

Consider a case of binomial process with n=10, exploring the likelihood function in TI Nspire using variable slider p:

mle1

For the log function, window settings has to be adjusted for a complete picture.

mle2

Besides graphical solutions, the maximum can also be obtained from differentiating with respect to p for a zero result:

mle3

For usage in logistic regression, the Nelder-Mead method can be applied for determining the maximum value.

Using TI Nspire to explore mathematics behind blockchain technology

The TI Nspire is a great tool for exploring mathematics through its calculation and graphing capability. One of the emerging technologies that is based on mathematics is blockchain. It gained popularity through bitcoin that caused much debate and controversy in the field of banking, economics and finance. Until recently more and more established research and technology firms started to look at it seriously and its underlying core technology, blockchain, is gaining momentum for being adopted by traditional financial institutions.

In a previous installment, the property of the Elliptic Curve is explored using TI Nspire. As shown in the dynamic graph below, the curve exhibit several properties that form the two basic operations of asymmetric encryption – point addition and point doubling – for public and private key pair generation.

ecanim

Using a=0, and b=7 as in Bitcoin, the two properties are basically illustrated in the following graphs.

Point Addition
blockchainecc1c

Point Doubling
blockchainecc2c2

However, in reality, the Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm to generate public and private key relied also on another mathematical concept known as the finite field. This is basically a limit imposed on the numbers that are available for use in the calculation, and in this case, positive integers from a modulo calculation. The prime modulo for Bitcoin (as in secp256k1) is set to  2256 – 232 – 29 – 28 – 27 – 26 – 24 – 1. Having this in place, the graph will not look like the above but some scattered points on a fixed region, and overflows will wrap around. However, the symmetry will still be preserved and recognized visually on graph.

With this mathematical backed technology as the foundation, blockchain can provides open ledger for secure transaction service.

Doing matrix multiplication in TI Nspire and Excel

In TI Nspire, matrix multiplication can be accomplished in the Calculator page. The process is intuitive and easy with the visual templates.

Firstly use the matrix template to define one:
matrixnspire1matrixnspire2

Then simply do multiplication after filling in the matrix elements.
matrixnspire4

Doing so in Excel required the use of the MMULT() function. A little trick is needed for this function for returning answer in array format – by pressing CTRL+SHIFT+ENTER at the same time after inputting the function for the cells selected as output array.

First step, fill in the matrix with the elements into respective cells.
matrixexcel1

Mark the output region to use the array function. In this example it is also a 3×3 matrix.
matrixexcel2

Apply the MMULT() function on the upper left corner cell of the region selected.
matrixexcel3

The trick is here, when finished typing in the function, press CTRL+SHIFT+ENTER instead of just ENTER. The answer from the function will then be populated in the selected cells, and the formula will be displayed with curly brackets enclosed, like  {=MMULT(B2:D4,F2:H4)}.matrixexcel4

Confidence Interval for Odds Ratio calculation in TI Nspire

In comparing the relative odds of an outcome, odds ratio is often used and can be easily calculated after constructing the frequency table as in below where the row-wise values represent the treatment and column-wise as the outcome.
oddsratio-ci1

Even though there is no built-in function for the calculation for the confidence interval of odds ratio in TI Nspire, doing it in the Calculator page is pretty straight forward.

oddsratio-ci2

Confidence Interval calculation in TI Nspire and Excel

In TI Nspire, calculation of Student’s t confidence interval can be achieved using data or statistics input. The menu can be accessed from “Statistics > Confidence Interval > t Interval”.
t-confidenceinterval1

In Excel, the same function does not have a separate menu item, but instead is included in the Descriptive Statistics dialog with a check box of “Confidence Level for mean”, and a percentage input box next to it. Unlike in Nspire, lower and upper are not included in the output.
t-confidenceinterval3

SHA-256 initial hash derivation explained in TI Nspire

The SHA-256 is a cryptographic hash function with many usages. From bitcoin and block chain calculation to digital signature, SHA-256 played a pivotal role.

From the official definition, there are 8 initial hash values in the algorithm. They are hexadecimal form of the fractional part of the square roots of the first 8 prime numbers 2, 3, 5, 7, 11, 13, 17, and 19. The values are:

nspire-sha256-1

In practice these initial values are constants, but for demonstrating how fractions are represented in hexadecimal, the calculation can be shown in TI Nspire although no built-in support is provided for hexadecimal fractions. The calculation is very simple, take the fractional part from the value times 16, and then convert the integer part to hexadecimal. Repeat with the resulting value to concatenate the answer. In the below example, the second SHA-256 initial hash value calculation is shown (first three most significant value).

nspire-sha256-2