MathGroup Archive 2009

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

Search the Archive

Re: Questions about assumptions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101824] Re: Questions about assumptions
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Sat, 18 Jul 2009 04:51:23 -0400 (EDT)
  • References: <h3n5lq$25m$1@smc.vnet.net>

You can give your variables some UpValues to make them some kind of
Reals.

Attributes[DefAlsReell] = {Listable};
DefAlsReell[x_] := (UpValues[x] = {
    HoldPattern[Re[x]] :> x,
    HoldPattern[Im[x]] :> 0,
    HoldPattern[Conjugate[x]] :> x});

Then do   (I write ^* here for Conjugate in the output):

Input                                   Output
--------------------------------------------------------
DefAlsReell[{u, v}];

(a + b I)\[Conjugate]                   a^* -I b^*
(u + v I)\[Conjugate]                   u - I v
(E^(I (a + u) + b + v))\[Conjugate]     Exp[v-I(u+a^*)+b^*]
(a b)\[Conjugate]                       Conjugage[a b]
(u v)\[Conjugate]                       u v
Re[a + u]                               u + Re[a]
Im[a + u]                               Im[a]

f[z_] := Expand[z^2 + z\[Conjugate]];
f[a + b I]                              a^2+2I a b-b^2+a^* -I b^* 
f[u + I v]                              u+u^2-v^2 +I (2u v-v)
f[a + I v]                              a^2-v^2+a^* +I(2a v-v)

Alexander Erlich wrote:

> Hello,
>
> I would like to make assumptions like e.g. Element[a,Reals] or b>0 or
> simlar ones global in order to avoid using Refine with long assumption
> lists every tome. For this purpose, I've found $Assumptions. But I
> encountered the following problem:
>
> In[5]:= $Assumptions = Element[g, Reals]
>
> Out[5]= g \[Element] Reals
>
> In[6]:= Conjugate[g]
>
> Out[6]= Conjugate[g]
>
> Why didn't Mathematica just return g?
>
> Maybe, there is a different, or even better way to make assumptions
> global to the whole notebook, so that they are considered
> automatically (and without Refine or similar)?
>
> Regards,
>
> Alexander
>

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: rotate but not resize Graphics3D in Dialog
  • Next by Date: Re: Add syntax highlighting to own command
  • Previous by thread: Re: Questions about assumptions
  • Next by thread: CityData can't be used in Init.m?