2018年5月24日
摘要: #optimazer优化器 from scipy.optimize import minimize def rosem(x): return sum(100.0*(x[1:]-x[:-1])**2.0+(1-x[:-1])**2.0) x0=np.array([1.3,.7,.8,1.9,1.2]) res=minimize(rosem,x0,method="nelder-mead",o... 阅读全文
posted @ 2018-05-24 15:51 裸睡的猪 阅读(1515) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/5/24 15:03 # @Author : zhang chao # @File : s.py #integral积分 import numpy as np from scipy.integrate import quad,dblquad,nquad pri... 阅读全文
posted @ 2018-05-24 15:21 裸睡的猪 阅读(750) 评论(0) 推荐(0) 编辑
摘要: #scatter fig=plt.figure() ax=fig.add_subplot(3,3,1)#3行3列 第一个图 n=128 X=np.random.normal(0,1,n) Y=np.random.normal(0,1,n) T=np.arctan2(Y,X)#T用来上色的 #plt. 阅读全文
posted @ 2018-05-24 14:56 裸睡的猪 阅读(423) 评论(0) 推荐(0) 编辑
摘要: fig=plt.figure() fig.add_subplot(3,3,1)#3行3列 第一个图 n=128 X=np.random.normal(0,1,n) Y=np.random.normal(0,1,n) T=np.arctan2(Y,X)#T用来上色的 plt.axes([0.025,0.025,0.95,0.95])#显示的范围 plt.scatter(X,Y,s=75,c=T,a... 阅读全文
posted @ 2018-05-24 14:10 裸睡的猪 阅读(484) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import matplotlib.pyplot as plt from scipy.constants.constants import alpha from matplotlib.patches import ArrowStyle x=np.linspace(-np.pi,np.pi,256,endpoint=True) #np.linspace定义横轴... 阅读全文
posted @ 2018-05-24 09:31 裸睡的猪 阅读(217) 评论(0) 推荐(0) 编辑
  2018年5月23日
摘要: fig = plt.figure() ax=plt.gca() timeList = np.array(timeList) timeList=timeList*100 timeList1 = np.array(timeList1) timeList1=timeList1*100 timeList2 = np.array(timeList2... 阅读全文
posted @ 2018-05-23 21:54 裸睡的猪 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #func.__name__: now#I am Banner brother! 阅读全文
posted @ 2018-05-23 21:51 裸睡的猪 阅读(179) 评论(0) 推荐(0) 编辑
  2018年5月22日
摘要: #include using namespace std; template struct TreeNode { T element; TreeNode*parent, *lnode, *rnode; TreeNode(){ parent = lnode = rnode = NULL; } TreeNode(const T& key) { ... 阅读全文
posted @ 2018-05-22 16:14 裸睡的猪 阅读(652) 评论(0) 推荐(0) 编辑
摘要: #include /** * 折半查找函数 * * @param arr 数组 * @param len 数组长度 * @param value 查找元素 * * @return 返回查找元素的位置 */ int searchItem(int arr[],int len, int value){ int low = 0,high = len-1,mid... 阅读全文
posted @ 2018-05-22 15:35 裸睡的猪 阅读(210) 评论(0) 推荐(0) 编辑
摘要: Prim算法 1.概览 普里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点(英语:Vertex (graph theory)),且其所有边的权值之和亦为最小。该算法于1930年由捷克数学家沃伊捷赫·亚尔尼 阅读全文
posted @ 2018-05-22 10:46 裸睡的猪 阅读(51083) 评论(0) 推荐(7) 编辑