Post Reply 
Set theory on HP Prime
05-07-2014, 02:01 AM
Post: #1
Set theory on HP Prime
Hi all,
Does the prime have any facilities for dealing with sets such as union, difference, equality and such?
for example in PSUDOCODE:

{1, 2, 3} Union {2, 4, 5} = {1, 2, 3, 4, 5}
{1, 2, 3} Intersection {2, 4, 5} = {2}
{1, 2, 3} == {2, 1, 3} == TRUE
...
Find all posts by this user
Quote this message in a reply
05-07-2014, 02:58 AM
Post: #2
RE: Set theory on HP Prime
Reading the Xcas documentation here and there is a full section on sets - tried using a similar syntax but the prime doesn't know what I'm on about. >;|
Find all posts by this user
Quote this message in a reply
05-07-2014, 06:57 AM
Post: #3
RE: Set theory on HP Prime
Sets are supported: the infix operators are union, minus, intersect, and you should use set[ ] instead of {} or [ ] to avoid confusion with lists/vectors, e.g. for ==
set[1,2]==set[2,1]
[1,2]==[2,1]
Find all posts by this user
Quote this message in a reply
05-07-2014, 12:35 PM (This post was last modified: 05-07-2014 12:37 PM by norlesh.)
Post: #4
RE: Set theory on HP Prime
Thanks for the reply Parisse
I just tried evaluating the following in the home screen

set[1,2]==set[2,1] ... result 1
set[1,2]==set[2,1,5] ... result 1 // WTF?

am I not understanding set theory correctly?

also every time set[..] gets evaluated it turns into set(..)
and 'set(1,2) union set(2, 1, 5)' gives a syntax error... is there any documentation?
Find all posts by this user
Quote this message in a reply
05-07-2014, 02:53 PM
Post: #5
RE: Set theory on HP Prime
Just tried on my emulator, set[1,2]==set[2,1,5] correctly returns 0 here and set[] are not converted to set(), so perhaps this is a UI bug that has been fixed.
Find all posts by this user
Quote this message in a reply
05-07-2014, 03:43 PM
Post: #6
RE: Set theory on HP Prime
(05-07-2014 06:57 AM)parisse Wrote:  Sets are supported: the infix operators are union, minus, intersect, and you should use set[ ] instead of {} or [ ] to avoid confusion with lists/vectors, e.g. for ==
set[1,2]==set[2,1]
[1,2]==[2,1]

Good to know! By the way, minus and union don't seem to appear in the toolbox catalog (intersect is in there, though).
Find all posts by this user
Quote this message in a reply
05-07-2014, 03:48 PM
Post: #7
RE: Set theory on HP Prime
I have also tried out the commands mentioned by Parisse and they work correctly in CAS, but result in syntax error in Home.

A.
Find all posts by this user
Quote this message in a reply
05-07-2014, 06:04 PM
Post: #8
RE: Set theory on HP Prime
Thanks guys - so I ran it under the CAS screen and can now confirm that set[1 2]==set[2 1 5] does indeed evaluate to zero... yey I don't have to learn a new formulation of set theory Smile

{ just to be clear though it's definately still mutzed under the home screen as of the current firmware running on a physical device - I had no idea the calculators split brain disorder ran so deep!}
Find all posts by this user
Quote this message in a reply
05-07-2014, 06:14 PM
Post: #9
RE: Set theory on HP Prime
(05-07-2014 03:43 PM)Helge Gabert Wrote:  
(05-07-2014 06:57 AM)parisse Wrote:  Sets are supported: the infix operators are union, minus, intersect, and you should use set[ ] instead of {} or [ ] to avoid confusion with lists/vectors, e.g. for ==
set[1,2]==set[2,1]
[1,2]==[2,1]

Good to know! By the way, minus and union don't seem to appear in the toolbox catalog (intersect is in there, though).

There are the standard math symbols for union and intersection in the Chars list, but they do not work as such.
Find all posts by this user
Quote this message in a reply
05-07-2014, 07:13 PM
Post: #10
RE: Set theory on HP Prime
The HP Prime never ceases to tease me. In CAS, if I type
[1,2,3] union [2,5]
in the command line, it displays (correctly)
union( [1,2,3], [2,5]) [1,2,3,5]

But if I enter directly
union( [1,2,3], [2,5])
in the command line, it reports syntax error.
Find all posts by this user
Quote this message in a reply
05-08-2014, 07:03 AM
Post: #11
RE: Set theory on HP Prime
This is a textbook mode display bug, if you uncheck it in Settings, it's ok.
Find all posts by this user
Quote this message in a reply
Post Reply 




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