启动jupyter notebook

终端>>jupter notebook

jupyter notebook 代码补全

安装nbextensions
终端>>

pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user

勾选Hinterland选项

绘制记录曲线

%matplotlib inline
import matplotlib.pyplot as plt
x = [1,2,3,4,5,6,7]
y = [10,30,20,25,35,35,40]
plt.plot(x,y)
plt.axhline(linewidth=2, color="k")   #加粗X轴
plt.axvline(linewidth=2, color="k")   #加速Y轴
plt.grid(color= '0.8')
plt.show()

绘制y=x2

%matplotlib inline
import matplotlib.pyplot as plt
x = list(range(-5,6))
y = []
for i in x:
    y.append(i ** 2)
plt.plot(x,y)
plt.grid(color='0.8')
plt.show()

绘制y=x3,密集步数

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-1.0,1.01,0.01)
y = x ** 3
plt.plot(x,y)
plt.grid(color= '0.8')
plt.show()

绘制圆

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
th = np.arange(0,360) #定义角度区间
r = 1 #默认半径为1
x = r * np.cos(np.radians(th)) + 0 #x坐标序列 radians()角度转弧度函数
y = r * np.sin(np.radians(th)) + 0 #y坐标序列 默认圆心为0,0
plt.plot(x,y)
plt.axis('equal') #设置x,y轴等比例
plt.grid(color='0.8')
plt.axhline(linewidth=2, color="k")
plt.axvline(linewidth=2, color="k")
plt.show()

反三角函数以及弧度转角度

>>> rad = np.arctan2(1,1)
>>> th = np.degrees(rad)
>>> th
45.0

VGA模式下,新增分辨率

VGA-0是显示器大的名称,自行查询

cvt 1366 768 60
// # 1368x768 59.88 Hz (CVT) hsync: 47.79 kHz; pclk: 85.25 MHz
// Modeline "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync

xrandr --newmode "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync

xrandr --addmode VGA-0 1368x768_60.00

xrandr -s 1368x768_60.00



cvt 1920 1080 60
// # 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
// Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

xrandr --addmode VGA-0 1920x1080_60.00

xrandr -s 1920x1080_60.00

将上述命令写入开机启动

Linux发行版本如CentOs等在etc目录下会有一个rc.local文件,这个文件是启动加载文件,也就是说,在我们开机后,系统会检查一遍这个文件,并且会自动执行里面写入的命令;
需要把想开机自动执行的脚本的执行路径写在这里就可以实现开机自动执行。
rc.local文件需要加上执行权限,>>chmod +x rc.local
如果deepin系统中没有这个rc.local文件,需要用vim自己写一个。文件内容如下,需要执行的放在 exit 0 上边:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

exit 0

如遇到创建文件不能写入,需要在vim保存命令中加上强制代码:w !sudo tee %
查询文件权限>>ls -l filename
添加写入权限>>chmod +w filename
如被占用,强制释放文件>>fuser -k filename

与运算 AND &

除了11为1 外,其他都为0
计算方式为两个数相乘
与运算可以作为一种掩码运算,原值遇1为原值,原值遇0为0

原值10101010
AND00001111
结果00001010

- 阅读剩余部分 -