I tried a mathematical experiment, using the DirectSearch package http://www.maplesoft.com/applications/view.aspx?SID=101333 , and obtained $\max f = 0.809126470893692 $ for $a_1 = .243175515810934, a_2 = .417367431111117, a_3 = .432125841032896,$ $ a_4 = .281815795280440, a_5= 0.239770895080612e-1, a_6 = -.243248539429584,$ $ a_7 = -.417366236874912, a_8 = -.432123102835062, a_9 = -.281798611220396,$ $ a_{10} = -0.0239247832264742$ in the case $n=10$. The optimal solution is not unique.