Set theory on HP Prime - 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 on HP Prime (/thread-1261.html) |
Set theory on HP Prime - norlesh - 05-07-2014 02:01 AM 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 ... RE: Set theory on HP Prime - norlesh - 05-07-2014 02:58 AM 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. >;| RE: Set theory on HP Prime - parisse - 05-07-2014 06:57 AM 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] RE: Set theory on HP Prime - norlesh - 05-07-2014 12:35 PM 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? RE: Set theory on HP Prime - parisse - 05-07-2014 02:53 PM 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. RE: Set theory on HP Prime - Helge Gabert - 05-07-2014 03:43 PM (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 == Good to know! By the way, minus and union don't seem to appear in the toolbox catalog (intersect is in there, though). RE: Set theory on HP Prime - Alberto Candel - 05-07-2014 03:48 PM I have also tried out the commands mentioned by Parisse and they work correctly in CAS, but result in syntax error in Home. A. RE: Set theory on HP Prime - norlesh - 05-07-2014 06:04 PM 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 { 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!} RE: Set theory on HP Prime - Alberto Candel - 05-07-2014 06:14 PM (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 == There are the standard math symbols for union and intersection in the Chars list, but they do not work as such. RE: Set theory on HP Prime - Alberto Candel - 05-07-2014 07:13 PM 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. RE: Set theory on HP Prime - parisse - 05-08-2014 07:03 AM This is a textbook mode display bug, if you uncheck it in Settings, it's ok. |