-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprefix-postfix.html
129 lines (128 loc) · 5.73 KB
/
prefix-postfix.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="description" content="Prefix and postfix notations."/>
<meta name="keywords" content="education, technology, mathematics, programming, prefix, postfix"/>
<meta name="author" content="Shiv Shankar Dayal" />
<meta name="copyright" content="Shiv Shankar Dayal" />
<meta name="robots" content="index,follow"/>
<meta http-equiv="expires" content="86400"/>
<meta name="viewport" content="width=21cm, initial-scale=1">
<title>Humans, education and technology</title>
<link rel="stylesheet" href="css/material-components-web.min.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/mdb.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/jquery.min.js"></script>
<script src="js/material-components-web.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></script>
<script>
MathJax.Hub.Config({
config: ["MMLorHTML.js"],
jax: ["input/TeX","input/MathML","input/AsciiMath","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
TeX: {
extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
}
});
</script>
</head>
<body class="mdc-typography">
<page size="A4">
<header class="mdc-toolbar mdc-theme--secondary-dark">
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<span class="mdc-toolbar__title"><a href="/" class="menu-anchor">Home</a></span>
<span class="mdc-toolbar__title"><a href="toc.html" class="menu-anchor">Table of Contents</a></span>
</section>
</div>
</header>
<div class="margins">
<section>
<h2>Prefix and Postfix Notataions</h2>
<p>
<b>Prefix notation</b>, also known as <b>normal Polish notation (NPN), Łukasiewicz notation,
Warsaw notation, Polish prefix notation</b> or simply <b>Polish notation(PN)</b> was
invented by Polish logician Jan Łukasiewicz. You can read about him at <a href="https://en.wikipedia.org/wiki/Jan_%C5%81ukasiewicz">
https://en.wikipedia.org/wiki/Jan_%C5%81ukasiewicz</a>
</p>
<p>
<img src="img/Jan_Łukasiewicz.jpg" class="fr"/> Due to nature of prefix notation it does not
need parenthesis as infix does(it will become clear soon). It is used heavily in <code>LISP</code>
family of languages(this will take time). <code>Scheme</code> language which you have just
used also belongs to same family of languages. It is not of much importance for us
now except the fact that it will be used on <code>GNU Guile</code> prompt for
calculations and verifying our calculations. The only point worth noting is that
prefix notation can be easily and readily reduced to <i>abstract syntax </i> trees.
I can give a link as to what it is but for now hold your curiosity a bit.
</p>
<p>
Anology can be drawn and prefix notation led to postfix notation. It is also known as
<strong>Reverse Polish notation (RPN)</strong>. As I have already told in this notation
operator comes after both the operands. It was invented by Arthur Burks, Don Warren
and Jesse Wright in 1954. Practcally it was used in
<a href="https://en.wikipedia.org/wiki/HP-35">HP-25</a> calculators and many other
places. In programming it was used in <i>stack</i> based programming languages like
<i>Postscript</i>.
</p>
<p>
We have strayed from our main topic of addition quite a bit so let us get
back to it.
</section>
<section>
<h2>Addition Exmaples</h2>
<table class="table table-responsive table-striped">
<tbody>
<tr>
<td class="ml-10">\(0 + 0 = 0\)</td>
<td class="ml-10">\(0 + 1 = 1\)</td>
<td class="ml-10">\(0 + 2 = 2\)</td>
<td class="ml-10">\(0 + 3 = 3\)</td>
<td class="ml-10">\(0 + 4 = 4\)</td>
</tr>
<tr>
<td class="ml-10">\(1 + 0 = 1\)</td>
<td class="ml-10">\(1 + 1 = 2\)</td>
<td class="ml-10">\(1 + 2 = 3\)</td>
<td class="ml-10">\(1 + 3 = 4\)</td>
<td class="ml-10">\(1 + 4 = 5\)</td>
</tr>
<tr>
<td class="ml-10">\(2 + 0 = 2\)</td>
<td class="ml-10">\(2 + 1 = 3\)</td>
<td class="ml-10">\(2 + 2 = 4\)</td>
<td class="ml-10">\(2 + 3 = 5\)</td>
<td class="ml-10">\(2 + 4 = 6\)</td>
</tr>
</tbody>
</table>
<h3>Observations</h3>
<p>
The most important observation is order of appearance of operands does
not have effect on final value. This is known as <i><strong>commutative
property</strong></i> of addition.
</p>
<p style="color:red">
<i><strong>Note that it does not always hold true though it will a long while
before I can show you.</strong></i>
</p>
<p>
The second observation is that adding zero to any number is not of any use
as it does not change the number at all. Also, adding one increases value
to next number and adding two increases the value to next-next number.
</p>
<p>
There are other properties of addition but all in due course of time.
Patience is virtue.
</p>
</section>
</div>
<div style="clear-both"></div>
<footer class="margins">
<a href="addition.html" class="mdc-button mdc-theme--secondary-light mdc-button--raised fl">Previous</a>
<a href="addition-exercise.html" class="mdc-button mdc-theme--secondary-light mdc-button--raised fr">Next</a>
</footer>
</page>
</body>
</html>