2.27 Obtain elements that are common to two vectors
Given vector or list \(d=[-9,1,3,-3,50,7,19],\) \(t=[0,7,2,50]\), find the common elements.
| Mathematica
d = {-9,1,3,-3,50,7,19};
t = {0,7,2,50};
Intersection[d,t]
|
Out[412]= {7,50}
|
| Matlab
d=[-9 1 3 -3 50 7 19];
t =[0 7 2 50];
intersect(t,d)
|
ans =
7 50
|
| Maple
d := {-9,1,3,-3,50,7,19};
t := {0,7,2,50};
d intersect t;
|
{7, 50}
|