# is there a way to obtain F(-x) polynomial

1 view (last 30 days)
ali temsah on 14 May 2022
Commented: Voss on 14 May 2022
syms x
%if i have
% f is the coeffents of the polynomial
f=[2 43 12];
%F(x) is the polynomial of (+x)
F(x)=poly2sym(f,x)
%F(-x) the poly nomial of(-x)
F(-x)=???
% is there a way to obtain F(-x)?
Torsten on 14 May 2022
You define a new symbolic function G as G(x) = F(-x). That's what F(-x) means.

Voss on 14 May 2022
Here's a way to do it by operating on the coefficients f rather than the symbolic F(x).
Realize that
• , n even
• , n odd
Therefore, you can obtain the coefficients of F(-x) from the cofficients of F(x) by negating the coefficients of the odd powers of x:
syms x
f=[2 43 12];
%F(x) is the polynomial of (+x)
F(x)=poly2sym(f,x)
F(x) = %F_(x) is the polynomial of (-x)
f_ = f;
f_(end-1:-2:1) = -f(end-1:-2:1);
F_(x) = poly2sym(f_,x)
F_(x) = Voss on 14 May 2022
An alternative (maybe more intuitive) way to do the same (multiplying each coefficient by (-1)^n, where n is the corresponding power of x):
syms x
f=[2 43 12];
%F(x) is the polynomial of (+x)
F(x)=poly2sym(f,x)
F(x) = %F_(x) is the polynomial of (-x)
f_ = f.*(-1).^(numel(f)-1:-1:0);
F_(x) = poly2sym(f_,x)
F_(x) = Sam Chak on 14 May 2022
Alternatively, the same you've got F(x).
H(x) = poly2sym(f, -x)
##### 2 CommentsShowHide 1 older comment
Sam Chak on 14 May 2022
My apologies. I quickly ran it from Octave. I was not aware that it doesn't work on MATLAB. Follow @Torsten's and @_'s methods. R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!