MathGroup Archive 2007

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

Search the Archive

Re: Extracting solutions from Solve[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82573] Re: Extracting solutions from Solve[]
  • From: Steven Siew <siewsk at bp.com>
  • Date: Thu, 25 Oct 2007 06:05:01 -0400 (EDT)
  • References: <ffn0bv$5o0$1@smc.vnet.net>

On Oct 24, 6:39 pm, "Isaac Martinez G." <isaac.marti... at sbcglobal.net>
wrote:
> Hello group:
> New guy to Mathematica and I am using the Solve function to find all the roots of a non linear set of equations.
I do not have a function that selects positive solutions between 0 and
1

But I do have a select positive function.

SelectPositive[soln_] := Select[soln, Apply[And,Map[Abs[Part[#, 2]] ==
Part[#, 2] &, #]] & ]

In[4]:= Solve[4 x^2 - 6 x - 9 == 0, x]  // SelectPositive
Out[4]:=  {{x->3/4 (1+Sqrt[5])}}



> My question is once I have all the solution I am getting rid of all the complex ones and then I need to keep the ones that are within the interval [0,1].
> I have the following nested list after removing complex values:
> {{}, {}, {}, {}, {}, {}, {}, {}, {
>   1., -0.357968, -0.0366376}, {1., -0.357968, -0.0366376}, {}, {}, {}, {}, \
> {0.326026, -0.812319, 0.0112833}, {-0.791102,
>     0.283189, 0.0113524}, {}, {}, {0.454731, 0.840435, 0.0318799}, {}, {}, \
> {0.999998,
>     1.8482, 1.63961}, {0.999997, 1.8482, 1.63962}, {0.998429, -2.49158,
>     3.06313}, {0.999101, -2.49158, 3.06323}}
>
> I need to take the solution/group that is within [0,1].
> How do you do this??
> Any help is appreciated....no luck so far...




  • Prev by Date: Re: What am I doing wrong with this code?
  • Next by Date: Re: Gradient of a List
  • Previous by thread: Extracting solutions from Solve[]
  • Next by thread: Re: Extracting solutions from Solve[]