python数学和物理模块

matphys的Python项目详细描述


Matphys 1.1.27版

python数学和物理模块

  • 帕斯卡三角形
  • 钟形三角形
  • 欧拉三角形
  • 欧拉常数
  • 幂级数
  • 弗洛伊德三角形
  • 斐波那契序列

PASCAL模块

帕斯卡三角形

>>> from matphys import pascal
>>> p = pascal.PascalTriangle(10) #arg is the number of rows wanted
>>> p.read()
[1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
[1, 5, 10, 10, 5, 1]
[1, 6, 15, 20, 15, 6, 1]
[1, 7, 21, 35, 35, 21, 7, 1]
[1, 8, 28, 56, 70, 56, 28, 8, 1]
[1, 9, 36, 84, 126, 126, 84, 36, 9, 1]
>>> p.row(5) #arg is row number
16

钟形模块

钟形三角形

>>> from matphys import bell
>>> b = bell.BellTriangle(10) #arg is the number of rows wanted
>>> b.read()
[1]
[1, 2]
[2, 3, 5]
[5, 7, 10, 15]
[15, 20, 27, 37, 52]
[52, 67, 87, 114, 151, 203]
[203, 255, 322, 409, 523, 674, 877]
[877, 1080, 1335, 1657, 2066, 2589, 3263, 4140]
[4140, 5017, 6097, 7432, 9089, 11155, 13744, 17007, 21147]
[21147, 25287, 30304, 36401, 43833, 52922, 64077, 77821, 94828, 115975]
>>> b.row(5) #arg is row number
151

弗洛伊德模块

弗洛伊德三角形

>>> from matphys import floyd
>>> f = floyd.FloydTriangle(10) #arg is the number of rows wanted
>>> f.read()
[1]
[2, 3]
[4, 5, 6]
[7, 8, 9, 10]
[11, 12, 13, 14, 15]
[16, 17, 18, 19, 20, 21]
[22, 23, 24, 25, 26, 27, 28]
[29, 30, 31, 32, 33, 34, 35, 36]
[37, 38, 39, 40, 41, 42, 43, 44, 45]
[46, 47, 48, 49, 50, 51, 52, 53, 54, 55]
>>> f.row(5) #arg is row number
65

欧拉模块

欧拉三角形

>>> from matphys import euler
>>> e = euler.EulerTriangle(10) #arg is the number of rows wanted
>>> e.read()
[1]
[1, 1]
[1, 4, 1]
[1, 11, 11, 1]
[1, 26, 66, 26, 1]
[1, 57, 302, 302, 57, 1]
[1, 120, 1191, 2416, 1191, 120, 1]
[1, 247, 4293, 15619, 15619, 4293, 247, 1]
[1, 502, 14608, 88234, 156190, 88234, 14608, 502, 1]
[1, 1013, 47840, 455192, 1310354, 1310354, 455192, 47840, 1013, 1]
>>> e.row(5)
120

欧拉数

欧拉数在数学上用(e)表示

>>> from matphys import euler
>>> e = euler.EulerNumber(128500000) #arg is the precision
>>> e.read()
2.7182818243

欧拉常数

欧拉常数在数学上用伽马(γ)表示

>>> from matphys import euler
>>> e = euler.EulerConstant(10000000) #arg is the precision of the constant
>>> e.read()
0.577265664068

功率系列

>>> from matphys import euler
>>> p = euler.PowerSeries(10, 10) #args are (n, x)
>>> p.read()
12842.305114638448

斐波那契模

斐波那契序列

>>> from matphys import fibonacci
>>> f = fibonacci.FibonacciSequence(10) #arg is the sequence out to the nth term
>>> f.read()
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在用户输入小于0的数字时中断扫描仪?   为什么JIT编译器(Java)不保存结果?   查询中的配置单元Sparksql错误:不支持java类型类java。util。ArrayList   java maven缺少plexusutils的插件描述符   基于列表项位置的java替换片段   java在安卓中测试类编辑文本字段时出现空指针异常   java通过socketsReusing端口定期查询客户端以进行更新   异常setDefaultAuthenticator导致java错误。安全GWT web应用程序中的AccessControlException   java GridBagLayout填充空白空间   JAVAlang.NoClassDefFoundError:无法初始化类组织。阿帕奇。http。康涅狄格州。SSL连接插座厂   在Phone Gap中通过Ajax实现java JSON效果不佳   java有没有办法从spring上下文获取Hibernate SequenceGenerator?   java在本地主机上共享文件的替代方法   java如何将数据插入到content://media/external/audio/albumart通过内容解析器(如果是Mediastore)。音频媒体数据已弃用?   使用JAVA反射类执行函数   java如何模拟来自Faces上下文和外部上下文的请求?   javax的java替代位置。Windows中的comm.properties   java如何使用Spring表单标记包含jsp页面?   java包含来自Servlet的私有JSP