# horner

### 呼び出し手順

`horner(P,x)`

P

x

### 説明

`horner(P,x)`=`P(x)`

### 例

```P = poly(1:3, 'x', 'coeff')
s = %s;
horner(P, [1 2 ; 3 4])       // for real values
horner(P, [1 2 ; 3 4]+%i)    // for complex values
horner(P, [1, s ; s^2, s^3]) // for polynomial values
horner(P, [1/s, 1/s^2])      // for rational values```
```--> P = poly(1:3, 'x', 'coeff')
P  =
1 +2x +3x²

--> s = %s;
--> horner(P, [1 2 ; 3 4])       // for real values
ans  =
6.    17.
34.   57.

--> horner(P, [1 2 ; 3 4]+%i)    // for complex values
ans  =
3.  + 8.i    14. + 14.i
31. + 20.i   54. + 26.i

--> horner(P, [1, s ; s^2, s^3]) // for polynomial values
ans  =
6            1 +2s +3s²

1 +2s² +3s⁴  1 +2s³ +3s⁶

--> horner(P, [1/s, 1/s^2])      // for rational values
ans  =
3 +2s +s²  3 +2s² +s⁴
---------  ----------
s²          s⁴
```

いくつかの多項式商の評価 :

```[s,z] = (%s, %z);
M = [1/s, (s-1)/s]
horner(M, 1)
horner(M, %i)
horner(M, 2+s)
horner(M, (2+z)/z)
horner(M, [1, 1/z ; 2, (2+z)/z])```
```--> M = [1/s, (s-1)/s]
M  =
1  -1 +s
-  -----
s    s

--> horner(M, 1)
ans  =
1.   0.

--> horner(M, %i)
ans  =
0. - i     1. + i

--> horner(M, 2+s)
ans  =
1    1 +s
----  ----
2 +s  2 +s

--> horner(M, (2+z)/z)
ans  =
z     2
----  ----
2 +z  2 +z

--> horner(M, [1, 1/z ; 2, (2+z)/z])
ans  =
1   z    0  1 -z
-   -    -  ----
1   1    1   1

1   z    1   2
-  ----  -  ----
2  2 +z  2  2 +z
```

### 参照

• freq — 周波数応答
• repfreq — 周波数応答
• evstr — 式を評価する
 Report an issue << hermit Polynomials hrmt >>