Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Re: silly questions?


On 29 Jul 2005, at 06:41, snoofly wrote:

> Thanks Andrzej and others for your informative replies on LeafCount
> regarding my simplification query. I see how it all makes sense  
> regarding
> the Cos simplification but I have one little nagging issue left as the
> following example shows:
>
> Factor[x^4 - 16]
>
> (-2 + x)*(2 + x)*(4 + x^2)
>
> FullSimplify[(x^4-16)/(-2+x)]
>
> (2 + x)*(4 + x^2)
>
> FullSimplify[(x^4-16)/(2+x)]
>
> (-16 + x^4)/(2 + x)
>
> LeafCount[(-16+x^4)/(2+x)]
>
> 11
>
> LeafCount[(-16+x^4)/(-2+x)]
>
> 11
>
> LeafCount[(2+x)*(4+x^2)]
>
> 9
>
> LeafCount[(-2+x)*(4+x^2)]
>
> 9
>
> The question to you gifted individuals is why doesn't
> FullSimplify[(x^4-16)/(2+x)] give (-2 + x)*(4 + x^2) which has a lower
> leaf count?



FullSimplify[(x^4 - 16)/(2 + x),
   TransformationFunctions -> {Automatic, Factor}]


(x - 2)*(x^2 + 4)

Andrzej Kozlowski






>
> On Thu, 28 Jul 2005 07:55:58 +0100, Andrzej Kozlowski  
> <akoz at mimuw.edu.pl>
> wrote:
>
>
>>
>>
>> On 27 Jul 2005, at 07:26, Kent Holing wrote:
>>
>>
>>> Why does not (x^5-32)/(x-2)//FullSimplify in Mathematica  work?
>>> Compare with Factor[x^5-32]//InputForm which returns (-2 + x)*(16 +
>>> 8*x + 4*x^2 + 2*x^3 + x^4).
>>> So why does not the first command just return 16 + 8*x + 4*x^2 +
>>> 2*x^3 + x^4?
>>> As in a factorization above, how is the easiest way to pick
>>> automatically (by a function) the factors of say degree >=2,  if  
>>> any ?
>>>
>>> Kent Holing
>>>
>>>
>>>
>>
>> Very "simple". What makes you think the cancelled out form is  
>> "simpler"?
>>
>>
>> LeafCount[(x^5-32)/(x-2)]
>>
>>
>> 11
>>
>> while
>>
>>
>> LeafCount[Cancel[(x^5-32)/(x-2)]]
>>
>>
>> 18
>>
>> The cancelled form is much more "complicated", at least as measured
>> by LeafCount (and Mathematica's default complexity function).
>>
>> So if you want your answer it is better to make ask Mathematica to
>> make the expression more "complex":
>>
>>
>> Simplify[(x^5 - 32)/(x - 2), ComplexityFunction ->
>>     (1/LeafCount[#1] & )]
>>
>>
>> x^4 + 2*x^3 + 4*x^2 + 8*x + 16
>>
>> But it is of course much more sensible to just use Cancel.
>>
>> Andrzej Kozlowski
>>
>>
>>
>>
>
>


  • Prev by Date: Re: Add terms surrounded by zero together in matrix
  • Next by Date: Re: Add terms surrounded by zero together in matrix
  • Previous by thread: Re: silly questions?
  • Next by thread: Re: silly questions?