       Re: assuming certain properties about variables

• To: mathgroup at smc.vnet.net
• Subject: [mg111641] Re: assuming certain properties about variables
• From: Peter Pein <petsie at dordos.net>
• Date: Sun, 8 Aug 2010 07:23:08 -0400 (EDT)
• References: <i3jc5i\$d0d\$1@smc.vnet.net>

```Am Sat, 7 Aug 2010 10:22:42 +0000 (UTC)
schrieb "Christoph Lhotka" <christoph.lhotka at univie.ac.at>:

> Hello,
>
> Sorry for my late reply. The reason is, that I found your message in
> the MathGroup archive, but never recieved it by mail. In addition it
> puzzles me, why you were not able to find my post, since it is
> present in the archive ...
>
> Regarding your comment, I repeat, how I would use the symbol
> \$Assumptions to define the function f to work for t without setting
> the upvalue to it:
>
> f[t_] := If[MemberQ[{\$Assumptions}, t > 0], t, -t]
>
> Assuming[t > 0, f[t]]
>
> which will return t, if t is assumed to be positive and -t otherwise.
>
> The draw back is, that one also has to give a return value if t is not
> greater than 0.
>
> Best regards,
>
> Christoph
>
...

Hmmm, wouldn't g be the better choice of the two functions below?

In:= f[t_] := If[MemberQ[{\$Assumptions}, t > 0], t, -t]
In:= Assuming[t^3 > 0, f[t]]
Out= -t
In:= g[t_] := If[FullSimplify[t > 0, \$Assumptions], t, -t]
In:= Assuming[t^3 > 0, g[t]]
Out= t

```

• Prev by Date: Re: Default and head in function argument
• Next by Date: Re: Combine these displays