polytrans & polyscale

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

polytrans & polyscale

Jaroslav Hajek-2
hi,

I recently added the functions polytrans (p(x) -> p(x+a)) and
polyscale (p(x) -> p(x*a)) to the scripts/polynomial, though they are
not yet added to the build process. Does anyone object to adding these
functions definitely? These are not in Matlab core, but then neither
is a number of other polynomial functions (polyint, polyout...).
Opinons wanted.

regards

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
Reply | Threaded
Open this post in threaded view
|

Re: polytrans & polyscale

Thorsten Meyer
Jaroslav Hajek wrote:
> hi,
>
> I recently added the functions polytrans (p(x) -> p(x+a)) and
> polyscale (p(x) -> p(x*a)) to the scripts/polynomial, though they are
> not yet added to the build process. Does anyone object to adding these
> functions definitely? These are not in Matlab core, but then neither
> is a number of other polynomial functions (polyint, polyout...).
> Opinons wanted.
>
I like those functions. So I vote for adding them to octave.

Still, I have a few remarks:
 - there seems to be a bug in polytrans: try the example given in the help text.
It looks as if polytrans calculates f(-x - a)
 - polyval also contains an option to translate and scale. And it seems to me
that it will translate into the other direction and scale with the inverse
compare to polytrans and polyscale. Wouldn't it be better to make those
functions consistent to avoid confusion?
 - I notice that there are no tests included in the functions. Also, there is no
reference to polyval and polytrans in the manual yet. And the doc strings have
not been fully translated to texinfo. Don't we have the general rule, that
tests, manual entry and style compliance are required before adding a new function?

regards

Thorsten

Reply | Threaded
Open this post in threaded view
|

Re: polytrans & polyscale

Jaroslav Hajek-2
On Fri, Apr 10, 2009 at 12:19 PM, Thorsten Meyer <[hidden email]> wrote:

> Jaroslav Hajek wrote:
>> hi,
>>
>> I recently added the functions polytrans (p(x) -> p(x+a)) and
>> polyscale (p(x) -> p(x*a)) to the scripts/polynomial, though they are
>> not yet added to the build process. Does anyone object to adding these
>> functions definitely? These are not in Matlab core, but then neither
>> is a number of other polynomial functions (polyint, polyout...).
>> Opinons wanted.
>>
> I like those functions. So I vote for adding them to octave.
>
> Still, I have a few remarks:
>  - there seems to be a bug in polytrans: try the example given in the help text.
> It looks as if polytrans calculates f(-x - a)

Works for me. What's your tip? Be aware that I extended "pascal" for
this purpose to be able to return the standard pascal triangle without
unnecessary sign changes.

>  - polyval also contains an option to translate and scale. And it seems to me
> that it will translate into the other direction and scale with the inverse
> compare to polytrans and polyscale. Wouldn't it be better to make those
> functions consistent to avoid confusion?

Yes, that's a good point. I see polyval uses a single array to pass
both parameters, so maybe we should actually do "polytranscale" and
use the same form to be consistent.

>  - I notice that there are no tests included in the functions. Also, there is no
> reference to polyval and polytrans in the manual yet. And the doc strings have
> not been fully translated to texinfo. Don't we have the general rule, that
> tests, manual entry and style compliance are required before adding a new function?
>

As I explained, they're not truly added yet, because they're not
listed in makefiles, so they won't be installed if you install a
snapshot, and they won't go into the autogenerated docs (at least I
hope so). So they're only there if you test development builts "in
place" using run-octave, which is precisely what I wanted. If people
think this is still too bad of a practice, I'll wipe them out. The
benefit is that you can see the history and you won't miss essential
changes (such as the "pascal" extension) if you go via the normal
mercurial way.

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

Reply | Threaded
Open this post in threaded view
|

Re: polytrans & polyscale

bpabbott
Administrator
In reply to this post by Jaroslav Hajek-2

On Apr 8, 2009, at 3:05 AM, Jaroslav Hajek wrote:

> hi,
>
> I recently added the functions polytrans (p(x) -> p(x+a)) and
> polyscale (p(x) -> p(x*a)) to the scripts/polynomial, though they are
> not yet added to the build process. Does anyone object to adding these
> functions definitely? These are not in Matlab core, but then neither
> is a number of other polynomial functions (polyint, polyout...).
> Opinons wanted.
>
> regards

I'd like to see them added to the core as well.

As pointed out by Thorsten these functions are implicitly implemented  
in polyfit/polyval already. I had the privilege of adding this  
functionality and had considered introducing such functions at that  
time.

Beyond that, I commonly make use of polynomials in my work. My two  
most common polynomial related problems are cure-fitting, and solving  
DEs (electrostatics in particular).  Thus from my position these have  
broad application and would be useful to have in Octave's core.

Ben
Reply | Threaded
Open this post in threaded view
|

Re: polytrans & polyscale

Thorsten Meyer
In reply to this post by Jaroslav Hajek-2
Hi,

Jaroslav Hajek wrote:
On Fri, Apr 10, 2009 at 12:19 PM, Thorsten Meyer [hidden email] wrote:
  
Jaroslav Hajek wrote:
    
hi,

I recently added the functions polytrans (p(x) -> p(x+a)) and
polyscale (p(x) -> p(x*a)) to the scripts/polynomial, though they are
not yet added to the build process. Does anyone object to adding these
functions definitely? These are not in Matlab core, but then neither
is a number of other polynomial functions (polyint, polyout...).
Opinons wanted.

      
I like those functions. So I vote for adding them to octave.

Still, I have a few remarks:
 - there seems to be a bug in polytrans: try the example given in the help text.
It looks as if polytrans calculates f(-x - a)
    

Works for me. What's your tip? Be aware that I extended "pascal" for
this purpose to be able to return the standard pascal triangle without
unnecessary sign changes.
  
I've just rebuilt from the current tip. Now the sign reversal is gone.

thanks

Thorsten
Reply | Threaded
Open this post in threaded view
|

Re: polytrans & polyscale

Jaroslav Hajek-2
In reply to this post by Thorsten Meyer
On Fri, Apr 10, 2009 at 12:19 PM, Thorsten Meyer <[hidden email]> wrote:

> Jaroslav Hajek wrote:
>> hi,
>>
>> I recently added the functions polytrans (p(x) -> p(x+a)) and
>> polyscale (p(x) -> p(x*a)) to the scripts/polynomial, though they are
>> not yet added to the build process. Does anyone object to adding these
>> functions definitely? These are not in Matlab core, but then neither
>> is a number of other polynomial functions (polyint, polyout...).
>> Opinons wanted.
>>
> I like those functions. So I vote for adding them to octave.
>
> Still, I have a few remarks:
>  - there seems to be a bug in polytrans: try the example given in the help text.
> It looks as if polytrans calculates f(-x - a)
>  - polyval also contains an option to translate and scale. And it seems to me
> that it will translate into the other direction and scale with the inverse
> compare to polytrans and polyscale. Wouldn't it be better to make those
> functions consistent to avoid confusion?
>  - I notice that there are no tests included in the functions. Also, there is no
> reference to polyval and polytrans in the manual yet. And the doc strings have
> not been fully translated to texinfo. Don't we have the general rule, that
> tests, manual entry and style compliance are required before adding a new function?
>

I addressed these points partly by merging polytrans & polyscale to
"polyaffine" (which someone suggested earlier) to make it consistent
with polyval. I also added a simple test and turned the example from
the docs to a demo.
I'll include this function in the docs eventually, but feel free to do
it (or anyone else).

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz