0
|
5374 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

How do I make a Symbol Positive?

Posted 10 years ago
 Hi, I want to make a Symbol, i.e. A, such that A>0 will return True. Of course, I want Positive[A] to return True, and Less[0,A] to return True, and so on, and so on. There are a very large number of relations that could be tested and I want to make every one of them return the appropriate True or False depending upon the logical relationship. Trying to set up the upvalues of A for all relationships is mind-boggling. I can't even start to think of every one that could occur. I can't find any documentation on the Web when Google'ing Mathematica "Positive Symbol" or without quotes that is worth anything. Noting on the Wolfram site search and nothing here. Are there any developers listening who must have dealt with this issue in the internals of MMA? How do I go about this? It seems like a reasonable request, or am I missing something really fundamental that would make this easy? Thanks in advance/Cheers/Bob
4 Replies
Sort By:
Posted 10 years ago
 Perhaps you can using something like: FindInstance[A > 5 && 0 < A, A]This gives 6, one instance.
Posted 10 years ago
 No, you completely misunderstand. I want to tell MMA that this Symbol (whatever it is) should be treated in all Logical tests as say a Positive, Real number. So, A>0 should return True, A>=0 should return False, Positive[A] should return True, Negative[A] should return False, etc for any and all possible tests that are syntactically correct logical statements that evaluate. Now, sometimes, e.g. 0
Posted 10 years ago
 I am not exactly sure of whether this will work for your purposes: Refine[Positive[A], Assumptions -> {Element[A, real], A > 0}] True Refine[Negative[A], Assumptions -> {Element[A, real], A > 0}] False
Posted 10 years ago
 Hi and Thanks Priyan,I hadn't thought about this, and it is closer, but..Unless I don't understand, Refine would have to be used on every expression that contains the Symbol. I want to set up MMA so that it uses this information Globally, without my intervention on all subsequent evaluations when it encounters the Symbol, i.e. I want this info to be an upvalue.I want the behavior to be an upvalue, i.e. A/:Positive[A]=True which works fine anytime the Positive operator is used in MMA, i.e., MMA remembers and uses this automatically any time the operator is applied. However, even though Positive[A] evaluates to True, Negative[A] evaluates to Negative[A], MMA does not remember or infer that if Positive[A] is True, then by usual rules of logic, Negative[A] should be False, and Equal[0,A] is False is another inference, and so on. There are so many operators to be covered by setting each one as another upvalue, that the whole thing just becomes ridiculously complex. So, the question is how to set an upvalue that MMA will use to make all possible (within the scope of MMA) equivalent operators evaluate properly to True or False as appropriate. Again, as an example so that, 00 evaluates to True which would have to be another upvalue and A>=0 is True (YAUV [Yet another upvalue]) and 0<=A [YAUV], and so on and so on. There are many, many logical comparison operators and I can't even think how to get a exhaustive list of everyone of them that could be logically related to Positive and Real if I did want to make an elaborate table of upvalues.Some developers must have thought about this. Maybe they have some idea.Thanks/Cheers/Bob