V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Hlianbobo
V2EX  ›  Python

sage 能判断级数的敛散性么?

  •  
  •   Hlianbobo · 2020-09-13 23:41:38 +08:00 · 1516 次点击
    这是一个创建于 1311 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在网上搜索了一圈,可以找到 mathematica 判断级数敛散性的说明。但是 sage 则没有找到相关的文章。求助论坛大神。是否有这方面的知识分享。

    另外,看了一根 sage 书的目录。sage 似乎可以和 python 下流行的第三方库一起交互工作。不知道 mathematica 是否有支持于 python 交互?
    7 条回复    2020-09-28 13:25:22 +08:00
    necomancer
        1
    necomancer  
       2020-09-14 13:45:00 +08:00
    直接 sum,发散会出错。
    或者
    try:
    ....sum(exp, x, infinity)
    except:
    ....print("diverge")
    这样
    Hlianbobo
        2
    Hlianbobo  
    OP
       2020-09-14 13:59:37 +08:00
    @necomancer 谢谢回复。
    x = var('x')
    try:
    sum(1/(x^2),x,infinity)
    except:
    print("diverge")
    结果是:diverge

    x = var('x,ustar,uend')
    ustar=1
    uend=oo
    try:
    sum(1/(x^2),x,ustar,uend)
    except:
    print("diverge")
    结果还是 diverge

    按理说:级数 1/(x^2) 在 1 到 oo 是收敛的啊。这个结果不对。

    计算地址 https://sagecell.sagemath.org/
    在这里运算必须去掉 sum 和 print 前面的点,否则报错
    另外,不知道有什么 sage 的书推荐么?目前在豆瓣上只找到一本中文书,是 sage 在物理学上的应用,虽然也涉及到部分数学知识,但是数学部分不够全面。例如敛散性的判断目录中就没有涉及。
    necomancer
        3
    necomancer  
       2020-09-14 14:52:08 +08:00
    sum(1/x,x, 1, infinity) ---- ValueError: Sum is divergent.
    sum(1/x^2, x, 1, infinity) ---- 1/6*pi^2

    是不是代码哪有错?我这两个在你给的地方算的是对的呀,expect: 可能跳过了所有错误,应该是 except ValueError,级数发散好像是 value error
    Hlianbobo
        5
    Hlianbobo  
    OP
       2020-09-14 18:36:04 +08:00
    @necomancer 牛。有效。请问你是在哪里学的 sage 的使用方法。有好的中文资料推荐么?我在 sage 官网上下载了两页中文说明,都是 2009 年的,只有两页 pdf 。比较简单。
    necomancer
        6
    necomancer  
       2020-09-15 13:26:42 +08:00
    @Hlianbobo 学点 python 就行。sage 看文档就好。
    shm7
        7
    shm7  
       2020-09-28 13:25:22 +08:00
    没用过,过来给大佬们拜拜。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1452 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:56 · PVG 07:56 · LAX 16:56 · JFK 19:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.