Monthly Archives: January 2013

Class and Subclass in Python

Defining Classes and Subclasses in python is very easy and interesting, I am providing some examples to show the templates: # ———————— code —————————————————— # first define the class class Employee: ‘Common base class for all employees’       … Continue reading

Posted in Linux, programming, Python | Tagged , , , , , , , , | 1 Comment

100 lines of simple code to know numpy better (Python)

“”” the code is written and tested in Python 2.7, and it just needs NumPy library to be installed “”” import numpy as np # define arrays a = np.array([1,4,5,6],float) print a, type(a) a[1] = 20 print a # define … Continue reading

Posted in Linux, programming, Python, Statistics | Tagged , , , , , , | Leave a comment

3D-Bar Plot in Python

Using mathematical libraries in python, such as matplotlib you can create very nice plots for your programs, here is an example: in this example we want to show a 3d bar plot for a random data, using different colors, I have … Continue reading

Posted in Linux, Machine Learning, programming, Python | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Finding root of function using Python

Here I am using python 2.7.3 and I have added NumPy and SciPy libraries to my Python, You can find the root of a function easily like this: >>> import numpy as np               … Continue reading

Posted in Machine Learning, Optimization, programming, Python | Tagged , , , , , , , , , , , , | 1 Comment