Skip to content

Commit

Permalink
Latest build deployed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel-Lubliner committed Mar 2, 2024
1 parent 522e46d commit da0d070
Show file tree
Hide file tree
Showing 37 changed files with 672 additions and 477 deletions.
2 changes: 1 addition & 1 deletion .mapping.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"source/main.ptx": ["Discrete-Math-with-SageMath"], "source/frontmatter.ptx": ["frontmatter"], "source/getting-started/ch-getting-started.ptx": ["ch-getting-started"], "source/getting-started/sec-intro-to-sage.ptx": ["about-sage"], "source/getting-started/sec-printing.ptx": ["printing"], "source/getting-started/sec-OOP.ptx": ["OOP"], "source/getting-started/sec-data-types.ptx": ["data-types"], "source/getting-started/sec-iteration.ptx": ["iteration"], "source/getting-started/sec-debugging.ptx": ["debugging"], "source/getting-started/sec-documentation.ptx": ["documentation"], "source/getting-started/sec-sage-browser.ptx": ["sage-browser"], "source/set-theory/ch-set-theory.ptx": ["ch-set-theory"], "source/set-theory/sec-creating-sets.ptx": ["creating-sets"], "source/set-theory/sec-cardinality.ptx": ["cardinality"], "source/set-theory/sec-operation-on-sets.ptx": ["sec-operation-on-sets"], "source/combinatorics/ch-combinatorics.ptx": ["ch-combinatorics"], "source/combinatorics/sec-combinatorics.ptx": ["sec-combinatorics"], "source/logic/ch-logic.ptx": ["ch-logic"], "source/logic/sec-logical-operation.ptx": ["sec-logical-operation"], "source/logic/sec-truth-table.ptx": ["sec-truth-table"], "source/logic/sec-tautology.ptx": ["sec-tautology"], "source/relations/ch-relations.ptx": ["ch-relations"], "source/relations/sec-intro-relations.ptx": ["intro-relations"], "source/relations/sec-relations-on-a-set.ptx": ["relations-on-a-set"], "source/relations/sec-digraphs.ptx": ["digraphs"], "source/relations/sec-properties.ptx": ["properties"], "source/relations/sec-equivalence.ptx": ["equivalence"], "source/relations/sec-partial-order.ptx": ["partial-order"], "source/functions/ch-functions.ptx": ["ch-functions"], "source/functions/sec-functions.ptx": ["sec-functions"], "source/functions/sec-recursion.ptx": ["sec-recursion"], "source/backmatter.ptx": ["backmatter"]}
{"source/main.ptx": ["Discrete-Math-with-SageMath"], "source/frontmatter.ptx": ["frontmatter"], "source/getting-started/ch-getting-started.ptx": ["ch-getting-started"], "source/getting-started/sec-intro-to-sage.ptx": ["about-sage"], "source/getting-started/sec-displaying.ptx": ["displaying"], "source/getting-started/sec-OOP.ptx": ["OOP"], "source/getting-started/sec-data-types.ptx": ["data-types"], "source/getting-started/sec-iteration.ptx": ["iteration"], "source/getting-started/sec-debugging.ptx": ["debugging"], "source/getting-started/sec-documentation.ptx": ["documentation"], "source/getting-started/sec-sage-browser.ptx": ["sage-browser"], "source/set-theory/ch-set-theory.ptx": ["ch-set-theory"], "source/set-theory/sec-creating-sets.ptx": ["creating-sets"], "source/set-theory/sec-cardinality.ptx": ["cardinality"], "source/set-theory/sec-operation-on-sets.ptx": ["sec-operation-on-sets"], "source/combinatorics/ch-combinatorics.ptx": ["ch-combinatorics"], "source/combinatorics/sec-combinatorics.ptx": ["sec-combinatorics"], "source/logic/ch-logic.ptx": ["ch-logic"], "source/logic/sec-logical-operation.ptx": ["sec-logical-operation"], "source/logic/sec-truth-table.ptx": ["sec-truth-table"], "source/logic/sec-tautology.ptx": ["sec-tautology"], "source/relations/ch-relations.ptx": ["ch-relations"], "source/relations/sec-intro-relations.ptx": ["intro-relations"], "source/relations/sec-relations-on-a-set.ptx": ["relations-on-a-set"], "source/relations/sec-digraphs.ptx": ["digraphs"], "source/relations/sec-properties.ptx": ["properties"], "source/relations/sec-equivalence.ptx": ["equivalence"], "source/relations/sec-partial-order.ptx": ["partial-order"], "source/functions/ch-functions.ptx": ["ch-functions"], "source/functions/sec-functions.ptx": ["sec-functions"], "source/functions/sec-recursion.ptx": ["sec-recursion"], "source/backmatter.ptx": ["backmatter"]}
2 changes: 1 addition & 1 deletion Discrete-Math-with-SageMath.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h2 class="search-results-heading">Search Results: </h2>
<div class="toc-title-box"><a href="ch-getting-started.html" class="internal"><span class="codenumber">1</span> <span class="title">Getting Started</span></a></div>
<ul class="structural toc-item-list">
<li class="toc-item toc-section"><div class="toc-title-box"><a href="about-sage.html" class="internal"><span class="codenumber">1.1</span> <span class="title">Intro to Sage</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="printing.html" class="internal"><span class="codenumber">1.2</span> <span class="title">Printing</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="displaying.html" class="internal"><span class="codenumber">1.2</span> <span class="title">Display Values</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="OOP.html" class="internal"><span class="codenumber">1.3</span> <span class="title">Object Oriented Programming</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="data-types.html" class="internal"><span class="codenumber">1.4</span> <span class="title">Data Types</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="iteration.html" class="internal"><span class="codenumber">1.5</span> <span class="title">Iteration</span></a></div></li>
Expand Down
27 changes: 14 additions & 13 deletions OOP.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h2 class="search-results-heading">Search Results: </h2>
<ol id="searchresults" class="searchresults"></ol>
</div>
</div>
<span class="nav-other-controls"></span><span class="treebuttons"><a class="previous-button button" href="printing.html" title="Previous"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cb;</span><span class="name">Prev</span></a><a class="up-button button" href="ch-getting-started.html" title="Up"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5ce;</span><span class="name">Up</span></a><a class="next-button button" href="data-types.html" title="Next"><span class="name">Next</span><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cc;</span></a></span></nav><div id="latex-macros" class="hidden-content process-math" style="display:none"><span class="process-math">\(\newcommand{\N}{\mathbb N} \newcommand{\Z}{\mathbb Z} \newcommand{\Q}{\mathbb Q} \newcommand{\R}{\mathbb R}
<span class="nav-other-controls"></span><span class="treebuttons"><a class="previous-button button" href="displaying.html" title="Previous"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cb;</span><span class="name">Prev</span></a><a class="up-button button" href="ch-getting-started.html" title="Up"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5ce;</span><span class="name">Up</span></a><a class="next-button button" href="data-types.html" title="Next"><span class="name">Next</span><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cc;</span></a></span></nav><div id="latex-macros" class="hidden-content process-math" style="display:none"><span class="process-math">\(\newcommand{\N}{\mathbb N} \newcommand{\Z}{\mathbb Z} \newcommand{\Q}{\mathbb Q} \newcommand{\R}{\mathbb R}
\newcommand{\lt}{&lt;}
\newcommand{\gt}{&gt;}
\newcommand{\amp}{&amp;}
Expand All @@ -149,7 +149,7 @@ <h2 class="search-results-heading">Search Results: </h2>
<div class="toc-title-box"><a href="ch-getting-started.html" class="internal"><span class="codenumber">1</span> <span class="title">Getting Started</span></a></div>
<ul class="structural toc-item-list contains-active">
<li class="toc-item toc-section"><div class="toc-title-box"><a href="about-sage.html" class="internal"><span class="codenumber">1.1</span> <span class="title">Intro to Sage</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="printing.html" class="internal"><span class="codenumber">1.2</span> <span class="title">Printing</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="displaying.html" class="internal"><span class="codenumber">1.2</span> <span class="title">Display Values</span></a></div></li>
<li class="toc-item toc-section active"><div class="toc-title-box"><a href="OOP.html" class="internal"><span class="codenumber">1.3</span> <span class="title">Object Oriented Programming</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="data-types.html" class="internal"><span class="codenumber">1.4</span> <span class="title">Data Types</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="iteration.html" class="internal"><span class="codenumber">1.5</span> <span class="title">Iteration</span></a></div></li>
Expand Down Expand Up @@ -254,22 +254,23 @@ <h2 class="search-results-heading">Search Results: </h2>
<main class="ptx-main"><div id="ptx-content" class="ptx-content"><section class="section" id="OOP"><h2 class="heading hide-type">
<span class="type">Section</span><span class="space"> </span><span class="codenumber">1.3</span><span class="space"> </span><span class="title">Object Oriented Programming</span>
</h2>
<div class="para" id="OOP-2">What is an <dfn class="terminology">object</dfn>? Almost everything in Sage and Python for that matter is an object! More specifically an object is an instance of a <dfn class="terminology">class</dfn>.</div>
<div class="para" id="OOP-2">What is an <dfn class="terminology">object</dfn>? An object can be used to model almost anything. More specifically, an object is an instance of a <dfn class="terminology">class</dfn>.</div>
<div class="para" id="OOP-3">A class provides a template or blueprint for creating objects and defines the <dfn class="terminology">attributes</dfn> (properties) and <dfn class="terminology">methods</dfn> (behaviors) that those objects can have.</div>
<div class="para" id="OOP-4">This might not mean too much right now and it will be more clear as we explore what is known as <dfn class="terminology">object-oriented</dfn> programming. Just know that SageMath has different ways of representing and working with data. We can create an object by typing something into our Sage Worksheet or the cells on this page.</div>
<div class="para" id="OOP-4">While this concept might seem abstract at first, it becomes clearer as we dive deeper into object-oriented programming (OOP). SageMath utilizes OOP principles, offering a structured way to represent and manipulate data. We can create an object by typing something into our Sage Worksheet or the cells on this page.</div>
<div class="para" id="OOP-5">
<dfn class="terminology">Dot notation</dfn> is a feature in object-oriented programming. Here is an example of dot notation. There are many more examples of this in Sage. Dot notation is used to access attributes and methods of an object. We can also pass in arguments to this method to specify the number of digits we want to round to.</div>
<div class="para" id="OOP-6">Lets use Sage’s object oriented syntax to plot a graph and save it to a file.</div>
<div class="para" id="OOP-7">In terms of object-oriented programming, the <code class="code-inline tex2jax_ignore">Circuit</code> method is a method of the <code class="code-inline tex2jax_ignore">digraphs</code> class. We can use the <code class="code-inline tex2jax_ignore">plot</code> method to plot the graph.</div>
<pre id="OOP-8" class="ptx-sagecell sagecell-sage"><script type="text/x-sage"># we will learn more about digraphs later in this text
g = digraphs.Circuit(10)
plot(g)
<dfn class="terminology">Dot notation</dfn> is a syntax used in OOP to access an object’s attributes and methods. Here is an example of dot notation. There are many more examples of this in Sage.</div>
<pre id="OOP-6" class="ptx-sagecell sagecell-sage"><script type="text/x-sage">n = 4
n.sqrt()
</script></pre>
<div class="para" id="OOP-9">You can save the plot by using the <code class="code-inline tex2jax_ignore">save</code> method.</div>
<pre id="OOP-10" class="ptx-sagecell sagecell-sage"><script type="text/x-sage">plot(g).save('filename.pdf')
<pre id="OOP-7" class="ptx-sagecell sagecell-sage"><script type="text/x-sage">n = 4
n.sqrt(all=True)
</script></pre>
<pre id="OOP-8" class="ptx-sagecell sagecell-sage"><script type="text/x-sage">sqrt(2).n()
</script></pre>
<pre id="OOP-9" class="ptx-sagecell sagecell-sage"><script type="text/x-sage">sqrt(2).n(prec=100)
</script></pre></section></div>
<div class="ptx-content-footer">
<a class="previous-button button" href="printing.html" title="Previous"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cb;</span><span class="name">Prev</span></a><a class="top-button button" href="#" title="Top"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5ce;</span><span class="name">Top</span></a><a class="next-button button" href="data-types.html" title="Next"><span class="name">Next</span><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cc;</span></a>
<a class="previous-button button" href="displaying.html" title="Previous"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cb;</span><span class="name">Prev</span></a><a class="top-button button" href="#" title="Top"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5ce;</span><span class="name">Top</span></a><a class="next-button button" href="data-types.html" title="Next"><span class="name">Next</span><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cc;</span></a>
</div></main>
</div>
<div id="ptx-page-footer" class="ptx-page-footer">
Expand Down
Loading

0 comments on commit da0d070

Please sign in to comment.