| 查看: 1058 | 回复: 3 | |||
herozhu木虫 (正式写手)
|
[求助]
用symsum计算发散级数和无法转换为数值型
|
|
如题,需要计算一个发散级数的有限项和,级数喂 >> syms n x >> ff=n^2*exp(-10*(1-1/n^2)) ff = n^2*exp(10/n^2 - 10) >> symsum(ff,n,1,1e18) ans = sum(n^2*exp(10/n^2 - 10), n == 1..1000000000000000000) 用double(ans),出现错误提示: Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead. Error in sym/double (line 827) Xstr = mupadmex('symobj::double', S.s, 0); 尝试用vpa转换, >> vpa(ans) ans = numeric::sum(n^2*exp(10.0/n^2 - 10.0), n == 1..1000000000000000000) 得到的结果尝试进行后续数值计算,比如ans/1e5: >> ans/1e5 ans = numeric::sum(n^2*exp(10.0/n^2 - 10.0), n == 1..1000000000000000000)/100000 想求教是否有方法将发散级数大区间的求和结果用数值型表示?并且能够保留合适精度,带入后续计算过程? 不胜感谢! |
» 猜你喜欢
交叉科学部支持青年基金,对三无青椒是个机会吗?
已经有3人回复
国家级人才课题组招收2026年入学博士
已经有5人回复
Fe3O4@SiO2合成
已经有6人回复
青年基金C终止
已经有4人回复
青椒八年已不青,大家都被折磨成啥样了?
已经有7人回复
为什么nbs上溴 没有产物点出现呢
已经有10人回复
救命帖
已经有11人回复
招博士
已经有5人回复
26申博求博导推荐-遥感图像处理方向
已经有4人回复
限项规定
已经有7人回复

hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6329.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206.3小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
★ ★ ★ ★ ★ ★ ★ ★ ★ ★
herozhu(nono2009代发): 金币+10 2015-09-09 06:04:44
herozhu(nono2009代发): 金币+10 2015-09-09 06:04:44
|
貌似循环次数太多,建议分开算,分开也够多的。下面是我的想法 clear; clc; uplim=1e6; lowlim=1; cycltime=uplim/1e5; syms n result=0; for i=1:cycltime temp1=symsum(n^2*exp(10/n^2)/exp(10),n,(i-1)*1e5+1,i*1e5); temp2=vpa(temp1); result=result+temp2; end disp(result) |
2楼2014-08-25 11:33:47
herozhu
木虫 (正式写手)
- 应助: 0 (幼儿园)
- 金币: 2408.6
- 散金: 31
- 红花: 1
- 帖子: 514
- 在线: 118.9小时
- 虫号: 1772719
- 注册: 2012-04-23
- 性别: GG
- 专业: 零件加工制造

3楼2014-08-25 14:44:04
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6329.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206.3小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
4楼2014-08-25 15:56:31













回复此楼