摘要: import matplotlib.pyplot as plt import numpy as np x = np.linspace(-3,3,50) y = 2*x+1 plt.figure() #范围 plt.xlim((-3,4)) plt.ylim((-3,6)) #轴含义(标签) plt. 阅读全文
posted @ 2023-01-31 20:32 不迷路的小孩 阅读(12) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) y1 = 2*x+1 y2 = x**2 plt.figure() #范围 plt.xlim((-1,2)) plt.ylim((-2,3)) #轴 阅读全文
posted @ 2023-01-31 20:32 不迷路的小孩 阅读(12) 评论(0) 推荐(0) 编辑
摘要: ```pythonimport matplotlib.pyplot as pltimport numpy as np x = np.linspace(-1,1,50)y1 = 2*x+1y2 = x**2 plt.figure()plt.plot(x,y2)plt.plot(x,y1,color=' 阅读全文
posted @ 2023-01-31 20:32 不迷路的小孩 阅读(18) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) y1 = 2*x+1 y2 = x**2 plt.figure() plt.plot(x,y2) plt.plot(x,y1,color='red' 阅读全文
posted @ 2023-01-31 20:32 不迷路的小孩 阅读(20) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) y1 = 2*x+1 y2 = x**2 plt.figure(num=1,figsize=(10,10)) plt.plot(x,y1) plt. 阅读全文
posted @ 2023-01-31 20:31 不迷路的小孩 阅读(22) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) #y = 2*x+1 y = x**2 plt.plot(x,y) plt.show() 阅读全文
posted @ 2023-01-31 20:31 不迷路的小孩 阅读(17) 评论(0) 推荐(0) 编辑
摘要: import numpy as np #行合并 a = np.arange(6).reshape(2,3) b = np.random.randint(10,20,size=(4,3)) print(a) print(b) print('******************************* 阅读全文
posted @ 2023-01-20 17:52 不迷路的小孩 阅读(19) 评论(0) 推荐(0) 编辑
摘要: import numpy as np arr = np.arange(5) print(arr) print(arr.shape) #method1 print(arr[np.newaxis,:]) print(arr[np.newaxis,:].shape) print(arr[:,np.newa 阅读全文
posted @ 2023-01-20 17:52 不迷路的小孩 阅读(44) 评论(0) 推荐(0) 编辑
摘要: import numpy as np arr = np.arange(12).reshape(3,4) print(arr) print(np.sum(arr)) print(np.prod(arr)) print(np.cumsum(arr)) print(np.cumprod(arr)) pri 阅读全文
posted @ 2023-01-20 17:51 不迷路的小孩 阅读(20) 评论(0) 推荐(0) 编辑
摘要: import numpy as np np.random.seed(666) print(np.random.rand(5)) print(np.random.rand(3,4)) print(np.random.rand(2,3,4)) print('*********************** 阅读全文
posted @ 2023-01-20 17:51 不迷路的小孩 阅读(39) 评论(0) 推荐(0) 编辑