%% HW1 - 3101 Matlab -- (INSERT NAME and UNI HERE)
% Due 11:59pm on Tuesday, March 11th, 2008
%% Goals
% Open Matlab, and start using it for simple stuff (instead of your TI-83)

%% Directions
% Please fill in your name at the top of this page and write your answers
% under their corresponding question.  When you are done, publish this file
% to html using File > Publish To HTML (or the command publish('hw1.m', 'html')
% and create a new zip file that is labeled with your UNI and homework 
% number (eg. bs2018-hw1.zip), that contains this original m file, and the 
% html directory created from publishing the file. Email this file to
% cs3101@gmail.com, making sure to include your name, and uni in the subject.


%% Note
% When I say display a variable I mean display it so the output is labeled
% with the variable name, don't use disp, just leave off the semicolon
% from the end of the command.

%% Help
% If you get stuck, type the command doc to pull up the documentation
% window, from there it's easy to search for any other commands or
% functions you might want to use...

%% Problem 1 - some basic calculations
%% 1.1
% what is 2 to 20th power?




%% 1.2
% what is the square root of 157? 



%% 1.3
% http://en.wikipedia.org/wiki/Compound_interest#Continuous_compounding
% if i have 100 dollars in a savings account that is compounded 4 times a
% year, with 5 percent interest how much money will i have after 12 years?




%% Problem 2 - mathematical functions on lists of numbers
% We are given the heights of 10 people in inches:

heights = [60    64    69    60    61    62    62    67    63    62];
 
%% 2.1
% what are their heights in feet?



%% 2.2
% what is the mean and standard deviation of the heights (in inches)?



%% 2.3
% what is the maximum and minimum height?



%% 2.4
% we find out that the last 5 heights were measured incorrectly, using only 
% one line and one command (no semicolons allowed), add two inches to the 
% last 5 heights in the list, store the new list in a variable called 
% heights2, and display heights2



%% 2.5
% sort and display heights2



%% 2.6
% plot the corrected heights2 in a histogram



%% Problem 3 - investigate prime numbers

%% 3.1
% print out the help pages for the primes, and isprime function



%% 3.2
% compute a new variable p that contains all prime numbers less then 1000,
% and suppress the output (do not display, so add a semicolon)




%% 3.3
% make a new variable ps which contains the first 10 prime numbers, display
% them



%% 3.4
% make a new variable pe which contains the last 10 prime numbers that are
% smaller then 1000, display pe, (hint: help end)



%% 3.5
% how many primes are less then 1000?




%% 3.5
% plot the first 1000 primes



%% 3.6
% Mersenne primes are prime numbers of the form 2^x - 1... for example 7 is
% a mersenne prime because 7 is prime and 7 = 2^3 - 1... let's try to find
% more mersenne primes. first create a variable x that contains the number
% 1,2,3,...32, do not display x


%% 3.7
% now create a variable m that contains all the numbers of the form 
% (2^x) - 1, for x=1,2,3...32, do not display m or x (hint, remember .^ and
% ^ are different)




%% 3.8
% which numbers in m are prime? (hint there is a function that will make a
% new list which contains a 1 if the number is prime and 0 if its not, 
% store this list in a variable called i, and display the output)



%% 3.9
% create a new variable mersenne which contains all of the mersenne primes
% that are less then 2^32 (hint, you need to use the variables m and i).
% Then display only the first 5 mersenne primes.



%% 3.9.1
% what is the biggest meresenne prime that is less then 2^32


