%% Summation of Polynomial Series
% Find the summation of the polynomial series F\left(x\right)=\sum_{k=1}^8 a_k x^k.
% If you know that the coefficient a_k is a function of some integer variable k, use the symsum function. For example, find the sum F\left(x\right)=\sum_{k=1}^8 kx^k.

syms x k
F(x) = symsum(k*x^k,k,1,8)

% Calculate the summation series for x = 2.

F(2)

% Alternatively, if you know that the coefficients a_k are a vector of values, you can use the sum function. For example, the coefficients are a_1 ,\dots ,a_8 =1,\dots ,8. Declare the term x^k as a vector by using subs(x^k,k,1:8).

a = 1:8;
G(x) = sum(a.*subs(x^k,k,1:8))

% Calculate the summation series for x = 2.

G(2)

%
% Copyright 2019 The MathWorks, Inc.