Show More
@@ -28,17 +28,18 In[1]: | |||
|
28 | 28 | pwd |
|
29 | 29 | |
|
30 | 30 | Out[1]: |
|
31 | ||
|
32 | 31 | .. parsed-literal:: |
|
33 | 32 | |
|
34 | 33 | u'/Users/minrk/dev/ip/mine/docs/examples/notebooks' |
|
35 | 34 | |
|
35 | ||
|
36 | 36 | In[2]: |
|
37 | 37 | |
|
38 | 38 | .. code:: python |
|
39 | 39 | |
|
40 | 40 | ls |
|
41 | 41 | |
|
42 | ||
|
42 | 43 | .. parsed-literal:: |
|
43 | 44 | |
|
44 | 45 | 00_notebook_tour.ipynb callbacks.ipynb python-logo.svg |
@@ -48,7 +49,6 In[2]: | |||
|
48 | 49 | Script Magics.ipynb octavemagic_extension.ipynb trapezoid_rule.ipynb |
|
49 | 50 | animation.m4v progbar.ipynb |
|
50 | 51 | |
|
51 | ||
|
52 | 52 | In[3]: |
|
53 | 53 | |
|
54 | 54 | .. code:: python |
@@ -57,11 +57,11 In[3]: | |||
|
57 | 57 | # note: the echo command does not run on Windows, it's a unix command. |
|
58 | 58 | !echo $message |
|
59 | 59 | |
|
60 | ||
|
60 | 61 | .. parsed-literal:: |
|
61 | 62 | |
|
62 | 63 | The IPython notebook is great! |
|
63 | 64 | |
|
64 | ||
|
65 | 65 | Plots with matplotlib |
|
66 | 66 | --------------------- |
|
67 | 67 | |
@@ -74,13 +74,13 In[4]: | |||
|
74 | 74 | |
|
75 | 75 | %pylab inline |
|
76 | 76 | |
|
77 | ||
|
77 | 78 | .. parsed-literal:: |
|
78 | 79 | |
|
79 | 80 | |
|
80 | 81 | Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline]. |
|
81 | 82 | For more information, type 'help(pylab)'. |
|
82 | 83 | |
|
83 | ||
|
84 | 84 | In[5]: |
|
85 | 85 | |
|
86 | 86 | .. code:: python |
@@ -89,7 +89,7 In[5]: | |||
|
89 | 89 | plot(x, sin(x**2)) |
|
90 | 90 | title('A simple chirp'); |
|
91 | 91 | |
|
92 | .. image:: tests/ipynbref/00_notebook_tour_orig_files/00_notebook_tour_orig_fig_00.png | |
|
92 | .. image:: _fig_07.png | |
|
93 | 93 | |
|
94 | 94 | You can paste blocks of input with prompt markers, such as those from |
|
95 | 95 | `the official Python |
@@ -103,11 +103,11 In[6]: | |||
|
103 | 103 | >>> if the_world_is_flat: |
|
104 | 104 | ... print "Be careful not to fall off!" |
|
105 | 105 | |
|
106 | ||
|
106 | 107 | .. parsed-literal:: |
|
107 | 108 | |
|
108 | 109 | Be careful not to fall off! |
|
109 | 110 | |
|
110 | ||
|
111 | 111 | Errors are shown in informative ways: |
|
112 | 112 | |
|
113 | 113 | In[7]: |
@@ -116,10 +116,10 In[7]: | |||
|
116 | 116 | |
|
117 | 117 | %run non_existent_file |
|
118 | 118 | |
|
119 | ||
|
119 | 120 | .. parsed-literal:: |
|
120 | 121 | |
|
121 | 122 | ERROR: File `u'non_existent_file.py'` not found. |
|
122 | ||
|
123 | 123 | In[8]: |
|
124 | 124 | |
|
125 | 125 | .. code:: python |
@@ -138,7 +138,6 In[8]: | |||
|
138 | 138 | ----> 3 z = y/(1-x) |
|
139 | 139 | |
|
140 | 140 | ZeroDivisionError: integer division or modulo by zero |
|
141 | ||
|
142 | 141 | When IPython needs to display additional information (such as providing |
|
143 | 142 | details on an object via ``x?`` it will automatically invoke a pager at |
|
144 | 143 | the bottom of the screen: |
@@ -164,38 +163,10 In[19]: | |||
|
164 | 163 | print i, |
|
165 | 164 | time.sleep(0.5) |
|
166 | 165 | |
|
167 | .. parsed-literal:: | |
|
168 | ||
|
169 | 0 | |
|
170 | 166 | |
|
171 | 167 | .. parsed-literal:: |
|
172 | 168 | |
|
173 | 1 | |
|
174 | ||
|
175 | .. parsed-literal:: | |
|
176 | ||
|
177 | 2 | |
|
178 | ||
|
179 | .. parsed-literal:: | |
|
180 | ||
|
181 | 3 | |
|
182 | ||
|
183 | .. parsed-literal:: | |
|
184 | ||
|
185 | 4 | |
|
186 | ||
|
187 | .. parsed-literal:: | |
|
188 | ||
|
189 | 5 | |
|
190 | ||
|
191 | .. parsed-literal:: | |
|
192 | ||
|
193 | 6 | |
|
194 | ||
|
195 | .. parsed-literal:: | |
|
196 | ||
|
197 | 7 | |
|
198 | ||
|
169 | 0 1 2 3 4 5 6 7 | |
|
199 | 170 | |
|
200 | 171 | Clean crash and restart |
|
201 | 172 | ----------------------- |
@@ -265,10 +236,8 In[1]: | |||
|
265 | 236 | Image(filename='../../source/_static/logo.png') |
|
266 | 237 | |
|
267 | 238 | Out[1]: |
|
239 | .. image:: _fig_22.png | |
|
268 | 240 | |
|
269 | .. parsed-literal:: | |
|
270 | ||
|
271 | <IPython.core.display.Image at 0x10faeafd0> | |
|
272 | 241 | |
|
273 | 242 | An image can also be displayed from raw data or a url |
|
274 | 243 | |
@@ -279,11 +248,11 In[2]: | |||
|
279 | 248 | Image(url='http://python.org/images/python-logo.gif') |
|
280 | 249 | |
|
281 | 250 | Out[2]: |
|
282 | ||
|
283 | 251 | .. parsed-literal:: |
|
284 | 252 | |
|
285 | 253 | <IPython.core.display.Image at 0x1060e7410> |
|
286 | 254 | |
|
255 | ||
|
287 | 256 | SVG images are also supported out of the box (since modern browsers do a |
|
288 | 257 | good job of rendering them): |
|
289 | 258 | |
@@ -295,10 +264,8 In[3]: | |||
|
295 | 264 | SVG(filename='python-logo.svg') |
|
296 | 265 | |
|
297 | 266 | Out[3]: |
|
267 | .. image:: _fig_26.svg | |
|
298 | 268 | |
|
299 | .. parsed-literal:: | |
|
300 | ||
|
301 | <IPython.core.display.SVG at 0x10fb998d0> | |
|
302 | 269 | |
|
303 | 270 | Embedded vs Non-embedded Images |
|
304 | 271 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
@@ -334,10 +301,8 In[5]: | |||
|
334 | 301 | Embed |
|
335 | 302 | |
|
336 | 303 | Out[5]: |
|
304 | ..jpg image:: | |
|
337 | 305 |
|
|
338 | .. parsed-literal:: | |
|
339 | ||
|
340 | <IPython.core.display.Image at 0x10fb99b50> | |
|
341 | 306 |
|
|
342 | 307 | Today's image from same webcam at Berkeley, (refreshed every minutes, if |
|
343 | 308 | you reload the notebook), visible only with an active internet |
@@ -353,11 +318,11 In[6]: | |||
|
353 | 318 | SoftLinked |
|
354 | 319 | |
|
355 | 320 | Out[6]: |
|
356 | ||
|
357 | 321 | .. parsed-literal:: |
|
358 | 322 | |
|
359 | 323 | <IPython.core.display.Image at 0x10fb99b10> |
|
360 | 324 | |
|
325 | ||
|
361 | 326 | Of course, if you re-run the all notebook, the two images will be the |
|
362 | 327 | same again. |
|
363 | 328 | |
@@ -381,11 +346,11 In[7]: | |||
|
381 | 346 | YouTubeVideo('1j_HxD4iLn8') |
|
382 | 347 | |
|
383 | 348 | Out[7]: |
|
384 | ||
|
385 | 349 | .. parsed-literal:: |
|
386 | 350 | |
|
387 | 351 | <IPython.lib.display.YouTubeVideo at 0x10fba2190> |
|
388 | 352 | |
|
353 | ||
|
389 | 354 | Using the nascent video capabilities of modern browsers, you may also be |
|
390 | 355 | able to display local videos. At the moment this doesn't work very well |
|
391 | 356 | in all browsers, so it may or may not work for you; we will continue |
@@ -407,11 +372,11 In[8]: | |||
|
407 | 372 | HTML(data=video_tag) |
|
408 | 373 | |
|
409 | 374 | Out[8]: |
|
410 | ||
|
411 | 375 | .. parsed-literal:: |
|
412 | 376 | |
|
413 | 377 | <IPython.core.display.HTML at 0x10fba28d0> |
|
414 | 378 | |
|
379 | ||
|
415 | 380 | Local Files |
|
416 | 381 | ----------- |
|
417 | 382 | |
@@ -474,6 +439,7 In[1]: | |||
|
474 | 439 | |
|
475 | 440 | ls |
|
476 | 441 | |
|
442 | ||
|
477 | 443 | .. parsed-literal:: |
|
478 | 444 | |
|
479 | 445 | 00_notebook_tour.ipynb formatting.ipynb |
@@ -485,7 +451,6 In[1]: | |||
|
485 | 451 | cython_extension.ipynb sympy_quantum_computing.ipynb |
|
486 | 452 | display_protocol.ipynb trapezoid_rule.ipynb |
|
487 | 453 | |
|
488 | ||
|
489 | 454 | If we want to create a link to one of them, we can call use the |
|
490 | 455 | ``FileLink`` object. |
|
491 | 456 | |
@@ -497,11 +462,11 In[2]: | |||
|
497 | 462 | FileLink('00_notebook_tour.ipynb') |
|
498 | 463 | |
|
499 | 464 | Out[2]: |
|
500 | ||
|
501 | 465 | .. parsed-literal:: |
|
502 | 466 | |
|
503 | 467 | <IPython.lib.display.FileLink at 0x10f7ea3d0> |
|
504 | 468 | |
|
469 | ||
|
505 | 470 | Alternatively, if we want to link to all of them, we can use the |
|
506 | 471 | ``FileLinks`` object, passing ``'.'`` to indicate that we want links |
|
507 | 472 | generated for the current working directory. Note that if there were |
@@ -517,11 +482,11 In[7]: | |||
|
517 | 482 | FileLinks('.') |
|
518 | 483 | |
|
519 | 484 | Out[7]: |
|
520 | ||
|
521 | 485 | .. parsed-literal:: |
|
522 | 486 | |
|
523 | 487 | <IPython.lib.display.FileLinks at 0x10f7eaad0> |
|
524 | 488 | |
|
489 | ||
|
525 | 490 | External sites |
|
526 | 491 | ~~~~~~~~~~~~~~ |
|
527 | 492 | |
@@ -535,11 +500,11 In[9]: | |||
|
535 | 500 | HTML('<iframe src=http://en.mobile.wikipedia.org/?useformat=mobile width=700 height=350></iframe>') |
|
536 | 501 | |
|
537 | 502 | Out[9]: |
|
538 | ||
|
539 | 503 | .. parsed-literal:: |
|
540 | 504 | |
|
541 | 505 | <IPython.core.display.HTML at 0x1094900d0> |
|
542 | 506 | |
|
507 | ||
|
543 | 508 | Mathematics |
|
544 | 509 | ~~~~~~~~~~~ |
|
545 | 510 | |
@@ -562,14 +527,10 In[10]: | |||
|
562 | 527 | Math(r'F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx') |
|
563 | 528 | |
|
564 | 529 | Out[10]: |
|
565 | ||
|
566 | 530 | .. math:: |
|
567 | 531 | |
|
568 | 532 | $$F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx$$ |
|
569 | 533 | |
|
570 | .. parsed-literal:: | |
|
571 | ||
|
572 | <IPython.core.display.Math at 0x10fba26d0> | |
|
573 | 534 | |
|
574 | 535 | With the ``Latex`` class, you have to include the delimiters yourself. |
|
575 | 536 | This allows you to use other LaTeX modes such as ``eqnarray``: |
@@ -587,7 +548,6 In[11]: | |||
|
587 | 548 | \end{eqnarray}""") |
|
588 | 549 | |
|
589 | 550 | Out[11]: |
|
590 | ||
|
591 | 551 | .. math:: |
|
592 | 552 | |
|
593 | 553 | \begin{eqnarray} |
@@ -597,9 +557,6 Out[11]: | |||
|
597 | 557 | \nabla \cdot \vec{\mathbf{B}} & = 0 |
|
598 | 558 | \end{eqnarray} |
|
599 | 559 | |
|
600 | .. parsed-literal:: | |
|
601 | ||
|
602 | <IPython.core.display.Latex at 0x10fba2c10> | |
|
603 | 560 | |
|
604 | 561 | Or you can enter latex directly with the ``%%latex`` cell magic: |
|
605 | 562 | |
@@ -615,9 +572,14 In[12]: | |||
|
615 | 572 | \nabla \cdot \vec{\mathbf{B}} & = 0 |
|
616 | 573 | \end{aligned} |
|
617 | 574 | |
|
618 | .. parsed-literal:: | |
|
575 | .. math:: | |
|
619 | 576 | |
|
620 | <IPython.core.display.Latex at 0x10a617c90> | |
|
577 | \begin{aligned} | |
|
578 | \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ | |
|
579 | \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ | |
|
580 | \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ | |
|
581 | \nabla \cdot \vec{\mathbf{B}} & = 0 | |
|
582 | \end{aligned} | |
|
621 | 583 | |
|
622 | 584 | There is also a ``%%javascript`` cell magic for running javascript |
|
623 | 585 | directly, and ``%%svg`` for manually entering SVG content. |
@@ -642,13 +604,13 In[12]: | |||
|
642 | 604 | |
|
643 | 605 | %pylab inline |
|
644 | 606 | |
|
607 | ||
|
645 | 608 | .. parsed-literal:: |
|
646 | 609 | |
|
647 | 610 | |
|
648 | 611 | Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline]. |
|
649 | 612 | For more information, type 'help(pylab)'. |
|
650 | 613 | |
|
651 | ||
|
652 | 614 | In[15]: |
|
653 | 615 | |
|
654 | 616 | .. code:: python |
@@ -695,4 +657,5 In[16]: | |||
|
695 | 657 | show() |
|
696 | 658 | |
|
697 | 659 | |
|
698 | .. image:: tests/ipynbref/00_notebook_tour_orig_files/00_notebook_tour_orig_fig_01.png | |
|
660 | .. image:: _fig_60.png | |
|
661 |
General Comments 0
You need to be logged in to leave comments.
Login now