Re: Bug in Mathematica 7.0.1.0 ?
- To: mathgroup at smc.vnet.net
- Subject: [mg109319] Re: Bug in Mathematica 7.0.1.0 ?
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Wed, 21 Apr 2010 07:47:53 -0400 (EDT)
- References: <hqmd2g$pro$1@smc.vnet.net>
slawek wrote: > In[1] := Im[a] ^= 0; Conjugate[a b] > > Out[1] := Conjugate[a b] > > It is not funny, Mathematica 6 properly evaluates the result > > a Conjugate[b] > > What happens? > > slawek > > There are several points here: 1) The answer from 7.0.1 is not wrong - just not in the form you desired. 2) Your code assumed that Conjugate called Im internally - this is the sort of assumption that may vary from one version to the next. 3) Using the code: FullSimplify[Conjugate[a b], Im[a] == 0] solves the problem, but in a possibly unreliable way because (a Conjugate[b]) is actually no simpler than Conjugate[a b] Ideally, you need to find a way to tell Mathematica that a is Real, and what kind of expression you prefer, for example: In[8]:= complexity[expr_] := LeafCount[expr] + 10*Count[expr, Conjugate[x_ y_], {0, Infinity}]; FullSimplify[Conjugate[a b], Im[a] == 0, ComplexityFunction -> complexity] Out[9]= a Conjugate[b] Note that although that looks like a lot of work, you can wrap the process up in a function that you define at startup, or in a package, and then use as required. David Bailey http://www.dbaileyconsultancy.co.uk