MathGroup Archive 2006

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

Search the Archive

Re: using answer form reduce

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68634] Re: using answer form reduce
  • From: dimmechan at yahoo.com
  • Date: Mon, 14 Aug 2006 06:44:06 -0400 (EDT)
  • References: <ebmtf5$6fb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, akil,

Actually, it would very helpful to post your equation.
Anyway, I believe the following will be interesting for you.

First I generate a 4th degree polynomial:

In[1]:=
InputForm[pol=Apply[Plus,Table[Random[Integer,{1,10}]x^i,{i,0,4}]]]

Out[1]//InputForm=
10 + x + 3*x^2 + 7*x^3 + x^4

Using Reduce, I get:

In[2]:=
Reduce[pol\[Equal]0,x,Reals]//InputForm

Out[2]//InputForm=
x == Root[10 + #1 + 3*#1^2 + 7*#1^3 + #1^4 & , 1, 0] || x == Root[10 +
#1 + 3*#1^2 + 7*#1^3 + #1^4 & , 2, 0]

Now I use {ToRules[%]} obtaing:

In[3]:=
{ToRules[%]}//InputForm

Out[3]//InputForm=
{{x -> Root[10 + #1 + 3*#1^2 + 7*#1^3 + #1^4 & , 1, 0]}, {x -> Root[10
+ #1 + 3*#1^2 + 7*#1^3 + #1^4 & , 2, 0]}}

In[4]:=
?ToRules

ToRules[eqns] takes logical combinations of equations, in the form
generated \
by Roots and Reduce, and converts them to lists of rules, of the form \
produced by Solve. More...

To get the solutions in the form {Real1,Real2}, I simply use:

In[5]:=
x/.%%//InputForm

Out[5]//InputForm=
{Root[10 + #1 + 3*#1^2 + 7*#1^3 + #1^4 & , 1, 0], Root[10 + #1 + 3*#1^2
+ 7*#1^3 + #1^4 & , 2, 0]}

Finally I can get a form containing Radicals, executing the command:

In[100]:=
ToRadicals[%]//InputForm

Out[100]//InputForm=
{-7/4 - Sqrt[41/4 + (5481 - 27*Sqrt[39481])^(1/3)/3 + (203 +
Sqrt[39481])^(1/3)]/2 -
  Sqrt[(246 - 4*(5481 - 27*Sqrt[39481])^(1/3) - 12*(203 +
Sqrt[39481])^(1/3) +
      801/Sqrt[41/4 + (5481 - 27*Sqrt[39481])^(1/3)/3 + (203 +
Sqrt[39481])^(1/3)])/3]/4,
 -7/4 - Sqrt[41/4 + (5481 - 27*Sqrt[39481])^(1/3)/3 + (203 +
Sqrt[39481])^(1/3)]/2 +
  Sqrt[(246 - 4*(5481 - 27*Sqrt[39481])^(1/3) - 12*(203 +
Sqrt[39481])^(1/3) +
      801/Sqrt[41/4 + (5481 - 27*Sqrt[39481])^(1/3)/3 + (203 +
Sqrt[39481])^(1/3)])/3]/4}


I hope this will be helpful for you.

Cheers,

Jim

Î?/Î? akil έγÏ?αÏ?ε:
> After using reduce I get the following two types of answers:
>
> answer == Real1 || answer == Real2
> or
> answer == Real3
> , the type can change from one formula to another.
>
> I need the Reals, and put them all in a list. The problem is getting all the
> reals, without knowing which type I deal with, it should be able to be done
> fast.
>
> I tried making a list of the returned adres, and then using
> Cases[list, _Real, Infinity] and using Select[list,NumericQ] but both do not
> give me the answer I require.
>
> How can I get the answer I require e.g. something like {Real1,Real2,Real3}


  • Prev by Date: RE: RE: [heur] Scientific Notation on Y-axis of ListPlots
  • Next by Date: Re: Re: Wolfram Workbench and package development
  • Previous by thread: Re: using answer form reduce
  • Next by thread: to recover an image using edge integration