I have a set S = { 1, 2, 3, 4, 5 }
.
What is the syntax for changing the contents of the set (or rather, creating a new set) by applying a mathematical operation to it e.g. multiplication, power?
I have a set S = { 1, 2, 3, 4, 5 }
.
What is the syntax for changing the contents of the set (or rather, creating a new set) by applying a mathematical operation to it e.g. multiplication, power?
Copyright © 2021 Jogjafile Inc.
This sounds like a case for a set comprehension. So you generate f(e) for those elements of s which match a predicate p(e). The general syntax is:
So for example:
There are more complex cases where you bind more than one element from the set, but this is enough to meet your example :)