-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtour-quickstart.html
450 lines (380 loc) · 15.1 KB
/
tour-quickstart.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
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>SageMath - Tour - Quickstart
</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="search"
type="application/opensearchdescription+xml"
href="https://www.sagemath.org/res/sage-search.xml"
title="Search sagemath.org" />
<link href='res/sage.css' type="text/css" rel="stylesheet" />
<link rel="shortcut icon" href="pix/sageicon.png" type="image/x-icon" />
<link rel="mask-icon" href="pix/icon_only/sagemath_pinned_tab_icon.svg" color="blue" />
<script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src='res/sage.js' type="text/javascript"></script>
<link href='//fonts.googleapis.com/css?family=RobotoDraft:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en,fr,de,es' rel='stylesheet' type='text/css'>
<link href="https://mathstodon.xyz/@sagemath" rel="me" />
<meta property="og:title" content="SageMath Mathematical Software System - Sage"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="https://www.sagemath.org/"/>
<meta property="og:image" content="https://sagemath.org/pix/logo_sagemath+icon_oldstyle.png"/>
<meta property="og:site_name" content="SageMath Mathematical Software System"/>
<meta property="og:description" content="SageMath is a free and open-source mathematical software system."/></head>
<body>
<div id="header" class="small">
<div id="header-logo">
<a href="index.html">
<img width="250" height="65" alt="SageMath Logo" class="round raised"
src="pix/logo_sagemath+icon_oldstyle.png" title="SageMath Mathematical Software" />
</a></div>
<div id="header-text"><form action="search.html" method="get">
<a href="https://github.com/sagemath/sage">GitHub</a>
·
<a href="https://wiki.sagemath.org/">Wiki</a>
·
<a href="https://ask.sagemath.org/">Questions?</a>
·
<a href="https://github.com/sponsors/sagemath" style="font-weight: bold;">
<span style="color:#ea4aaa">♥</span> Sponsor
</a>
·
<a href="https://opencollective.com/sage_math" style="font-weight: bold;">Donate</a>
</form>
Online:
<a href="https://cocalc.com/?utm_source=sagemath.org&utm_medium=top">CoCalc</a>
·
<a href="https://sagecell.sagemath.org/">SageCell</a>
or
<a href="https://doc.sagemath.org/html/en/installation/index.html">Install</a>,
<a href="https://github.com/sagemath/sage">Clone</a>
<br/>
<a href="https://www.facebook.com/pages/Sage-Math/26593144945">
<img alt="F" src="pix/facebook-favicon.ico" width="16" height="16" /></a>
<a href="https://mathstodon.xyz/@sagemath">
<img alt="T" src="pix/mastodon-favicon.ico" width="16" height="16"/></a></div>
</div>
<div id="sage-nav-buffer" style="display: none"></div>
<ul id="sage-nav"><li><a href="index.html">Home</a>
<ul>
<li><a href="search.html">Search</a></li>
<li><a href="development-ack.html">Acknowledgments</a></li>
<li><a href="https://wiki.sagemath.org/Workshops">SageMath Days</a></li>
</ul>
</li>
<li><a href="tour.html">Tour</a>
<ul>
<li><a href="tour.html">Overview</a></li>
<li><a href="library-why.html">Why Sage?</a></li>
<li class="section"><a href="tour-quickstart.html">Quickstart</a></li>
<li><a href="tour-graphics.html">Graphics</a></li>
<li><a href="tour-research.html">Research</a></li>
<li class="section"><a href="https://wiki.sagemath.org/interact/">Interactive Plots (wiki)</a></li>
<li><a href="https://doc.sagemath.org/html/en/a_tour_of_sage/">A Tour of SageMath</a></li>
</ul>
</li>
<li><a href="help.html">Help</a>
<ul>
<li><a href="https://doc.sagemath.org"><b>Online Documentation</b></a></li>
<li class="section"><a href="help.html">Support Resources</a></li>
<li><a href="help-groups.html">Mailing Lists</a></li>
<li><a href="https://ask.sagemath.org" class="ext">Ask a question</a></li>
<li><a href="https://sagemath.zulipchat.com/" class="ext">Chat on Zulip</a></li>
<li><a href="help-video.html">Videos</a></li>
<li class="section"><a href="https://doc.sagemath.org/html/en/tutorial/">Tutorial</a></li>
<li><a href="https://doc.sagemath.org/html/en/constructions/">Constructions</a></li>
<li><a href="https://doc.sagemath.org/html/en/reference/">Reference Manual</a></li>
</ul>
</li>
<li><a href="library.html">Library</a>
<ul>
<li><a href="library.html">Overview</a></li>
<li><a href="library-stories.html">Testimonials</a></li>
<li><a href="library-publications.html">Publications</a></li>
<li><a href="library-publications-combinat.html">Publications Combinat</a></li>
<li><a href="library-publications.html#books" >Books</a></li>
<li class="section"><a href="library-marketing.html">Marketing</a></li>
<li><a href="library-press.html">Press Kit</a></li>
<li class="section"><a href="calctut/index.html">Calculus Tutorial</a></li>
</ul>
</li>
<li><a href="https://doc.sagemath.org/html/en/installation/index.html">Download</a>
<ul>
<li><a href="https://doc.sagemath.org/html/en/installation/index.html">Install guide: What/how to download</a>
<li class="section"><a href="https://github.com/sagemath/sage">Clone from GitHub</a></li>
<li class="section"><a href="https://github.com/3-manifolds/Sage_macOS/releases" class="ext">macOS binaries (3-manifolds)</a></li>
<li><a href="https://doc.sagemath.org/html/en/installation/conda.html#sec-installation-conda">Linux/macOS binaries (conda-forge)</a></li>
<li><a href="https://docs.microsoft.com/en-us/windows/wsl/install">Windows: Use Windows Subsystem for Linux</a></li>
</ul>
</li>
<li><a href="development.html">Development</a>
<ul>
<li><a href="https://github.com/sagemath/sage/blob/develop/CONTRIBUTING.md" class="ext">Contributing to SageMath</a></li>
<li><a href="https://github.com/sagemath/sage" class="ext">GitHub repository</a></li>
<li><a href="development-groups.html">Mailing Lists</a></li>
<li><a href="development-map.html">Developer Map</a></li>
<li><a href="development-prize.html">Prize</a></li>
<li><a href="development-ack.html">Acknowledgment</a></li>
<li><a href="https://doc.sagemath.org/html/en/developer/" class="ext">Developer Guide</a></li>
</ul>
</li>
<li><a href="links.html">Links</a>
<ul>
<li><a href="https://github.com/sagemath/sage/wiki/Mathematical-Software-Landscape" class="ext">Math Software Landscape</a></li>
<li><a href="https://doc.sagemath.org/html/en/reference/spkg/" class="ext">SageMath Components</a></li>
<li class="section"><a href="https://sagecell.sagemath.org/" class="ext">SageMath Cell Server</a></li>
<li><a href="https://wiki.sagemath.org/">SageMath Wiki</a></li>
<li><a href="https://groups.google.com/forum/#!forum/sage-devel">Report a bug</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</li></ul>
<h1>Quickstart</h1>
<div class="bodypadding">
This is a short introduction in how to interact with SageMath. Make sure you have installed it
according to the <a href="https://doc.sagemath.org/html/en/installation">installation guide</a>. There are also nice
<a href="./help-video.html">Screencasts</a> for introduction available. Make sure to read
more about SageMath in the <a href="https://doc.sagemath.org/html/en/tutorial/index.html">SageMath Tutorial</a>!
</div>
<table class="top">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<tbody>
<tr>
<th colspan="2">
<h3>Basics</h3>
</th>
</tr>
<tr>
<td class="leftpadding">
<pre class="code">
sage: <strong>1+1</strong>
2
sage: <strong>V = QQ^3</strong>
sage: <strong>V.[tab key]</strong>
...
V.base_ring
V.basis
V.coordinates
...
</pre>
</td>
<td class="rightpadding">
<div class="justify txt">
SageMath uses the basic user-interface principle of "question and answer" found in many
other software systems. You enter an expression and after pressing the <span class=
"code">Return</span> key in the command line interface or hitting <span class=
"code">Shift+Return</span> in the notebook interface, SageMath evaluates your expression and
returns the answer. – <a href="https://doc.sagemath.org/html/en/tutorial/interactive_shell.html"
>read more</a>
</div>
<div class="justify">
Tab-completion helps you enter commands. On the command-line, it also provides history and
reverse lookup search. – <a href="https://doc.sagemath.org/html/en/tutorial/interactive_shell.html#reverse-search-and-tab-completion"
>read more</a>
</div>
</td>
</tr><!--
</tbody>
</table>
-->
<tr>
<th colspan="2">
<h3>Classes of Objects</h3>
</th>
</tr><!--
<table class="top ">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<tbody>
-->
<tr>
<td class="leftpadding">
<pre class="code">
sage: <strong>R = RealIntervalField(100)</strong>
sage: <strong>R</strong>
Real Interval Field with 100 bits of precision
sage: <strong>a = R((-1,0)); a</strong>
-1.?
sage: <strong>b = sin(a); b</strong>
-1.?
sage: <strong>c = a*b; c.diameter()</strong>
0.84147098480789650665250232163
</pre>
</td>
<td class="rightpadding">
<div class="justify txt">
As you can see in the previous example, SageMath knows about mathematical objects embedded into
the Python language. Every quantity - a real number, a polynomial, a matrix, and so on -
belongs to a <em>parent</em>, and this tells SageMath how to perform operations on the quantity.
</div>
<div class="justify">
In the example on the left, R is defined as the class of all intervals of real values with
100 bits of precision. Then an interval is created and stored in <span class=
"code">a</span>, the function <span class="code">sin</span> is applied and stored in
<span class="code">b</span>. In the end they are multiplied and the diameter is calculated.
<span class="code">sin</span> is a function that "knows" about intervals, as well
as the multiplication does, and <span class="code">diameter()</span> is a method of an
interval instance object.
</div>
</td>
</tr>
<tr>
<th colspan="2">
<h3>Interactive Help</h3>
</th>
</tr>
<tr>
<td class="leftpadding">
<pre class="code">
sage: <strong>c.diameter?</strong>
Docstring:
If 0 is in "self", then return "absolute_diameter()", otherwise
return "relative_diameter()".
EXAMPLES:
sage: RIF(1, 2).diameter()
0.666666666666667
...
</pre>
</td>
<td class="rightpadding">
<div class="justify txt">
The example above shows that there are thousands of functions and methods. SageMath comes with
<a href="https://doc.sagemath.org/html/en/tutorial/interactive_shell.html#integrated-help-system"
>a built-in help system</a> and you do not have to memorize them all.
Entering a question mark after a method shows the description and additional information
about that method. The example on the left shows the documentation for the <span class=
"code">diameter</span> method from the previous example.
</div>
</td>
</tr>
<tr>
<th colspan="2">
<h3>Symbolic Maths</h3>
</th>
</tr>
<tr>
<td class="leftpadding">
<pre class="code">
sage: <strong>f = 1 - sin(x)^2</strong>
sage: <strong>f</strong>
-sin(x)^2 + 1
sage: <strong>unicode_art(f) # pretty printing</strong>
2
1 - sin (x)
sage: <strong>f.simplify_trig()</strong>
cos(x)^2
sage: <strong>f(x=pi/2)</strong>
0
sage: <strong>f(x=pi/3)</strong>
1/4
sage: <strong>integrate(f, x).simplify_trig()</strong>
1/2*sin(x)*cos(x) + 1/2*x
sage: <strong>unicode_art(integrate(f, x).simplify_trig())</strong>
x sin(x)⋅cos(x)
─ + ─────────────
2 2
sage: <strong>f.differentiate(2).substitute({x: 3/pi})</strong>
2*sin(3/pi)^2 - 2*cos(3/pi)^2
sage: <strong>unicode_art(f.differentiate(2).substitute({x: 3/pi}))</strong>
2⎛3⎞ 2⎛3⎞
- 2⋅cos ⎜─⎟ + 2⋅sin ⎜─⎟
⎝π⎠ ⎝π⎠
</pre>
</td>
<td class="rightpadding">
<div class="justify txt">
Here we define a function $$f$$, simplify it, evaluate it at $$\pi/2$$ and $$\pi/3$$ and
integrate it with simplification. After that, $$f$$ is differentiated two times and $$x$$ is
substituted by $$3/\pi$$.
</div>
</td>
</tr>
<tr>
<th colspan="2">
<h3>Numerical Maths</h3>
</th>
</tr>
<tr>
<td class="leftpadding">
<pre class="code">
sage: <strong>g = sin(x) + (1- x^2)</strong>
sage: <strong>find_root(g, 0, 2)</strong>
1.4096240040025754
sage: <strong>var('x y z')</strong>
(x, y, z)
sage: <strong>f = (1 + (y+x^2)^2 + (1+z+y^2)^2)^2</strong>
sage: <strong>f</strong>
2 2 2 2 2
((z + y + 1) + (y + x ) + 1)
sage: <strong>minimize(f,[1,2,3],algorithm='powell',verbose=1)</strong>
Optimization terminated successfully.
Current function value: 1.000059
Iterations: 2
Function evaluations: 84
(-0.000607497243458, 0.00486816565959, -1.00243223164)
</pre>
</td>
<td class="rightpadding">
<div class="justify txt">
On the left side, a root of the function<br />
$$g(x) = sin(x) + (1-x^2)$$<br />
is found numerically.
</div>
<div class="justify txt">
Below, the function<br />
$$f(x,y,z) = (1 + (y + x^2)^2 + (1+z+y^2)^2)^2$$<br />
is minimized using the "powell" algorithm.
</div>
</td>
</tr>
</tbody>
</table>
<div class="txt"></div>
<div class="narrow center txt">
<a href="./tour-research.html">Tour Research</a> · <a href="./tour-graphics.html">Tour
Graphics</a>
</div>
<div style="height:auto;min-height:50px;"> </div>
<div id="footer" class="center">
<table>
<tr id="links">
<td><a id="footer-webmaster" href="https://github.com/sagemath/website"></a></td>
<td>·</td>
<td><a id="footer-cc" title="website content is Creative Commons 3.0 licensed"
href="https://creativecommons.org/licenses/by-sa/4.0/"></a></td>
<td>·</td>
<td><a id="footer-contact" title="Contact SageMath Project" href="contact.html"></a></td>
</tr>
<tr style="height: 70px;">
<td align="right" colspan="1">
<a style="background:none;" href="https://www.clustrmaps.com/map/Sagemath.org">
<img width="65" height="42"
style="border:0px;"
id="clustrMapsImg"
src="https://www.clustrmaps.com/stats/maps-no_clusters/sagemath.org-thumb.jpg" alt="Locations of visitors to this page" />
</a>
</td>
<td></td>
<td align="center" style="padding-bottom: 10px;vertical-align: center">
<div id="histats_counter"></div>
<noscript>
<a href="https://www.histats.com" alt="free web stats" target="_blank" >
<div id="histatsC"><img border="0" src="https://s4is.histats.com/stats/i/1579950.gif?1579950&103"></div></a>
</noscript>
</td>
<td></td>
</tr>
<tr>
<td colspan="7" style="text-align: center;">
<iframe src="https://github.com/sponsors/sagemath/button" title="Sponsor sagemath" height="35" width="116" style="border: 0; vertical-align: middle;"></iframe>
</td>
</tr>
</table>
</div></body>
</html>