摘要: expr 数学表达式 Tcl支持的数学操作符(优先级按照从高到低): -一元负号 +一元正号 ~按位取反 !逻辑非 *乘 /除 %取余 +加号 -减号 >右移位==等于判断 !=不等于判断 &按位与操作 ^按位异或操作 |按为或操作 &&逻辑与操作||逻辑或操作 x?y:z 如果x为真(... 阅读全文
posted @ 2015-12-04 02:23 硫酸亚铜 阅读(1418) 评论(0) 推荐(0) 编辑
摘要: 用龙贝格算法计算积分 #include #include#include usingnamespace std; int power(int a, intb) { intresult = 1; if(b == 0) returnre... 阅读全文
posted @ 2015-12-04 01:53 硫酸亚铜 阅读(775) 评论(0) 推荐(0) 编辑
摘要: binary format 格式化描述符 参数1 参数2...参数N binary scan 二进制数据 格式化描述符 变量1 变量2... 变量N 格式化描述符由两部分组成,第一是格式化类型关键字(一个字母),另一个为可选的整数count(不选,默认为1)注意:格式化关键字区分大小写 格式化... 阅读全文
posted @ 2015-11-28 23:29 硫酸亚铜 阅读(1076) 评论(0) 推荐(0) 编辑
摘要: 摘自《c++和面向对象数值计算》,代码简洁明快,采用模板函数,通用性增强,牛顿差分合理利用存储空间,采用Horner算法(又称秦九韶算法)提高精度,减少时间复杂度,高!确实是高!对其中代码稍加改动。#include#include using namespace std;template T ... 阅读全文
posted @ 2015-11-28 20:51 硫酸亚铜 阅读(767) 评论(0) 推荐(1) 编辑
摘要: 摘自《c++和面向对象数值计算》,代码简洁明快,采用模板函数,通用性增强,对其中代码稍加改动#include#include using namespace std;template T lagrange(constvector&vx,constvector&vy,T x); int main... 阅读全文
posted @ 2015-11-28 16:30 硫酸亚铜 阅读(1193) 评论(0) 推荐(0) 编辑
摘要: 本程序对cosx函数进行插值,取步长为0.1,因此x的值为0.00,0.10,0.20,0.30,对应的y值为cos(0.00),cos(0.10),cos(0.20),cos(0.30),其实本程序Horner方法(又称秦九韶算法)效率更高,计算更加准确#include #include u... 阅读全文
posted @ 2015-11-28 11:51 硫酸亚铜 阅读(738) 评论(0) 推荐(0) 编辑
摘要: XY0.400.410750.550.578150.650.696750.800.888110.901.026521.051.25382#includeusing namespacestd;doubleaverage_deviation(double* function_value,doubl... 阅读全文
posted @ 2015-11-28 05:10 硫酸亚铜 阅读(1027) 评论(0) 推荐(0) 编辑
摘要: #include#include #include"matlib.h"using namespacestd;int main(){ initM(MATCOM_VERSION); //初始化Matcom C++矩阵库,当与exitM()同时使用,否则会造成内存泄露 Mma... 阅读全文
posted @ 2015-11-28 03:23 硫酸亚铜 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 已给sin0.32=0.314567,sin0.34=0.333487,sin0.36=0.352274,计算sin0.3367的值#include #include#include using namespace std;int main(){ double numerator_c... 阅读全文
posted @ 2015-11-27 23:53 硫酸亚铜 阅读(1757) 评论(0) 推荐(0) 编辑
摘要: C++当中获得现在计算机上所能表示的各种类型(比如int,longint,shortint,double,float等)最大最小有两种方法,一种是使用c++预先定义的宏,对于有些编译器可能需要包含和两种头文件,还有一种是使用numeric_limits::max()和numeric_limit... 阅读全文
posted @ 2015-11-27 20:37 硫酸亚铜 阅读(523) 评论(0) 推荐(0) 编辑