Re: assuming certain properties about variables
- To: mathgroup at smc.vnet.net
- Subject: [mg111442] Re: assuming certain properties about variables
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 1 Aug 2010 04:58:42 -0400 (EDT)
On 7/31/10 at 2:40 AM, hell at exoneon.de (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? Basically, you can't unless you assign a positive value to t. The pattern _?PositiveQ only matches positive numbers. A variable with no assigned values will not match this pattern. If you want your function to evaluate to a symbolic expression given variables with no assigned values as arguments, you cannot use a pattern that places restrictions on the arguments those variables are used for. Such restrictive patterns will always fail to match a variable with no assigned values. Consequently, Mathematica will always return the function unevaluated.