# Is it possible to set a variable as a positive one in the whole notebook?

I'm having issues during integration due to the fact that Mathematica doesn't know if an undefined variable is positive or not (it gives me complexes which bothers me in the end).

For example I do this:

yy[x_, t_] = aa[t]*(Cos[0.1*x]-Cosh[0.1 x]-Sin[0.1 x]+Sinh[0.1 x])

Integrate[D[yy[x, t], t]^2, {x, 0, 18}]


gives me:

(10.1601 + 0.I) aa'[t]²

while the 0.I shouldn't be here. By using:

Integrate[D[yy[x, t], t]^2, {x, 0, 18}, Assumptions -> aa[t] > 0]


I get rid of the imaginary part but this has to be done cell by cell.

Then comes my questions, is it possible to define, in that case, aa[t] as a posivite variable in the whole notebook and not cell by cell?
Note that in this expample the I is not bothering at all, but with concrete numbers it messes everything up, even by using Chop.

-

You can modify the global system variable $Assumptions, to get the effect you want: $Assumptions = aa[t] > 0


Then

Integrate[D[yy[x, t], t]^2, {x, 0, 18}]

10.1601 Derivative[1][aa][t]^2


This may, however, be somewhat error-prone. Here is how I'd do this with local environments. This is a generator for a local environment:

createEnvironment[assumptions_] :=
Function[code,
Block[{$Assumptions =$Assumptions && assumptions}, code],
HoldAll];


We now create one:

$Assumptions = True; env = createEnvironment[aa[t] > 0];  To use it, prefix the intergal with it: env@Integrate[D[yy[x,t],t]^2,{x,0,18}]   10.1601 (aa^\[Prime])[t]^2  This is a bit more work since you have to prefix, but it is safer. - Thanks a lot!I've been looking around on google for ages, and you replied me within 3 mins, thanks! – Öskå Jun 4 '12 at 11:17 @Öskå Have a look at the addition I made with environments. This is an intermediate variant - more convenient than setting Assumptions in Integrate explicitly, and safer than modifying $Assumptions globally. –  Leonid Shifrin Jun 4 '12 at 11:19
I did, & edited comment too, once again, thank you. –  Öskå Jun 4 '12 at 11:20