% function psi = energy_fun(P,q); alpha_1 = q(1); alpha_11 = q(2); alpha_111 = q(3); psi = alpha_1*P.^2 + alpha_11*P.^4 + alpha_111*P.^6;