PyPyNum 1.8.1__py3-none-any.whl → 1.8.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.8.1
4
- Summary: A multifunctional mathematical calculation package written in pure Python programming language [Python>=3.5]
5
- Home-page: https://www.gitee.com/PythonSJL/PyPyNum
3
+ Version: 1.8.2
4
+ Summary: A multifunctional mathematical calculation package written in pure Python programming language [Python>=3.4]
5
+ Home-page: https://github.com/PythonSJL/PyPyNum
6
6
  Author: Shen Jiayi
7
7
  Author-email: 2261748025@qq.com
8
8
  License:
@@ -669,13 +669,13 @@ License:
669
669
  <http://www.gnu.org/licenses/>.
670
670
 
671
671
  Keywords: math,数学,mathematics,数学计算,numerical,数值,computation,计算,scientific,科学,algebra,代数,calculus,微积分,statistics,统计,linear-algebra,线性代数,optimization,优化,numerical-analysis,数值分析,matrix,矩阵,vector,向量,tensor,张量,numerics,数值计算,library,库,tools,工具,utils,实用程序,algorithms,算法,software,软件,package,包,methods,方法,data-science,数据科学,machine-learning,机器学习,computational,计算的,operations,操作,functions,函数,processing,处理,programming,编程,simulation,仿真,visualization,可视化,physics,物理
672
- Requires-Python: >=3.5
672
+ Requires-Python: >=3.4
673
673
  Description-Content-Type: text/markdown
674
674
 
675
675
  # <font color = blue>PyPyNum</font>
676
676
 
677
677
  <font color = gree>A multifunctional mathematical calculation package written in pure Python programming language
678
- </font><font color = red>[Python>=3.5]</font>
678
+ </font><font color = red>[Python>=3.4]</font>
679
679
 
680
680
  ```
681
681
  ________ ___ ___ ________ ___ ___ ________ ___ ___ _____ ______
@@ -692,7 +692,7 @@ Description-Content-Type: text/markdown
692
692
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
693
693
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
694
694
 
695
- ## Version -> 1.8.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum
695
+ ## Version -> 1.8.2 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
696
696
 
697
697
  ![LOGO](PyPyNum.png)
698
698
 
@@ -704,8 +704,9 @@ The logo cannot be displayed on PyPI, it can be viewed in Gitee.
704
704
 
705
705
  #### Introduction
706
706
 
707
- + DIY数学库,类似于numpy、scipy等,专为PyPy解释器制作
708
- + DIY math library, similar to numpy, scipy, etc., specifically designed for PyPy interpreters
707
+ + 多功能数学库,类似于numpy、scipy等,专为PyPy解释器制作,亦支持其他类型的Python解释器
708
+ + Multi functional math library, similar to numpy, scipy, etc., designed specifically for PyPy interpreters and also
709
+ supports other types of Python interpreters
709
710
  + 不定期更新版本,增加更多实用功能
710
711
  + Update versions periodically to add more practical features
711
712
  + 如需联系,QQ 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰)
@@ -741,26 +742,49 @@ Python interpreter and run it!)
741
742
  ```
742
743
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
743
744
 
744
- eig函数修复了计算错误并改名为eigen
745
+ 已确认此库能够向下兼容Python 3.4版本
746
+ 以此支持IronPython解释器。
745
747
 
746
- The eig function fixed
747
- calculation errors and changed
748
- its name to eigen
748
+ It has been confirmed that this
749
+ library is backward compatible
750
+ with Python version 3.4 to
751
+ support the IronPython
752
+ interpreter.
749
753
 
750
754
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
751
755
 
752
- <<<以下结构中的省略号表示原有的部分>>>
756
+ 修改并优化了部分功能。
753
757
 
754
- <<<The ellipsis in the following structure represents the original part>>>
758
+ Modified and optimized some
759
+ features.
755
760
 
756
- PyPyNum
757
- ★ Matrix [Matrix calculation]
758
- FUNCTIONS
759
- ...
760
- rotate90(matrix: pypynum.Matrix.Matrix, times: int) -> pypynum.Matrix.Matrix
761
- hessenberg(matrix: pypynum.Matrix.Matrix) -> tuple
762
- eigen(matrix: pypynum.Matrix.Matrix) -> tuple
763
- ...
761
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
762
+
763
+ 修改了fill函数,该函数将一维值序列填充
764
+ 到指定形状的数组中。如果未指定列表,则默
765
+ 认为从零开始递增的序列。此函数默认为循环
766
+ 填充,否则使用零填充来填充剩余位置。
767
+
768
+ Modified the fill function,
769
+ which fills a one-dimensional
770
+ value sequence into an array of
771
+ specified shapes. If no list is
772
+ specified, it defaults to a
773
+ sequence that increments from
774
+ zero. This function defaults to
775
+ loop padding, otherwise zero
776
+ padding is used to fill the
777
+ remaining positions.
778
+
779
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
780
+
781
+ 使用辛普森公式提高定积分的计算精度。
782
+
783
+ Use Simpson's formula to improve
784
+ the calculation accuracy of
785
+ definite integrals.
786
+
787
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
764
788
  ```
765
789
 
766
790
  ### 运行用时测试
@@ -811,7 +835,7 @@ PyPyNum
811
835
  Array
812
836
  FUNCTIONS
813
837
  array(data=None)
814
- fill(shape, sequence=None)
838
+ fill(shape, sequence=None, repeat=True)
815
839
  function(_array, _function, args=None)
816
840
  get_shape(data)
817
841
  is_valid_array(_array, _shape)
@@ -1,4 +1,4 @@
1
- pypynum/Array.py,sha256=MLGvkYC9V7fGAR3g1Xykt_-hJYDC8mE47ji8dBcqFhk,6632
1
+ pypynum/Array.py,sha256=U6_BzAazuz0XY6LAsRtxW9NS6vY-oF8Pk-N49_vQlgI,6739
2
2
  pypynum/FourierT.py,sha256=AtG0tESykzEs4gDsXhcizW7qhQnmw0gjcWcXefBqzhs,1401
3
3
  pypynum/Geometry.py,sha256=bJCuif-wHO-t7oHFEE7ntzIdQwzUEbT3mcKgmBV6Wps,13982
4
4
  pypynum/Graph.py,sha256=m9iTCNYRCZmAexDzwJ8Y6J7v1aweT-6TZkqh4fOtZDE,10131
@@ -7,20 +7,20 @@ pypynum/Logic.py,sha256=IJAv59ECHU0HmG9lYCAQ_puqeL6Zor3-IDIVH48KBWE,11000
7
7
  pypynum/Matrix.py,sha256=vjkz-m90aWDIv2vzXBriyb4vwaZv8tsPYZzPUeUh-Vk,18050
8
8
  pypynum/NeuralN.py,sha256=iSOvC9JW1h4AFGokGGOTkKie5hAYN_YT9H4f3apI9b8,3275
9
9
  pypynum/PyPyNum.png,sha256=t96tJPWfHxT8kcXm_qZI2z5W36TgOqjCU9qdgbmlFws,11623
10
- pypynum/Quaternion.py,sha256=E7ajc4sDJyOuQQIwKPhUEHgiaeeR5BEzFZHhJMxvbok,8007
11
- pypynum/README.md,sha256=eouG6yg8No8iooz_5cLZqS-pR0eMzgtbLBassoqspVE,42891
10
+ pypynum/Quaternion.py,sha256=-BW_crP_i-veHN0_pD3Z1dipFNUX198oZDrUYTsoZw0,8017
11
+ pypynum/README.md,sha256=0M7ZUC1Xi4duMsXQ61cwoUiVg5hBa_PiAsnaeuruZtE,43586
12
12
  pypynum/Symbolics.py,sha256=Nfo0DEch7LII53ye1wZAdIfd3IAOKbECnZQMSk_cmCs,2898
13
13
  pypynum/Tensor.py,sha256=SJzGRNwHZzOgEabt47scccb-plA25-6s01SFyHd6lJo,3801
14
14
  pypynum/Tree.py,sha256=MUT9LErZ3ER_cbiga-nOaZC7Hln8jEV8tRca2dRPWmY,2827
15
- pypynum/Vector.py,sha256=eiFCY6H35pMvvDX7NpLux_bSfLI8rK8JHkaRxv7pOW8,3552
16
- pypynum/__init__.py,sha256=wjl8Vtz9hWI7UP-Hh2JggiLf1FR0VMusXUyG2CGfzAg,1843
15
+ pypynum/Vector.py,sha256=0GSLDmUE0ZWB4JELB4rL6xHhf767wJlSIIdLt2ZpO9M,3526
16
+ pypynum/__init__.py,sha256=h801qsk1weSnt6yQ97HKc9aNpZpvDh9lpyfauhnpVQU,1905
17
17
  pypynum/chars.py,sha256=VcK9w0i73FMCzc-9aIibjdHqyMsofJXdoBq0d8L7Vr0,1001
18
18
  pypynum/cipher.py,sha256=J5PZl8Xt71LuX29eSBu4cybNK6Z3rhA9og_YzD0YJfU,1002
19
19
  pypynum/constants.py,sha256=s2P1K8HH2nqoA6_YOVf6TKRl1Ozjf79GmCmLN9YbWxI,843
20
20
  pypynum/equations.py,sha256=Bn1_VjwMnnvzT0mHYI0eAARRqIHuc3IpOfYvzojTPx0,713
21
21
  pypynum/errors.py,sha256=11-Au4aV8H5ExaDuMtu5iuGvpRaJP8gW7XbGNRmefSI,173
22
22
  pypynum/file.py,sha256=rqrPdcX0NOEPM8s40-ymgPKsTn0HKABW-VEh1OtPnsk,3188
23
- pypynum/maths.py,sha256=Nf_1k1VpKDFWUJQlwB40ljML6xHcW9INlAtstJi3Uc0,26637
23
+ pypynum/maths.py,sha256=EmhJA0lR5tPYB3qPiY04zBhO-qnF9-Vd-DbCGC8q9H0,26719
24
24
  pypynum/numbers.py,sha256=WOxwwAN3yHakN4eHcVNn35qsfDcgw3UPSblv4woWyDE,6028
25
25
  pypynum/plotting.py,sha256=xoaG6KVoKTu2Zax2FXk3_bHkiu5LguGi_siNi1FLE98,8463
26
26
  pypynum/polynomial.py,sha256=psFukA31Ed4U7hZHcCGWCpYMi8tanTsZl-pUdklikfg,5998
@@ -28,12 +28,12 @@ pypynum/probability.py,sha256=kZLCfZb2q_y1CVbozSZj9xQ8Dw3il5WcAojX0jsNyXw,2130
28
28
  pypynum/random.py,sha256=vfTtyH5yOSKJoSI_-NT_Tg8wC-ZXT0wt34f87oaSpJY,4610
29
29
  pypynum/regression.py,sha256=D9J9lM23HiyY4eE8vHKaHoiwuvD1RYhkVNO0jQ4yml4,2118
30
30
  pypynum/sequence.py,sha256=7NSZm_p_B00KFj5XZrtSm2FXhsowxs0qg_Q_P4pAA8o,7194
31
- pypynum/test.py,sha256=Bksa7HZaywKBbLaCw2R5kGRFj6eKzkkJ7BdJBgIB3uM,8428
32
- pypynum/this.py,sha256=8Swp75xE5g6436NCVDfYUVwUzUcQFPLcCNFWQWY5eGQ,2129
31
+ pypynum/test.py,sha256=exqz_CRCCakwgFi9NvUWGuFl8qUxTePLUP1C4WWbCc0,8461
32
+ pypynum/this.py,sha256=GORWMUN9HCx0pr2wR712nwZLj-OfQmZGvnIhmof57X0,2162
33
33
  pypynum/tools.py,sha256=jqmzsRi2INRlnI4hb4IbpMKHlvEww3ZKO9y6DxrJUbA,12697
34
34
  pypynum/types.py,sha256=CVWPZo_ACr_QGH5gAOhoG3jK35peiqipu3PH8ScEYHE,181
35
35
  pypynum/utils.py,sha256=V1k-JFHLr_VGUVqwOeAVH9Ju7AHQVEoVgYA7M-dPsLw,9881
36
- PyPyNum-1.8.1.dist-info/METADATA,sha256=y9fXQuOCwcMcXjemYXpTwz5vPiQKTACt3l_9w-nhjxA,84338
37
- PyPyNum-1.8.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
38
- PyPyNum-1.8.1.dist-info/top_level.txt,sha256=4wW_Xb4bRglmiMsdPAe9f75MkXhNpuN88H17g_Cr5u8,8
39
- PyPyNum-1.8.1.dist-info/RECORD,,
36
+ PyPyNum-1.8.2.dist-info/METADATA,sha256=inblOm7FFuZjEyxTtefkuJECcNAxC16l9MoNYtNS-PA,85030
37
+ PyPyNum-1.8.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
38
+ PyPyNum-1.8.2.dist-info/top_level.txt,sha256=4wW_Xb4bRglmiMsdPAe9f75MkXhNpuN88H17g_Cr5u8,8
39
+ PyPyNum-1.8.2.dist-info/RECORD,,
pypynum/Array.py CHANGED
@@ -183,19 +183,22 @@ def zeros_like(_nested_list):
183
183
  return 0
184
184
 
185
185
 
186
- def fill(shape, sequence=None):
186
+ def fill(shape, sequence=None, repeat=True):
187
187
  pointer = -1
188
188
  length = 1
189
189
  for item in shape:
190
190
  length *= item
191
191
  if sequence is None:
192
192
  sequence = list(range(length))
193
+ total = len(sequence)
193
194
 
194
195
  def inner(_shape):
195
196
  nonlocal pointer
196
197
  if len(_shape) == 0:
198
+ if pointer == total and not repeat:
199
+ return 0
197
200
  pointer += 1
198
- return sequence[pointer % len(sequence)]
201
+ return sequence[pointer % total]
199
202
  else:
200
203
  _array = []
201
204
  for i in range(_shape[0]):
pypynum/Quaternion.py CHANGED
@@ -203,4 +203,4 @@ def change(data: Union[Quaternion, Matrix, Euler], to: str) -> Union[Quaternion,
203
203
  roll = atan2(t3, t4)
204
204
  return Euler(yaw, pitch, roll)
205
205
  else:
206
- raise TypeError("Data can only be Euler or Quaternion")
206
+ raise TypeError("Data can only be Euler or Matrix or Quaternion")
pypynum/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # <font color = blue>PyPyNum</font>
2
2
 
3
3
  <font color = gree>A multifunctional mathematical calculation package written in pure Python programming language
4
- </font><font color = red>[Python>=3.5]</font>
4
+ </font><font color = red>[Python>=3.4]</font>
5
5
 
6
6
  ```
7
7
  ________ ___ ___ ________ ___ ___ ________ ___ ___ _____ ______
@@ -18,7 +18,7 @@
18
18
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
19
19
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
20
20
 
21
- ## Version -> 1.8.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum
21
+ ## Version -> 1.8.2 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
22
22
 
23
23
  ![LOGO](PyPyNum.png)
24
24
 
@@ -30,8 +30,9 @@ The logo cannot be displayed on PyPI, it can be viewed in Gitee.
30
30
 
31
31
  #### Introduction
32
32
 
33
- + DIY数学库,类似于numpy、scipy等,专为PyPy解释器制作
34
- + DIY math library, similar to numpy, scipy, etc., specifically designed for PyPy interpreters
33
+ + 多功能数学库,类似于numpy、scipy等,专为PyPy解释器制作,亦支持其他类型的Python解释器
34
+ + Multi functional math library, similar to numpy, scipy, etc., designed specifically for PyPy interpreters and also
35
+ supports other types of Python interpreters
35
36
  + 不定期更新版本,增加更多实用功能
36
37
  + Update versions periodically to add more practical features
37
38
  + 如需联系,QQ 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰)
@@ -67,26 +68,49 @@ Python interpreter and run it!)
67
68
  ```
68
69
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
69
70
 
70
- eig函数修复了计算错误并改名为eigen
71
+ 已确认此库能够向下兼容Python 3.4版本
72
+ 以此支持IronPython解释器。
71
73
 
72
- The eig function fixed
73
- calculation errors and changed
74
- its name to eigen
74
+ It has been confirmed that this
75
+ library is backward compatible
76
+ with Python version 3.4 to
77
+ support the IronPython
78
+ interpreter.
75
79
 
76
80
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
77
81
 
78
- <<<以下结构中的省略号表示原有的部分>>>
82
+ 修改并优化了部分功能。
79
83
 
80
- <<<The ellipsis in the following structure represents the original part>>>
84
+ Modified and optimized some
85
+ features.
81
86
 
82
- PyPyNum
83
- ★ Matrix [Matrix calculation]
84
- FUNCTIONS
85
- ...
86
- rotate90(matrix: pypynum.Matrix.Matrix, times: int) -> pypynum.Matrix.Matrix
87
- hessenberg(matrix: pypynum.Matrix.Matrix) -> tuple
88
- eigen(matrix: pypynum.Matrix.Matrix) -> tuple
89
- ...
87
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
88
+
89
+ 修改了fill函数,该函数将一维值序列填充
90
+ 到指定形状的数组中。如果未指定列表,则默
91
+ 认为从零开始递增的序列。此函数默认为循环
92
+ 填充,否则使用零填充来填充剩余位置。
93
+
94
+ Modified the fill function,
95
+ which fills a one-dimensional
96
+ value sequence into an array of
97
+ specified shapes. If no list is
98
+ specified, it defaults to a
99
+ sequence that increments from
100
+ zero. This function defaults to
101
+ loop padding, otherwise zero
102
+ padding is used to fill the
103
+ remaining positions.
104
+
105
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
106
+
107
+ 使用辛普森公式提高定积分的计算精度。
108
+
109
+ Use Simpson's formula to improve
110
+ the calculation accuracy of
111
+ definite integrals.
112
+
113
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
90
114
  ```
91
115
 
92
116
  ### 运行用时测试
@@ -137,7 +161,7 @@ PyPyNum
137
161
  Array
138
162
  FUNCTIONS
139
163
  array(data=None)
140
- fill(shape, sequence=None)
164
+ fill(shape, sequence=None, repeat=True)
141
165
  function(_array, _function, args=None)
142
166
  get_shape(data)
143
167
  is_valid_array(_array, _shape)
pypynum/Vector.py CHANGED
@@ -45,7 +45,7 @@ class Vector(Array):
45
45
  return self.norm()
46
46
 
47
47
  def __pos__(self):
48
- return Vector([abs(item) for item in self.data])
48
+ return Vector([item for item in self.data])
49
49
 
50
50
  def __neg__(self):
51
51
  return Vector([-item for item in self.data])
@@ -73,7 +73,7 @@ class Vector(Array):
73
73
  for a in range(self.len):
74
74
  axis = Vector([1 if p == a else 0 for p in range(self.len)])
75
75
  result.append(acos(self @ axis / (self.norm() * axis.norm())))
76
- elif isinstance(axes, int) and abs(axes) == axes:
76
+ elif int(abs(axes)) == axes:
77
77
  axis = Vector([1 if p == axes else 0 for p in range(self.len)])
78
78
  result = acos(self @ axis / (self.norm() * axis.norm()))
79
79
  elif isinstance(axes, (list, tuple)):
pypynum/__init__.py CHANGED
@@ -21,7 +21,7 @@ from .Graph import *
21
21
  from .Group import group
22
22
  from .Logic import *
23
23
  from .maths import *
24
- from .Matrix import mat, identity, rotate90, lu, qr, eigen, svd
24
+ from .Matrix import mat, identity, rotate90, lu, qr, hessenberg, eigen, svd
25
25
  from .NeuralN import *
26
26
  from .numbers import *
27
27
  from .plotting import unary, binary, c_unary, color
@@ -39,7 +39,7 @@ from . import types
39
39
  from .utils import OrderedSet, InfIterator
40
40
  from .Vector import vec
41
41
 
42
- __version__ = "1.8.1"
42
+ __version__ = "1.8.2"
43
43
  print("PyPyNum", "Version -> " + __version__, "PyPI -> https://pypi.org/project/PyPyNum/",
44
- "Gitee -> https://www.gitee.com/PythonSJL/PyPyNum", sep=" | ")
44
+ "Gitee -> https://www.gitee.com/PythonSJL/PyPyNum", "GitHub -> https://github.com/PythonSJL/PyPyNum", sep=" | ")
45
45
  del math, arr, ite, num, real, geom, ContentError, RandomError, LogicError, InputError, FullError, Union
pypynum/maths.py CHANGED
@@ -750,7 +750,7 @@ def pi(i: int, n: int, f) -> num:
750
750
  return product(list(map(f, range(i, n + 1))))
751
751
 
752
752
 
753
- def derivative(f, x: real, h: real = 1e-7) -> float:
753
+ def derivative(f, x: real, h: real = 1e-6) -> float:
754
754
  """
755
755
  introduction
756
756
  ==========
@@ -759,17 +759,18 @@ def derivative(f, x: real, h: real = 1e-7) -> float:
759
759
  example
760
760
  ==========
761
761
  >>> derivative(lambda a: a ** 2, 2)
762
- 3.9999999956741306
762
+ 4.000000000115023
763
763
  >>>
764
764
  :param f: function
765
765
  :param x: integer | float
766
766
  :param h: integer | float
767
767
  :return:
768
768
  """
769
+ h = h / 2
769
770
  return (f(x + h) - f(x - h)) / (2 * h)
770
771
 
771
772
 
772
- def definite_integral(f, x_start: real, x_end: real, n: int = 10000000) -> float:
773
+ def definite_integral(f, x_start: real, x_end: real, n: int = 1000000) -> float:
773
774
  """
774
775
  introduction
775
776
  ==========
@@ -778,7 +779,7 @@ def definite_integral(f, x_start: real, x_end: real, n: int = 10000000) -> float
778
779
  example
779
780
  ==========
780
781
  >>> definite_integral(lambda a: a ** 2, 0, 2)
781
- 2.6666666666664036
782
+ 2.666666666666616
782
783
  >>>
783
784
  :param f: function
784
785
  :param x_start: integer | float
@@ -787,11 +788,10 @@ def definite_integral(f, x_start: real, x_end: real, n: int = 10000000) -> float
787
788
  :return:
788
789
  """
789
790
  h = (x_end - x_start) / n
790
- _sum = 0
791
- for i in range(n):
792
- x = x_start + i * h
793
- _sum += f(x + h) + f(x)
794
- return _sum * h / 2
791
+ s = f(x_start) + f(x_end)
792
+ s += sum(map(lambda i: 4 * f(x_start + i * h), range(1, n, 2)))
793
+ s += sum(map(lambda i: 2 * f(x_start + i * h), range(2, n - 1, 2)))
794
+ return s * h / 3
795
795
 
796
796
 
797
797
  def beta(p: real, q: real) -> real:
pypynum/test.py CHANGED
@@ -271,7 +271,8 @@ print(tools.frange(0, 3, 0.4))
271
271
  print(tools.linspace(0, 2.8, 8))
272
272
 
273
273
  for _ in list(globals().keys()):
274
- del globals()[_]
274
+ if _ != "__builtins__":
275
+ del globals()[_]
275
276
  del _
276
277
 
277
278
  print("""\033[91m
pypynum/this.py CHANGED
@@ -5,5 +5,6 @@ The Zen of PyPyNum
5
5
  Zen = "\x9a¤¢\xa0¢°¼§¢°éâñåâòõÖ°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°\x9a\x9a±äù°õóñâòýõ°ã·äõü½äàõóþÿó°äåÿôþñäã°ñ°ãù°þ÷ùãõô°âñüåôÿÝ\x9a¾÷þùãùýÿâà°õò°äø÷ùý°äù°¼ôâñçâÿöäø÷ùñâäã°ãù°þÿùäñäþõýõüàýù°õøä°öÙ\x9a¾äù°âõôùãþÿóõâ°¼ôþõøõâàýÿó°ÿä°÷þù÷þõüüñøó°ãù°þÿùäñäþõýõüàýù°õøä°öÙ\x9a¾÷þùøãåâ°ÿä°âÿùâõàåã°ãù°÷þùäùñç°ãõýùäõýÿã°¼âõæõçÿØ\x9a¾þÿùäñþùäãñâóÿâà°þñøä°âõääõò°ãù°éüäàýÿâà°÷þùäóÑ\x9a¾øóñÿâààñ°ãåÿùæòÿ½õþÿ°éüþÿ°õøä°¼éüüñõôù½õþÿ°õò°äãåý°õâõøÄ\x9a¾õäñüåóõàã°ÿä°õ÷âå°õøä°äãùãõâ°¼ããõþõå÷ñæ°öÿ°õóþõãõâà°õøä°þÙ\x9a¾ôõäåý°éüäùóùüàèõ°ããõüþÅ\x9a¾ôõóþõüùã°äÿþ°¼þõûÿàã°õò°äãåý°ãâÿââÕ\x9a¾éäùâåà°âõæÿ°ãøàýåùâä°þõäöÿ°éäùüñóùäóñâÀ\x9a¾ãýâÿþ°õøä°õôùââõæÿ°äÿþ°ôüåÿøã°ãõãñó°üñùóõàÃ\x9a¾äþåÿýñâñà°ãù°éäùüùòñôñõÂ\x9a¾ãõþÿ°ôõäñÿüò°âõæÿ°ãþùç°õôÿó°õãâñàÃ\x9a¾ãõùøóâñâõùø°ôõäãõþ°ãäñõò°õâåäóåâäã°äñüÖ\x9a¾ôõäñóùüàýÿóâõæÿ°þñøä°âõääõò°ãù°ôõäñóùäãùøàÿÃ\x9a¾þÿùäåüÿæþÿó°âõæÿ°ôõââõöõâà°ãù°ããõþôâñçâÿöäø÷ùñâäÃ\x9a¾éäùâåóãòÿ°ãàýåâä°éäùâñüÓ\x9a¾éûþåüó°ÿä°âÿùâõàåã°ãù°äþñ÷õüÕ\x9a\x9a¾þÿøäéÀ°þù°éüõâåà°þõääùâç°õ÷ñûóñà°øäñý°ñ°ãù°ãùøÄ\x9a\x9aùéñùÚ°þõøÃ°éò°¼ýåÞéÀéÀ°öÿ°þõʰõøÄ°°°°\x9a"
6
6
  print("".join([chr(ord(_) ^ 144) for _ in Zen[::-1]]))
7
7
  for _ in list(globals().keys()):
8
- del globals()[_]
8
+ if _ != "__builtins__":
9
+ del globals()[_]
9
10
  del _