# Re: st: How to obtain the solution of a quintic polynomial equation using Stata

 From "Austin Nichols" To statalist@hsphsun2.harvard.edu Subject Re: st: How to obtain the solution of a quintic polynomial equation using Stata Date Sat, 17 Nov 2007 12:33:42 -0500

```In Stata 10, you can use Mata's optimize() to find the zeros of an equation like
f(x)=dy-(a0+a1*x+a2*x^2+a3*x^3+a4*x^4+a5*x^5)
by minimizing
(f(x))^2

On 11/17/07, tiago.pereira@incor.usp.br <tiago.pereira@incor.usp.br> wrote:
> Dear Statalisters
>
> I have the following quintic polynomial equation
> dy=a0+a1*x+a2*x^2+a3*x^3+a4*x^4+a5*x^5
>
> the objective is to estimate x.
>
> where
>
> a0= x12*mu_s*(1+mu_s)+2*x22*mu_s^2
> a1=-2*(n*mu_s*(1+mu_s)+x12*mu_s)
> a2=6*n*mu_s+2*x11+x12
> a3=-2*(2*n*mu_s+n+2*x11+x12)
> a4=4*n+2*x11+x12
> a5=-2*n
>
> Is there a straighforward way to solve it using Stata? Or, since I know
> that x is constrained between 0 and 1, to use brute force to find out the
> solution? If so, how many decimals places used in a loop would you
> suggest?
>
> Tiago
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```