(4) Given the function $y=a^{2 x}+2 a^{x}-1$ has a maximum value of 14 on the interval $[-1,1]$, find the value of $a$.

 untranslated text remains unchanged:
将上面的文本翻译成英文，请保留源文本的换行和格式，直接输出翻译结果。 

(4) Given the function $y=a^{2 x}+2 a^{x}-1$ has a maximum value of 14 on the interval $[-1,1]$, find the value of $a$.
(4) $a=\frac{1}{3}$ or 3