Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Defining assumptions globally

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95990] Re: Defining assumptions globally
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 31 Jan 2009 06:43:50 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <glvkeq$e67$1@smc.vnet.net>

In article <glvkeq$e67$1 at smc.vnet.net>,
 Kay-Michael Voit <usenet1 at voits.net> wrote:

> is it possible to define assumptions globally?
> 
> This is my (simplified) problem:
> To calculate certain quantities I wrote some modules like
> 
> cE[n_,0,s_]:=Module[{},
>   cE[n,0,s]= E[n-1,0,s] Integrate[W[x,s],{s,0,1}]
> ]
> 
> (cE[0,0,s] is of course defined)
> 
> Later I would like to use for example
> 
> : [Module-Def]
> 
> 
> Now, W might be quite complicated, so Integrate might need assumptions.
> is there a better way than
> 
> : WAssumptions={}
>   cE[n_,0,s_]:=Module[{},
>     cE[n,0,s]= E[n-1,0,s]
> Integrate[W[x,s],{s,0,1},Assumptions->WAssumptions]
>   ]
> : WAssumptions={a>0}
>   W[x_,s_]= a ...;
> : cE[n]

You could modify the global system variable $Assumptions, which "is the 
default setting for the Assumptions option used in such functions as 
Simplify, Refine and Integrate. (From the online help.)" 

The advantage in doing so is that you do not have to use or set 
explicitly the option Assumptions in each command for your assumptions 
to be taken into account.

In[1]:= Integrate[x^a, {x, 0, 1}]

Out[1]= If[Re[a] > -1, 1/(1 + a), 
 Integrate[x^a, {x, 0, 1}, Assumptions -> Re[a] <= -1]]

In[2]:= Integrate[x^a, {x, 0, 1}, Assumptions -> a > 0]

Out[2]= 1/(1 + a)

In[3]:= $Assumptions = a > 0

Out[3]= a > 0

In[4]:= Integrate[x^a, {x, 0, 1}]

Out[4]= 1/(1 + a)

Regards,
--Jean-Marc


  • Prev by Date: Re: NEWBIE: How do I use the results of a Solve?
  • Next by Date: Re: Book mathematica 6
  • Previous by thread: Re: Defining assumptions globally
  • Next by thread: BarChart3D with Ticks-option in Mathematica 7