python学习--numpy的数组

摘要: numpy中的数组类型为ndarry创建# -*- coding: utf-8 -*-import numpy as np#用列表或元组创建a = np.array([[1,2,3],[4,5,6]])b = np.array([1,2],dtype=complex)#类似内置函数rangec = np.arange(24).reshape(2,3,4)#等差,等比数组d = np.linspace(0,1,10,endpoint=False)print np.logspace(0,4,3,base=2)#创建特殊数组print np.zeros((2,3))print np.zeros_li 阅读全文
posted @ 2013-10-13 13:22 赛欧拉 阅读(13052) 评论(0) 推荐(0) 编辑

R语言学习-金融

摘要: library(quantmod)setSymbolLookup(SZZS=list(name="000001.SS", src="yahoo"))getSymbols("SZZS")getSymbols(Symbols = NULL, #股票代码,例如'000001.SS', 'CHL', 'APPL' env = .GlobalEnv, reload.Symbols = FALSE, verbose = FALSE, warnings = TRUE, src = "yaho 阅读全文
posted @ 2013-09-28 00:58 赛欧拉 阅读(519) 评论(0) 推荐(0) 编辑

编译环境

摘要: 我的配置为mingw+eclipse.点eclipse的运行,出现launch failed binary not found.解决方案:1. 右击工程,Properties->C/C+ Build->Binary Parser, 点"PE Windows Parser"2. 点run, run configuration, 在C/C++ Application中点Browse(上面的那个), 选中工程目录下的Debug目录,选择生成的可执行文件. 阅读全文
posted @ 2013-09-25 22:09 赛欧拉 阅读(143) 评论(0) 推荐(0) 编辑

好看的函数图

摘要: 1. 鸡蛋型解析式:x = 0.7*cos(t/4)*sin(t)y = cos(t)图像:python程序:import numpy as npimport matplotlib.pyplot as pltt = np.linspace(-np.pi, np.pi, 100)x = 0.7 * np.cos(t/4) * np.sin(t)y = -np.cos(t)plt.plot(x,y)plt.xlim(-1,1)plt.ylim(-1,1)plt.show()未完待续 阅读全文
posted @ 2013-09-16 19:01 赛欧拉 阅读(1633) 评论(0) 推荐(0) 编辑

R语言学习

摘要: 基本语法赋值aa, 也可以是assign("x",3)基本运算符+, -, *, /, ^基本函数log, exp, sin, cos, tan, sqrt等其他逻辑符号位TRUE和FALSENaN非数字向量产生x <- c(10.4, 5.6, 3.1, 6.4, 21.7)1:n 产生[1,n]的向量.seq是最常用的方式,它的原型是seq(from, to, by=1, length, along) by为步长,默认是1.rep(x, times=2) 将x重复两次产生新的向量, rep(x,each=2) 将x的每个分量重复2次产生新的向量.不同维数的向量一起 阅读全文
posted @ 2013-09-06 22:46 赛欧拉 阅读(329) 评论(0) 推荐(0) 编辑

python画图

摘要: 包含头文件:import numpy as npimport matplotlib.pyplot as plt直接将文件中的二维数组读进来:data = np.loadtxt('data.txt')画图:plt.plot(data[:,0], data[:,1], 'ro')plt.show()其中r为红色,o为形状. 默认是b-.颜色表:AlliasColor'b'blue'g'green'r'red'c'cyan'm'magenta'y'yellow'k& 阅读全文
posted @ 2013-08-04 22:32 赛欧拉 阅读(731) 评论(0) 推荐(0) 编辑

C++技巧

摘要: 文件打开文件时判断文件是否存在:ifstream f("123.txt");if (!f) cout#includeusing namespace std;int date2week(int date){ time_t rawTime; time(&rawTime); struct tm* timeInfo = localtime(&rawTime); timeInfo->tm_year = date / 10000 - 1900; timeInfo->tm_mon = date/100 %100 - 1; timeInfo->tm_mda 阅读全文
posted @ 2013-06-28 21:25 赛欧拉 阅读(223) 评论(0) 推荐(0) 编辑

DLL

摘要: 新建工程,选Win32 Dynamic-Link Library,工程名为dll例子,然后选A DLL that exports some symbols,完成.工程已经有了一个类CDll,一个变量nDll和一个函数fnDll.在类CDll中添加例子函数f.在dll例子.h中添加#ifdef __cplusplusextern "C" {#endif和#ifdef __cplusplus}#endif以下是dll例子.h的代码://手动添加#ifdef __cplusplus // If used by C++ code, extern "C" { // 阅读全文
posted @ 2013-06-27 23:10 赛欧拉 阅读(317) 评论(0) 推荐(0) 编辑

进程共享数据

摘要: 程序A中共享数据, 代码:// 内存共享数据A.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "内存共享数据A.h"#includeusing namespace std;#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif////////////////////////////////////// 阅读全文
posted @ 2013-06-24 23:05 赛欧拉 阅读(316) 评论(0) 推荐(0) 编辑

八数码问题

摘要: #pragma warning(disable:4786)#include#include#include#includeusing namespace std;int gOrient[4][2] = {-1,0, 1,0, 0,-1, 0,1};//-----------------------------------------------------------------------------class State{public: int findPos(int n) const; bool operator calculated; priority_queue ... 阅读全文
posted @ 2013-06-23 11:09 赛欧拉 阅读(263) 评论(0) 推荐(0) 编辑