Post Reply 
INTERSECT ?
10-28-2016, 03:26 PM
Post: #1
INTERSECT ?
Bonjour

INTERSECT({1,2,3,2},{0,2,3,2}) -> {2,3,2} OK 2 est répété dans chaque liste.
INTERSECT({1,2,3,2},{0,2,3,0}) -> {2,3,2} est-ce normal ? j'attendais {2,3}
INTERSECT({1,2,3,4},{2,2,3,0}) -> {2,3} OK pour moi
INTERSECT({2,2,3,0},{1,2,3,4}) -> {2,3,2} ce sont les mêmes listes ?

Merci d'avance

Hello

INTERSECT ({1,2,3,2}, {0,2,3,2}) -> {2,3,2} OK 2 is repeated in each list.
INTERSECT ({1,2,3,2}, {0,2,3,0}) -> {2,3,2} is this normal? I expected {2,3}
INTERSECT ({1,2,3,4}, {2,2,3,0}) -> {2,3} OK for me
INTERSECT ({2,2,3,0}, {1,2,3,4}) -> {2,3,2} are the same lists?

thank you in advance

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-28-2016, 03:45 PM (This post was last modified: 10-28-2016 07:56 PM by compsystems.)
Post: #2
RE: INTERSECT ?
Wolfram all returns set{2,3}
https://www.wolframalpha.com/input/?i=IN...,2,3,2%5D)

in CAS MODE

INTERSECT(set[1,2,3,2],set[0,2,3,2]) -> [2,3] [up] [copy] -> set[2,3] // ok

-----------------------------------¬
I take this publication to make the new request, and do not a new publication =)
I would like to see in history view in pretty print
INTERSECT(set[1,2,3,2],set[0,2,3,2]) -> [1, 2, 3, 2] ∩ [0, 2, 3, 2]
or at least infix notation -> [1, 2, 3, 2] intersection [0, 2, 3, 2]
and 2-D templates for sets commands [∩] [∪] ...
------------------------------------

INTERSECT(set[1,2,3,2],set[0,2,3,0]) -> set[2,3] // ok
INTERSECT(set[1,2,3,4],set[2,2,3,0]) -> set[2,3] // ok
INTERSECT(set[2,2,3,0],set[1,2,3,4]) -> set[2,3] // ok
INTERSECT([1,2,3,2],[0,2,3,2]) -> {} ?
INTERSECT({1,2,3,2},{0,2,3,2}) -> {2,3,2}?

in HOME Mode

INTERSECT(set[1,2,3,2],set[0,2,3,2]) -> {2} ?
INTERSECT([1,2,3,2],[0,2,3,2]) -> {} ?
INTERSECT({1,2,3,2},{0,2,3,2}) -> {2,3,2} ?

Without complete documentation I can not determine how the calculator works =(
Find all posts by this user
Quote this message in a reply
10-28-2016, 08:00 PM
Post: #3
RE: INTERSECT ?
we need the complete documentation of operation of cas and hp-prime, I do not understand really know when to put brackets [] or lists {} on a cmd or function
Find all posts by this user
Quote this message in a reply
10-29-2016, 06:24 AM
Post: #4
RE: INTERSECT ?
The CAS command for set intersection is intersect (lowercase) and is infixed, not prefixed.
[1,2,3,2] intersect [0,2,3,2] -> set[2,3]
There is no duplicate with intersect.
The history displays intersect incorrectly prefixed in 2d mode, but correctly in algebraic mode.
Find all posts by this user
Quote this message in a reply
11-01-2016, 04:35 PM
Post: #5
RE: INTERSECT ?
Bonjour
Merci à tous pour vos réponses.
Le but étant d'adapter ces fonctions (INTERSECT,DIFFERENCE et UNION)
à d'autres machines, je vais faire sans répétitions.
D'ailleurs sur la prime, UNION qui supprime tous les doublons
fonctionne avec une seule liste et peut
donc corriger INTERSECT.

Hello
Thank you all for your answers.
The goal is to adapt these functions (INTERSECT, DIFFERENCE and UNION)
to other machines, I'll do without repetitions.
Besides on the prime, UNION removes all duplicates
works with only one list and can
therefore correct INTERSECT.

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-02-2016, 02:12 PM
Post: #6
RE: INTERSECT ?
One of the challenges that we faced with these commands was trying to determine if they should follow the "mathematical definition" or the "programming definition". What I mean by this is that the purely mathematical definition operates exclusively on sets - groups with no duplicates. However, in actual usage there are tons of cases where you actually DO want to keep duplicates and not be suppressing them all. Having the pure set based version means that in probably the majority of cases a user would like to use it in a program, they end up having to rewrite it to get the desired behavior.

The compromise we decided to make was that if you do want to suppress duplicates, the UNION command would do so as has been pointed out.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
11-03-2016, 05:34 AM
Post: #7
RE: INTERSECT ?
Bonjour
Merci pour ces précisions Tim.

Hello
Tim thank you for these details.

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-03-2016, 11:01 AM
Post: #8
RE: INTERSECT ?
(10-29-2016 06:24 AM)parisse Wrote:  The CAS command for set intersection is intersect (lowercase) and is infixed, not prefixed.
[1,2,3,2] intersect [0,2,3,2] -> set[2,3]
There is no duplicate with intersect.
The history displays intersect incorrectly prefixed in 2d mode, but correctly in algebraic mode.

Details that are leaving overlook. Also to avoid misunderstandings the history-view on CAS mode must be different than in HOME mode, using real symbols of sets, I think it is not difficult to implement, as they see are many hours of coding, but a more precise mathematical system
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: