[Date Index]
[Thread Index]
[Author Index]
Re: Questions about Abs[_]
*To*: mathgroup at smc.vnet.net
*Subject*: [mg55540] Re: [mg55511] Questions about Abs[_]
*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>
*Date*: Mon, 28 Mar 2005 03:39:03 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
On 28 Mar 2005, at 01:09, Steeve Brechmann (schumi) wrote:
> Hi,
> First, thanks for you help.
> Second, i make a mistake in the second question. It is more like :
> 2) Why Abs[2*z0-2*d*m]^2 doesn't simplify with (2*z0-2*d*m)^2 ?
> The two expressions are always positive...and contains the same
> variables...
> Steeve Brechmann
> Physics Department, Laval University
> steevebrechmann at yahoo.ca
>
It will "simplify" but you have to pass the information that the
variables are real and that you want the expression to be transformed
in this way. There are two ways to do it. The first is not really a
"simplification" but "expansion" without using Abs:
ComplexExpand[Abs[2*z0 - 2*d*m]^2, TargetFunctions ->
{Im, Re}]
(2*z0 - 2*d*m)^2
while the second is indeed a "Simplification":
eals]
(2*d*m - 2*z0)^2
Note that 4 is not factored out, if you want that you have to do it
explicitly:
Factor[%]
4*(d*m - z0)^2
Andrzej Kozlowski
>
>
>
>
> On 27 Mar 2005, at 09:42, Steeve Brechmann (schumi) wrote:
>
> >
> > Hi,
> >
> > I define,
> >
> > G0[r_List, r0_List]:=(Exp[I k
> > Norm[r-r0]/(4*Pi*Norm[r-r0]))*((1+(I/(k*Norm[r-r0]))-(1/(k^2*Norm[r-
> >
> r0]^2)))*IdentityMatrix[3]-(1/Norm[r-r0]^2)*(1+((3*I)/(k*Norm[r-r0]))-
> > (3/(k^2*Norm[r-r0]^2)))*Outer[Times,r-r0,r-r0])
>
>
> Your code does not work. It can't be the one you have actually used.
>
> >
> > where
> >
> > r = {x,y,z}
> > r0={x0,y0,z0}
> > ri={x0,y0,-z0}
> > rsn=r0+{0,0,2*n*d}
> > rim=ri+{0,0,2*m*d}
> >
> > When i want to compute
> >
> > G0r0rim=G0[r0,rim]
> >
> > I find something odd...
> >
> > 1) Why Abs[2*z0-2*d*m] doesn't give 2*Abs[z0-m*d] ?
>
> Why should it? Even Simplify won't convert Abs[2*z0-2*d*m] to
> 2*Abs[z0-m*d] because, first of all, Simplify does not use a
> transformation function that would do this and secondly even if it did
> the default complexity of the two expressions is the same. So if you
> really insist on this transformation you will have to do something
> like:
>
>
> f[expr_] := expr /. Abs[(k_)*x] :> k*Abs[x] /; k > 0
>
>
> Simplify[Abs[2*z0 - 2*d*m], TransformationFunctions ->
> {Automatic, f}, ComplexityFunction ->
> (1/Depth[#1] + LeafCount[#1] & )]
>
>
> 2*Abs[z0 - d*m]
>
> This Depth increasing ComplexityFunction is not very natural and may
> well do undesirable things to the rest of your expression so it may be
> better to look for something better that makes k*Abs[x] less complex
> than Abs[k*x]. However, I can't see anything obvious and natural at
> the
> same time so
> if you do not mind factoring other subexpressions you might prefer to
> use something like this:
>
>
> Map[Factor, Sin[2*x + 2] + Abs[2*z0 - 2*d*m] + (2*z0 - 2*d*m)^2, {1,
> Infinity}]
>
>
> 4*(d*m - z0)^2 + 2*Abs[d*m - z0] + Sin[2*(x + 1)]
>
>
>
> >
> > 2) Why Abs[2*z0-2*d*m] doesn't simplify with (2*z0-2*d*m)^2 ?
>
> ??
>
> Andrzej Kozlowski
Simplify[Abs[2*z0 - 2*d*m]^2, (z0 | d | m)
Prev by Date:
**Re: Simplifying ArcTan**
Next by Date:
**Re: Re: Re: Re: Bug in Import?**
Previous by thread:
**Re: Questions about Abs[_]**
Next by thread:
**Re: Questions about Abs[_]**
| |