* Split the polynomial into two polynomials of the same overall shape. * * @param u - The point at which to split the polynomial.
(u: number)
| 151 | * @param u - The point at which to split the polynomial. |
| 152 | */ |
| 153 | public split(u: number): [Polynomial, Polynomial] { |
| 154 | const d = 1 - u; |
| 155 | |
| 156 | const pre = new Polynomial( |
| 157 | this.c0, |
| 158 | this.c1 * u, |
| 159 | this.c2 * u * u, |
| 160 | this.c3 * u * u * u, |
| 161 | ); |
| 162 | const post = new Polynomial( |
| 163 | this.eval(0), |
| 164 | d * this.differentiate(1).eval(u), |
| 165 | ((d * d) / 2) * this.differentiate(2).eval(u), |
| 166 | ((d * d * d) / 6) * this.differentiate(3).eval(u), |
| 167 | ); |
| 168 | |
| 169 | return [pre, post]; |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Calculate the roots (values where this polynomial = 0). |
no test coverage detected