哪种编程语言或库可以处理无限系列? [英] Which programming language or a library can process Infinite Series?

查看:150
本文介绍了哪种编程语言或库可以处理无限系列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种编程语言或库能够处理无限级数(如几何或谐波)?它可能必须拥有一些知名系列的数据库,并在收敛的情况下自动给出适当的值,并且可能在发散情况下产生异常。



例如,在Python中,它可能如下所示:

  sum = 0 
sign = -1.0
(1,Infinity,2):
sign = -
$ + $ sign $ / $ $ b

然后,sum必须是math.pi / 4,而不在循环中进行任何计算(因为它是一个众所周知的总和)。

解决方案

你需要一些可以做象征性计算的东西,比如 Mathematica
您也可以考虑quering wolframaplha:sum(( - 1)^ i * 1 / i,i,1,inf)

Which programming language or a library is able to process infinite series (like geometric or harmonic)? It perhaps must have a database of some well-known series and automatically give proper values in case of convergence, and maybe generate an exception in case of divergence.

For example, in Python it could look like:

sum  = 0
sign = -1.0
for i in range(1,Infinity,2):
     sign = -sign
     sum += sign / i

then, sum must be math.pi/4 without doing any computations in the loop (because it's a well-known sum).

解决方案

You need something that can do a symbolic computation like Mathematica. You can also consider quering wolframaplha: sum((-1)^i*1/i, i, 1 , inf)

这篇关于哪种编程语言或库可以处理无限系列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆