Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Selecting Real Roots, Again

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67140] Re: Selecting Real Roots, Again
  • From: bghiggins at ucdavis.edu
  • Date: Sat, 10 Jun 2006 04:53:49 -0400 (EDT)
  • References: <e6b5q5$d3c$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I believe you need to have a numeric value since Solve returns a root
function as the solution for your higher order polynomial. Thus Select
will not work. An alternative is to use FindInstance to see the roots
as y and x vary in the required domain. Here are 10 instances of those
roots:

FindInstance[.9 x^10 + .1 x^2 == y && 0 = x = 1 && 0 = y = 1,
{x, y}, 10] // N

{{x -> 0., y -> 0.}, {x -> 0.0728543, y ->
   0.000530775}, {x -> 0.121756,
    y -> 0.00148246}, {x -> 0.162675, y -> 0.00264632}, {x -> 0.297405,
y ->
    0.00884986}, {x -> 0.406188, y -> 0.0166089}, {x -> 0.46507, y ->
    0.022055}, {x -> 0.651697, y -> 0.0549073}, {x ->
      0.933134, y -> 0.53756}, {x -> 1., y -> 1.}}

Another approach is to use DeleteCases to eliminate complex roots and
those roots that lie ouside the domain for a given value of y say:

realRoot1[y1_?NumericQ] :=
      DeleteCases[N[x /. Solve[.9 x^10 + .1 x^2 == y, x] /.
      y -> y1], Complex[_, _] | x_Real /; (x < 0 || x > 1)]

In[92]:=
realRoot1[0.5]

Out[92]=
{0.925368}


You can use the above function to plot the roots for y in the required
range

Plot[Evaluate[realRoot1[y1]], {y1, 0, 1}]

Hope this helps,

Brian


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?


  • Prev by Date: Re: Formatted Date String
  • Next by Date: Re: Using Mathlink to export arrays
  • Previous by thread: Re: Selecting Real Roots, Again
  • Next by thread: Re: Selecting Real Roots, Again