[Date Index]
[Thread Index]
[Author Index]
Re: assuming certain properties about variables
*To*: mathgroup at smc.vnet.net
*Subject*: [mg111513] Re: assuming certain properties about variables
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Tue, 3 Aug 2010 06:43:26 -0400 (EDT)
I don't see what $Assumptions has to do with the situation at hand,
since using
$Assumptions = t>0
does not change the result of leaving f[t] unevaluated; nor does either of
Assuming[t>0, f[t]]
Simplify[f[t], t>0]
The only really workable thing I've seen posted in response to the
O.P.'s query -- sorry, I cannot find any previous posting by you to
MathGroup on this subject -- is Leonid Shifrin's [mg111421], using UpValues:
t /: Positive[t] = True
And I guess that, except for employing user-defined heads to create new
types of objects, that's the closest one can come to declaring types of
variables. Or am I missing something?
On 8/2/2010 4:26 AM, Christoph Lhotka wrote:
> hello,
>
> there is the symbol $Assumptions exactly for this purpose (please see my
> previous response for a working definition of f, such that it will
> return t, whenever it is assumed to be positive)...
>
> best,
>
> christoph
>
> On 01/08/2010 10:57, Murray Eisenberg wrote:
>> But once you put the restriction on the argument of f, you've told
>> Mathematica not to carry out the evaluation of f unless the input
>> supplied is actually positive.
>>
>> If now t is just a symbol, then it is not positive (and not negative,
>> either) -- it's just a symbol. So why would you expect to be able to
>> tell Mathematica that it's positive? In general, Mathematica variables
>> don't really have types.
>>
>> If it's just the particular symbol t that you want to supply to f, then
>> you could do this (I'm changing your function definition for clarity) --
>> not that you probably want SetDelayed (:=) instead of Set (=):
>>
>> f[x_?Positive] := x^2
>> f[t] = t^2;
>>
>> f[3]
>> 9
>> f[t]
>> t^2
>> t = -5;
>> f[t]
>> f[-5]
>>
>> f
>>
>>
>> On 7/31/2010 2:40 AM, Benjamin Hell wrote:
>>> let's say I have defined the following function:
>>> f[x_?Positive] = x
>>> Now I want to evaluate f with a variable t:
>>> f[t]
>>> As mathematica knows nothing about t, the output is f[t] instead of t.
>>>
>>> How can I tell mathematica, that t should be a positive number so that
>>> Positive[t] evaluates true and then f[t] evaluates to t?
>>> Of course this is just an example, which should present what I would
>>> like to know.
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
**Re: ODE solution transfer**
Next by Date:
**Re: A distribution problem using Mathematica**
Previous by thread:
**Re: Re: assuming certain properties about variables**
Next by thread:
**Re: assuming certain properties about variables**
| |