This file is indexed.

/usr/share/doc/yacas-doc/html/essayschapter4.html is in yacas-doc 1.3.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<html>
<head>
  <title>Why <b>-x^(-1)</b> and <b>-1/x</b> are not the same in Yacas</title>
  <link rel="stylesheet" href="yacas.css" TYPE="text/css" MEDIA="screen">
</head>
<body>
<a name="c4">

</a>
<h1>
4. Why <b>-x^(-1)</b> and <b>-1/x</b> are not the same in Yacas
</h1>
<p> </p>
Wouldn't it be wonderful if we had a program that could do all 
the mathematical problems for us we could ever need? Need to 
solve a set of equations? Just call <b><tt>Solve</tt></b> with the appropriate
arguments. Want to simplify an expression? Just call <b><tt>Simplify</tt></b>
and you will always get the form you would like to see.
A program, simply, that could replace any mathematician. An
expert system, the domain of expertise being mathematics.
Wouldn't that be great?


<p>
The answer to the above is, at least according to the author,
a resounding no. It is doubtful such a program will ever exist,
but it is not even sure that such a program would be desirable.


<p>
Humans have a long history of making tools to make their lives
easier. One important property of a tool is that it is clear
conceptually to the user of that tool what that tool does.
A tool should not be clever. The user of the tool can be clever
about using the tool, or combining it with other tools.
A 'clever' tool often results in a tool that is not useful.
It is hard to understand what a clever tool does, or why
it does what it does. In short: its behavior will be unpredictable.


<p>
This is a passionate plea against generic commands like <b><tt>Simplify</tt></b>
and <b><tt>Solve</tt></b>.


<p>
Consider this bit of interaction in <b><tt>Yacas</tt></b>:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; a:= -x^(-1)
Out&gt; -x^(-1);
In&gt; b:= -1/x
Out&gt; (-1)/x;
In&gt; a = b
Out&gt; False;
</pre></tr>
</table>


<p>
Now, that can not be right, can it? Clearly, these are the same?
No, they are not. They have a slightly different form, and are
thus represented differently internally. the <b><tt>=</tt></b> sign compares
the internal representation of two expressions , so <b><tt>a = b</tt></b> returns 
<b><tt>False</tt></b> because the internal representations of the expressions
<b><tt>a</tt></b> and <b><tt>b</tt></b> are bound to are different. Note that this is behaviour
that is simple to explain. The <b><tt>=</tt></b> operator is a 'tool', it is
simple, and does one thing but does it well. It is easy to use,
an important property of a tool.


<p>
To drive home this point further, suppose we did modify the
<b><tt>=</tt></b> operator to detect that <b><tt>a</tt></b> and <b><tt>b</tt></b> are indeed equal.
Great! Wonderful! <b><tt>a=b</tt></b> now returns <b><tt>True</tt></b>. But consider


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; c:=1+r+r^2
Out&gt; r+r^2+1;
In&gt; d:=(1-r^3)/(1-r)
Out&gt; (1-r^3)/(1-r);
In&gt; c=d
Out&gt; False;
</pre></tr>
</table>


<p>
<b><tt>c</tt></b> and <b><tt>d</tt></b> are equal for all values of <b><tt>r</tt></b> where <b><tt>r != 1</tt></b>,
but there a limit can be taken:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; Limit(r,1)d
Out&gt; 3;
In&gt; Limit(r,1)c
Out&gt; 3;
</pre></tr>
</table>


<p>
Now, we have to modify the
<b><tt>=</tt></b> tool to also detect that these are the same. Actually,
this will have to be done for all known identities! Or we
shall have to explain for which expressions it can determine
equality. This will be a complex story, it will be hard to
explain. It will be a complex tool to use. And, more practically,
it will be a slow tool.


<p>
So, how do we go about verifying that <b><tt>a</tt></b> and <b><tt>b</tt></b> are the same?
Or that <b><tt>c</tt></b> and <b><tt>d</tt></b> are the same?


<p>
The solution lies in devising new tools.


<p>

<a name="c4s1">

</a>
<h2>
<hr>4.1 Canonical and normal representations
</h2>
A <i>canonical</i> representation for a group of expressions 
is a representation for each object in that group such
that if two elements of the group are the same, they
also have the same (internal) representation. Thus, when
expressions are brought to their canonical representations,
the <b><tt>=</tt></b> tool can be used to verify that they are the same.


<p>
A representation is called a <i>normal</i> representation if zero
only has one representation. Thus <b><tt>nf(a-b)=0</tt></b> should be
something that should return <b><tt>True</tt></b> if <b><tt>a</tt></b> and <b><tt>b</tt></b> are
the same mathematically.


<p>
Consider a normal form defined on rational functions:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; MM(a)
Out&gt; MultiNomial({x},{{-1,-1}});
In&gt; MM(b)
Out&gt; MultiNomial({x},{{0,-1}})/
MultiNomial({x},{{1,1}});
</pre></tr>
</table>


<p>
However:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; MM(a-b)
Out&gt; MultiNomial({x},{{0,0}})/
MultiNomial({x},{{1,1}});
In&gt; NormalForm(%)
Out&gt; 0;
</pre></tr>
</table>


<p>
So here we have found a <i>combination</i> of tools that together
allow us to decide that the <b><tt>a</tt></b> and <b><tt>b</tt></b> defined in the 
beginning of this section are the same: convert <b><tt>a-b</tt></b> to
a normal form of <b><tt>a-b</tt></b>, and verify with the <b><tt>=</tt></b> tool that
they are the same:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; NormalForm(MM(a-b)) = 0
Out&gt; True;
</pre></tr>
</table>


<p>
Now consider the <b><tt>c</tt></b> and <b><tt>d</tt></b> defined above. <b><tt>c</tt></b> and <b><tt>d</tt></b> are
both functions of <b><tt>r</tt></b> only, <b>c=c(r)</b> and <b>d=d(r)</b>.
Now, let us define a function <b>f(r)=c(r)-d(r)</b>:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; f(r):=Eval(c-d)
Out&gt; True;
In&gt; f(r)
Out&gt; r+r^2+1-(1-r^3)/(1-r);
</pre></tr>
</table>


<p>
It is not quite clear yet that this is zero. But we can decide
that this is zero (and thus <b><tt>c(r)=d(r)</tt></b>) by first noting that
<b>f(r)</b> is zero for some r, and then that the first derivative
of <b>f(r)</b> with respect to <b>r</b> is zero, independent of r:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; f(0)
Out&gt; 0;
In&gt; D(r)f(r)
Out&gt; 2*r+1-(-((1-r)*3*r^2+r^3-1))/(1-r)^2;
In&gt; NormalForm(MM(%))
Out&gt; 0;
</pre></tr>
</table>


<p>
So here we have avoided bringing <b><tt>c</tt></b> and <b><tt>d</tt></b> to canonical forms,
by for example first discovering that <b><tt>c</tt></b> is a geometric series,
and gone straight to detecting that <b><tt>c-d</tt></b> is in fact zero, and
thus <b> c(r)=d(r)</b>.


<p>
Here again we have combined tools that are simple, do one thing
but do it well, and for which it is easy to understand for human
beings what they do.


<p>

<a name="c4s2">

</a>
<h2>
<hr>4.2 But how can we then build a powerful CAS?
</h2>
A new problem is introduced when algorithms are written down
that require more powerful comparison tools, tools that are
more sophisticated than the <b><tt>=</tt></b> tool for detecting that two
expressions are indeed the same. The solution to this is to
write the algorithm, but leave the actual comparison tool
to be used by the algorithm configurable. This makes 
algorithms more flexible: the comparison operator can be
passed in as an argument, or the algorithm can perhaps detect
to which group its arguments belong, and use the appropriate
tool to detect equality between two expressions.


<p>

<a name="c4s3">

</a>
<h2>
<hr>4.3 Conclusion
</h2>
A CAS (or any other system built to be used by humans for that
matter) should be built up from small, well understood building
blocks. Yacas contains hundreds of functions that can be combined
into more powerful algorithms. These tools are documented in the
documentation that comes with Yacas. Yacas solves the problem in
that way. Let the user be smart, and choose the tools he needs
based on understanding what the tools do. Large, complicated,
cumbersome calculations can be done that way by just using 
well understood tools and combining them appropriately.


<p>


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2425144-1";
urchinTracker();
</script>
</body>

</html>