Repetition of the basic concepts of Python
------------------------------------------
1) Write a program in python that sums 1 to 100 (without using Gauss's trick)
2) Create a list that stores the numbers 1 to 100 and then sum the list
3) Sum only the odd entries in the list (entries with index 1, 3, ...)
4) The so-called Fizz Buzz Test
"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."
5) Sort a list using bubble sort. You can use the pseudocode implementation at https://en.wikipedia.org/wiki/Bubble_sort
6) Implement the bubble sort as a function and apply it to multiple lists.
7) Using list comprehension create a function that returns a list [0,2,4,6,...]. The length of the list should be an argument of that function.
8) Using list comprehension create a functions that reteurns a list that stores n!. The length of the list should be an argument of that function.
Resources:
[1] http://chris.friedline.net/2015-12-15-rutgers/lessons/python2/00-short-introduction-to-Python.html
[2] The script for 'Mathematische Software und Programmieren'
[3] https://www.w3schools.com/python/
[4] https://pythonhosted.org/spyder/installation.html
Python for numerical work (pylab = numpy + scipy + matplotlib)
-------------------------
9) Create two large (n>100000) lists and two arrays of the same size. Measure the time it takes to compute a+b using the timeit module. What do you observe.
10) Create the 'shift matrix' and multiply it by a vector. Check your result.
11) Plot some interesting functions.
12) Implement the rectangular rule to compute the integral of cos(x) from 0 to 1.
Resources:
[1] http://www.numpy.org/
[2] http://jakevdp.github.io/mpl_tutorial/tutorial_pages/tut1.html