Prev: discretized Laplacian or linear inverse problem with extremely
Next: Kernels dying on parallel code
From: Peter Pein on 8 Aug 2010 07:22 Am Sat, 7 Aug 2010 10:22:42 +0000 (UTC) schrieb "Christoph Lhotka" <christoph.lhotka(a)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[1]:= f[t_] := If[MemberQ[{$Assumptions}, t > 0], t, -t] In[2]:= Assuming[t^3 > 0, f[t]] Out[2]= -t In[3]:= g[t_] := If[FullSimplify[t > 0, $Assumptions], t, -t] In[4]:= Assuming[t^3 > 0, g[t]] Out[4]= t
First
|
Prev
|
Pages: 1 2 3 Prev: discretized Laplacian or linear inverse problem with extremely Next: Kernels dying on parallel code |