Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a question about Simplify: When I do a simplification the returned result is not as simple as I want. When I ask for the Norm of an complex expression, Mathematica just returns Norm[expr].

I don't know how to make it simpler, is this the final form that Mathematica can give?

Simplify[Conjugate[h^4 k^2 + 2 I h^2 k m V + (-1 + E^(2 I k l)) m^2 V^2], 
  {k, V, m, h, l} ∈ Reals]

When evaluating the above code, Mathematica just returns Conjugate[...], but what I need is a form without Conjugate in the front, just replace $i$ to $-i$ as usual math calculation.

share|improve this question
2  
You've seen ComplexExpand[]? –  J. M. May 12 '13 at 16:05
    
Next time I will try this with complex functions –  luming May 13 '13 at 17:34
add comment

2 Answers 2

up vote 10 down vote accepted
FullSimplify[
   ComplexExpand[
       Conjugate[(-1 + E^(2 I k l)) m^2 V^2 + 2 I k m V \[HBar]^2 + 
              k^2 \[HBar]^4], {k, V, m, \[HBar], l} \[Element] Reals]]

is probably as simple as it's going to get

E^(-2 I k l) m^2 V^2 + (-I m V + k \[HBar]^2)^2

There are a range of functions for dealing with complex numbers and equations: FullSimplify, Simplify, TrigToExp and it's brother ExpToTrig, and of course the ever popular ComplexExpand, which does such a nice job here. It's worth exploring the help files for these commands because they often give slightly different forms that might be useful in various situations.

share|improve this answer
    
Thank you, your comment is helpful! –  luming May 13 '13 at 17:06
add comment

Simplify uses as few assumptions as possible when simplifying an expression. This means that it doesn't presume that anything is real, or positive for example. At first this may seem perverse, but in fact it saves you from making incorrect assumptions a lot of the time.

Simplify is however very adaptable and allows you to not only include your own assumptions as to the variable types you are using, but also what simple actually means.

The simplest type of assumption you might want to make is that an elements is in the reals, or that something is within some range.

Simplify[somefunction[x,y], {x \[Element] Reals, y>0}]

In order to make your own definition of what simple means you can introduce a ComplexityFunction argument into Simplify. For instance, you can define simple to mean that you want to have the fewest possible characters in the expression:

f[e_] := StringLength[ToString[InputForm[e]]]
Simplify[Abs[x], x < 0, ComplexityFunction -> f]

The above is taken directly from the documentation for ComplexityFunction but I think it's a good example. The second argument in the above is the assumption.

There are, as @bill s has noted, some ready built commands like ComplexExpand which are useful in conjunction with the Simplify command.

Another useful tip for using Simplify is to note that you can adjust the time for which Mathematica will search down a particular transformation path. Setting the option TimeConstraint->10 will mean that after 10 seconds, it will give up with a particular transformation and try something else. Sometimes you will find that Mathematica makes a large improvement in the simplification of an expression in the first few seconds and then spends a long time making smaller improvements, so the TimeConstraint command can be used to define for yourself how long it is spending doing this. The default for this is 300 seconds and of course you can increase this as well if you need to.

You are able also to define your own transformation which Simplify will apply to your expression. For instance, you can ask it to use Reduce, or ComplexExpand. Look up TransformationFunctions in the documentation for this.

share|improve this answer
    
Your comment has such a large scope and I need to digest it with further study in mathematica. Thank you very much! –  luming May 13 '13 at 17:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.