New answers tagged

0 votes

How to select elements from a list of pairs based on first element belonging to a different list?

Using Cases, FreeQ and Condition: ...
0 votes

How to select elements from a list of pairs based on first element belonging to a different list?

Here we can use <| |> ...
  • 6,877
1 vote

How to select elements from a list of pairs based on first element belonging to a different list?

Position[listA[[All,1]], Alternatives@@listB]//Extract[listA,#]& (* {{1, a}, {3, c}, {5, e}} *)
  • 10.6k
2 votes

How to select elements from a list of pairs based on first element belonging to a different list?

One of many ways ...
  • 119k
2 votes
Accepted

How to select elements from a list of pairs based on first element belonging to a different list?

Here is one way to do it: ...
  • 22.6k
3 votes

Use the command Select to find all integers x in the list $r=Range[16]$ such that $Mod[x^4,17]=-1$ and also try doing it by cases command

PowerModList[-1, 1/4, 17] {2, 8, 9, 15}
  • 45.8k
2 votes

Use the command Select to find all integers x in the list $r=Range[16]$ such that $Mod[x^4,17]=-1$ and also try doing it by cases command

Solve[x^4 == -1, Modulus -> 17] (* {{x -> 2}, {x -> 8}, {x -> 9}, {x -> 15}} *)
  • 38.6k
2 votes
Accepted

Use the command Select to find all integers x in the list $r=Range[16]$ such that $Mod[x^4,17]=-1$ and also try doing it by cases command

Select[Range[16], Function[x,Mod[x^4+1,17]==0]] (* {2,8,9,15} *) Alternative syntax: ...
  • 10.8k
5 votes

What does Dash Question mark do?

This is called conditional pattern-matching. From Professor Richard J. Gaylord's Wolfram Language Fundamentals Part One at time 57:04 See also using-a-patterntest-versus-a-condition-for-pattern-...
  • 119k
10 votes

I understand b_ matches beta, but why does it also match alpha?

You've severely misunderstood how pattern matching of Mathematica works. _ is not wildcard character like ? or ...
  • 56.9k

Top 50 recent answers are included