V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Sep 13, 2020 · 2000 views
    This topic created in 2052 days ago, the information mentioned may be changed or developed.
    在网上搜索了一圈,可以找到 mathematica 判断级数敛散性的说明。但是 sage 则没有找到相关的文章。求助论坛大神。是否有这方面的知识分享。

    另外,看了一根 sage 书的目录。sage 似乎可以和 python 下流行的第三方库一起交互工作。不知道 mathematica 是否有支持于 python 交互?
    7 replies    2020-09-28 13:25:22 +08:00
    necomancer
        1
    necomancer  
       Sep 14, 2020
    直接 sum,发散会出错。
    或者
    try:
    ....sum(exp, x, infinity)
    except:
    ....print("diverge")
    这样
    Hlianbobo
        2
    Hlianbobo  
    OP
       Sep 14, 2020
    @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  
       Sep 14, 2020
    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
       Sep 14, 2020
    @necomancer 牛。有效。请问你是在哪里学的 sage 的使用方法。有好的中文资料推荐么?我在 sage 官网上下载了两页中文说明,都是 2009 年的,只有两页 pdf 。比较简单。
    necomancer
        6
    necomancer  
       Sep 15, 2020
    @Hlianbobo 学点 python 就行。sage 看文档就好。
    shm7
        7
    shm7  
       Sep 28, 2020
    没用过,过来给大佬们拜拜。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1002 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 19:10 · PVG 03:10 · LAX 12:10 · JFK 15:10
    ♥ Do have faith in what you're doing.