<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Introduction to Ipython notebook
The Ipython notebook is an enviroment that can combine code, execution, text and plots, in the style of Matlab, Mathematica, or Maple.
The nice thing of these last three is that they provide a notebook environment. You can have it also in Python.
The backend is a python kernel server, to which connects a client in the browser by means of HTTP web protocols.
Code typed in sent to the kernel, executed there, and the results returned back to the browser client.
To start ipython we can use the command line
jupyter notebook
Or the Launcher
<img src="./Images/Screen Shot 2015-09-08 at 10.23.54.png" width="400">
After starting Ipython, we are presented with a navigator, in which we can select the folder and file we want to edit or start a new notebook.
<img src="./Images/Screen Shot 2015-09-08 at 10.26.25.png" width="700">
In an Ipython notebook, the input is divided in cells, that can contain text, in Markdown mode, or python code input, in code cells.
This is a markdown cell with text. To see the raw content, double click on it. To render it, we execute the cell pressing Shift + Intro
Step1:  In the notebook we can execute cells with more than one line of code, in the style of matlab or mathematica
Step2:  In the menu we can find useful drop-down menus to perform simple tasks to edit our notebook. The best way to know them is to experiment
Most important, the kernel menu, where we can kill the execution if we run intro trouble.
The use of the notebook allows to develop code faster in an exploratory way, writing small pieces successively, thus concentrating in the implementation of the algorithm, and not in the details of programming language.
Running long codes from the notebook is however not advisable.
We sould never thus forget to refactor our code into a standalone python program, encapsulating the different pieces of the algorithms in function or modules, to allow for reusability.
Markdown essentials for documenting an Ipython notebook
Here are some examples of formatting with markdown (click in the cell to see the markdown source)
<ASSISTANT_TASK:>
Python Code:
# This is a comment
# This is code cell, we execute it pressing also Shift + Intro
print 1+2
Explanation: Introduction to Ipython notebook
The Ipython notebook is an enviroment that can combine code, execution, text and plots, in the style of Matlab, Mathematica, or Maple.
The nice thing of these last three is that they provide a notebook environment. You can have it also in Python.
The backend is a python kernel server, to which connects a client in the browser by means of HTTP web protocols.
Code typed in sent to the kernel, executed there, and the results returned back to the browser client.
To start ipython we can use the command line
jupyter notebook
Or the Launcher
<img src="./Images/Screen Shot 2015-09-08 at 10.23.54.png" width="400">
After starting Ipython, we are presented with a navigator, in which we can select the folder and file we want to edit or start a new notebook.
<img src="./Images/Screen Shot 2015-09-08 at 10.26.25.png" width="700">
In an Ipython notebook, the input is divided in cells, that can contain text, in Markdown mode, or python code input, in code cells.
This is a markdown cell with text. To see the raw content, double click on it. To render it, we execute the cell pressing Shift + Intro
End of explanation
a = 5
b = 10
print "a + b = %d" % (a + b)
print "a * b = %d" % (a * b)
Explanation: In the notebook we can execute cells with more than one line of code, in the style of matlab or mathematica
End of explanation
%lsmagic
Explanation: In the menu we can find useful drop-down menus to perform simple tasks to edit our notebook. The best way to know them is to experiment
Most important, the kernel menu, where we can kill the execution if we run intro trouble.
The use of the notebook allows to develop code faster in an exploratory way, writing small pieces successively, thus concentrating in the implementation of the algorithm, and not in the details of programming language.
Running long codes from the notebook is however not advisable.
We sould never thus forget to refactor our code into a standalone python program, encapsulating the different pieces of the algorithms in function or modules, to allow for reusability.
Markdown essentials for documenting an Ipython notebook
Here are some examples of formatting with markdown (click in the cell to see the markdown source):
Headers:
Header 1
Header 2
Header 3
Header 6
Lists:
Red
Green
Blue
Nested lists:
Red
Strawberry, cherry
Green
Apple, pear
Blue
None
As far as I know
Ordered lists:
Bird
McHale
Parish
Code blocks:
for i in xrange(1000):
    print i
Inline code:
Use the printf() function.
Horizontal rules:
HTML links:
This is an example inline link.
Emphasis:
italics
italics
bold face
bold face
Inserting $\LaTeX$ symbols
One of the great improvements of ipython over simple markdown is that it allows to include latex expressions. This operation is performed by using MathJax to render LaTeX inside markdown.
MathJax is installed by default in the anaconda distribution. It can handle regularly complex expressions, but take into account that it is not a full full latex intepreter.
Let us see some examples:
$$c = \sqrt{a^2 + b^2}$$
$$F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx$$
\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \
\nabla \cdot \vec{\mathbf{B}} & = 0 
\end{eqnarray}
Magic commands
Ipython includes a number of "magic" commands, that offer increased functionality beyond python.
Magic commands come on two flavors:
Line magic commands: Prefixed with the character '%'. They work as functions, with the rest of the line treated as arguments
Cell magic commands: Prefixed with the character '%%'. The affect the behavior of the whole cell
Line magic commands
%timeit: Estimate the performance of a function, running it in a loop several times
%edit: Start the default editor to edit a file
%automagic: Make magic commands callable without the '%' character
%magic: Information on magic commands
End of explanation
<END_TASK>