Re: Selecting Real Roots, Again

*To*: mathgroup at smc.vnet.net*Subject*: [mg67136] Re: [mg67104] Selecting Real Roots, Again*From*: "Carl K. Woll" <carlw at wolfram.com>*Date*: Sat, 10 Jun 2006 04:53:38 -0400 (EDT)*References*: <200606090508.BAA11280@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

DOD wrote: > I've read the many posts already here about how to get mathematica to > select real roots for you, but I have a slightly(very slighty, I > thought) different problem ,and I don't know how to get mathematica to > do what I want. > > I want to get the solution for a polynomial of the following form: > d x^n + (1-d) x^2 =y > > so for example, I do > Solve[.9 x^10 + .1 x^2 ==y,x] > and I get a whole bunch of solution, very good. For my purposes, y > lives in the [0,1], as must the solution. So I can see, by hand, which > root I want; exactly one root is both real, and has solutions in my > inverval. So I want to tell mathematica to: > > A: look at only solutions x* that are real over y in [0,1] > > and > > B: of those solutions, give the one x* that itself lies is [0,1]. > > So, when I try to do something from reading previous posts, I cannot > get it to work: > In[24]:= > Select[Solve[.9 x^10 + .1 x^2 ==y,x],Element[x/.#,Reals]&] > > Out[24]= > {} > or perhaps > In[41]:= > Select[Solve[.9 x^10 + .1 x^2 > ==y,x],Assuming[Element[y,Reals],Eement[x/.#,Reals]]&] > Out[41]= > {} > > > So How to I tell mathematica to do this? Mathematica can't determine whether the Root objects returned by Solve are real without knowing something about y, so your Select condition will not work. A better approach would be to use Reduce, where you can specify the conditions you are interested in: In[21]:= Reduce[ d x^10 + (1 - d) x^2 == y && 0 <= y <= 1 && 0 <= x <= 1 && 0 <= d <= 1, x] Out[21]= (y == 0 && 0 <= d <= 1 && x == Root[d #1^10 + (1 - d) #1^2 &, 1]) || (0 < y <= 1 && 0 <= d <= 1 && x == Root[d #1^10 + (1 - d) #1^2 - y &, 2]) So, the root you are looking for is the second one returned above (the first is only defined for y==0). For example, Plot[ Root[ .9 #^10 + .1 #^2 - y&, 2], {y,0,1}] will plot the dependence of x on y for d==.9. Carl Woll Wolfram Research

**References**:**Selecting Real Roots, Again***From:*"DOD" <dcodea@gmail.com>