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

chapter logic gates #145

Closed Zune-Ahmed closed 1 month ago

Zune-Ahmed commented 1 month ago

added new chapter

Samuel-Lubliner commented 1 month ago

Resolve build warnings:

vscode ➜ /workspaces/sage-discrete-math (logic-gates) $ pretext build

XSL conversion of /workspaces/sage-discrete-math/source/main.ptx by /home/vscode/.ptx/2.5.2/core/xsl/pretext-html.xsl
messages from the log for XSL processing:
warning: * PTX:WARNING: A section containing subsections needs to have other content inside an <introduction> and/or  <conclusion>.
*              located within: "sec-practical-applications" (xml:id), "Practical Applications of Logic Gates" (title)
successful application of /home/vscode/.ptx/2.5.2/core/xsl/pretext-html.xsl

Success! Run `pretext view` to see the results.
Samuel-Lubliner commented 1 month ago

The chapter introduction is word for word the same as chapter 4. Maybe you copied and pasted and forgot to update it? image

image

Samuel-Lubliner commented 1 month ago

All mathematical terms or code like AND, OR, NOT, NAND, NOR, XOR, and XNOR or 0or 1 within a paragraph tag need to use an m , me, or c tag.

Samuel-Lubliner commented 1 month ago

This is hard to read image

Zune-Ahmed commented 1 month ago

Fixes all issues mentioned by Sam, new commit made

Samuel-Lubliner commented 1 month ago
from sympy.logic.boolalg import And, Or, Not, Nand, Nor, Xor, Equivalent
from sympy.abc import A, B
A = True
B = False
# Example: AND gate with inputs A and B
And(A, B)

The above is sympy but sage can already do it: 1 & 0

Zune-Ahmed commented 1 month ago

I am trying to show the gates instead of using the representation here, i don’t know i should just use the operators or not, because that will make it similar to the chapter on logic we did before, what’s ur thought?


From: Samuel Lubliner @.> Sent: Thursday, September 26, 2024 4:25:46 PM To: SageMathOER-CCC/sage-discrete-math @.> Cc: Zunaid Ahmed @.>; Author @.> Subject: Re: [SageMathOER-CCC/sage-discrete-math] chapter logic gates (PR #145)

from sympy.logic.boolalg import And, Or, Not, Nand, Nor, Xor, Equivalent from sympy.abc import A, B A = True B = False

Example: AND gate with inputs A and B

And(A, B)

This is 5 lines of code but sage can already do it in 1 line like so: A & B

— Reply to this email directly, view it on GitHubhttps://github.com/SageMathOER-CCC/sage-discrete-math/pull/145#issuecomment-2377966685, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5KWWUUOUPUN2W3RVWADY43ZYR3VVAVCNFSM6AAAAABOZZYRWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZXHE3DMNRYGU. You are receiving this because you authored the thread.Message ID: @.***>

Samuel-Lubliner commented 1 month ago

Yeah I think there is still value in it.

I think it's okay to bring in sympy if we make it clear what sage can and can't do. For example sage lacks built in XOR and NAND functions.

Samuel-Lubliner commented 1 month ago

You may want to look into a library like: https://schemdraw.readthedocs.io/en/latest/elements/logic.html image

At the moment it is not installed in the SageCell Server. Maybe Andrey Novoseltsev can install it if we ask kindly :)

The contact info can be found here: https://sagecell.sagemath.org/

You may want to look at the packages already installed in the SageCell https://github.com/sagemath/sagecell/blob/master/contrib/vm/container_manager.py#L58

hcolmanccc commented 1 month ago

This looks good!

On Sep 27, 2024, at 12:53 PM, Samuel Lubliner @.***> wrote:

This message is from an external sender. Please do not open unexpected links or attachments.

You may want to look into a library like: https://schemdraw.readthedocs.io/en/latest/elements/logic.html image.png (view on web)https://github.com/user-attachments/assets/491c7005-19f1-4ab6-b81a-c1d3de417e6f

At the moment it is not installed in the SageCell Server. Andrey Novoseltsev may install it if we ask kindly :)

The contact info can be found here: https://sagecell.sagemath.org/

— Reply to this email directly, view it on GitHubhttps://github.com/SageMathOER-CCC/sage-discrete-math/pull/145#issuecomment-2379784927, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFJZLURFOVW3RANCMD7CGQ3ZYWLSHAVCNFSM6AAAAABOZZYRWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZZG44DIOJSG4. You are receiving this because your review was requested.Message ID: @.***>

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

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

Zune-Ahmed commented 1 month ago

I already asked for the integration of the module, waiting for reply, hopefully it goes thru. Please do not merge this pull request yet.

edit: looked into all the available packages, non would help draw the gates as easily and clearly. I think asking to add this package would be the best way to do it.