Re: Collect, Coefficient, and non-integer exponents
- To: mathgroup at smc.vnet.net
- Subject: [mg8769] Re: [mg8733] Collect, Coefficient, and non-integer exponents
- From: Olivier Gerard <jacquesg at pratique.fr>
- Date: Thu, 25 Sep 1997 12:26:04 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hi Sergio, In my posting to the newsgroup, I made a mistake in writing down your example. Fortunately my code will works for the original one too. Allan Hayes has proposed a solution which is quite elegant . But it works only with 3.0 and not with my 2.2 (Macintosh). In the latter case it hangs forever with your test example. It seems the problem in his code is the use of Exponent which works differently in 2.2 and in 3.0 as shows this test: Exponent[x^45+10 x^(7000/81)+ 5x^(1000.3),x] which gives 1000.3 in 3.0 but 7000/81 with 2.2, ignoring approximate exponents in the latter case. A solution to work this around would perhaps be the use of Rationalize ? Of course it works in 2.2 if you express the exponents as 12/100 /n and not 0.12/n . In slight contradiction to what I said, Coefficient seems to work in very general cases (even on 2.2 Mma on a Mac) although CoefficientList does not works with rationals in 2.2 and 3.0 and would not accept any non polynomial input. (If there is at least one rational exponents, it puts everything in the 0 exponent place, whereas if there are approximate exponents it treats correctly the integer exponents present ). This was the motivation of my code which works the same way with every Mma version I tested it. If you prefer the presentation given by Allan routine, just Transpose my routine's output. Olivier Gerard.