You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "DI COSTANZO (Created) (JIRA)" <ji...@apache.org> on 2011/10/03 12:20:33 UTC

[jira] [Created] (MATH-683) Create a method shift in the PolynomialFunction class

Create a method shift in the PolynomialFunction class
-----------------------------------------------------

                 Key: MATH-683
                 URL: https://issues.apache.org/jira/browse/MATH-683
             Project: Commons Math
          Issue Type: New Feature
    Affects Versions: 3.0
         Environment: All
            Reporter: DI COSTANZO
            Priority: Trivial


Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119304#comment-13119304 ] 

Gilles commented on MATH-683:
-----------------------------

Maybe that I'm being a little dense, but I think that you've not explained why the following class, which you could create in your application, is not what you need:
{code}
public class ShiftedPolynomial extends PolynomialFunction {
    private double shift;

    public ShiftedPolynomial(PolynomialFunction f, double a) {
        this(f.getCoefficients(), a);
    }
    public ShiftedPolynomial(double c[], double a) {
        super(c);
        shift = a;
    }

    public double value(double x) {
        super.value(x + shift);
    }

    public ShiftedPolynomial polynomialDerivative() {
        return new ShiftedPolynomial(super.polynomialDerivative(), shift);
    }
}
{code}

                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

DI COSTANZO updated MATH-683:
-----------------------------

    Attachment: PolynomialsUtilsTest.java
                PolynomialsUtils.java

Hello,

Here is the code for the shift method described above, and its associated test. As wanted, I add this functionnality in the PolynomailsUtils class.
Romain
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>         Attachments: PolynomialsUtils.java, PolynomialsUtilsTest.java
>
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119339#comment-13119339 ] 

DI COSTANZO commented on MATH-683:
----------------------------------

That's it. I'll send you the code when completed.

                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119313#comment-13119313 ] 

DI COSTANZO commented on MATH-683:
----------------------------------

Effectivelly, the code you posted above can be a solution for someone who only want to evaluate a polynomial function shifted by a specific value.
Unfortunately, I can't deal with that representation, as I need to have the coefficients of the shifted polynomial :
I'm facing this problem in a recurrence formula. To achieve it, I need to sum polynomial, some of them being shifted by real values.
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "Gilles (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles resolved MATH-683.
-------------------------

       Resolution: Fixed
    Fix Version/s: 3.0

Committed (with some stylistic changes) in revision 1179671.

Thanks for the contribution. But when submitting changes to an existing file, it is better to provide a "patch". Also, do not forget to check whether there are any warnings generated by the "CheckStyle" tool.

                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>             Fix For: 3.0
>
>         Attachments: PolynomialsUtils.java, PolynomialsUtilsTest.java
>
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13122664#comment-13122664 ] 

DI COSTANZO commented on MATH-683:
----------------------------------

Thanks !
I didn't know for the patch, I'll provide one next time. And I'll will also check the CheckStyle warnings. 
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>             Fix For: 3.0
>
>         Attachments: PolynomialsUtils.java, PolynomialsUtilsTest.java
>
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119267#comment-13119267 ] 

DI COSTANZO commented on MATH-683:
----------------------------------

No. I don't want to modify the "value" method. I just want to add a new "shift" method transforming the current polynomial defined as an array of coeffcient in increasing 'x' power, by a new polynomial where 'x' is replaced by 'x+a', a beeing a double value. The signature could be something like this :

PolynomialFunction shift(final double shift){
}

So, if the initial polynomial is given by :
P1 = sum(ai * x^i) (i = 0...n)

The new polynomial created by the "shift" method will be :
P2 = sum(ai * (x + a)^i) (i = 0...n)
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119256#comment-13119256 ] 

Gilles commented on MATH-683:
-----------------------------

You obtain the result by calling the "value" method with "k + a" as the argument.
Or did I miss something?
Please explain what you want to achieve.

                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119278#comment-13119278 ] 

DI COSTANZO commented on MATH-683:
----------------------------------

You're right, I'm interested by the first option, I need P2 to be a PolynomialFunction. 
And effectively, my post on the Pascal Triangle goes in this sense.
Romain
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "Sébastien Brisard (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119273#comment-13119273 ] 

Sébastien Brisard commented on MATH-683:
----------------------------------------

I think you might want to specify whether or not you would like at some point to be able to retrieve the coefficients of {{P2}}. In other words, do you need {{P2}} to be a {{PolynomialFunction}} or do you merely need to be able to compose {{P1}} and a shifter, which would return {{P2}} as a {{UnivariateRealFunction}}, e.g
{code}
final PolynomialFunction p1 = PolynomialsUtils.createLegendrePolynomial(10);
final double a = 1.;
UnivariateRealFunction p2 = new UnivariateRealFunction(){
  public double value(final double x){
    return p1.value(x+a);
  }
}
{code}
I suspect the answer is the first option, since you also requested for the Pascale Triangle...
Sébastien
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13122018#comment-13122018 ] 

Gilles commented on MATH-683:
-----------------------------

I also changed the return type of the method, in order to emphasize the transformation of the coefficients. It is trivial for the user to create the "PolynomialFunction".
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>             Fix For: 3.0
>
>         Attachments: PolynomialsUtils.java, PolynomialsUtilsTest.java
>
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "DI COSTANZO (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119315#comment-13119315 ] 

DI COSTANZO commented on MATH-683:
----------------------------------

Just a last precision,I need to implement this method anyway to achieve my work on those recurrence formul. What I can do is to send you the corresponding code, and you could add it if you think it could be usefull to others...
Romain
                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class

Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119334#comment-13119334 ] 

Gilles commented on MATH-683:
-----------------------------

Yes, please attach everything that could be useful to figure out what is the required functionality.
So, if I understand correctly, what you really request is the function that would compute the new  coefficients ("bi"):
{noformat}
Ps(k) = Sum bi * k^i
      = Sum ai * (k + a)^i
      = P(k + a)
{noformat}

This functionality should probably go in the "PolynomialsUtils" class:
{code}
public static double[] shiftedPolynomialCoefficients(double[] c, double shift) {
    // ...
}
{code}

                
> Create a method shift in the PolynomialFunction class
> -----------------------------------------------------
>
>                 Key: MATH-683
>                 URL: https://issues.apache.org/jira/browse/MATH-683
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: DI COSTANZO
>            Priority: Trivial
>
> Create a method shift to transform a polynomial P(k) in P(k + a) where a is any double value.
> The polynomial sum(ai * k^i) turns into sum(ai * (k+a)^i)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira