RE: Partial Fraction Decomposition with imaginary coeff.
- To: mathgroup at yoda.physics.unc.edu
- Subject: RE: Partial Fraction Decomposition with imaginary coeff.
- From: HAY at leicester.ac.uk
- Date: Mon, 9 MAR 92 12:03:23 GMT
Jason C. Breckenridge, Department of Physics, University of Western Ontario, Internet:jbrecken at hydra.uwo.ca writes > I am experiencing some difficulty getting Mathematica to factor > something like > (x^2 + 1) into (x + I) (x - I). > I have studied the book, and cannot find anything subtle, let > alone obvious, which deals with this. A FIRST TRY AT THE FACTORISING : FactorComplex[expr_,x_] := Times@@(x - (x/.Solve[expr == 0, x])) TESTS: FactorComplex[x^2 +1, x] (-I + x) (I + x) FactorComplex[(x^2 +1)^2, x] 2 2 (-I + x) (I + x) FactorComplex[x^3 +x^2 -2x +1, x] (*Wo 1/3 1/3 1 7 2 (-47 + Sqrt[837]) (- - ---------------------- - -------------------- + x) 3 1/3 1/3 3 (-47 + Sqrt[837]) 3 2 1/3 1/3 1 I -7 2 (-47 + Sqrt[837]) (- - - Sqrt[3] (---------------------- + --------------------) + 3 2 1/3 1/3 3 (-47 + Sqrt[837]) 3 2 1/3 1/3 7 2 (-47 + Sqrt[837]) ---------------------- + -------------------- 1/3 1/3 3 (-47 + Sqrt[837]) 3 2 --------------------------------------------- + x) 2 1/3 1/3 1 I -7 2 (-47 + Sqrt[837]) (- + - Sqrt[3] (---------------------- + --------------------) + 3 2 1/3 1/3 3 (-47 + Sqrt[837]) 3 2 1/3 1/3 7 2 (-47 + Sqrt[837]) ---------------------- + -------------------- 1/3 1/3 3 (-47 + Sqrt[837]) 3 2 --------------------------------------------- + x) 2 Together[Expand[%32]] 2 3 1 - 2 x + x + x PROBLEM: Consider Expand[(x-1)( x^5 +x^2 -2x +1)] 2 3 5 6 -1 + 3 x - 3 x + x - x + x The following cannot be done since Solve is stumped by -1 + 3x - 3x^2 + x^3 - x^5 + x^6 == 0 FactorComplex[-1 + 3x - 3x^2 + x^3 - x^5 + x^6, x] ReplaceAll::rmix: 5 Elements of {{x -> 1}, ToRules[Roots[1 + <<2>> + x == 0, x]]} are a mixture of lists and non-lists. ReplaceAll::rmix: 5 Elements of {{x -> 1}, ToRules[Roots[1 + <<2>> + x == 0, x]]} are a mixture of lists and non-lists. 2 5 -(x (x /. {{x -> 1}, ToRules[Roots[1 - 2 x + x + x == 0, x]]})) A WAY OUT One way is to arrange for a numerical solution to the offending part. For this it is conveient to introduce a variant of Solve SolveN[arg__] := Solve[arg]/.e_ToRules :> N[e]; Now define FactorComplexN[expr_,x_] := Times@@(x - (x/.SolveN[expr == 0, x])) TEST: FactorComplexN[-1 + 3x - 3x^2 + x^3 - x^5 + x^6, x] (-1 + x) (-0.661809 - 0.256023 I + x) (-0.661809 + 0.256023 I + x) (-0.050841 - 1.17931 I + x) (-0.050841 + 1.17931 I + x) (1.4253 + x) (-1 + x) (-0.661809 - 0.256023 I + x) (-0.661809 + 0.256023 I + x) (-0.050841 - 1.17931 I + x) (-0.050841 + 1.17931 I + x) (1.4253 + x) Expand[%]//Chop 2 3 5 6 -1. + 3. x - 3. x + 1. x - 1. x + x From Allan Hayes Department of Mathematics The University Leicester LE1 7RH U.K. hay at leicester.ac.uk