Set theory (operators) - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Set theory (operators) ( /thread-2318.html) |

Set theory (operators) - DrD - 10-21-2014 04:15 PM
There might be a way to express UNION and INTERSECTION (U or ∩) using set theory notation in lieu of logical operator notation (AND / OR), for example. If so, I don't know how it is implemented. Is there any documentation discussing set notation with regard to the hp Prime? Given the classroom focus of this product, it would seem this would be something useful. Guidance appreciated, and thanks! -Dale- RE: Set theory (operators) - Han - 10-22-2014 03:36 AM
(10-21-2014 04:15 PM)DrD Wrote: There might be a way to express UNION and INTERSECTION (U or ∩) using set theory notation in lieu of logical operator notation (AND / OR), for example. If so, I don't know how it is implemented. The commands are union() and intersect(). union( {1,2}, {1,2,3} ) or {1,2} union {1,2,3} will both produce the result [ 1 2 3 ] The intersect() command works similarly. RE: Set theory (operators) - DrD - 10-22-2014 11:01 AM
Han, thanks for responding. I tried and learned from your examples, however on emu the form: union( {1,2}, {1,2,3} ) did not work for me; {1,2} union {1,2,3} worked great! intersect( {1,2}, {1,2,3} ) worked using both methods. So a couple of things: I could find no reference to help on-calc or user guide, for the 'union' function. The 'intersect' function does have help support, but does not reveal an example like you've given: {1,2} intersect {1,2,3}. The main point of my posting, however, was not about the functions. It is about set notation operators that invoke the operation: (U or ∩). There have been times when I would have liked to have been able to use: {1,2} U {1,2,3}, instead of the longer form: {1,2} union {1,2,3}, for SET operations (example). Help for 'intersect' while available, worked as expected on-calc, but one would probably search the user guide for "intersection," and quickly discover a lot of hits focused mainly on plotting, or at least within a graphical context, not set theory. Usually, when I wonder about such things, Joe Horn shows up with some clever way I never thought of, to solve sometimes more than I was even questioning, and so I "put it out there" to see if he, or someone, had discovered trickery absent from help files! I appreciate your taking the time to shed additional light on this! -Dale- RE: Set theory (operators) - Alberto Candel - 10-22-2014 03:22 PM
The math symbols for union and intersection do exist [Shift][Chars] Math Operators 222A/8746 and 2229/8745. But they do not seem to perform any set theoretic operation. RE: Set theory (operators) - Joe Horn - 10-23-2014 08:25 AM
(10-22-2014 11:01 AM)DrD Wrote: Usually, when I wonder about such things, Joe Horn shows up with some clever way I never thought of, to solve sometimes more than I was even questioning, and so I "put it out there" to see if he, or someone, had discovered trickery absent from help files! We're all learning from each other here! RE: Set theory (operators) - dbbotkin - 10-24-2014 01:57 AM
Isn't it possible to define a CAS function and name it with the appropriate 'set' symbol and have it execute the command? RE: Set theory (operators) - Joe Horn - 10-24-2014 03:57 AM
(10-24-2014 01:57 AM)dbbotkin Wrote: Isn't it possible to define a CAS function and name it with the appropriate 'set' symbol and have it execute the command? Yep! Voilà: ... however, the Connectivity Kit doesn't seem to want to Restore that function from a Backup. Maybe because it's not a valid filename... but that's just a wild guess. More experimentation is required. RE: Set theory (operators) - Alberto Candel - 10-24-2014 04:26 AM
(10-24-2014 03:57 AM)Joe Horn Wrote:(10-24-2014 01:57 AM)dbbotkin Wrote: Isn't it possible to define a CAS function and name it with the appropriate 'set' symbol and have it execute the command? I have tried this one also, but, can you do \(A\cap B\), or \(A\cap B\cap C\), with the \(\cap\) symbol between the sets? RE: Set theory (operators) - DrD - 10-24-2014 10:39 AM
I considered "Define"-ing Set operations using appropriate notation symbols as well, but it takes something like 11 pages of "Chars" to sort through to get to the needed symbols; hardly worth the effort. It's quicker just typing function keywords! Education being the Prime's target market, it was fitting that there might be some kind of more direct way to perform set operations. As something encountered all the time by students of mathematics, many useful applications exist outside the classroom, for which the secondary market (the rest of us!), might also exploit. If nothing else, the "Entry Line" would be easier to work with, using ONE character instead of the parenthetically embedded functions, to mix the expressions! Perhaps set notation will become part of some future calculation device, although marketers may have found this topic unworthy of production. -Dale- RE: Set theory (operators) - Joe Horn - 10-24-2014 02:43 PM
(10-24-2014 04:26 AM)Alberto Candel Wrote: I have tried this one also, but, can you do \(A\cap B\), or \(A\cap B\cap C\), with the \(\cap\) symbol between the sets? I don't think so. If Prime has a built-in facility for defining infix operators, I'd love to know about it. (10-24-2014 10:39 AM)DrD Wrote: I considered "Define"-ing Set operations using appropriate notation symbols as well, but it takes something like 11 pages of "Chars" to sort through to get to the needed symbols; hardly worth the effort. It's quicker just typing function keywords! Well... yes and no. It's much faster if you use the "More" button in the Chars browser. In the above example, tapping "More" and then pressing ALPHA M jumps immediately to the "Math Operators" block, where ∩ and many other goodies can be found. No need to press Page Down repeatedly to get there. Ditto for the other Unicode blocks. Also, AFTER defining such a function, typing the name is usually NOT faster than using your defined function, because the latter is available in the Toolbox User Functions menu, usually in 3 keystrokes total, no matter what you named your function. For example, right now I can access my ∩ function by pressing Toolbox 2 1. That's 3 keystrokes, whereas INTERSECT() requires 13 if you type it out. RE: Set theory (operators) - DrD - 10-24-2014 05:31 PM
Well there is that ... (the Math Tools approach, which, naturally, I didn't think of)! Still, (Math Tools | User | <scroll waaay to the bottom of that list> | User Functions | <scroll through that list> | select function - in my case, I can still type, "intersect({blah}, {blah})," faster. {blah} intersect {blah} works -- but {blah} ∩() {blah} doesn't quite get the context correct, and can't work in that format. How would one get past the parens enclosing expected params? Inefficient for sure. Necessary? I don't know. The Prime gods will sort it out, no doubt. -Dale- RE: Set theory (operators) - parisse - 10-24-2014 08:39 PM
Xcas can define infix operator, for example user_operator("U",(x,y)->x union y,Binary); [1,2,3] U [1,2,4] but it's a little bit experimental, it's not available on the Prime, it requires making some tricky operations to make the parser understand U is infix. |