SageMathOER-CCC / sage-discrete-math

An open textbook for Discrete Mathematics with SageMath, as taught at the City Colleges of Chicago
https://sagemathoer-ccc.github.io/sage-discrete-math/
Other
2 stars 2 forks source link

Powe Sets section revision #120

Closed hcolmanccc closed 2 weeks ago

hcolmanccc commented 3 weeks ago

This is confusing (it is not showing the power set):

Screenshot 2024-09-05 at 8 56 14 AM

Was this section changed? Somehow breaks the flow of the previous ones that were clean and to the point. First title should be just Power Sets.

Then the first example something simple like:

R = Set(["red", "orange", "yellow", "green", "blue", "indigo", "violet"]) S = Subsets(R) list(S)

Just to visualize the power set. (And keep the convention of the rest of the section of calling sets with a capital letter.)

Samuel-Lubliner commented 3 weeks ago

These changes approved on PR #106

I wrote it this way to show the Sage Object representing the set of subsets. A few cells down it is displayed here . I am happy to remove the object and dive right into displaying it to improve the flow.

I think descriptive variable names improve readability and help me understand the code. Abbreviations create more mental overhead imo because I need to think more about what the variable represents. This might be a stylistic difference between software and mathematics. If single letters are the style we are going for I can change that as well.

hcolmanccc commented 3 weeks ago

I wrote ithttps://sagemathoer-ccc.github.io/sage-discrete-math/sec-operation-on-sets.html#sec-operation-on-sets-8-5 this way to show the Sage Object representing the set of subsets. A few cells down it is displayed herehttps://sagemathoer-ccc.github.io/sage-discrete-math/sec-operation-on-sets.html#sec-operation-on-sets-8-12 . I am happy to remove the object and dive right into displaying it to improve the flow.

In the first instance, you are not showing the power set. I mean the set of subsets is not shown here. The code I propose is to show right away the power set, in the same way that we show before the intersection or the union. See how clean are each of the sections before. There is no reason to approach this subsection differently. We can just say, this is the set A, this is the set power set of A. Just like 2.3.1 or 2.3.2.

I think descriptive variable names improve readability and help me understand the code. Abbreviations create more mental overhead imo because I need to think more about what the variable represents. This might be a stylistic difference between software and mathematics. If single letters are the style we are going for I can change that as well.

I agree that if the variables represent something, like the rainbow, “rainbow” is a good name for a variable. I think this is kind of the same discussion we had with the shirts problem in the section Relations.

The involved example/exercise that we are adding in the next stage will be a good place for that. When variables refer to a concrete practical problem.

But in the core section here, where we are just explaining how to do A ∩ B, A ∪ B and the like. We would like to show simply, how to do P(A) as well. Just in the same way that we show the other operations. Even having a set whose elements are just numbers or letters as example may be better. The idea is to not introduce any extra complication when we want to focus on how to produce the power set.

Besides that, yes, in mathematics the norm is for names of sets to be capital letters (and elements in lowercase). This is a common law that most people follow, but of course it is just a convention, you can call sets whatever you want. Most variables in mathematics will end up in some sort of equation. If the example is simple like the one you are proposed, it may be useful to call a set “non_hashable_elements” instead of A. But imagine that your set ends up in the equation:

((A & B)|(A-B))&((A|B)|(A&B))

You will definitely want your set be called A and not “non_hashable_elements” here!

Hellen Colman, Ph.D. Professor of Mathematics Wilbur Wright College 4300 N. Narragansett Chicago, IL 60634

@.*** hellencolman.com/mathhttps://www.hellencolman.com/math

Samuel-Lubliner commented 3 weeks ago

Sounds good. Yes your approach is more clean. This is a really good point about long set names in a complicated expression! Perhaps I should add more text about hashable elements instead of trying to explain it with variable names. That way I can have shorter variable names.

I like your point about variable names for the involved examples/exercise when variables refer to a concrete practical problem and keeping the mathematical examples more short.