[Date Index]
[Thread Index]
[Author Index]
ComplexExpand, Piecewise, and simplification
*To*: mathgroup at smc.vnet.net
*Subject*: [mg66659] ComplexExpand, Piecewise, and simplification
*From*: Andrew Moylan <andrew.moylan at anu.edu.au>
*Date*: Fri, 26 May 2006 04:17:19 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Thanks for your help regarding "Simplification and Arg[]", Andrzej and
others. I have written a function that determines which independent
variables in an expression are not known to be real (according to
$Assumptions), and thus must be passed as the second argument to
ComplexExpand. This makes ComplexExpand safe to call on any expression.
I have since noticed that FullSimplify is also comparitively poor at
handling Piecewise functions. There are two aspects to this that I have
found:
(1) In an expression like a+Piecewise[{{b,condition1},{c,condition2}}],
it is frequently useful to try calling PiecewiseExpand; it will bring
the "a+" inside the Piecewise function and allow for
simplification/cancellation of it with the pieces. This is a very cheap
operation, but FullSimplify does not appear to take advantage of it.
(2) In an expression like
Piecewise[{{b,condition1},{c,condition2}},defaultvalue], it is
frequently useful to append condition1 to $Assumptions and then call
FullSimplify on piece b, followed by instead appending condition2 to
$Assumptions and calling FullSimplify on piece c, then finally appending
Not[Or[condition1,condition2]] to $Assumptions and then calling
FullSimplify on the defaultvalue.
As Andrezj suggested, I have written extended versions of Simplify and
FullSimplify. They expose an indentical interface to the built-in
functions, except they expose additional options specifying whether to
try various ComplexExpand transformation functions (with various values
for the TargetFunctions option and automatically-determined list of
complex variables); and whether to use the simple Piecewise
simplification methods described above.
-Andrew
Andrzej Kozlowski wrote:
> On 22 May 2006, at 11:30, Andrew Moylan wrote:
>
>
>>Should Mathematica be able to simplify the following expression?
>>(It is
>>easily seen to be zero under the given condition, x > 0.)
>>
>>FullSimplify[
>> Arg[1 + I * x] + Arg[1 - I * x],
>> {x > 0}
>>]
>>
>>In particular, I would have expected the following to yield ArcTan[b /
>>a], from which the above expression is easily reduced to zero:
>>
>>FullSimplify[
>> Arg[a + I b],
>> {a > 0, b > 0}
>>]
>>
>>Any ideas?
>>
>>Cheers,
>>
>>Andrew
>>
>>P.S. Apologies if I have sent this twice; my original message seems
>>not
>>to have worked.
>>
>
>
>
> You do not even need the condition x>0: it is enough that x is real.
>
> ComplexExpand[Arg[1 + I * x] + Arg[1 - I * x],TargetFunctions->{Re,Im}]
>
> 0
>
> Simplify and FullSimplify by default do not make use of ComplexExpand.
> Of course, if you wish you can make Simplify use ComplexExpand:
>
> Simplify[Arg[1 + I*x] + Arg[1 - I*x],
> TransformationFunctions ->
> {ComplexExpand[#1, TargetFunctions -> {Re, Im}] & ,
> Automatic}]
>
> 0
>
> Note that doing this automatically involves the assumption that x is
> real, so it would not be a good idea to permanently append
> ComplexExpand to the TransformationFunctions, except when the
> assumptions imply that the variables involved are real. However, it
> is not difficult to write a version of Simplify or FullSimplify which
> will make use ComplexExpand in a way that is compatible with the
> assumptions about the variables (real or complex). That it is not
> done by default is probably due to the facts that, on the one hand,
> ComplexExpand is a high complexity function, and on the other, it
> usually leads to more rather than less complex expressions (after all
> it "Expands").
>
> Note also that:
>
>
> ComplexExpand[Arg[a + I*b], TargetFunctions -> {Re, Im}]
>
>
> ArcTan[a, b]
>
> so the assumption about a and b being positive are again not needed.
>
>
> Andrzej Kozlowski
> Tokyo, Japan
>
Prev by Date:
**RE: scalar field visualization**
Next by Date:
**Re: Output Table Format Change**
Previous by thread:
**Using Mathematica to locate a PDE singularity**
Next by thread:
**x/x**
| |