修改interfaces文件重启网络还是启动不了

比如,修改/etc/network/interfaces为这样

1
2
3
4
5
6
auto eth0
iface eth0 inet static
address 192.168.1.38
gateway 192.168.1.1
netmask 255.255.255.0
dns-nameservers 192.168.1.1

保存再重启,发现网络还是不通,经测试,是要去掉最后一行

1
#dns-nameservers 192.168.1.1

保存再重启,网络就通了。

xfce命令行关闭屏保

1
xset s 0 #关闭屏幕保护

还有一种方法就是关掉ubuntu桌面,命令行为:

1
/etc/init.d/lightdm stop

ubuntu不能上网的dns问题

不能上网也就不能apt-get,也就不能

apt-get install resolvconf

所以先修改/etc/resolv.conf,加入dns,如:

nameserver 8.8.8.8

再重启网络:

/etc/init.d/networking restart

这样就可以暂时上网了,若现在重启系统,/etc/resolv.conf会被清空的,就又不能上网了。所以现在,马上执行:

apt-get install resolvconf

完成后编辑/etc/resolvconf/resolv.conf.d/base文件,加入如:

nameserver 8.8.8.8

保存并重启系统,会看到可以永久上网了。

python求方程解析解和数值解

解一元方程:

1
2
3
from sympy import *
x, a, b, c = symbols('x a b c')
solve(a * x**2 + b * x + c, x)

解多元方程:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from sympy import *
x, y, z = symbols('x y z')
solve([y + x - 1, 3 * x + 2 * y - 5], [x, y])
limit(sin(x) / x, x, 0)
simplify(sin(x)**2 + cos(x)**2)
expand((x + 1)**2)
factor(x**2 + 2*x + 1)
collect(x*y + x - 3 + 2*x**2 - z*x**2 + x**3, x)
trigsimp(cosh(x)**2 + sinh(x)**2)
expand_trig(sin(x + y)) 
 
x, y = symbols('x y', positive=True)
n = symbols('n', real=True)
expand_log(log(x*y))
logcombine(n*log(x))
 
E**(I*pi)+1
expand(exp(I*x), complex=True)
 
tmp = series(exp(I*x), x, 0, 10)
pprint(tmp)
re(tmp)
series(sinh(x), x, 0, 10)
 
integrate(x*sin(x), x)
integrate(x*sin(x), (x, 0, 2*pi))
diff(x**2)
 
r = symbols('r', positive=True)
circle_area = 2 * integrate(sqrt(r**2-x**2), (x, -r, r))
circle_area.subs(r, x)

求数值解

1
2
3
s = solve(a * x**2 + b * x + c, x)
val = s.evalf(subs = {a:1, b:2, c:1})
print(str(val))

Fourier,

from sympy import *
from sympy.abc import x
s = fourier_series(x**2, (x, -pi, pi))
s.truncate(4)

refer to:
https://blog.csdn.net/shuangguo121/article/details/86611948
https://www.cnblogs.com/coshaho/p/9653460.html
https://baike.baidu.com/item/%E5%8F%8C%E6%9B%B2%E5%87%BD%E6%95%B0/8704306?fr=aladdin
https://www.cnblogs.com/FrostyForest/p/16660154.html