| 查看: 1055 | 回复: 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 想求教是否有方法将发散级数大区间的求和结果用数值型表示?并且能够保留合适精度,带入后续计算过程? 不胜感谢! |
» 猜你喜欢
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
实验室接单子
已经有7人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复

hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6324.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
4楼2014-08-25 15:56:31
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6324.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206小时
- 虫号: 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












回复此楼