Post Reply 
Set theory (operators)
10-21-2014, 04:15 PM
Post: #1
Set theory (operators)
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-
Find all posts by this user
Quote this message in a reply
10-22-2014, 03:36 AM
Post: #2
RE: Set theory (operators)
(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.

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-

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.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-22-2014, 11:01 AM
Post: #3
RE: Set theory (operators)
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-
Find all posts by this user
Quote this message in a reply
10-22-2014, 03:22 PM
Post: #4
RE: Set theory (operators)
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.
Find all posts by this user
Quote this message in a reply
10-23-2014, 08:25 AM
Post: #5
RE: Set theory (operators)
(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! Smile

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-24-2014, 01:57 AM
Post: #6
RE: Set theory (operators)
Isn't it possible to define a CAS function and name it with the appropriate 'set' symbol and have it execute the command?
Visit this user's website Find all posts by this user
Quote this message in a reply
10-24-2014, 03:57 AM
Post: #7
RE: Set theory (operators)
(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à:

[Image: intersect1.png] [Image: intersect2.png]

... 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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-24-2014, 04:26 AM
Post: #8
RE: Set theory (operators)
(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?

Yep! Voilà:

[Image: intersect1.png] [Image: intersect2.png]

... 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.

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?
Find all posts by this user
Quote this message in a reply
10-24-2014, 10:39 AM
Post: #9
RE: Set theory (operators)
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-
Find all posts by this user
Quote this message in a reply
10-24-2014, 02:43 PM (This post was last modified: 10-24-2014 02:44 PM by Joe Horn.)
Post: #10
RE: Set theory (operators)
(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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-24-2014, 05:31 PM
Post: #11
RE: Set theory (operators)
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-
Find all posts by this user
Quote this message in a reply
10-24-2014, 08:39 PM
Post: #12
RE: Set theory (operators)
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)