PyPyNum 1.12.0__py3-none-any.whl → 1.12.1__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.12.0
3
+ Version: 1.12.1
4
4
  Summary: PyPyNum is a Python library for math & science computations, covering algebra, calculus, stats, with data structures like matrices, vectors, tensors. It offers numerical tools, programs, and supports computational ops, functions, processing, simulation, & visualization in data science & ML, crucial for research, engineering, & data processing.
5
5
  Home-page: https://github.com/PythonSJL/PyPyNum
6
6
  Author: Shen Jiayi
@@ -234,7 +234,7 @@ processing.</font><font color = red>[Python>=3.4]</font>
234
234
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
235
235
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
236
236
 
237
- ## Version -> 1.12.0 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
237
+ ## Version -> 1.12.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
238
238
 
239
239
  ![LOGO](PyPyNum.png)
240
240
 
@@ -338,151 +338,22 @@ Python interpreter and run it!
338
338
  ```
339
339
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
340
340
 
341
- 添加了zh_cn模块,
342
- 其中包括一些用中文名称封装的函数,
343
- 并将继续补充未封装的函数。
341
+ 修复了矩阵的默认输出格式
344
342
 
345
- Added zh_cn module,
346
- which includes some functions encapsulated with Chinese names,
347
- and will continue to supplement unencapsulated functions.
348
-
349
- 以下是当前已经过中文名称封装的函数:
350
-
351
- The following are the functions that have already been encapsulated with Chinese names:
352
-
353
- ["Fraction转为Decimal", "RC4伪随机生成算法", "RC4初始化密钥调度算法", "RC4密码", "ROT13密码", "S型函数", "base64密码",
354
- "x对数y乘积", "y次方根", "一维傅里叶变换", "上伽玛", "上标转整数", "下伽玛", "下标转整数", "中位数", "中国剩余定理",
355
- "中心矩", "乘积和", "代替密码", "众数", "伽玛函数", "余切", "余割", "余弦", "偏度", "全一", "全部填充", "全零", "写入",
356
- "几何平均数", "凯撒密码", "判定系数", "判断平方数", "加权平均", "协方差", "原根", "原点矩", "双曲余切", "双曲余割",
357
- "双曲余弦", "双曲正切", "双曲正割", "双曲正弦", "反余切", "反余割", "反余弦", "反双曲余切", "反双曲余割", "反双曲余弦",
358
- "反双曲正切", "反双曲正割", "反双曲正弦", "反正切", "反正割", "反正弦", "可能是平方数", "填充序列", "多次方根取整",
359
- "多精度余弦", "多精度圆周率", "多精度对数", "多精度欧拉数", "多精度正弦", "多精度自然对数", "多精度黄金分割率",
360
- "多项式方程", "导数", "峰度", "希尔256密码", "平均数", "平方平均数", "平方根取整", "序列滚动", "归一化",
361
- "扩展欧几里得算法", "排列数", "数组", "整数转上标", "整数转下标", "方差", "普莱费尔密码", "最大公约数", "最小公倍数",
362
- "极差", "标准差", "模运算阶", "欧拉函数", "正切", "正割", "正弦", "相关系数", "积分", "积累乘积", "符号函数",
363
- "类似形状全一", "类似形状全零", "类似形状填充", "累乘积", "累加和", "线性方程组", "组合数", "维吉尼亚密码", "自然对数",
364
- "自然指数", "莫尔斯密码", "误差函数", "读取", "调和平均数", "贝塔函数", "贝塞尔I0", "贝塞尔Iv", "负一整数次幂",
365
- "转换为列表", "转换为数组", "连续乘积", "连续加和", "阶乘函数", "阿特巴什密码", "频率统计", "黎曼函数"]
366
-
367
- (120 functions)
368
-
369
- 下面是一个使用示例
370
-
371
- Here is an example of usage
372
-
373
- >>> from pypynum import zh_cn
374
- >>> print(zh_cn.多精度正弦(1, 100))
375
- 0.8414709848078965066525023216302989996225630607983710656727517099919104043912396689486397435430526959
376
-
377
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
378
-
379
- Group类修复了原有方法的问题并且新增了
380
- 一些方法。
381
-
382
- The Group class has fixed the
383
- issues with the original methods
384
- and added some new methods.
385
-
386
-
387
- 下面是新增的方法(Monoid是幺半群):
388
-
389
- Here are the newly added methods:
390
-
391
-
392
- elements(self)
393
- getop(self)
394
- identity(self)
395
- is_monoid(self, modulus=None)
396
- is_subgroup(self, other, modulus=None)
397
- is_supergroup(self, other, modulus=None)
398
- setop(self, operation)
399
-
400
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
401
-
402
- "Polynomial"类增加了五个寻找特殊点的方法,下面是这五个方法。
403
-
404
- The "Polynomial" class has added five methods for finding special points.
405
- Here are these five methods.
406
-
407
-
408
- 1. `stationaries(self, tolerance=1e-15)`:
409
-
410
- 计算多项式的**驻点**,即一阶导数等于零的点。
411
- 驻点可能是局部极大值、局部极小值或鞍点。
412
-
413
- Calculate the stationary point of a polynomial,
414
- which is the point where the first derivative equals zero.
415
- The stationary point may be a local maximum,
416
- local minimum,
417
- or saddle point.
418
-
419
-
420
- 2. `saddles(self, tolerance=1e-15)`:
421
-
422
- 计算多项式的**鞍点**。
423
- 鞍点是驻点,其一阶导数在该点为零,而二阶导数在该点不为零且一阶导数与二阶导数的符号相反。
424
-
425
- Calculate the saddle point of a polynomial.
426
- The saddle point is a stationary point,
427
- where its first derivative is zero and its second derivative is non-zero,
428
- and the signs of the first and second derivatives are opposite.
429
-
430
-
431
- 3. `minima(self, tolerance=1e-15)`:
432
-
433
- 计算多项式的**局部极小值点**。
434
- 局部极小值点是驻点,其二阶导数在该点大于零。
435
-
436
- Calculate the local minimum points of a polynomial.
437
- The local minimum point is a stationary point,
438
- and its second derivative is greater than zero at that point.
439
-
440
-
441
- 4. `maxima(self, tolerance=1e-15)`:
442
-
443
- 计算多项式的**局部极大值点**。
444
- 局部极大值点是驻点,其二阶导数在该点小于零。
445
-
446
- Calculate the local maximum points of a polynomial.
447
- The local maximum point is a stationary point,
448
- and its second derivative is less than zero at that point.
449
-
450
-
451
- 5. `inflections(self, tolerance=1e-15)`:
452
-
453
- 计算多项式的**拐点**。
454
- 拐点是二阶导数等于零的点,并且三阶导数在该点不为零,表示函数在该点改变其凹凸性。
455
-
456
- Calculate the inflection point of a polynomial.
457
- The inflection point is the point where the second derivative equals zero,
458
- and the third derivative is not zero at that point,
459
- indicating that the function changes its concavity and convexity at that point.
460
-
461
-
462
- 每个方法都使用了`tolerance`参数来确定计算过程中可接受的误差范围。
463
- 例如,在判断导数是否为零或者是否大于/小于零时,都会考虑到这个容差值。
464
-
465
- Each method uses the 'tolerance' parameter to determine the acceptable range of error during the calculation process.
466
- For example,
467
- when determining whether the derivative is zero or greater/less than zero,
468
- this tolerance value will be taken into account.
343
+ Fixed the default output format of the matrix
469
344
 
470
345
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
471
346
 
472
- highprec模块改名为multiprec
473
- 然后重命名和新增了几个函数。
347
+ multiprec模块新增了一些函数
474
348
 
475
- The highprec module was renamed as multiparec,
476
- and several functions were renamed and added.
349
+ The multiprec module has added some new functions
477
350
 
478
- frac2dec(frac: fractions.Fraction, sigfigs: int) -> decimal.Decimal
479
- mp_cos(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
480
- mp_e(sigfigs: int, method: str = 'series') -> decimal.Decimal
481
- mp_ln(x: Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool = True) -> decimal.Decimal
482
- mp_log(x: Union[int, str, decimal.Decimal], base: Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool = True) -> decimal.Decimal
483
- mp_phi(sigfigs: int, method: str = 'algebraic') -> decimal.Decimal
484
- mp_pi(sigfigs: int, method: str = 'chudnovsky') -> decimal.Decimal
485
- mp_sin(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
351
+ mp_atan(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
352
+ mp_atan2(y: Union[int, str, decimal.Decimal], x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
353
+ mp_cosh(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
354
+ mp_exp(x: Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool = True) -> decimal.Decimal
355
+ mp_sinh(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
356
+ setprec(sigfigs: int)
486
357
 
487
358
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
488
359
  ```
@@ -558,7 +429,7 @@ PyPyNum
558
429
  │ └── FUNCTION
559
430
  ├── Group
560
431
  │ ├── CLASS
561
- │ │ └── Group(object)/__init__(self: Any, data: Any) -> Any
432
+ │ │ └── Group(object)/__init__(self: Any, data: Any, operation: Any) -> Any
562
433
  │ └── FUNCTION
563
434
  │ └── group(data: Any) -> Any
564
435
  ├── Logic
@@ -813,13 +684,19 @@ PyPyNum
813
684
  │ ├── CLASS
814
685
  │ └── FUNCTION
815
686
  │ ├── frac2dec(frac: fractions.Fraction, sigfigs: int) -> decimal.Decimal
687
+ │ ├── mp_atan(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
688
+ │ ├── mp_atan2(y: typing.Union[int, str, decimal.Decimal], x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
816
689
  │ ├── mp_cos(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
690
+ │ ├── mp_cosh(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
817
691
  │ ├── mp_e(sigfigs: int, method: str) -> decimal.Decimal
692
+ │ ├── mp_exp(x: typing.Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool) -> decimal.Decimal
818
693
  │ ├── mp_ln(x: typing.Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool) -> decimal.Decimal
819
694
  │ ├── mp_log(x: typing.Union[int, str, decimal.Decimal], base: typing.Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool) -> decimal.Decimal
820
695
  │ ├── mp_phi(sigfigs: int, method: str) -> decimal.Decimal
821
696
  │ ├── mp_pi(sigfigs: int, method: str) -> decimal.Decimal
822
- └── mp_sin(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
697
+ ├── mp_sin(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
698
+ │ ├── mp_sinh(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
699
+ │ └── setprec(sigfigs: int) -> Any
823
700
  ├── numbers
824
701
  │ ├── CLASS
825
702
  │ └── FUNCTION
@@ -991,11 +868,16 @@ PyPyNum
991
868
  ├── 填充序列(形状: Any, 序列: Any, 重复: Any, 填充: Any, 返回类型: Any) -> Any
992
869
  ├── 多次方根取整(被开方数: int, 开方数: int) -> int
993
870
  ├── 多精度余弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
871
+ ├── 多精度双曲余弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
872
+ ├── 多精度双曲正弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
873
+ ├── 多精度反正切(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
994
874
  ├── 多精度圆周率(有效位数: int, 方法: str) -> decimal.Decimal
995
875
  ├── 多精度对数(真数: typing.Union[int, float], 底数: typing.Union[int, float], 有效位数: int, 使用内置方法: bool) -> decimal.Decimal
876
+ ├── 多精度方位角(y: typing.Union[int, float], x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
996
877
  ├── 多精度欧拉数(有效位数: int, 方法: str) -> decimal.Decimal
997
878
  ├── 多精度正弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
998
879
  ├── 多精度自然对数(真数: typing.Union[int, float], 有效位数: int, 使用内置方法: bool) -> decimal.Decimal
880
+ ├── 多精度自然指数(指数: typing.Union[int, float], 有效位数: int, 使用内置方法: bool) -> decimal.Decimal
999
881
  ├── 多精度黄金分割率(有效位数: int, 方法: str) -> decimal.Decimal
1000
882
  ├── 多项式方程(系数: list) -> list
1001
883
  ├── 导数(函数: Any, 参数: float, 步长: float, 额外参数: Any, 额外关键字参数: Any) -> float
@@ -4,16 +4,16 @@ pypynum/Geometry.py,sha256=bJCuif-wHO-t7oHFEE7ntzIdQwzUEbT3mcKgmBV6Wps,13982
4
4
  pypynum/Graph.py,sha256=m9iTCNYRCZmAexDzwJ8Y6J7v1aweT-6TZkqh4fOtZDE,10131
5
5
  pypynum/Group.py,sha256=kzUR_r10ubOB2o51rKKdQPHRsgdTGL2yoY7yseKInZc,4263
6
6
  pypynum/Logic.py,sha256=IJAv59ECHU0HmG9lYCAQ_puqeL6Zor3-IDIVH48KBWE,11000
7
- pypynum/Matrix.py,sha256=AeA8I8uQ-Q2b63qDW4aasI6h6Vt3at-CK2IQ9WXfexQ,20436
7
+ pypynum/Matrix.py,sha256=TCq8Tjz5OjhbMkkEbGFgTgnT_UyQxDHbMj8OEFeJm9M,20408
8
8
  pypynum/NeuralN.py,sha256=iSOvC9JW1h4AFGokGGOTkKie5hAYN_YT9H4f3apI9b8,3275
9
9
  pypynum/PyPyNum.png,sha256=t96tJPWfHxT8kcXm_qZI2z5W36TgOqjCU9qdgbmlFws,11623
10
10
  pypynum/Quaternion.py,sha256=-BW_crP_i-veHN0_pD3Z1dipFNUX198oZDrUYTsoZw0,8017
11
- pypynum/README.md,sha256=AiWIBOXP4A4ze8B4q_MEcb053aGdhcXqalMS-ey-feo,76274
11
+ pypynum/README.md,sha256=Fzhu8twNZCx0Oj6FFJ0_a9dtrkEeSfs2D6wMHlm-loc,71552
12
12
  pypynum/Symbolics.py,sha256=u-Dig3OLs6qoLzxMpTAYJGq5uSWDMvgU13TAHKLyjMY,2768
13
13
  pypynum/Tensor.py,sha256=gi7OjrGgP5BSJS9Oma1B2EdX9qSpMNIP2BnKLojdT78,3930
14
14
  pypynum/Tree.py,sha256=BYnlb2kKNJ8kkuq8BAHIcLvPZw5KHxbvM7YuVGhQVMk,4330
15
15
  pypynum/Vector.py,sha256=ee-gkBtyG0l5dLFwAKRTTlnDG05pWpM19RGN7VoPvqE,3212
16
- pypynum/__init__.py,sha256=K9xZ8D7UZyG4ziHxhvTD1czsaItgmsXQgD8GrO49oGc,2873
16
+ pypynum/__init__.py,sha256=azGa-0cR-0syULb5BnS9vHWCdoXOz_kR4t5Xtw5dtw0,2873
17
17
  pypynum/chars.py,sha256=ZOXZn2VzxmpHuvZ87ojhEib3CfTNgysRsFMFITHOA2E,2179
18
18
  pypynum/cipher.py,sha256=DaitY3DCoTuzyrXtD8Ap3IYDLhlMc7-o4AJfLlicvB4,10011
19
19
  pypynum/confs.py,sha256=iFz83iZ1A4BK4LTqo-ZbpAcoxhYWUxtEQKsr_-d8ryw,2869
@@ -24,7 +24,7 @@ pypynum/errors.py,sha256=I3nh5YD5F_sBoa7hjPJi81goRflbVAZcjtmW7O2BhJk,220
24
24
  pypynum/file.py,sha256=-sg3pndZdiyM8cS6KeIhCvB6NfAovHnLOhEf0XkjidE,3411
25
25
  pypynum/image.py,sha256=nhTZmaBVIKhuar-CcwZWb-hRYmkj4b_g7vIlYvEJEEE,12155
26
26
  pypynum/maths.py,sha256=rI16_5Mvow4aCfoG6gz6WKoraOjwUfQBKmtwjg5g88Q,30646
27
- pypynum/multiprec.py,sha256=85AoSFWKYiAkTjFQli8wtPFyaxvXpC8XD_GOL0UNCu4,5934
27
+ pypynum/multiprec.py,sha256=ZexsJa_kMT0_quk_d8qc-knX8kq-C7SKktfw9hzAKvI,8084
28
28
  pypynum/numbers.py,sha256=PqQ07TWfcNlfjCjUg1UJda-BI1uOffmQVK1qIGbll_s,8619
29
29
  pypynum/plotting.py,sha256=mbIYK5TpY1qvuMJrqz4d8bxJEiZww3AI684vSKV-DgU,7781
30
30
  pypynum/polynomial.py,sha256=vETxsXsMWmCObZxkcvt9piSAZmb-Z5aaQEgkM_GOrnU,11669
@@ -39,8 +39,8 @@ pypynum/tools.py,sha256=xN2hYpEnPGmn1CsdQ60OUv5HIwJRbQAWTI8NclwwHno,12609
39
39
  pypynum/types.py,sha256=VrC-V9LXnHL0YmloKwM67wSGHvmvEQXEDgZgKQFnF68,239
40
40
  pypynum/ufuncs.py,sha256=g2tewdsGa4VrIq2khR-0SWJoXBitVRN87DulOnTxxDA,2572
41
41
  pypynum/utils.py,sha256=OqUFVraYDTSubF9QhZm8WC6A0ppnkhVU0YtAeYN9EyU,21048
42
- pypynum/zh_cn.py,sha256=CpelF_mLcQp7SrtIa2C18myBSJEUD3iO4LBOoIgNlqU,11034
43
- PyPyNum-1.12.0.dist-info/METADATA,sha256=Via1S7mpRGA81Bwfr15vrFRgfjWUyJRA8DwldFpXYLs,90653
44
- PyPyNum-1.12.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
45
- PyPyNum-1.12.0.dist-info/top_level.txt,sha256=4wW_Xb4bRglmiMsdPAe9f75MkXhNpuN88H17g_Cr5u8,8
46
- PyPyNum-1.12.0.dist-info/RECORD,,
42
+ pypynum/zh_cn.py,sha256=tzBpdQyE6emrSrnh9iENo5wxuK0PXlx8btZNPo3Ovb8,11643
43
+ PyPyNum-1.12.1.dist-info/METADATA,sha256=3SvFwsh6S9LMZoYOOQRp_3ARCA4MoCdFXSIzL13UlR0,85931
44
+ PyPyNum-1.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
45
+ PyPyNum-1.12.1.dist-info/top_level.txt,sha256=4wW_Xb4bRglmiMsdPAe9f75MkXhNpuN88H17g_Cr5u8,8
46
+ PyPyNum-1.12.1.dist-info/RECORD,,
pypynum/Matrix.py CHANGED
@@ -211,11 +211,9 @@ class Matrix(Array):
211
211
  "\\end{{{}}}".format(matrix_type)]
212
212
  return "".join(latex_str)
213
213
 
214
- def __repr__(self, use_latex=False):
214
+ def __str__(self, use_latex=False):
215
215
  use_latex = config.use_latex or use_latex
216
- return self.latex() if use_latex else super().__repr__()
217
-
218
- __str__ = __repr__
216
+ return self.latex() if use_latex else super().__str__()
219
217
 
220
218
  def __setitem__(self, key, value):
221
219
  if isinstance(key, (int, slice)):
pypynum/README.md CHANGED
@@ -20,7 +20,7 @@ processing.</font><font color = red>[Python>=3.4]</font>
20
20
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
21
21
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
22
22
 
23
- ## Version -> 1.12.0 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
23
+ ## Version -> 1.12.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
24
24
 
25
25
  ![LOGO](PyPyNum.png)
26
26
 
@@ -124,151 +124,22 @@ Python interpreter and run it!
124
124
  ```
125
125
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
126
126
 
127
- 添加了zh_cn模块,
128
- 其中包括一些用中文名称封装的函数,
129
- 并将继续补充未封装的函数。
127
+ 修复了矩阵的默认输出格式
130
128
 
131
- Added zh_cn module,
132
- which includes some functions encapsulated with Chinese names,
133
- and will continue to supplement unencapsulated functions.
134
-
135
- 以下是当前已经过中文名称封装的函数:
136
-
137
- The following are the functions that have already been encapsulated with Chinese names:
138
-
139
- ["Fraction转为Decimal", "RC4伪随机生成算法", "RC4初始化密钥调度算法", "RC4密码", "ROT13密码", "S型函数", "base64密码",
140
- "x对数y乘积", "y次方根", "一维傅里叶变换", "上伽玛", "上标转整数", "下伽玛", "下标转整数", "中位数", "中国剩余定理",
141
- "中心矩", "乘积和", "代替密码", "众数", "伽玛函数", "余切", "余割", "余弦", "偏度", "全一", "全部填充", "全零", "写入",
142
- "几何平均数", "凯撒密码", "判定系数", "判断平方数", "加权平均", "协方差", "原根", "原点矩", "双曲余切", "双曲余割",
143
- "双曲余弦", "双曲正切", "双曲正割", "双曲正弦", "反余切", "反余割", "反余弦", "反双曲余切", "反双曲余割", "反双曲余弦",
144
- "反双曲正切", "反双曲正割", "反双曲正弦", "反正切", "反正割", "反正弦", "可能是平方数", "填充序列", "多次方根取整",
145
- "多精度余弦", "多精度圆周率", "多精度对数", "多精度欧拉数", "多精度正弦", "多精度自然对数", "多精度黄金分割率",
146
- "多项式方程", "导数", "峰度", "希尔256密码", "平均数", "平方平均数", "平方根取整", "序列滚动", "归一化",
147
- "扩展欧几里得算法", "排列数", "数组", "整数转上标", "整数转下标", "方差", "普莱费尔密码", "最大公约数", "最小公倍数",
148
- "极差", "标准差", "模运算阶", "欧拉函数", "正切", "正割", "正弦", "相关系数", "积分", "积累乘积", "符号函数",
149
- "类似形状全一", "类似形状全零", "类似形状填充", "累乘积", "累加和", "线性方程组", "组合数", "维吉尼亚密码", "自然对数",
150
- "自然指数", "莫尔斯密码", "误差函数", "读取", "调和平均数", "贝塔函数", "贝塞尔I0", "贝塞尔Iv", "负一整数次幂",
151
- "转换为列表", "转换为数组", "连续乘积", "连续加和", "阶乘函数", "阿特巴什密码", "频率统计", "黎曼函数"]
152
-
153
- (120 functions)
154
-
155
- 下面是一个使用示例
156
-
157
- Here is an example of usage
158
-
159
- >>> from pypynum import zh_cn
160
- >>> print(zh_cn.多精度正弦(1, 100))
161
- 0.8414709848078965066525023216302989996225630607983710656727517099919104043912396689486397435430526959
162
-
163
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
164
-
165
- Group类修复了原有方法的问题并且新增了
166
- 一些方法。
167
-
168
- The Group class has fixed the
169
- issues with the original methods
170
- and added some new methods.
171
-
172
-
173
- 下面是新增的方法(Monoid是幺半群):
174
-
175
- Here are the newly added methods:
176
-
177
-
178
- elements(self)
179
- getop(self)
180
- identity(self)
181
- is_monoid(self, modulus=None)
182
- is_subgroup(self, other, modulus=None)
183
- is_supergroup(self, other, modulus=None)
184
- setop(self, operation)
185
-
186
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
187
-
188
- "Polynomial"类增加了五个寻找特殊点的方法,下面是这五个方法。
189
-
190
- The "Polynomial" class has added five methods for finding special points.
191
- Here are these five methods.
192
-
193
-
194
- 1. `stationaries(self, tolerance=1e-15)`:
195
-
196
- 计算多项式的**驻点**,即一阶导数等于零的点。
197
- 驻点可能是局部极大值、局部极小值或鞍点。
198
-
199
- Calculate the stationary point of a polynomial,
200
- which is the point where the first derivative equals zero.
201
- The stationary point may be a local maximum,
202
- local minimum,
203
- or saddle point.
204
-
205
-
206
- 2. `saddles(self, tolerance=1e-15)`:
207
-
208
- 计算多项式的**鞍点**。
209
- 鞍点是驻点,其一阶导数在该点为零,而二阶导数在该点不为零且一阶导数与二阶导数的符号相反。
210
-
211
- Calculate the saddle point of a polynomial.
212
- The saddle point is a stationary point,
213
- where its first derivative is zero and its second derivative is non-zero,
214
- and the signs of the first and second derivatives are opposite.
215
-
216
-
217
- 3. `minima(self, tolerance=1e-15)`:
218
-
219
- 计算多项式的**局部极小值点**。
220
- 局部极小值点是驻点,其二阶导数在该点大于零。
221
-
222
- Calculate the local minimum points of a polynomial.
223
- The local minimum point is a stationary point,
224
- and its second derivative is greater than zero at that point.
225
-
226
-
227
- 4. `maxima(self, tolerance=1e-15)`:
228
-
229
- 计算多项式的**局部极大值点**。
230
- 局部极大值点是驻点,其二阶导数在该点小于零。
231
-
232
- Calculate the local maximum points of a polynomial.
233
- The local maximum point is a stationary point,
234
- and its second derivative is less than zero at that point.
235
-
236
-
237
- 5. `inflections(self, tolerance=1e-15)`:
238
-
239
- 计算多项式的**拐点**。
240
- 拐点是二阶导数等于零的点,并且三阶导数在该点不为零,表示函数在该点改变其凹凸性。
241
-
242
- Calculate the inflection point of a polynomial.
243
- The inflection point is the point where the second derivative equals zero,
244
- and the third derivative is not zero at that point,
245
- indicating that the function changes its concavity and convexity at that point.
246
-
247
-
248
- 每个方法都使用了`tolerance`参数来确定计算过程中可接受的误差范围。
249
- 例如,在判断导数是否为零或者是否大于/小于零时,都会考虑到这个容差值。
250
-
251
- Each method uses the 'tolerance' parameter to determine the acceptable range of error during the calculation process.
252
- For example,
253
- when determining whether the derivative is zero or greater/less than zero,
254
- this tolerance value will be taken into account.
129
+ Fixed the default output format of the matrix
255
130
 
256
131
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
257
132
 
258
- highprec模块改名为multiprec
259
- 然后重命名和新增了几个函数。
133
+ multiprec模块新增了一些函数
260
134
 
261
- The highprec module was renamed as multiparec,
262
- and several functions were renamed and added.
135
+ The multiprec module has added some new functions
263
136
 
264
- frac2dec(frac: fractions.Fraction, sigfigs: int) -> decimal.Decimal
265
- mp_cos(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
266
- mp_e(sigfigs: int, method: str = 'series') -> decimal.Decimal
267
- mp_ln(x: Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool = True) -> decimal.Decimal
268
- mp_log(x: Union[int, str, decimal.Decimal], base: Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool = True) -> decimal.Decimal
269
- mp_phi(sigfigs: int, method: str = 'algebraic') -> decimal.Decimal
270
- mp_pi(sigfigs: int, method: str = 'chudnovsky') -> decimal.Decimal
271
- mp_sin(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
137
+ mp_atan(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
138
+ mp_atan2(y: Union[int, str, decimal.Decimal], x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
139
+ mp_cosh(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
140
+ mp_exp(x: Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool = True) -> decimal.Decimal
141
+ mp_sinh(x: Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
142
+ setprec(sigfigs: int)
272
143
 
273
144
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
274
145
  ```
@@ -344,7 +215,7 @@ PyPyNum
344
215
  │ └── FUNCTION
345
216
  ├── Group
346
217
  │ ├── CLASS
347
- │ │ └── Group(object)/__init__(self: Any, data: Any) -> Any
218
+ │ │ └── Group(object)/__init__(self: Any, data: Any, operation: Any) -> Any
348
219
  │ └── FUNCTION
349
220
  │ └── group(data: Any) -> Any
350
221
  ├── Logic
@@ -599,13 +470,19 @@ PyPyNum
599
470
  │ ├── CLASS
600
471
  │ └── FUNCTION
601
472
  │ ├── frac2dec(frac: fractions.Fraction, sigfigs: int) -> decimal.Decimal
473
+ │ ├── mp_atan(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
474
+ │ ├── mp_atan2(y: typing.Union[int, str, decimal.Decimal], x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
602
475
  │ ├── mp_cos(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
476
+ │ ├── mp_cosh(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
603
477
  │ ├── mp_e(sigfigs: int, method: str) -> decimal.Decimal
478
+ │ ├── mp_exp(x: typing.Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool) -> decimal.Decimal
604
479
  │ ├── mp_ln(x: typing.Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool) -> decimal.Decimal
605
480
  │ ├── mp_log(x: typing.Union[int, str, decimal.Decimal], base: typing.Union[int, str, decimal.Decimal], sigfigs: int, builtin: bool) -> decimal.Decimal
606
481
  │ ├── mp_phi(sigfigs: int, method: str) -> decimal.Decimal
607
482
  │ ├── mp_pi(sigfigs: int, method: str) -> decimal.Decimal
608
- └── mp_sin(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
483
+ ├── mp_sin(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
484
+ │ ├── mp_sinh(x: typing.Union[int, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
485
+ │ └── setprec(sigfigs: int) -> Any
609
486
  ├── numbers
610
487
  │ ├── CLASS
611
488
  │ └── FUNCTION
@@ -777,11 +654,16 @@ PyPyNum
777
654
  ├── 填充序列(形状: Any, 序列: Any, 重复: Any, 填充: Any, 返回类型: Any) -> Any
778
655
  ├── 多次方根取整(被开方数: int, 开方数: int) -> int
779
656
  ├── 多精度余弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
657
+ ├── 多精度双曲余弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
658
+ ├── 多精度双曲正弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
659
+ ├── 多精度反正切(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
780
660
  ├── 多精度圆周率(有效位数: int, 方法: str) -> decimal.Decimal
781
661
  ├── 多精度对数(真数: typing.Union[int, float], 底数: typing.Union[int, float], 有效位数: int, 使用内置方法: bool) -> decimal.Decimal
662
+ ├── 多精度方位角(y: typing.Union[int, float], x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
782
663
  ├── 多精度欧拉数(有效位数: int, 方法: str) -> decimal.Decimal
783
664
  ├── 多精度正弦(x: typing.Union[int, float], 有效位数: int) -> decimal.Decimal
784
665
  ├── 多精度自然对数(真数: typing.Union[int, float], 有效位数: int, 使用内置方法: bool) -> decimal.Decimal
666
+ ├── 多精度自然指数(指数: typing.Union[int, float], 有效位数: int, 使用内置方法: bool) -> decimal.Decimal
785
667
  ├── 多精度黄金分割率(有效位数: int, 方法: str) -> decimal.Decimal
786
668
  ├── 多项式方程(系数: list) -> list
787
669
  ├── 导数(函数: Any, 参数: float, 步长: float, 额外参数: Any, 额外关键字参数: Any) -> float
pypynum/__init__.py CHANGED
@@ -65,7 +65,7 @@ from .utils import OrderedSet, InfIterator, LinkedList, IntervalSet
65
65
  from .Vector import vec
66
66
  from . import zh_cn
67
67
 
68
- __version__ = "1.12.0"
68
+ __version__ = "1.12.1"
69
69
  print("PyPyNum", "Version -> " + __version__, "PyPI -> https://pypi.org/project/PyPyNum/",
70
70
  "Gitee -> https://www.gitee.com/PythonSJL/PyPyNum", "GitHub -> https://github.com/PythonSJL/PyPyNum", sep=" | ")
71
71
  del math, arr, ite, num, prec, real, geom, ContentError, RandomError, LogicError, InputError, FullError, Union
pypynum/multiprec.py CHANGED
@@ -1,12 +1,15 @@
1
1
  from decimal import Decimal, getcontext as __
2
2
  from fractions import Fraction
3
-
4
3
  from .types import prec
5
4
 
6
5
  __context = __()
7
6
  del __
8
7
 
9
8
 
9
+ def setprec(sigfigs: int):
10
+ __context.prec = sigfigs
11
+
12
+
10
13
  def frac2dec(frac: Fraction, sigfigs: int) -> Decimal:
11
14
  __context.prec = sigfigs
12
15
  return Decimal(frac.numerator) / Decimal(frac.denominator)
@@ -175,27 +178,26 @@ def mp_ln(x: prec, sigfigs: int, builtin: bool = True) -> Decimal:
175
178
  if builtin:
176
179
  __context.prec = sigfigs
177
180
  return Decimal(x).ln()
178
- else:
179
- x = Decimal(x)
180
- if x <= 0:
181
- raise ValueError("Natural logarithm is not defined for x <= 0")
182
- sigfigs = sigfigs + 5
183
- __context.prec = sigfigs
184
- sign = -1
185
- if x > 1:
186
- x = 1 / x
187
- sign = 1
188
- ln_x = Decimal(0)
189
- term = Decimal(1)
190
- dx = 1 - x
191
- k = 1
192
- eps = Decimal(10) ** -sigfigs
193
- while abs(term) > eps:
194
- term *= dx
195
- ln_x += term / k
196
- k += 1
197
- __context.prec -= 5
198
- return ln_x * sign
181
+ x = Decimal(x)
182
+ if x <= 0:
183
+ raise ValueError("Natural logarithm is not defined for x <= 0")
184
+ sigfigs = sigfigs + 5
185
+ __context.prec = sigfigs
186
+ sign = -1
187
+ if x > 1:
188
+ x = 1 / x
189
+ sign = 1
190
+ ln_x = Decimal(0)
191
+ term = Decimal(1)
192
+ dx = 1 - x
193
+ k = 1
194
+ eps = Decimal(10) ** -sigfigs
195
+ while abs(term) >= eps:
196
+ term *= dx
197
+ ln_x += term / k
198
+ k += 1
199
+ __context.prec -= 5
200
+ return ln_x * sign
199
201
 
200
202
 
201
203
  def mp_log(x: prec, base: prec, sigfigs: int, builtin: bool = True) -> Decimal:
@@ -215,3 +217,87 @@ def mp_log(x: prec, base: prec, sigfigs: int, builtin: bool = True) -> Decimal:
215
217
  log_x_base = ln_x / ln_base
216
218
  __context.prec -= 5
217
219
  return +log_x_base
220
+
221
+
222
+ def mp_atan(x: prec, sigfigs: int) -> Decimal:
223
+ x = Decimal(x)
224
+ if abs(x) != x:
225
+ return -mp_atan(-x, sigfigs)
226
+ __context.prec = sigfigs + 5
227
+ m = 0
228
+ if x > 2:
229
+ x = 1 / x
230
+ flag = -1
231
+ else:
232
+ flag = 0
233
+ if x > 0.5:
234
+ x = x / (1 + (1 + x ** 2).sqrt())
235
+ m = 2
236
+ flag = 1
237
+ if x > 0.5:
238
+ x = x / (1 + (1 + x ** 2).sqrt())
239
+ m = 4
240
+ atan_x = 0
241
+ term = power = x
242
+ n = 1
243
+ constant = -x * x
244
+ eps = Decimal(10) ** -sigfigs
245
+ while abs(term) >= eps:
246
+ atan_x += term
247
+ power *= constant
248
+ n += 2
249
+ term = power / n
250
+ if flag:
251
+ atan_x = atan_x * m if flag > 0 else mp_pi(sigfigs + 5) - atan_x
252
+ atan_x %= mp_pi(sigfigs) / 2
253
+ __context.prec = sigfigs
254
+ return +atan_x
255
+
256
+
257
+ def mp_atan2(y: prec, x: prec, sigfigs: int) -> Decimal:
258
+ pi = mp_pi(sigfigs + 5)
259
+ if x == 0:
260
+ if y == 0:
261
+ raise ValueError("Cannot compute atan2(0, 0)")
262
+ if y > 0:
263
+ return pi / 2
264
+ else:
265
+ return -pi / 2
266
+ result = mp_atan(y / x, sigfigs + 5)
267
+ if x < 0:
268
+ if y >= 0:
269
+ result += pi
270
+ else:
271
+ result -= pi
272
+ __context.prec = sigfigs
273
+ return +result
274
+
275
+
276
+ def mp_exp(x: prec, sigfigs: int, builtin: bool = True) -> Decimal:
277
+ if builtin:
278
+ __context.prec = sigfigs
279
+ return Decimal(x).exp()
280
+ x = Decimal(x)
281
+ __context.prec = sigfigs + 5
282
+ n = term = exp_x = Decimal(1)
283
+ eps = Decimal(10) ** -sigfigs
284
+ while abs(term) >= eps:
285
+ term *= x / n
286
+ exp_x += term
287
+ n += 1
288
+ __context.prec = sigfigs
289
+ return +exp_x
290
+
291
+
292
+ def mp_sinh(x: prec, sigfigs: int) -> Decimal:
293
+ x = Decimal(x)
294
+ sinh_x = (Decimal(1) - mp_exp(-2 * x, sigfigs + 5)) / (2 * mp_exp(-x, sigfigs + 5))
295
+ __context.prec = sigfigs
296
+ return +sinh_x
297
+
298
+
299
+ def mp_cosh(x: prec, sigfigs: int) -> Decimal:
300
+ x = Decimal(x)
301
+ cosh_x = (Decimal(1) + mp_exp(-2 * x, sigfigs + 5)) / (2 * mp_exp(-x, sigfigs + 5))
302
+ __context.prec = sigfigs
303
+ return +cosh_x
pypynum/zh_cn.py CHANGED
@@ -165,6 +165,26 @@ def 多精度对数(真数: real, 底数: real, 有效位数: int, 使用内置
165
165
  return mp_log(真数, 底数, 有效位数, 使用内置方法)
166
166
 
167
167
 
168
+ def 多精度反正切(x: real, 有效位数: int) -> Decimal:
169
+ return mp_atan(x, 有效位数)
170
+
171
+
172
+ def 多精度方位角(y: real, x: real, 有效位数: int) -> Decimal:
173
+ return mp_atan2(y, x, 有效位数)
174
+
175
+
176
+ def 多精度自然指数(指数: real, 有效位数: int, 使用内置方法: bool = True) -> Decimal:
177
+ return mp_exp(指数, 有效位数, 使用内置方法)
178
+
179
+
180
+ def 多精度双曲正弦(x: real, 有效位数: int) -> Decimal:
181
+ return mp_sinh(x, 有效位数)
182
+
183
+
184
+ def 多精度双曲余弦(x: real, 有效位数: int) -> Decimal:
185
+ return mp_cosh(x, 有效位数)
186
+
187
+
168
188
  def 下伽玛(s: num, x: num) -> num:
169
189
  return lower_gamma(s, x)
170
190