Mercurial > hg > octave-nkf
comparison scripts/polynomial/polyderiv.m @ 1596:b26b206a8994
[project @ 1995-11-01 00:47:21 by jwe]
author | jwe |
---|---|
date | Wed, 01 Nov 1995 00:47:21 +0000 |
parents | 611d403c7f3d |
children | 5d29638dd524 |
comparison
equal
deleted
inserted
replaced
1595:f110a90eb183 | 1596:b26b206a8994 |
---|---|
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with Octave; see the file COPYING. If not, write to the Free | 16 # along with Octave; see the file COPYING. If not, write to the Free |
17 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 |
19 function p = polyderiv (p) | 19 function q = polyderiv (p) |
20 | 20 |
21 # usage: polyderiv (p) | 21 # usage: polyderiv (p) |
22 # | 22 # |
23 # Returns the coefficients of the derivative of the polynomial whose | 23 # Returns the coefficients of the derivative of the polynomial whose |
24 # coefficients are given by vector p. | 24 # coefficients are given by vector p. |
36 error ("argument must be a vector"); | 36 error ("argument must be a vector"); |
37 endif | 37 endif |
38 | 38 |
39 lp = length (p); | 39 lp = length (p); |
40 if (lp == 1) | 40 if (lp == 1) |
41 p = 0; | 41 q = 0; |
42 return; | 42 return; |
43 elseif (lp == 0) | 43 elseif (lp == 0) |
44 p = []; | 44 q = []; |
45 return; | 45 return; |
46 end | 46 end |
47 | 47 |
48 p = p (1:(lp-1)) .* [(lp-1):-1:1]; | 48 q = p (1:(lp-1)) .* [(lp-1):-1:1]; |
49 | 49 |
50 endfunction | 50 endfunction |