[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: polyint vs polyinteg
From: |
David Bateman |
Subject: |
Re: polyint vs polyinteg |
Date: |
Fri, 31 Aug 2007 23:53:53 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
John W. Eaton wrote:
> On 31-Aug-2007, Sylvain Pelissier wrote:
>
> | I have already done a polyint function in Octave forge. You could use it
> | if it could help and tell me when I could delete it in Octave forge.
>
> It looks like your polyint function is just a wrapper around
> polyinteg. We need it to be the other way around: polyint should be
> the real function and polyinteg (which will be deprecated and removed
> in the future) should call polyint to do the real work (assuming that
> it is possible to do that while retaining the existing interface for
> polyinteg, for backward compatibility).
>
> jwe
>
Then what about the attached..
D.
*** ./scripts/deprecated/Makefile.in.orig16 2007-08-31 23:39:42.752057938
+0200
--- ./scripts/deprecated/Makefile.in 2007-08-31 23:38:44.873006684 +0200
***************
*** 34,40 ****
lognormal_inv.m lognormal_pdf.m lognormal_rnd.m meshdom.m normal_cdf.m \
normal_inv.m normal_pdf.m normal_rnd.m pascal_cdf.m \
pascal_inv.m pascal_pdf.m pascal_rnd.m poisson_cdf.m \
! poisson_inv.m poisson_pdf.m poisson_rnd.m setstr.m \
struct_contains.m struct_elements.m t_cdf.m t_inv.m t_pdf.m \
t_rnd.m uniform_cdf.m uniform_inv.m uniform_pdf.m uniform_rnd.m \
weibcdf.m weibinv.m weibpdf.m weibrnd.m weibull_cdf.m \
--- 34,40 ----
lognormal_inv.m lognormal_pdf.m lognormal_rnd.m meshdom.m normal_cdf.m \
normal_inv.m normal_pdf.m normal_rnd.m pascal_cdf.m \
pascal_inv.m pascal_pdf.m pascal_rnd.m poisson_cdf.m \
! poisson_inv.m poisson_pdf.m poisson_rnd.m polyinteg.m setstr.m \
struct_contains.m struct_elements.m t_cdf.m t_inv.m t_pdf.m \
t_rnd.m uniform_cdf.m uniform_inv.m uniform_pdf.m uniform_rnd.m \
weibcdf.m weibinv.m weibpdf.m weibrnd.m weibull_cdf.m \
*** ./scripts/deprecated/polyinteg.m.orig16 2007-08-31 23:52:39.956461948
+0200
--- ./scripts/deprecated/polyinteg.m 2007-08-31 23:40:48.981683758 +0200
***************
*** 0 ****
--- 1,38 ----
+ ## Copyright (C) 1996, 1997 John W. Eaton
+ ##
+ ## This file is part of Octave.
+ ##
+ ## Octave is free software; you can redistribute it and/or modify it
+ ## under the terms of the GNU General Public License as published by
+ ## the Free Software Foundation; either version 2, or (at your option)
+ ## any later version.
+ ##
+ ## Octave is distributed in the hope that it will be useful, but
+ ## WITHOUT ANY WARRANTY; without even the implied warranty of
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ## General Public License for more details.
+ ##
+ ## You should have received a copy of the GNU General Public License
+ ## along with Octave; see the file COPYING. If not, write to the Free
+ ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ ## 02110-1301, USA.
+
+ ## -*- texinfo -*-
+ ## @deftypefn {Function File} {} polyinteg (@var{c})
+ ## Return the coefficients of the integral of the polynomial whose
+ ## coefficients are represented by the vector @var{c}.
+ ##
+ ## The constant of integration is set to zero.
+ ## @seealso{poly, polyderiv, polyreduce, roots, conv, deconv, residue,
+ ## filter, polyval, and polyvalm}
+ ## @end deftypefn
+
+ ## Author: Tony Richardson <address@hidden>
+ ## Created: June 1994
+ ## Adapted-By: jwe
+
+ function y = polyinteg (p)
+
+ y = polyint (p);
+
+ endfunction
*** ./scripts/polynomial/polyinteg.m.orig16 2006-10-17 15:39:13.000000000
+0200
--- ./scripts/polynomial/polyinteg.m 2007-08-31 23:37:06.323027479 +0200
***************
*** 1,58 ****
- ## Copyright (C) 1996, 1997 John W. Eaton
- ##
- ## This file is part of Octave.
- ##
- ## Octave is free software; you can redistribute it and/or modify it
- ## under the terms of the GNU General Public License as published by
- ## the Free Software Foundation; either version 2, or (at your option)
- ## any later version.
- ##
- ## Octave is distributed in the hope that it will be useful, but
- ## WITHOUT ANY WARRANTY; without even the implied warranty of
- ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ## General Public License for more details.
- ##
- ## You should have received a copy of the GNU General Public License
- ## along with Octave; see the file COPYING. If not, write to the Free
- ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- ## 02110-1301, USA.
-
- ## -*- texinfo -*-
- ## @deftypefn {Function File} {} polyinteg (@var{c})
- ## Return the coefficients of the integral of the polynomial whose
- ## coefficients are represented by the vector @var{c}.
- ##
- ## The constant of integration is set to zero.
- ## @seealso{poly, polyderiv, polyreduce, roots, conv, deconv, residue,
- ## filter, polyval, and polyvalm}
- ## @end deftypefn
-
- ## Author: Tony Richardson <address@hidden>
- ## Created: June 1994
- ## Adapted-By: jwe
-
- function p = polyinteg (p)
-
- if(nargin != 1)
- print_usage ();
- endif
-
- if (! (isvector (p) || isempty (p)))
- error ("argument must be a vector");
- endif
-
- lp = length (p);
-
- if (lp == 0)
- p = [];
- return;
- end
-
- if (rows (p) > 1)
- ## Convert to column vector
- p = p.';
- endif
-
- p = [ p, 0 ] ./ [ lp:-1:1, 1 ];
-
- endfunction
--- 0 ----
*** ./scripts/polynomial/polyint.m.orig16 2007-08-31 23:37:42.278195682
+0200
--- ./scripts/polynomial/polyint.m 2007-08-31 23:51:11.835951396 +0200
***************
*** 0 ****
--- 1,63 ----
+ ## Copyright (C) 1996, 1997 John W. Eaton
+ ##
+ ## This file is part of Octave.
+ ##
+ ## Octave is free software; you can redistribute it and/or modify it
+ ## under the terms of the GNU General Public License as published by
+ ## the Free Software Foundation; either version 2, or (at your option)
+ ## any later version.
+ ##
+ ## Octave is distributed in the hope that it will be useful, but
+ ## WITHOUT ANY WARRANTY; without even the implied warranty of
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ## General Public License for more details.
+ ##
+ ## You should have received a copy of the GNU General Public License
+ ## along with Octave; see the file COPYING. If not, write to the Free
+ ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ ## 02110-1301, USA.
+
+ ## -*- texinfo -*-
+ ## @deftypefn {Function File} {} polyint (@var{c}, @var{k})
+ ## Return the coefficients of the integral of the polynomial whose
+ ## coefficients are represented by the vector @var{c}. The variable
+ ## @var{k} is the constant of integration, which by default is set to zero.
+ ## @seealso{poly, polyderiv, polyreduce, roots, conv, deconv, residue,
+ ## filter, polyval, and polyvalm}
+ ## @end deftypefn
+
+ ## Author: Tony Richardson <address@hidden>
+ ## Created: June 1994
+ ## Adapted-By: jwe
+
+ function p = polyint (p, k)
+
+ if (nargin < 1 || nargin > 2)
+ print_usage ();
+ endif
+
+ if (nargin == 1)
+ k = 0;
+ elseif (! isscalar (k))
+ error ("polyint: the constant of integration must be a scalar");
+ endif
+
+ if (! (isvector (p) || isempty (p)))
+ error ("argument must be a vector");
+ endif
+
+ lp = length (p);
+
+ if (lp == 0)
+ p = [];
+ return;
+ end
+
+ if (rows (p) > 1)
+ ## Convert to column vector
+ p = p.';
+ endif
+
+ p = [(p ./ [lp:-1:1]), k];
+
+ endfunction
*** ./scripts/polynomial/Makefile.in.orig16 2007-08-31 23:37:50.381782831
+0200
--- ./scripts/polynomial/Makefile.in 2007-08-31 23:38:04.363070531 +0200
***************
*** 21,27 ****
INSTALL_DATA = @INSTALL_DATA@
SOURCES = compan.m conv.m deconv.m mkpp.m pchip.m poly.m \
! polyder.m polyderiv.m polyfit.m polygcd.m polyinteg.m \
polyout.m polyreduce.m polyval.m polyvalm.m ppval.m residue.m \
roots.m spline.m unmkpp.m
--- 21,27 ----
INSTALL_DATA = @INSTALL_DATA@
SOURCES = compan.m conv.m deconv.m mkpp.m pchip.m poly.m \
! polyder.m polyderiv.m polyfit.m polygcd.m polyint.m \
polyout.m polyreduce.m polyval.m polyvalm.m ppval.m residue.m \
roots.m spline.m unmkpp.m