Sunday, March 2, 2008

Statistics and TI89 Calculator

I am doing first year statistics at Auckland University. Because I am also doing Maths108, I decided to invest in a TI89 calculator.

The TI89 is a great calculator - but it takes a bit to learn how to drive it. I decided to sit down over the mid term break and work out the easiest way to do some of the calulations required for statistics. There are probably other ways to do the calculations - but these notes work well for me.

Quick calculations

Sometimes it is quicker to quickly define a set of values instead of using the Matrix Editor. By using the STO-> button on the calculator, you can store a set of values into a variable.

{17,20,13,45,55,26,57,79} -> list1

Now we have a variable called "list1" that we can use in future calculations

To get the mean

mean(list1)

To get the standard deviation

stdDev(list1)

To get the median

median(list1)

To list all other statistical values

This requires two commands. The first command calculates the required results. The second command actually displays the results

OneVar list1
ShowStat

Entering frequency tables

Frequency tables are entered in the same way as simple lists. To enter a frequency table, you will need to create two variables. The first variable holds the values and the second variable holds the frequencies.

Value Freq
--------------
17   1
20   3
13   2
45   3
55   4
26   5
57   2
79   1
-------------

{17,20,13,45,55,26,57,79} -> list1
{1,3,2,3,4,5,2,1} -> freq1

To find the mean of a frequency table

mean(list1,freq1)

To get the standard deviation of a freq table

stdDev(list1,freq1)

To get the median of a frequency table

median(list1,freq1)

Entering a frequency table with a range of values

Value Freq
--------------
10-12   1
12-14   3
14-16   2
16-20   3
-------------

When presented with a frequency table with a range of values (eg Size 10-12), use the values in the middle of the ranges. eg {11,13,15,18}

Human Genome - Video Special

While searching Google Videos, I ran across a very good series from the Charlie Rose show. The series is from June 2000 - but it has an excellent overview of the Human Genome project and DNA.

Here is a link to all of these excellent videos in a single place.

The first video features Craig Venter.



Part 2 featured Paul Nurse, James Watson, Eric Lander and Craig Venter



Part 3 features Harold Varmus, Arnold Levine and Savio Woo.



Part 4 features Nicholas Wade, Richard Preston, William Haseltine and Viren Mehta.



The final video in this series features Henry Kissinger, Hamilton Smith, Harold Varmus, Arnold Levine, James Watson, William Haseltine, Arthur Caplan, Craig venter and Francis Collins.

Maths108 and Maths208 with TI89 Calculator

The TI-89 is a great calculator that can do calculus, matrices and vectors. Learning how to use it effectively is one of the greatest (and most rewarding) challenges.

If you can master using the TI89, you will find Maths108 and Maths208 much easier. The pretty printing of the TI89 is ideal for checking your answers and making sure you have entered the correct formulas to start with.

Normally you have to clear your calculators memory before exams and tests - so you will need to remember some of these formulas

Implicit Differenciation

If you have the TI-89 Titanium, the formula is already built into your calculator. The usage is :

impDer(equation, independent variable, dependent variable)

However, if you have an older TI-89, you can define the function by entering the following command : (Note the d is the differentiate function)

Define impDer(f, xx, yy) = -d(f, xx)/d(f, yy)

I tend to use a shorter function name and change the "impDer" to "id".

Here is an example of using this function :

To find dy/dx of
x^2 + y^2 = 1

Before you can use your new function, you must always rearrange your question so that the equation equals zero (very important - if you dont so this, the answer will be wrong), hence :

x^2 + y^2 - 1 = 0

Now use your new function (use the "VAR-LINK" button or type using the alpha keys)

impDer(x^2+y^2-1,x,y)

and you will get the answer -x/y. Make sure you dont put the x and y around the wrong way or you will end up with the answer -y/x (which is incorrect)

Important Note : If your formula contains combined variables (eg xy + 2y = 0), make sure that you expand the variables using a multiplication sign (eg x*y + 2y = 0). If you don't do this, the calculator will assume you are using a variable called xy. It does not automatically know that xy is the same as x times y.

An easier way to do Implicit Differenciation

To find dy/dx of
x^2 + y^2 = 1

Simply enter the following into your calculator

d(x^2 + y^2 = 1, x) | y = t(x)

You will notice that we did not need to reorganise the formula to equal zero. We simply told the calculator to substitute "t(x)" wherever we have used a "y".

This little trick converts "y" into a function of "x" which is easily differenciable.

The result of this calulation will be :

2.t(x) . d/dx(t(x)) + 2.x = 0

Now we can convert our t(x) back to a "y" (You can't do this on the calculator - you need to do it on paper or in your head)

First look for any "d/dx(t(x))" and change them to "dy/dx"

2.t(x) . dy/dx + 2.x = 0

And then look for any remaining "t(x)" and change them back to "y"

2.y . dy/dx + 2.x = 0

Now you can see that dy/dx appears in the middle of our equation. You can now solve this easily on paper or by using the "solve" function in the TI89.

If you use the "solve" function on the TI89, you need to substitute a single variable for the dy/dx. (in our example, we will use the variable "t" again)

solve(2 * y * t + 2 * x = 0,t)

And you will get the answer

t = -x/y (which is the same as dy/dx = -x/y)

Partial Differenciation

First Partial Derivatives : fx, fy

Second Partial Derivatives : fxx, fxy, fyy, fyx

You dont need to define any functions to do this type of problem. However, you may find it easier to store the formula in a variable to save having to type it in each time. Eg :

Define aa = ln(x^2 + y^2 + z^2)

Always use at least two characters for your variable name. You must make sure that you dont use a single character (especially x, y, z or t). If you do, it is almost guaranteed that you will mess up any future calculations using these variables.

Now that you have defined your variable, it is extremely easy.

To calculate fx

d(aa,x)

To calculate fy

d(aa,y)

To calculate fxx

d(aa,x,2) or d(d(aa,x),x)

To calculate fyy

d(aa,y,2) or d(d(aa,y),y)

To calculate fxy

d(d(aa,x),y)

To calculate fyx

d(d(aa,y),x)

In each of the examples shown above, you could have used the original formula instead of the variable "aa".

Calculus with TI89 calculator

I love my TI-89 calculator - but I hate the manual that came with it.

Dont get me wrong, maybe it is just that I have a really old version and it has been improved since my version was released - or maybe the manual is supposed to be a "reference" book instead of a user guide.

Anyway, I'm doing Calculus at University and so I decided to spend some time going through the manual and summarising the functions that I use the most.

Remembering the function names

All of the functions shown below can be accessed from the "Catalog" menu or the "Math" menu. The "Math" menu is much better as it groups all of the functions by their usage. (EG Matrix, Calculus etc)

Unfortunately the "Math" menu does not provide the (limited) help that the "catalog" menu provides. After using the commands for a while, you quickly get used to the available parameters.

Calculus

Differenciation

Use the F3 function key (option 1) or 2nd + 8 keys

d(x^2+2x,x) - Differenciate the function x^2+2x
d(x^2+2x,x,2) - Get the second differencial of the function

Integrals

Use the F3 function key (option 2) or 2nd + 7 keys

S(2x+2,x) - Get the integral of 2x+2 dx
S(2x+2,x,1,5) - Get the area under the function between 1 and 5

Local Minimum and Maxima (turning points)

fMin(x^2,x) - Get the min candidates of the function x^2
fMax(x^2,x) - Get the max candidates of the function x^2

Limits

limit(1/x^2,x,0) - Find the limit of 1/x^2 as x approaches 0
limit(1/x,x,0,1) - Find the limit of 1/x as x approaches 0 from above
limit(1/x,x,0,-1) - find the limit of 1/x as x approaches 0 from below

Algebra

Intercepts

To find the x intercepts, use the zeros function.

zeros((x+2)^2-2 , x) - List where the function crosses the x axis

To find where the function crosses the y axis, we use the "with" operator to set x equal to zero. The with operator is a vertical bar (on the button above the EE button)

(x+2)^2+2 | x=0

Solving Inequalities

solve( abs(2x+2)+1 < 5 )

Solving Quadratics

"factor" and "expand" are opposites of each other.

solve( x^2+4x+2=0 , x) - Find the values of x that make the equation true
factor( x^2+3x+2 ) - Find the factors [ eg (x+1)(x+2) ] of the equation
expand( (x+1)(x+2) ) - Convert the factors into an equation

Matrices and Vectors

Use ; to seperate rows and commas to seperate columns

[1,2,3;4,5,6] x [3,2;4,5;6,7] - Find the multiple of two matrices

ref( [1,2,3;4,5,6] ) - Convert to row echelon form
rref( [1,2,3;4,5,6] ) - Convert to reduced row echelon form

Transpose a matrix

Use the catalog button to get access to the letter T used in the following example

[1,2,3;4,5,6]T - Transpose the matrix

Inverse of a matrix

Note : The matrix needs to be square

[1,2;3,4]^-1

Determinant

det( [1,2,3;4,5,6;7,8,9] ) - Return the determinant of a matrix

Identity Matrix

Here is a quick way to enter an identity matrix. Saves entering all the 0's and 1's

identity(3) - Returns a 3 x 3 identity matrix

Normal (length) of a vector

norm( [1,2,3] ) - returns the norm of a vector

Dot product

dotP( [1,2,3] , [4,5,6] ) - Return the dot product of two vectors

Showing your working

We are often asked to show our working in our exams/tests. The easiest way to work with matrices is to use the rowSwap and mrowAdd functions. It is also a good idea to use the "Ans" key (2nd (-) button) to save re-entering the matrix for each step.

You need to remember that the "last" value entered is the row that will be replaced

rowSwap( Ans , 1 , 2) - Swap row 1 and 2

mrowAdd( 3, Ans , 1 , 2) - Row 2 is replaced with row 2 + 3 times row 1

Subtraction of a row can be done by using -1 as the first element in the mrowAdd function

Conclusion

There are many more functions that the TI89 is capable of. But these are the ones that I have found most useful in Stage 1 Mathematics. As I proceed through the year, I will no doubt find even easier ways to do things and will post them as I find them.

My next job is to write a summary of functions for my Statistics course

InkBuddy

After working in the computer industry for more years than I care to count, I have decided to go back to University. To help with my studies, I have been looking for some "Flash Card" software for the Tablet PC. There are a couple of good programs available - but none of them make it really easy to use the Leitner Card system on a Tablet PC.

After searching and searching (and searching some more), I finally decided the best solution was to write one for myself. I really liked the Microsoft Flash Card software, so I decided to model it on that.

Now that the software is finished and that I have been using it for a few days, I thought it could be really helpful to other students using Tablet PC's. So I have decided to release it as FREE software solution for the entire Tablet PC community to enjoy.

If you download the software and like it (or hate it), please post a comment on this blog. Because the software is free, it is the only way that I get to know that other people are using it.

The download link for the installer is
http://www.plugandplay.co.nz/inkbuddy.exe
Note : This software only works on Tablet PC's and requires a pen or mouse

The installer is 4MB in size. Downlaod and run the installer to create an icon on your desktop and to select the directory that you would like the program installed into.

Here are some of the features of the program :

* Tablet (pen) driven software
* Unlimited cards
* Up to 15 categories (or decks) of cards
* Test individual categories
* Test over all categories
* Quick access to 4 pens, 4 markers and 4 highlighters
* Automatic card flipping and adavancement

I wanted to have a way to enable me to do quick studying without messing up the long term memory features of the Leitner Card system. To handle this, I decided to add an "accelerated" learning mode. The accelerated mode does not use dates and does not affect the boxes that the cards are in for long term memory mode. It simply moves your cards between boxes depending on if the answers are correct or not. As you move through the boxes, the cards become immediately available for further testing. I also created a "Reset all" button to move the cards back into the first box.

Leitner card system for long term memory

- User defined aging for correctly answered cards
- Incorrect cards go back into the first box
- Cards disappear from the testing screen until their next due date
- Only see the cards that are due to be tested

Accelerated learning mode

- Can be used at the same time as Long Term Mode
- Does not use dates
- Correctly answered cards go up a box
- Incorrectly answered cards go back to the first box

Card Editing Mode

The pens and highlighters are displayed at the bottom of the screen along with the button that starts testing mode. The buttons at the top of the screen allow you to create a new card, delete and existing card and move between cards. Buttons are also provided to cut, copy and paste ink. The buttons at the top right corner allow you to setup categories and setup the aging for your long term memory boxes.

If you make changes to a card, an undo button appears (next to the cut, copy and paste buttons). The undo button reverts the card back to before any changes were made.

Testing Mode



In testing mode, The question appears in the panel at the top of the screen.

The bottom of the screen is provided for you to write the correct answer into. Most of the time you wont need this, but for complex questions (eg draw the structure of the Heart), you may want to write (or draw) your attempt before viewing the correct answer.

One you have drawn (or thought) of your answer, click the circular arrow to display the back of the card. The button will then turn to a tick or a cross. If the answer if correct, click the tick and your card will advance to the next box. If the answer is wrong, click the cross and your card will be moved back to the first box.

If you are in long term memory mode and you click the tick, your card will disappear from the deck until its next due date. Do not worry as the card has not been deleted - it is simply hidden from view.

When I was using the software, I found that i wanted to study one subject at a time (eg Chemistry or Maths). To allow for this, I added the ability to select a category before going into testing mode. Because of this, the "Reset all cards" button only changes the boxes for the category and/or mode that you have selected.

The rest of the software is fairly self explanitory. So download the software and let me know what you think. If you have any suggestions, please feel free to post them as comments as well.

Windows XP on ASUS EEE PC without a CD Drive

A couple of days ago I decided to buy a new EEE PC. It comes out of the box with Linux preloaded.

However, I wanted to install Office 2007 and Windows XP. My machine only has 4GB of internal flash hard drive but I can plug in an external SD card to give extra space as drive D: I have also upgraded the RAM in my machine to 1GB before I started.

After spending a long time reading the forums, I have found lots of really good tweaks. However, the tweaks are not all in one place - so I decided that it would be a good idea to make a log of how I configured my machine for the optimal performance and space.

Step 1 - Make an nLite iso file

Follow the instructions at http://wiki.eeeuser.com/howto:nlitexp
HOWEVER - DO NOT remove the "Manual Install" feature of Windows XP. This is under the "Operating System Options" tab. You need this if you are going to install off a USB memory stick. So DON'T tick this box.

When you are finished, you should have an iso file saved on your desktop (or elsewhere on your hard drive)

Step 2 - Load Virtual CD

I use Microsoft's Virtual CD driver - but you can use anything that can mount an iso image as a drive letter.

Here is the link for the Microsoft file

http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe

Check out the readme file for instructions on how to install it. Once it is installed, mount your iso file to a drive letter (mine was y:)

Step 3 - Make a USB boot disk with Windows XP

Follow the instructions on this page to make a bootable usb drive.

http://www.eeeguides.com/2007/11/installing-windows-xp-from-usb-thumb.html

When you are asked to select the Windows XP Setup Source path, select the drive letter that was assigned to your iso file when you mounted it in step 2

Step 4 - Boot the USB stick in your EEE PC

Before you start installing Windows XP, go into the BIOS and change the BIOS setting for the "OS Installation" to started. You will also need to change the system bios on the EEE PC to boot from the USB stick.

Once you have done this, select the second option (text mode) to start the setup process.

From this point on it is just like any other windows XP installation delete/recreate the primary partition on your EEE pc and format it using NTFS. Make sure you delete ALL partitions on the internal drive. You should create a single partition or you will get the hal.dll error message. (Make sure you dont delete the partition on your USB stick though)

Once the text mode portion of setup is complete it will boot into the GUI mode (you can press enter after the reboot if your too excited to wait the 30 seconds)

Once the GUI portion of setup is complete you will again have to boot into GUI mode this will complete the XP installation and you will end up at you XP desktop. It is very important that you DO NOT REMOVE THE USB STICK before this point. Once you can see your start menu it is safe to remove the usb stick and reboot your pc to make sure everything worked.

I have 1.82GB free at this point (from 3.72GB)

Step 5 - Install the required ASUS drivers

Now is a good time to change your BIOS setting for the "OS Installation" to finished. This will speed up your USB 2.0 ports.

If you dont have an external CD drive, the files from the driver CD can be copied to a memory stick and can be installed manually. You may need to reboot after each driver is installed.

Don't install the Touchpad driver - As at 27th Jan 2008, it doesnt work and you are better off using the Windows default driver.

Install ACPI from the \drivers\acpi\setup.exe file

Install the Chipset drivers from \driver\Chipset\Intel\Inf\setup.exe

Install the Video Driver from \drivers\vga\setup.exe
After rebooting, I like to change my resolution to 800 x 600

Install the Wireless adapter from \driver\Wireless\Install_CD\setup.exe
I only install the Driver and not the client software. I like to use Windows to manage my wireless networks.

Install the Lan (plugin) driver from \driver\lan\Attansic\setup.exe

Install the sound driver from \driver\Audio\driver\setup.exe

Step 6 - Disable Page File (and remove it)

To do this, right click on My Computer. Select Properties and the Advanced tab. Select the Settings button in the Performance section and go to the Advanced Tab.

Now select the Change button and choose the "No paging file" and click Set and OK. You will need to reboot before you can delete the pagefile (if it exists)

Note : You also may need to untick the option "Hide protected operating system files" to be able to see the pagefile.sys file. You can find this option by selecting the

Tools > Folder Options > View tab

and scrolling down the list. The Tools option is at the top of the "My Computer" windows when you open it.

I have 3.17GB !!! free space at this point (out of 3.72GB)

If you havent activated Windows yet, now is probably a good time.

Before downloading the patches from Microsoft, it is a good idea to optimize your internet connection. Have a read of http://forum.eeeuser.com/viewtopic.php?id=5192

My internet throughput increased by over 20%

Step 7 - Download patches

Use Windows Update to install the latest security updates

I have 2.91GB free at this point (out of 3.72GB)

Step 8 - Install Office 2007

To install Office 2007 without a CD drive, I simply share the cd drive on my desktop computer and insert the CD. The EEE PC can see the shared CD drive for the installation.

My free space is down to 2.04GB (out of 3.72GB)

Step 9 - Download patches

Use Windows Update (again) to install the latest security updates for Office 2007

Now I only have 1.35GB left (out of 3.72GB)

To get some of the space back, delete the following files and folders :

\Windows\$NtUninstallKB***$
\Windows\System32\Dllcache
\Windows\SoftwareDistribution\Download\*.*
\Windows\INF\*.PNF
\Windows\Temp\*.*
\MSOCache

Free space is back up to 1.96GB

Step 10 - Format the removable SD card as NTFS

This makes the access speeds on the SD Ram card much faster and allows you to have it in NTFS format. You should do this before moving "My Documents" (or any other files) to the removable card.

Go into Control Panel > System > Hardware Tab > Device Manager

Expand the "Disk Drives" part of the tree and right click on the "USB2.0 Card Reader SD0" device. Go into Properties. Select the Policies tab. And active the "Optimize for performance" option

Now you can close all the Windows and go to My Computer to format the removable drive D:

You will find that you have an NTFS option

After it was formatted, I turned off the Indexing Service by going back into the Properties of the newly formatted NTFS drive. You can also compress the drive if you wish (I didnt).

If you leave the Optimize performance option turned on, you need to make sure you "Safely remove" the drive before ejecting it from your machine at any time in the future. Note : You dont have to leave the option turned on to keep using the NTFS formatted card. It only has to be on to actually format the card.

Interesting Note : This appears to make the whole machine run quicker. My experience is that formatting your SD Ram card as NTFS instead of Fat32 make everything run 100% faster (if not more)

Step 11 - Move My Documents

Before you can move your Document files to the removable drive, you need to re-enable right clicking on the start menu

I wanted to be able to right click on the start menu

> right click on the task bar on desktop
> select properties
> select start menu tab
> click customize
> click on the advanced tab
> tick the "Enable dragging and dropping" box and that should fix it.

Now that you have done that, you can right click on "My Documents" on the start menu. Select "Properties" and use the "Move" button to move your documents to D: drive.

Step 14 - Compress the hard drive and turn off indexing

To turn off indexing, go to My Computer and right click on your Local Disk C. Go into properties and untick the "Allow Indexing Service" tick box. Click Apply and apply the changes to all folders and sub folders of C.

To compress the hard drive, tick the "Compress drive to save space" box on the same page. Click apply to start compressing your files. This may take some time.

Step 15 - Install other software

Other programs I installed were Adobe Acrobat and AVG Antivirus.

I now have 2.13GB free (out of 3.72GB). That means Windows XP, IE7 with Office 2007, all patches and a couple of other programs takes all of 1.58GB

Step 16 - Setting Up 800x600 scaled video

To get 800x600 or 1280x760 on the EEE PC, follow the instructions on this thread

http://forum.eeeuser.com/viewtopic.php?pid=104288#p104288

After you have downloaded the required files, uninstall the old video driver by using the "Add/Remove" programs option in the control panel. When Windows restarts, cancel all of the attempts to automatically reinstall the video driver.

Once Windows has restarted (you should be in 800x480 mode), install the new driver by running the SETUP.EXE file

When you reboot the computer, you may be asked if the various EXE files can be loaded into memory. Because the installed driver files are unsigned, you will need to untick the checkbox in the dialog that asks if the files can be loaded in future.

Now you need to setup the screen to display 1280x768 (Even if you are not going to display that high a res). To do this, go into the Control Panel and select the "System" icon. Choose the Hardware tab and click on Device Manager.

Expand the "Monitors" section of the tree and right click each monitor (there are probably more than one) and select "Update Driver". Choice the "Advanced" option and click next. Now select the "Don't Search" option and click next again. You will need to untick the box that says "Show compatible hardware" and you can then select the Digital Flat Panel (1280x768). You need to do this for all of the monitors.

The last thing to do is to create a startup shortcut. The best way to do this is to right click on the desktop and create a new shortcut. Browse to find the EEEPC_RESV1.EXE file and click next and then click finish. Once the icon is sitting on your Desktop, go back into the properties of the icon and change the Target to

EEEPC_RESV1.EXE 1 800 600 32

You can test your new icon by double clicking on it. The screen should change to a scaled 800x600 mode.

If the icon works properly, it is safe to move it to

C:\Documents and Settings\All users\Start Menu\Programs\Startup

and it will run every time you start your computer up.

[Update : I was getting an error with PersistWndName when I shutdown my machine. I fixed the problem by opening REGEDIT and looking for the key \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and removing the key "Persistance" which had the value "C:\WINDOWS\system32\igfxper.exe"]

Other things to try

I've still got to test out using a RAM drive for temp files and internet cache files

http://www.mydigitallife.info/2007/05/27/free-ramdisk-for-windows-vista-xp-2000-and-2003-server/

[Update : I installed a 128MB RAM drive. I have changed Internet Explorer to use the RAM drive for its temporary files and have also changed Windows TEMP and TMP enviromental variable settings. The good thing is that the temp files are deleted every time I reboot and they dont take any space on my C: drive]