In [3]:
# my first python script
print("hello world! \n I am Cheng-Jun Wang.")
Uses include:
In [7]:
print('hello world')
In [8]:
1 + 1
Out[8]:
$E = MC^2$
In [4]:
%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()
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 [5]:
%%file hello.c
#include <stdio.h>
int main() {
printf("Hello, world!");
}
In [6]:
! gcc hello.c -o hello # 编译
In [3]:
! ./hello # 执行
In [14]:
%lsmagic
Out[14]:
pip install version_information
In [8]:
!pip install version_information
In [9]:
# install version_information in the terminal first.
%reload_ext version_information
%version_information numpy, matplotlib, pandas, scipy, statsmodels
Out[9]:
This is the end.
In [ ]: