MathGroup Archive 2006

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

Search the Archive

Re: Re: Eliminate Complex Roots


bghiggins at ucdavis.edu wrote:

>Pratik and Bob
>
>Thanks much for the suggestion of using FindInstance and Reduce.
>
>Pratik, your code only finds 1 root but a simple modification allows
>one to plot(usingListPlot) all three real roots:
>
>data = ListPlot[Partition[Flatten[N[Table[Flatten[{
>      b, a /. FindInstance[a^3 + 10*a^2 - 15*a + b ==
>0, a, Reals,3]}], {b, -20, 30, .5}]] /. {x_, y1_, y2_,  y3_} -> {{x,
>y1}, {x, y2}, {x, y3}}], 2]]
>
>Downside with the above approach is that you cannot use
>PlotJoined->True. Of course, a work around is to separate out the
>individual roots and use MultipleListPlot or Show with multiple
>ListPlot
>  
>
Perhaps something like this using DisplayTogether
<< Graphics`Graphics`
plot1=ListPlot[Partition[Flatten[N[Table[Flatten[{b, a /. 
FindInstance[a^3 + 10*a^2 - 15*a + b ==0, a, Reals,3]}], {b, -20, 30, 
.5}]] /. {x_, y1_, y2_,  y3_} -> 
{x,y1}],2],PlotJoined->True,PlotStyle->Hue[0]]
plot2=ListPlot[Partition[Flatten[N[Table[Flatten[{b, a /. 
FindInstance[a^3 + 10*a^2 - 15*a + b ==0, a, Reals,3]}], {b, -20, 30, 
.5}]] /. {x_, y1_, y2_,  y3_} -> 
{x,y2}],2],PlotJoined->True,PlotStyle->Hue[0.4]]
plot3=ListPlot[Partition[Flatten[N[Table[Flatten[{b, a /. 
FindInstance[a^3 + 10*a^2 - 15*a + b ==0, a, Reals,3]}], {b, -20, 30, 
.5}]] /. {x_, y1_, y2_,  y3_} -> 
{x,y3}],2],PlotJoined->True,PlotStyle->Hue[0.2]]
DisplayTogether[plot1,plot2,plot3]

>Still would like to be able to do this using Plot, and thereby make use
>of Plots automatic gridding capabilities...
>
>Looking at Bob's suggestion, it seems I am still stuck with knowing
>which root to extract out for Plotting. I can in a pinch manipulate the
>solution from Reduce and use ListPlot as done above.
>
>Another approach that seems to work well is to use ImplicitPlot making
>use of its built in ContourPlot routine. For systems of equations, I
>also need to use Eliminate to get a single implicit equation with two
>unknowns and it seems to work well, but may not be general enough for
>the kinds of problems I am interested in, viz, plotting multiple steady
>states of dynamical systems as a function of a parameter.
>
>Brian
>
>
>  
>
>>Perhaps using FindInstance? Here is my attempt anyway
>>
>>Clear[a,b]
>>ListPlot[Flatten[a/.Table[FindInstance[a^3 + 10*a^2 - 15*a + b ==
>>0,a,Reals],{b,-10,30}]//N],PlotJoined->True,PlotRange->All]
>>    
>>
>
>  
>


  • Prev by Date: Re: Re: Using a text editor like interface for Mathematica?
  • Next by Date: Re: Re: Re: Solve or Reduce?
  • Previous by thread: Re: Eliminate Complex Roots
  • Next by thread: Re: Eliminate Complex Roots