The Jupyter Notebook

It is a web application that allows you to create and share documents that contain

  • live code
  • equations
  • visualizations
  • explanatory text
In [6]:
# my first python script
print("hello world!")# first try
hello world!

Uses include:

  • data cleaning and transformation,
  • numerical simulation,
  • statistical modeling,
  • machine learning
  • and much more.
In [7]:
print('hello world')
hello world
In [8]:
1 + 1
Out[8]:
2

$E = MC^2$

\begin{align} \dot{x} & = \sigma(y-x) \\ \dot{y} & = \rho x - y - xz \\ \dot{z} & = -\beta z + xy \end{align}

搜狗输入法表情和符号

  • ∫ ∑ ※ ➕➖✖️➗ ❎ √ ×
  • 😪😠😡😎☺️😁📚🌲
  • 👌👍👎👂👃👀✋❌💰🌂
  • 0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣②🔟
  • 🐶🐱🐔🐷🐖🐴🐎🐂🐑🐯🐧🐺🐒🐵🐻🐦🐲
  • 💻 🌈🌎☁️❄️🏃♀👩👱✨
  • 🆚🔥🌹✈️🌉🎄

(✿◡‿◡)害羞 ⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄ d=====( ̄▽ ̄*)b厉害

我是我,不一样花火。~( ̄▽ ̄~)(~ ̄▽ ̄)~ 矜持

In [2]:
%matplotlib inline
import matplotlib.pyplot as plt

xi = [1, 2, 3, 4, 5]
y = [3, 5, 9, 13, 16]

plt.plot(xi, y, 'g-s')
plt.xlabel('$x_i$', fontsize = 20)
plt.ylabel('$y$', fontsize = 20)
plt.title('$Scatter\,Plot$', fontsize = 20)
plt.show()

一级标题

二级标题

复旦大学是一个非常棒的大学!

  • point 1
  • point 2
  • point 3

运行C代码

C functions are typically split into header files (.h) where things are declared but not defined, and implementation files (.c) where they are defined. http://people.duke.edu/~ccc14/sta-663/CrashCourseInC.html#a-tutorial-example-coding-a-fibonacci-function-in-c

In [1]:
%%file hello.c
#include <stdio.h>

int main() {
    printf("Hello, world!");
}
Overwriting hello.c
In [2]:
! gcc hello.c -o hello # 编译
In [3]:
! ./hello # 执行
Hello, world!

Jupyter 魔术命令

In [14]:
%lsmagic 
Out[14]:
Available line magics:
%alias  %alias_magic  %autocall  %automagic  %autosave  %bookmark  %cat  %cd  %clear  %colors  %config  %connect_info  %cp  %debug  %dhist  %dirs  %doctest_mode  %ed  %edit  %env  %gui  %hist  %history  %killbgscripts  %ldir  %less  %lf  %lk  %ll  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %lx  %macro  %magic  %man  %matplotlib  %mkdir  %more  %mv  %notebook  %page  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %popd  %pprint  %precision  %profile  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %qtconsole  %quickref  %recall  %rehashx  %reload_ext  %rep  %rerun  %reset  %reset_selective  %rm  %rmdir  %run  %save  %sc  %set_env  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode

Available cell magics:
%%!  %%HTML  %%SVG  %%bash  %%capture  %%debug  %%file  %%html  %%javascript  %%js  %%latex  %%markdown  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile

Automagic is ON, % prefix IS NOT needed for line magics.

pip install version_information

In [4]:
# install version_information in the terminal first.

%reload_ext version_information 
%version_information numpy, matplotlib, pandas, scipy, statsmodels
Out[4]:
SoftwareVersion
Python3.5.4 64bit [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
IPython6.2.1
OSDarwin 14.0.0 x86_64 i386 64bit
numpy1.11.1
matplotlib2.2.2
pandas0.18.1
scipy0.18.1
statsmodels0.6.1
Fri Apr 27 13:58:30 2018 CST

END

This is the end.