Generate a Chebyshev series with given roots. The function returns the coefficients of the polynomial .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), in Chebyshev form, where the :math:`r_n` are the roots specified in `roots`. If a zero has multiplicity n, then it
(roots)
| 511 | |
| 512 | |
| 513 | def chebfromroots(roots): |
| 514 | """ |
| 515 | Generate a Chebyshev series with given roots. |
| 516 | |
| 517 | The function returns the coefficients of the polynomial |
| 518 | |
| 519 | .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), |
| 520 | |
| 521 | in Chebyshev form, where the :math:`r_n` are the roots specified in |
| 522 | `roots`. If a zero has multiplicity n, then it must appear in `roots` |
| 523 | n times. For instance, if 2 is a root of multiplicity three and 3 is a |
| 524 | root of multiplicity 2, then `roots` looks something like [2, 2, 2, 3, 3]. |
| 525 | The roots can appear in any order. |
| 526 | |
| 527 | If the returned coefficients are `c`, then |
| 528 | |
| 529 | .. math:: p(x) = c_0 + c_1 * T_1(x) + ... + c_n * T_n(x) |
| 530 | |
| 531 | The coefficient of the last term is not generally 1 for monic |
| 532 | polynomials in Chebyshev form. |
| 533 | |
| 534 | Parameters |
| 535 | ---------- |
| 536 | roots : array_like |
| 537 | Sequence containing the roots. |
| 538 | |
| 539 | Returns |
| 540 | ------- |
| 541 | out : ndarray |
| 542 | 1-D array of coefficients. If all roots are real then `out` is a |
| 543 | real array, if some of the roots are complex, then `out` is complex |
| 544 | even if all the coefficients in the result are real (see Examples |
| 545 | below). |
| 546 | |
| 547 | See Also |
| 548 | -------- |
| 549 | numpy.polynomial.polynomial.polyfromroots |
| 550 | numpy.polynomial.legendre.legfromroots |
| 551 | numpy.polynomial.laguerre.lagfromroots |
| 552 | numpy.polynomial.hermite.hermfromroots |
| 553 | numpy.polynomial.hermite_e.hermefromroots |
| 554 | |
| 555 | Examples |
| 556 | -------- |
| 557 | >>> import numpy.polynomial.chebyshev as C |
| 558 | >>> C.chebfromroots((-1,0,1)) # x^3 - x relative to the standard basis |
| 559 | array([ 0. , -0.25, 0. , 0.25]) |
| 560 | >>> j = complex(0,1) |
| 561 | >>> C.chebfromroots((-j,j)) # x^2 + 1 relative to the standard basis |
| 562 | array([1.5+0.j, 0. +0.j, 0.5+0.j]) |
| 563 | |
| 564 | """ |
| 565 | return pu._fromroots(chebline, chebmul, roots) |
| 566 | |
| 567 | |
| 568 | def chebadd(c1, c2): |
nothing calls this directly
no test coverage detected
searching dependent graphs…