Re: Factorizing...
- To: mathgroup at smc.vnet.net
- Subject: [mg74150] Re: Factorizing...
- From: "Valeri Astanoff" <astanoff at gmail.com>
- Date: Mon, 12 Mar 2007 22:11:22 -0500 (EST)
- References: <esr0lj$6hp$1@smc.vnet.net>
On 9 mar, 08:00, "Bruno Campanini" <B... at gmail.com> wrote: > How can I get it from Mathematica: > > Factor[2+SQR(5)] = ((1+SQR(5))/2)^3 > > ??? > > Bruno Good day, Here is a DIY way to do it : In[1]:=myFactor[p_+(q_:1)Sqrt[r_],maxi_:5]:= Module[{y,a,b,c,n}, Table[If[Simplify[p+q* Sqrt[r] == (y=(a+b *Sqrt[r])* (c+Sqrt[r])/n)],y], {a,-maxi,maxi},{b,-maxi,maxi},{c,-maxi,maxi},{n,1,maxi}]// Flatten//Cases[#,x_/;!MatchQ[x,(p+q*Sqrt[r]|Null)]]& // Cancel//Union ]; In[2]:=myFactor[2 + Sqrt[5]] Out[2]={(1/4)*(1+Sqrt[5])*(3+Sqrt[5]),(5+2*Sqrt[5])/Sqrt[5]} In[3]:=(1/4)*(1+Sqrt[5])*myFactor[3+Sqrt[5]] Out[3]={(1/8)*(1+Sqrt[5])^3, (1/4)*(-1+Sqrt[5])*(1+Sqrt[5])*(2+Sqrt[5]), (-(1/20))*(-5+Sqrt[5])*(1+Sqrt[5])*(5+2*Sqrt[5]), ((1+Sqrt[5])*(5+3*Sqrt[5]))/(4*Sqrt[5])} In[4]:=%//Simplify Out[4]={2+Sqrt[5],2+Sqrt[5],2+Sqrt[5],2+Sqrt[5]} V.Astanoff