mirror of
https://github.com/Estom/notes.git
synced 2026-04-02 02:20:25 +08:00
scipy
This commit is contained in:
54
Python/numpy/19多项式.md
Normal file
54
Python/numpy/19多项式.md
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
## basic API
|
||||
|
||||
| poly1d\(c\_or\_r\[, r, variable\]\) | A one\-dimensional polynomial class\. |
|
||||
|-------------------------------------|--------------------------------------------------------------------------|
|
||||
| polyval\(p, x\) | Evaluate a polynomial at specific values\. |
|
||||
| poly\(seq\_of\_zeros\) | Find the coefficients of a polynomial with the given sequence of roots\. |
|
||||
| roots\(p\) | Return the roots of a polynomial with coefficients given in p\. |
|
||||
|
||||
## filter
|
||||
|
||||
| polyfit\(x, y, deg\[, rcond, full, w, cov\]\) | Least squares polynomial fit\. |
|
||||
|-----------------------------------------------|--------------------------------|
|
||||
|
||||
|
||||
## calculus
|
||||
|
||||
| polyder\(p\[, m\]\) | Return the derivative of the specified order of a polynomial\. |
|
||||
|------------------------|--------------------------------------------------------------------|
|
||||
| polyint\(p\[, m, k\]\) | Return an antiderivative \(indefinite integral\) of a polynomial\. |
|
||||
|
||||
## Arithmetic
|
||||
|
||||
| polyadd\(a1, a2\) | Find the sum of two polynomials\. |
|
||||
|-------------------|-------------------------------------------------------------|
|
||||
| polydiv\(u, v\) | Returns the quotient and remainder of polynomial division\. |
|
||||
| polymul\(a1, a2\) | Find the product of two polynomials\. |
|
||||
| polysub\(a1, a2\) | Difference \(subtraction\) of two polynomials\. |
|
||||
|
||||
|
||||
## 创建多项式
|
||||
|
||||
* f = np.poly1d(a)
|
||||
## 求微分和积分
|
||||
* f.deriv()
|
||||
* f.integ()
|
||||
|
||||
```py
|
||||
from numpy import poly1d
|
||||
p = poly1d([3,4,5])
|
||||
print(p)
|
||||
2
|
||||
3 x + 4 x + 5
|
||||
print(p*p)
|
||||
4 3 2
|
||||
9 x + 24 x + 46 x + 40 x + 25
|
||||
print(p.integ(k=6))
|
||||
3 2
|
||||
1 x + 2 x + 5 x + 6
|
||||
print(p.deriv())
|
||||
6 x + 4
|
||||
p([4, 5])
|
||||
array([ 69, 100])
|
||||
```
|
||||
@@ -1,4 +1,6 @@
|
||||
# 量的定义
|
||||
> 定义n维数组,并且在数组上进行简单的变换与操作。
|
||||
|
||||
|
||||
## 名称
|
||||
|
||||
|
||||
Reference in New Issue
Block a user