Squaring the coefficients in homomorphic encryption In homomorphic encryption scheme FV, I can multiply an encrypted polynomial for any integer scalar, obtaining the same effect on the plain polynomial. For example, given the plain polynomial $\sum_ia_ix^i$, and its encrypted version $\sum_ib_ix^i$, I could multiply the latter by $c$ and decipher it, to obtain $\sum_i(ca_i)x^i$. Is there a way to do the same with squaring? Can I perform some operation on $\sum_ib_ix^i$ and then decipher it, to get $\sum_ia_i^2x^i$? I already tried with $\sum_ib_i^2x^i$, but it just dosen't work.

About the reasons I'm doing this, it's because I have to use a polynomial activation function in a neural network that uses homomorphic encryption, as explained in this paper
In the Fan-Vercauteren scheme, ciphertexts are composed of 2 polynomials, call them $ct_0$ and $ct_1$.
Although homomorphic addition is really simple (add the two parts independently), the same cannot be said for multiplication. As you noticed, simply multiplying the polynomials won't give you the desired result.
The homomorphic multiplication is composed of 2 steps.
First, you compute an intermediary ciphertext (it is not a real ciphertext because it's composed of 3 elements and not 2):
$$\frac{t}{q}ct_0ct'_0, \;\; \frac{t}{q}(ct_0ct'_1+ct_1ct'_0), \;\; \frac{t}{q}ct_1ct'_1$$ all of them rounded and taken modulo q. This intermediate can be obtained with the SEAL library using Evaluator::multiply.
You can use only this operation and keep your ciphertext size growing, but at some point, it would be more efficient to relinearize.
This operation is used to go back to a ciphertext containing only 2 elements, and can be obtained with the SEAL library using Evaluator::relinearize (it needs a key as a second argument that can be generated using KeyGenerator::generate_evaluation_keys.  

Now in order to square an element, you just have to multiply it by itself, but using the correct multiplication operation instead of the naive one.

For more details, you can have a look at this documentation.