# commons-issues mailing list archives

##### Site index · List index
Message view
Top
From "Gilles (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-683) Create a method shift in the PolynomialFunction class
Date Mon, 03 Oct 2011 13:32:34 GMT
```
[ 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.