MathGroup Archive 2005

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

Search the Archive

Re: Questions about Abs[_]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55534] Re: Questions about Abs[_]
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Mon, 28 Mar 2005 02:42:11 -0500 (EST)
  • References: <d25omd$699$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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])
>  
> 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] ?
>  
> 2) Why Abs[2*z0-2*d*m] doesn't simplify with (2*z0-2*d*m)^2 ?
>  
> Note : all the variables are positive, i.e. : z0>0, d>0 and -Infinity < m_Integer < Infinity.
>  
> Steeve Brechmann
> Physics Department, Laval University
> steevebrechmann at yahoo.ca
> 
> 
Hi,

In general simplification is a rather heuristic process. If necessary, 
it is possible to augment the standard definitions, for example:

Unprotect[Abs];
Abs[c_ a_ + c_ b_] := c Abs[a + b] /; c > 0;
Abs[c_ a_ + d_ b_] := c Abs[a - b] /; (c > 0 && c + d == 0);
Protect[Abs];

This will handle your point 1 - I am not sure I understand point 2.

If you do augment the standard definitions in this way, you must be 
extremely careful not to include an invalid simplification, because 
Mathematica will not 'realise' that anything is wrong.

In order to perform extensive manipulations of this sort, it can be 
better to use a private notation (say abs[x]) and supply any rules that 
you want for this notation. Then you can use a transformation rule to 
switch to standard Mathematica notation when you are ready.

David Bailey
dbaileyconsultancy.co.uk


  • Prev by Date: Re: Recursion question
  • Next by Date: Re: Re: point in convex hull
  • Previous by thread: Re: Questions about Abs[_]
  • Next by thread: Re: Questions about Abs[_]