##// END OF EJS Templates
Work on IPython Kernel notebooks.
Brian E. Granger -
Show More
This diff has been collapsed as it changes many lines, (1613 lines changed) Show them Hide them
@@ -0,0 +1,1613 b''
1 {
2 "metadata": {
3 "name": "",
4 "signature": "sha256:31071a05d0ecd75ed72fe3f0de0ad447a6f85cffe382c26efa5e68db1fee54ee"
5 },
6 "nbformat": 3,
7 "nbformat_minor": 0,
8 "worksheets": [
9 {
10 "cells": [
11 {
12 "cell_type": "heading",
13 "level": 1,
14 "metadata": {
15 "slideshow": {
16 "slide_type": "slide"
17 }
18 },
19 "source": [
20 "IPython: beyond plain Python"
21 ]
22 },
23 {
24 "cell_type": "markdown",
25 "metadata": {},
26 "source": [
27 "When executing code in IPython, all valid Python syntax works as-is, but IPython provides a number of features designed to make the interactive experience more fluid and efficient."
28 ]
29 },
30 {
31 "cell_type": "heading",
32 "level": 2,
33 "metadata": {
34 "slideshow": {
35 "slide_type": "slide"
36 }
37 },
38 "source": [
39 "First things first: running code, getting help"
40 ]
41 },
42 {
43 "cell_type": "markdown",
44 "metadata": {},
45 "source": [
46 "In the notebook, to run a cell of code, hit `Shift-Enter`. This executes the cell and puts the cursor in the next cell below, or makes a new one if you are at the end. Alternately, you can use:\n",
47 " \n",
48 "- `Alt-Enter` to force the creation of a new cell unconditionally (useful when inserting new content in the middle of an existing notebook).\n",
49 "- `Control-Enter` executes the cell and keeps the cursor in the same cell, useful for quick experimentation of snippets that you don't need to keep permanently."
50 ]
51 },
52 {
53 "cell_type": "code",
54 "collapsed": false,
55 "input": [
56 "print \"Hi\""
57 ],
58 "language": "python",
59 "metadata": {},
60 "outputs": [
61 {
62 "output_type": "stream",
63 "stream": "stdout",
64 "text": [
65 "Hi\n"
66 ]
67 }
68 ],
69 "prompt_number": 1
70 },
71 {
72 "cell_type": "markdown",
73 "metadata": {
74 "slideshow": {
75 "slide_type": "slide"
76 }
77 },
78 "source": [
79 "Getting help:"
80 ]
81 },
82 {
83 "cell_type": "code",
84 "collapsed": false,
85 "input": [
86 "?"
87 ],
88 "language": "python",
89 "metadata": {},
90 "outputs": [],
91 "prompt_number": 2
92 },
93 {
94 "cell_type": "markdown",
95 "metadata": {
96 "slideshow": {
97 "slide_type": "slide"
98 }
99 },
100 "source": [
101 "Typing `object_name?` will print all sorts of details about any object, including docstrings, function definition lines (for call arguments) and constructor details for classes."
102 ]
103 },
104 {
105 "cell_type": "code",
106 "collapsed": false,
107 "input": [
108 "import collections\n",
109 "collections.namedtuple?"
110 ],
111 "language": "python",
112 "metadata": {},
113 "outputs": [],
114 "prompt_number": 3
115 },
116 {
117 "cell_type": "code",
118 "collapsed": false,
119 "input": [
120 "collections.Counter??"
121 ],
122 "language": "python",
123 "metadata": {},
124 "outputs": [],
125 "prompt_number": 4
126 },
127 {
128 "cell_type": "code",
129 "collapsed": false,
130 "input": [
131 "*int*?"
132 ],
133 "language": "python",
134 "metadata": {},
135 "outputs": [],
136 "prompt_number": 5
137 },
138 {
139 "cell_type": "markdown",
140 "metadata": {
141 "slideshow": {
142 "slide_type": "slide"
143 }
144 },
145 "source": [
146 "An IPython quick reference card:"
147 ]
148 },
149 {
150 "cell_type": "code",
151 "collapsed": false,
152 "input": [
153 "%quickref"
154 ],
155 "language": "python",
156 "metadata": {},
157 "outputs": [],
158 "prompt_number": 6
159 },
160 {
161 "cell_type": "heading",
162 "level": 2,
163 "metadata": {
164 "slideshow": {
165 "slide_type": "slide"
166 }
167 },
168 "source": [
169 "Tab completion"
170 ]
171 },
172 {
173 "cell_type": "markdown",
174 "metadata": {},
175 "source": [
176 "Tab completion, especially for attributes, is a convenient way to explore the structure of any object you\u2019re dealing with. Simply type `object_name.<TAB>` to view the object\u2019s attributes. Besides Python objects and keywords, tab completion also works on file and directory names."
177 ]
178 },
179 {
180 "cell_type": "code",
181 "collapsed": false,
182 "input": [
183 "collections."
184 ],
185 "language": "python",
186 "metadata": {},
187 "outputs": [],
188 "prompt_number": 8
189 },
190 {
191 "cell_type": "heading",
192 "level": 2,
193 "metadata": {
194 "slideshow": {
195 "slide_type": "slide"
196 }
197 },
198 "source": [
199 "The interactive workflow: input, output, history"
200 ]
201 },
202 {
203 "cell_type": "code",
204 "collapsed": false,
205 "input": [
206 "2+10"
207 ],
208 "language": "python",
209 "metadata": {},
210 "outputs": [
211 {
212 "metadata": {},
213 "output_type": "pyout",
214 "prompt_number": 7,
215 "text": [
216 "12"
217 ]
218 }
219 ],
220 "prompt_number": 7
221 },
222 {
223 "cell_type": "code",
224 "collapsed": false,
225 "input": [
226 "_+10"
227 ],
228 "language": "python",
229 "metadata": {},
230 "outputs": [
231 {
232 "metadata": {},
233 "output_type": "pyout",
234 "prompt_number": 8,
235 "text": [
236 "22"
237 ]
238 }
239 ],
240 "prompt_number": 8
241 },
242 {
243 "cell_type": "markdown",
244 "metadata": {
245 "slideshow": {
246 "slide_type": "slide"
247 }
248 },
249 "source": [
250 "You can suppress the storage and rendering of output if you append `;` to the last cell (this comes in handy when plotting with matplotlib, for example):"
251 ]
252 },
253 {
254 "cell_type": "code",
255 "collapsed": false,
256 "input": [
257 "10+20;"
258 ],
259 "language": "python",
260 "metadata": {},
261 "outputs": [],
262 "prompt_number": 9
263 },
264 {
265 "cell_type": "code",
266 "collapsed": false,
267 "input": [
268 "_"
269 ],
270 "language": "python",
271 "metadata": {},
272 "outputs": [
273 {
274 "metadata": {},
275 "output_type": "pyout",
276 "prompt_number": 10,
277 "text": [
278 "22"
279 ]
280 }
281 ],
282 "prompt_number": 10
283 },
284 {
285 "cell_type": "markdown",
286 "metadata": {
287 "slideshow": {
288 "slide_type": "slide"
289 }
290 },
291 "source": [
292 "The output is stored in `_N` and `Out[N]` variables:"
293 ]
294 },
295 {
296 "cell_type": "code",
297 "collapsed": false,
298 "input": [
299 "_10 == Out[10]"
300 ],
301 "language": "python",
302 "metadata": {},
303 "outputs": [
304 {
305 "metadata": {},
306 "output_type": "pyout",
307 "prompt_number": 11,
308 "text": [
309 "True"
310 ]
311 }
312 ],
313 "prompt_number": 11
314 },
315 {
316 "cell_type": "markdown",
317 "metadata": {
318 "slideshow": {
319 "slide_type": "slide"
320 }
321 },
322 "source": [
323 "And the last three have shorthands for convenience:"
324 ]
325 },
326 {
327 "cell_type": "code",
328 "collapsed": false,
329 "input": [
330 "print 'last output:', _\n",
331 "print 'next one :', __\n",
332 "print 'and next :', ___"
333 ],
334 "language": "python",
335 "metadata": {},
336 "outputs": [
337 {
338 "output_type": "stream",
339 "stream": "stdout",
340 "text": [
341 "last output: True\n",
342 "next one : 22\n",
343 "and next : 22\n"
344 ]
345 }
346 ],
347 "prompt_number": 12
348 },
349 {
350 "cell_type": "code",
351 "collapsed": false,
352 "input": [
353 "In[11]"
354 ],
355 "language": "python",
356 "metadata": {
357 "slideshow": {
358 "slide_type": "-"
359 }
360 },
361 "outputs": [
362 {
363 "metadata": {},
364 "output_type": "pyout",
365 "prompt_number": 13,
366 "text": [
367 "u'_10 == Out[10]'"
368 ]
369 }
370 ],
371 "prompt_number": 13
372 },
373 {
374 "cell_type": "code",
375 "collapsed": false,
376 "input": [
377 "_i"
378 ],
379 "language": "python",
380 "metadata": {},
381 "outputs": [
382 {
383 "metadata": {},
384 "output_type": "pyout",
385 "prompt_number": 14,
386 "text": [
387 "u'In[11]'"
388 ]
389 }
390 ],
391 "prompt_number": 14
392 },
393 {
394 "cell_type": "code",
395 "collapsed": false,
396 "input": [
397 "_ii"
398 ],
399 "language": "python",
400 "metadata": {},
401 "outputs": [
402 {
403 "metadata": {},
404 "output_type": "pyout",
405 "prompt_number": 15,
406 "text": [
407 "u'In[11]'"
408 ]
409 }
410 ],
411 "prompt_number": 15
412 },
413 {
414 "cell_type": "code",
415 "collapsed": false,
416 "input": [
417 "print 'last input:', _i\n",
418 "print 'next one :', _ii\n",
419 "print 'and next :', _iii"
420 ],
421 "language": "python",
422 "metadata": {
423 "slideshow": {
424 "slide_type": "subslide"
425 }
426 },
427 "outputs": [
428 {
429 "output_type": "stream",
430 "stream": "stdout",
431 "text": [
432 "last input: _ii\n",
433 "next one : _i\n",
434 "and next : In[11]\n"
435 ]
436 }
437 ],
438 "prompt_number": 16
439 },
440 {
441 "cell_type": "code",
442 "collapsed": false,
443 "input": [
444 "%history -n 1-5"
445 ],
446 "language": "python",
447 "metadata": {},
448 "outputs": [
449 {
450 "output_type": "stream",
451 "stream": "stdout",
452 "text": [
453 " 1: print \"Hi\"\n",
454 " 2: ?\n",
455 " 3:\n",
456 "import collections\n",
457 "collections.namedtuple?\n",
458 " 4: collections.Counter??\n",
459 " 5: *int*?\n"
460 ]
461 }
462 ],
463 "prompt_number": 17
464 },
465 {
466 "cell_type": "markdown",
467 "metadata": {
468 "slideshow": {
469 "slide_type": "subslide"
470 }
471 },
472 "source": [
473 "**Exercise**\n",
474 "\n",
475 "Write the last 10 lines of history to a file named `log.py`."
476 ]
477 },
478 {
479 "cell_type": "heading",
480 "level": 2,
481 "metadata": {
482 "slideshow": {
483 "slide_type": "slide"
484 }
485 },
486 "source": [
487 "Accessing the underlying operating system"
488 ]
489 },
490 {
491 "cell_type": "code",
492 "collapsed": false,
493 "input": [
494 "!pwd"
495 ],
496 "language": "python",
497 "metadata": {},
498 "outputs": [
499 {
500 "output_type": "stream",
501 "stream": "stdout",
502 "text": [
503 "/home/fperez/ipython/tutorial/notebooks\r\n"
504 ]
505 }
506 ],
507 "prompt_number": 18
508 },
509 {
510 "cell_type": "code",
511 "collapsed": false,
512 "input": [
513 "files = !ls\n",
514 "print \"My current directory's files:\"\n",
515 "print files"
516 ],
517 "language": "python",
518 "metadata": {},
519 "outputs": [
520 {
521 "output_type": "stream",
522 "stream": "stdout",
523 "text": [
524 "My current directory's files:\n",
525 "['BackgroundJobs.ipynb', 'Custom Display Logic.ipynb', 'Customizing IPython - Condensed.ipynb', 'Customizing IPython - Config.ipynb', 'Customizing IPython - Extensions.ipynb', 'Customizing IPython - Magics.ipynb', 'data', 'figs', 'flare.json', 'Index.ipynb', 'Interactive Widgets.ipynb', 'IPython - beyond plain Python.ipynb', 'kernel-embedding', 'Markdown Cells.ipynb', 'myscript.py', 'nbconvert_arch.png', 'NbConvert from command line.ipynb', 'NbConvert Python library.ipynb', 'Notebook and javascript extension.ipynb', 'Notebook Basics.ipynb', 'Overview of IPython.parallel.ipynb', 'parallel', 'Rich Display System.ipynb', 'Running a Secure Public Notebook.ipynb', 'Running Code.ipynb', 'Sample.ipynb', 'soln', 'Terminal usage.ipynb', 'text_analysis.py', 'Typesetting Math Using MathJax.ipynb']\n"
526 ]
527 }
528 ],
529 "prompt_number": 19
530 },
531 {
532 "cell_type": "code",
533 "collapsed": false,
534 "input": [
535 "!echo $files"
536 ],
537 "language": "python",
538 "metadata": {},
539 "outputs": [
540 {
541 "output_type": "stream",
542 "stream": "stdout",
543 "text": [
544 "[BackgroundJobs.ipynb, Custom Display Logic.ipynb, Customizing IPython - Condensed.ipynb, Customizing IPython - Config.ipynb, Customizing IPython - Extensions.ipynb, Customizing IPython - Magics.ipynb, data, figs, flare.json, Index.ipynb, Interactive Widgets.ipynb, IPython - beyond plain Python.ipynb, kernel-embedding, Markdown Cells.ipynb, myscript.py, nbconvert_arch.png, NbConvert from command line.ipynb, NbConvert Python library.ipynb, Notebook and javascript extension.ipynb, Notebook Basics.ipynb, Overview of IPython.parallel.ipynb, parallel, Rich Display System.ipynb, Running a Secure Public Notebook.ipynb, Running Code.ipynb, Sample.ipynb, soln, Terminal usage.ipynb, text_analysis.py, Typesetting Math Using MathJax.ipynb]\r\n"
545 ]
546 }
547 ],
548 "prompt_number": 20
549 },
550 {
551 "cell_type": "code",
552 "collapsed": false,
553 "input": [
554 "!echo {files[0].upper()}"
555 ],
556 "language": "python",
557 "metadata": {},
558 "outputs": [
559 {
560 "output_type": "stream",
561 "stream": "stdout",
562 "text": [
563 "BACKGROUNDJOBS.IPYNB\r\n"
564 ]
565 }
566 ],
567 "prompt_number": 21
568 },
569 {
570 "cell_type": "markdown",
571 "metadata": {},
572 "source": [
573 "Note that all this is available even in multiline blocks:"
574 ]
575 },
576 {
577 "cell_type": "code",
578 "collapsed": false,
579 "input": [
580 "import os\n",
581 "for i,f in enumerate(files):\n",
582 " if f.endswith('ipynb'):\n",
583 " !echo {\"%02d\" % i} - \"{os.path.splitext(f)[0]}\"\n",
584 " else:\n",
585 " print '--'"
586 ],
587 "language": "python",
588 "metadata": {},
589 "outputs": [
590 {
591 "output_type": "stream",
592 "stream": "stdout",
593 "text": [
594 "00 - BackgroundJobs\r\n"
595 ]
596 },
597 {
598 "output_type": "stream",
599 "stream": "stdout",
600 "text": [
601 "01 - Custom Display Logic\r\n"
602 ]
603 },
604 {
605 "output_type": "stream",
606 "stream": "stdout",
607 "text": [
608 "02 - Customizing IPython - Condensed\r\n"
609 ]
610 },
611 {
612 "output_type": "stream",
613 "stream": "stdout",
614 "text": [
615 "03 - Customizing IPython - Config\r\n"
616 ]
617 },
618 {
619 "output_type": "stream",
620 "stream": "stdout",
621 "text": [
622 "04 - Customizing IPython - Extensions\r\n"
623 ]
624 },
625 {
626 "output_type": "stream",
627 "stream": "stdout",
628 "text": [
629 "05 - Customizing IPython - Magics\r\n"
630 ]
631 },
632 {
633 "output_type": "stream",
634 "stream": "stdout",
635 "text": [
636 "--\n",
637 "--\n",
638 "--\n",
639 "09 - Index\r\n"
640 ]
641 },
642 {
643 "output_type": "stream",
644 "stream": "stdout",
645 "text": [
646 "10 - Interactive Widgets\r\n"
647 ]
648 },
649 {
650 "output_type": "stream",
651 "stream": "stdout",
652 "text": [
653 "11 - IPython - beyond plain Python\r\n"
654 ]
655 },
656 {
657 "output_type": "stream",
658 "stream": "stdout",
659 "text": [
660 "--\n",
661 "13 - Markdown Cells\r\n"
662 ]
663 },
664 {
665 "output_type": "stream",
666 "stream": "stdout",
667 "text": [
668 "--\n",
669 "--\n",
670 "16 - NbConvert from command line\r\n"
671 ]
672 },
673 {
674 "output_type": "stream",
675 "stream": "stdout",
676 "text": [
677 "17 - NbConvert Python library\r\n"
678 ]
679 },
680 {
681 "output_type": "stream",
682 "stream": "stdout",
683 "text": [
684 "18 - Notebook and javascript extension\r\n"
685 ]
686 },
687 {
688 "output_type": "stream",
689 "stream": "stdout",
690 "text": [
691 "19 - Notebook Basics\r\n"
692 ]
693 },
694 {
695 "output_type": "stream",
696 "stream": "stdout",
697 "text": [
698 "20 - Overview of IPython.parallel\r\n"
699 ]
700 },
701 {
702 "output_type": "stream",
703 "stream": "stdout",
704 "text": [
705 "--\n",
706 "22 - Rich Display System\r\n"
707 ]
708 },
709 {
710 "output_type": "stream",
711 "stream": "stdout",
712 "text": [
713 "23 - Running a Secure Public Notebook\r\n"
714 ]
715 },
716 {
717 "output_type": "stream",
718 "stream": "stdout",
719 "text": [
720 "24 - Running Code\r\n"
721 ]
722 },
723 {
724 "output_type": "stream",
725 "stream": "stdout",
726 "text": [
727 "25 - Sample\r\n"
728 ]
729 },
730 {
731 "output_type": "stream",
732 "stream": "stdout",
733 "text": [
734 "--\n",
735 "27 - Terminal usage\r\n"
736 ]
737 },
738 {
739 "output_type": "stream",
740 "stream": "stdout",
741 "text": [
742 "--\n",
743 "29 - Typesetting Math Using MathJax\r\n"
744 ]
745 }
746 ],
747 "prompt_number": 27
748 },
749 {
750 "cell_type": "heading",
751 "level": 2,
752 "metadata": {},
753 "source": [
754 "Beyond Python: magic functions"
755 ]
756 },
757 {
758 "cell_type": "markdown",
759 "metadata": {},
760 "source": [
761 "The IPyhton 'magic' functions are a set of commands, invoked by prepending one or two `%` signs to their name, that live in a namespace separate from your normal Python variables and provide a more command-like interface. They take flags with `--` and arguments without quotes, parentheses or commas. The motivation behind this system is two-fold:\n",
762 " \n",
763 "- To provide an orthogonal namespace for controlling IPython itself and exposing other system-oriented functionality.\n",
764 "\n",
765 "- To expose a calling mode that requires minimal verbosity and typing while working interactively. Thus the inspiration taken from the classic Unix shell style for commands."
766 ]
767 },
768 {
769 "cell_type": "code",
770 "collapsed": false,
771 "input": [
772 "%magic"
773 ],
774 "language": "python",
775 "metadata": {},
776 "outputs": [],
777 "prompt_number": 28
778 },
779 {
780 "cell_type": "markdown",
781 "metadata": {},
782 "source": [
783 "Line vs cell magics:"
784 ]
785 },
786 {
787 "cell_type": "code",
788 "collapsed": false,
789 "input": [
790 "%timeit range(10)"
791 ],
792 "language": "python",
793 "metadata": {},
794 "outputs": [
795 {
796 "output_type": "stream",
797 "stream": "stdout",
798 "text": [
799 "10000000 loops, best of 3: 190 ns per loop\n"
800 ]
801 }
802 ],
803 "prompt_number": 29
804 },
805 {
806 "cell_type": "code",
807 "collapsed": false,
808 "input": [
809 "%%timeit\n",
810 "range(10)\n",
811 "range(100)"
812 ],
813 "language": "python",
814 "metadata": {},
815 "outputs": [
816 {
817 "output_type": "stream",
818 "stream": "stdout",
819 "text": [
820 "1000000 loops, best of 3: 888 ns per loop\n"
821 ]
822 }
823 ],
824 "prompt_number": 30
825 },
826 {
827 "cell_type": "markdown",
828 "metadata": {},
829 "source": [
830 "Line magics can be used even inside code blocks:"
831 ]
832 },
833 {
834 "cell_type": "code",
835 "collapsed": false,
836 "input": [
837 "for i in range(5):\n",
838 " size = i*100\n",
839 " print 'size:',size, \n",
840 " %timeit range(size)"
841 ],
842 "language": "python",
843 "metadata": {},
844 "outputs": [
845 {
846 "output_type": "stream",
847 "stream": "stdout",
848 "text": [
849 "size: 010000000 loops, best of 3: 129 ns per loop"
850 ]
851 },
852 {
853 "output_type": "stream",
854 "stream": "stdout",
855 "text": [
856 "\n",
857 " size: 1001000000 loops, best of 3: 649 ns per loop"
858 ]
859 },
860 {
861 "output_type": "stream",
862 "stream": "stdout",
863 "text": [
864 "\n",
865 " size: 2001000000 loops, best of 3: 1.09 \u00b5s per loop"
866 ]
867 },
868 {
869 "output_type": "stream",
870 "stream": "stdout",
871 "text": [
872 "\n",
873 " size: 3001000000 loops, best of 3: 1.74 \u00b5s per loop"
874 ]
875 },
876 {
877 "output_type": "stream",
878 "stream": "stdout",
879 "text": [
880 "\n",
881 " size: 400100000 loops, best of 3: 2.72 \u00b5s per loop"
882 ]
883 },
884 {
885 "output_type": "stream",
886 "stream": "stdout",
887 "text": [
888 "\n",
889 "\n"
890 ]
891 }
892 ],
893 "prompt_number": 31
894 },
895 {
896 "cell_type": "markdown",
897 "metadata": {},
898 "source": [
899 "Magics can do anything they want with their input, so it doesn't have to be valid Python:"
900 ]
901 },
902 {
903 "cell_type": "code",
904 "collapsed": false,
905 "input": [
906 "%%bash\n",
907 "echo \"My shell is:\" $SHELL\n",
908 "echo \"My memory status is:\"\n",
909 "free"
910 ],
911 "language": "python",
912 "metadata": {},
913 "outputs": [
914 {
915 "output_type": "stream",
916 "stream": "stdout",
917 "text": [
918 "My shell is: /bin/bash\n",
919 "My memory status is:\n",
920 " total used free shared buffers cached\n",
921 "Mem: 7870888 6389328 1481560 0 662860 2505172\n",
922 "-/+ buffers/cache: 3221296 4649592\n",
923 "Swap: 3905532 4852 3900680\n"
924 ]
925 }
926 ],
927 "prompt_number": 32
928 },
929 {
930 "cell_type": "markdown",
931 "metadata": {},
932 "source": [
933 "Another interesting cell magic: create any file you want locally from the notebook:"
934 ]
935 },
936 {
937 "cell_type": "code",
938 "collapsed": false,
939 "input": [
940 "%%writefile test.txt\n",
941 "This is a test file!\n",
942 "It can contain anything I want...\n",
943 "\n",
944 "And more..."
945 ],
946 "language": "python",
947 "metadata": {},
948 "outputs": [
949 {
950 "output_type": "stream",
951 "stream": "stdout",
952 "text": [
953 "Writing test.txt\n"
954 ]
955 }
956 ],
957 "prompt_number": 33
958 },
959 {
960 "cell_type": "code",
961 "collapsed": false,
962 "input": [
963 "!cat test.txt"
964 ],
965 "language": "python",
966 "metadata": {},
967 "outputs": [
968 {
969 "output_type": "stream",
970 "stream": "stdout",
971 "text": [
972 "This is a test file!\r\n",
973 "It can contain anything I want...\r\n",
974 "\r\n",
975 "And more..."
976 ]
977 }
978 ],
979 "prompt_number": 34
980 },
981 {
982 "cell_type": "markdown",
983 "metadata": {},
984 "source": [
985 "Let's see what other magics are currently defined in the system:"
986 ]
987 },
988 {
989 "cell_type": "code",
990 "collapsed": false,
991 "input": [
992 "%lsmagic"
993 ],
994 "language": "python",
995 "metadata": {},
996 "outputs": [
997 {
998 "json": [
999 "{\"cell\": {\"prun\": \"ExecutionMagics\", \"file\": \"Other\", \"!\": \"OSMagics\", \"capture\": \"ExecutionMagics\", \"timeit\": \"ExecutionMagics\", \"script\": \"ScriptMagics\", \"pypy\": \"Other\", \"system\": \"OSMagics\", \"perl\": \"Other\", \"HTML\": \"Other\", \"bash\": \"Other\", \"python\": \"Other\", \"SVG\": \"Other\", \"javascript\": \"DisplayMagics\", \"writefile\": \"OSMagics\", \"ruby\": \"Other\", \"python3\": \"Other\", \"python2\": \"Other\", \"latex\": \"DisplayMagics\", \"sx\": \"OSMagics\", \"svg\": \"DisplayMagics\", \"html\": \"DisplayMagics\", \"sh\": \"Other\", \"time\": \"ExecutionMagics\", \"debug\": \"ExecutionMagics\"}, \"line\": {\"psource\": \"NamespaceMagics\", \"logstart\": \"LoggingMagics\", \"popd\": \"OSMagics\", \"loadpy\": \"CodeMagics\", \"install_ext\": \"ExtensionMagics\", \"colors\": \"BasicMagics\", \"who_ls\": \"NamespaceMagics\", \"lf\": \"Other\", \"install_profiles\": \"DeprecatedMagics\", \"clk\": \"Other\", \"ll\": \"Other\", \"pprint\": \"BasicMagics\", \"lk\": \"Other\", \"ls\": \"Other\", \"save\": \"CodeMagics\", \"tb\": \"ExecutionMagics\", \"lx\": \"Other\", \"dl\": \"Other\", \"pylab\": \"PylabMagics\", \"dd\": \"Other\", \"quickref\": \"BasicMagics\", \"dx\": \"Other\", \"d\": \"Other\", \"magic\": \"BasicMagics\", \"dhist\": \"OSMagics\", \"edit\": \"KernelMagics\", \"logstop\": \"LoggingMagics\", \"gui\": \"BasicMagics\", \"alias_magic\": \"BasicMagics\", \"debug\": \"ExecutionMagics\", \"page\": \"BasicMagics\", \"logstate\": \"LoggingMagics\", \"ed\": \"Other\", \"pushd\": \"OSMagics\", \"timeit\": \"ExecutionMagics\", \"rehashx\": \"OSMagics\", \"hist\": \"Other\", \"qtconsole\": \"KernelMagics\", \"rm\": \"Other\", \"dirs\": \"OSMagics\", \"run\": \"ExecutionMagics\", \"reset_selective\": \"NamespaceMagics\", \"rep\": \"Other\", \"pinfo2\": \"NamespaceMagics\", \"matplotlib\": \"PylabMagics\", \"automagic\": \"AutoMagics\", \"doctest_mode\": \"KernelMagics\", \"logoff\": \"LoggingMagics\", \"reload_ext\": \"ExtensionMagics\", \"pdb\": \"ExecutionMagics\", \"load\": \"CodeMagics\", \"lsmagic\": \"BasicMagics\", \"cl\": \"Other\", \"autosave\": \"KernelMagics\", \"cd\": \"OSMagics\", \"pastebin\": \"CodeMagics\", \"prun\": \"ExecutionMagics\", \"cp\": \"Other\", \"autocall\": \"AutoMagics\", \"bookmark\": \"OSMagics\", \"connect_info\": \"KernelMagics\", \"mkdir\": \"Other\", \"system\": \"OSMagics\", \"whos\": \"NamespaceMagics\", \"rmdir\": \"Other\", \"unload_ext\": \"ExtensionMagics\", \"store\": \"StoreMagics\", \"more\": \"KernelMagics\", \"pdef\": \"NamespaceMagics\", \"precision\": \"BasicMagics\", \"pinfo\": \"NamespaceMagics\", \"pwd\": \"OSMagics\", \"psearch\": \"NamespaceMagics\", \"reset\": \"NamespaceMagics\", \"recall\": \"HistoryMagics\", \"xdel\": \"NamespaceMagics\", \"xmode\": \"BasicMagics\", \"cat\": \"Other\", \"mv\": \"Other\", \"rerun\": \"HistoryMagics\", \"logon\": \"LoggingMagics\", \"history\": \"HistoryMagics\", \"pycat\": \"OSMagics\", \"unalias\": \"OSMagics\", \"install_default_config\": \"DeprecatedMagics\", \"env\": \"OSMagics\", \"load_ext\": \"ExtensionMagics\", \"config\": \"ConfigMagics\", \"killbgscripts\": \"ScriptMagics\", \"profile\": \"BasicMagics\", \"pfile\": \"NamespaceMagics\", \"less\": \"KernelMagics\", \"who\": \"NamespaceMagics\", \"notebook\": \"BasicMagics\", \"man\": \"KernelMagics\", \"sx\": \"OSMagics\", \"macro\": \"ExecutionMagics\", \"clear\": \"KernelMagics\", \"alias\": \"OSMagics\", \"time\": \"ExecutionMagics\", \"sc\": \"OSMagics\", \"ldir\": \"Other\", \"pdoc\": \"NamespaceMagics\"}}"
1000 ],
1001 "metadata": {},
1002 "output_type": "pyout",
1003 "prompt_number": 35,
1004 "text": [
1005 "Available line magics:\n",
1006 "%alias %alias_magic %autocall %automagic %autosave %bookmark %cat %cd %cl %clear %clk %colors %config %connect_info %cp %d %dd %debug %dhist %dirs %dl %doctest_mode %dx %ed %edit %env %gui %hist %history %install_default_config %install_ext %install_profiles %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %popd %pprint %precision %profile %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode\n",
1007 "\n",
1008 "Available cell magics:\n",
1009 "%%! %%HTML %%SVG %%bash %%capture %%debug %%file %%html %%javascript %%latex %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefile\n",
1010 "\n",
1011 "Automagic is ON, % prefix IS NOT needed for line magics."
1012 ]
1013 }
1014 ],
1015 "prompt_number": 35
1016 },
1017 {
1018 "cell_type": "heading",
1019 "level": 2,
1020 "metadata": {},
1021 "source": [
1022 "Running normal Python code: execution and errors"
1023 ]
1024 },
1025 {
1026 "cell_type": "markdown",
1027 "metadata": {},
1028 "source": [
1029 "Not only can you input normal Python code, you can even paste straight from a Python or IPython shell session:"
1030 ]
1031 },
1032 {
1033 "cell_type": "code",
1034 "collapsed": false,
1035 "input": [
1036 ">>> # Fibonacci series:\n",
1037 "... # the sum of two elements defines the next\n",
1038 "... a, b = 0, 1\n",
1039 ">>> while b < 10:\n",
1040 "... print b\n",
1041 "... a, b = b, a+b"
1042 ],
1043 "language": "python",
1044 "metadata": {},
1045 "outputs": [
1046 {
1047 "output_type": "stream",
1048 "stream": "stdout",
1049 "text": [
1050 "1\n",
1051 "1\n",
1052 "2\n",
1053 "3\n",
1054 "5\n",
1055 "8\n"
1056 ]
1057 }
1058 ],
1059 "prompt_number": 36
1060 },
1061 {
1062 "cell_type": "code",
1063 "collapsed": false,
1064 "input": [
1065 "In [1]: for i in range(10):\n",
1066 " ...: print i,\n",
1067 " ...: "
1068 ],
1069 "language": "python",
1070 "metadata": {},
1071 "outputs": [
1072 {
1073 "output_type": "stream",
1074 "stream": "stdout",
1075 "text": [
1076 "0 1 2 3 4 5 6 7 8 9\n"
1077 ]
1078 }
1079 ],
1080 "prompt_number": 37
1081 },
1082 {
1083 "cell_type": "markdown",
1084 "metadata": {},
1085 "source": [
1086 "And when your code produces errors, you can control how they are displayed with the `%xmode` magic:"
1087 ]
1088 },
1089 {
1090 "cell_type": "code",
1091 "collapsed": false,
1092 "input": [
1093 "%%writefile mod.py\n",
1094 "\n",
1095 "def f(x):\n",
1096 " return 1.0/(x-1)\n",
1097 "\n",
1098 "def g(y):\n",
1099 " return f(y+1)"
1100 ],
1101 "language": "python",
1102 "metadata": {},
1103 "outputs": [
1104 {
1105 "output_type": "stream",
1106 "stream": "stdout",
1107 "text": [
1108 "Writing mod.py\n"
1109 ]
1110 }
1111 ],
1112 "prompt_number": 38
1113 },
1114 {
1115 "cell_type": "markdown",
1116 "metadata": {},
1117 "source": [
1118 "Now let's call the function `g` with an argument that would produce an error:"
1119 ]
1120 },
1121 {
1122 "cell_type": "code",
1123 "collapsed": false,
1124 "input": [
1125 "import mod\n",
1126 "mod.g(0)"
1127 ],
1128 "language": "python",
1129 "metadata": {},
1130 "outputs": [
1131 {
1132 "ename": "ZeroDivisionError",
1133 "evalue": "float division by zero",
1134 "output_type": "pyerr",
1135 "traceback": [
1136 "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
1137 "\u001b[1;32m<ipython-input-39-a54c5799f57e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmod\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mmod\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
1138 "\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mg\u001b[1;34m(y)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
1139 "\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
1140 "\u001b[1;31mZeroDivisionError\u001b[0m: float division by zero"
1141 ]
1142 }
1143 ],
1144 "prompt_number": 39
1145 },
1146 {
1147 "cell_type": "code",
1148 "collapsed": false,
1149 "input": [
1150 "%xmode plain\n",
1151 "mod.g(0)"
1152 ],
1153 "language": "python",
1154 "metadata": {},
1155 "outputs": [
1156 {
1157 "output_type": "stream",
1158 "stream": "stdout",
1159 "text": [
1160 "Exception reporting mode: Plain\n"
1161 ]
1162 },
1163 {
1164 "ename": "ZeroDivisionError",
1165 "evalue": "float division by zero",
1166 "output_type": "pyerr",
1167 "traceback": [
1168 "Traceback \u001b[1;36m(most recent call last)\u001b[0m:\n",
1169 " File \u001b[0;32m\"<ipython-input-40-5a5bcec1553f>\"\u001b[0m, line \u001b[0;32m2\u001b[0m, in \u001b[0;35m<module>\u001b[0m\n mod.g(0)\n",
1170 " File \u001b[0;32m\"mod.py\"\u001b[0m, line \u001b[0;32m6\u001b[0m, in \u001b[0;35mg\u001b[0m\n return f(y+1)\n",
1171 "\u001b[1;36m File \u001b[1;32m\"mod.py\"\u001b[1;36m, line \u001b[1;32m3\u001b[1;36m, in \u001b[1;35mf\u001b[1;36m\u001b[0m\n\u001b[1;33m return 1.0/(x-1)\u001b[0m\n",
1172 "\u001b[1;31mZeroDivisionError\u001b[0m\u001b[1;31m:\u001b[0m float division by zero\n"
1173 ]
1174 }
1175 ],
1176 "prompt_number": 40
1177 },
1178 {
1179 "cell_type": "code",
1180 "collapsed": false,
1181 "input": [
1182 "%xmode verbose\n",
1183 "mod.g(0)"
1184 ],
1185 "language": "python",
1186 "metadata": {},
1187 "outputs": [
1188 {
1189 "output_type": "stream",
1190 "stream": "stdout",
1191 "text": [
1192 "Exception reporting mode: Verbose\n"
1193 ]
1194 },
1195 {
1196 "ename": "ZeroDivisionError",
1197 "evalue": "float division by zero",
1198 "output_type": "pyerr",
1199 "traceback": [
1200 "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
1201 "\u001b[1;32m<ipython-input-41-81967cfaa0c3>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmagic\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mu'xmode verbose'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mmod\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m \u001b[1;36mglobal\u001b[0m \u001b[0;36mmod.g\u001b[0m \u001b[1;34m= <function g at 0x237fc08>\u001b[0m\n",
1202 "\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mg\u001b[1;34m(y=0)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m \u001b[1;36mglobal\u001b[0m \u001b[0;36mf\u001b[0m \u001b[1;34m= <function f at 0x2367c08>\u001b[0m\u001b[1;34m\n \u001b[0m\u001b[0;36my\u001b[0m \u001b[1;34m= 0\u001b[0m\n",
1203 "\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mf\u001b[1;34m(x=1)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m \u001b[0;36mx\u001b[0m \u001b[1;34m= 1\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
1204 "\u001b[1;31mZeroDivisionError\u001b[0m: float division by zero"
1205 ]
1206 }
1207 ],
1208 "prompt_number": 41
1209 },
1210 {
1211 "cell_type": "markdown",
1212 "metadata": {},
1213 "source": [
1214 "The default `%xmode` is \"context\", which shows additional context but not all local variables. Let's restore that one for the rest of our session."
1215 ]
1216 },
1217 {
1218 "cell_type": "code",
1219 "collapsed": false,
1220 "input": [
1221 "%xmode context"
1222 ],
1223 "language": "python",
1224 "metadata": {},
1225 "outputs": [
1226 {
1227 "output_type": "stream",
1228 "stream": "stdout",
1229 "text": [
1230 "Exception reporting mode: Context\n"
1231 ]
1232 }
1233 ],
1234 "prompt_number": 42
1235 },
1236 {
1237 "cell_type": "heading",
1238 "level": 2,
1239 "metadata": {},
1240 "source": [
1241 "Running code in other languages with special `%%` magics"
1242 ]
1243 },
1244 {
1245 "cell_type": "code",
1246 "collapsed": false,
1247 "input": [
1248 "%%perl\n",
1249 "@months = (\"July\", \"August\", \"September\");\n",
1250 "print $months[0];"
1251 ],
1252 "language": "python",
1253 "metadata": {},
1254 "outputs": [
1255 {
1256 "output_type": "stream",
1257 "stream": "stdout",
1258 "text": [
1259 "July"
1260 ]
1261 }
1262 ],
1263 "prompt_number": 43
1264 },
1265 {
1266 "cell_type": "code",
1267 "collapsed": false,
1268 "input": [
1269 "%%ruby\n",
1270 "name = \"world\"\n",
1271 "puts \"Hello #{name.capitalize}!\""
1272 ],
1273 "language": "python",
1274 "metadata": {},
1275 "outputs": [
1276 {
1277 "output_type": "stream",
1278 "stream": "stdout",
1279 "text": [
1280 "Hello World!\n"
1281 ]
1282 }
1283 ],
1284 "prompt_number": 44
1285 },
1286 {
1287 "cell_type": "heading",
1288 "level": 3,
1289 "metadata": {},
1290 "source": [
1291 "Exercise"
1292 ]
1293 },
1294 {
1295 "cell_type": "markdown",
1296 "metadata": {},
1297 "source": [
1298 "Write a cell that executes in Bash and prints your current working directory as well as the date.\n",
1299 "\n",
1300 "Apologies to Windows users who may not have Bash available, not sure how to obtain the equivalent result with `cmd.exe` or Powershell."
1301 ]
1302 },
1303 {
1304 "cell_type": "code",
1305 "collapsed": false,
1306 "input": [
1307 "%load soln/bash-script"
1308 ],
1309 "language": "python",
1310 "metadata": {},
1311 "outputs": []
1312 },
1313 {
1314 "cell_type": "heading",
1315 "level": 2,
1316 "metadata": {},
1317 "source": [
1318 "Raw Input in the notebook"
1319 ]
1320 },
1321 {
1322 "cell_type": "markdown",
1323 "metadata": {},
1324 "source": [
1325 "Since 1.0 the IPython notebook web application support `raw_input` which for example allow us to invoke the `%debug` magic in the notebook:"
1326 ]
1327 },
1328 {
1329 "cell_type": "code",
1330 "collapsed": false,
1331 "input": [
1332 "mod.g(0)"
1333 ],
1334 "language": "python",
1335 "metadata": {},
1336 "outputs": [
1337 {
1338 "ename": "ZeroDivisionError",
1339 "evalue": "float division by zero",
1340 "output_type": "pyerr",
1341 "traceback": [
1342 "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
1343 "\u001b[1;32m<ipython-input-45-5e708f13c839>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mmod\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
1344 "\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mg\u001b[1;34m(y)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
1345 "\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
1346 "\u001b[1;31mZeroDivisionError\u001b[0m: float division by zero"
1347 ]
1348 }
1349 ],
1350 "prompt_number": 45
1351 },
1352 {
1353 "cell_type": "code",
1354 "collapsed": false,
1355 "input": [
1356 "%debug"
1357 ],
1358 "language": "python",
1359 "metadata": {},
1360 "outputs": [
1361 {
1362 "output_type": "stream",
1363 "stream": "stdout",
1364 "text": [
1365 "> \u001b[0;32m/Users/bussonniermatthias/ipython-in-depth/notebooks/mod.py\u001b[0m(3)\u001b[0;36mf\u001b[0;34m()\u001b[0m\n",
1366 "\u001b[0;32m 2 \u001b[0;31m\u001b[0;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
1367 "\u001b[0m\u001b[0;32m----> 3 \u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1.0\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
1368 "\u001b[0m\u001b[0;32m 4 \u001b[0;31m\u001b[0;34m\u001b[0m\u001b[0m\n",
1369 "\u001b[0m\n"
1370 ]
1371 },
1372 {
1373 "name": "stdout",
1374 "output_type": "stream",
1375 "stream": "stdout",
1376 "text": [
1377 "ipdb> x\n"
1378 ]
1379 },
1380 {
1381 "output_type": "stream",
1382 "stream": "stdout",
1383 "text": [
1384 "1\n"
1385 ]
1386 },
1387 {
1388 "name": "stdout",
1389 "output_type": "stream",
1390 "stream": "stdout",
1391 "text": [
1392 "ipdb> up\n"
1393 ]
1394 },
1395 {
1396 "output_type": "stream",
1397 "stream": "stdout",
1398 "text": [
1399 "> \u001b[0;32m/Users/bussonniermatthias/ipython-in-depth/notebooks/mod.py\u001b[0m(6)\u001b[0;36mg\u001b[0;34m()\u001b[0m\n",
1400 "\u001b[0;32m 4 \u001b[0;31m\u001b[0;34m\u001b[0m\u001b[0m\n",
1401 "\u001b[0m\u001b[0;32m 5 \u001b[0;31m\u001b[0;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
1402 "\u001b[0m\u001b[0;32m----> 6 \u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
1403 "\u001b[0m\n"
1404 ]
1405 },
1406 {
1407 "name": "stdout",
1408 "output_type": "stream",
1409 "stream": "stdout",
1410 "text": [
1411 "ipdb> y\n"
1412 ]
1413 },
1414 {
1415 "output_type": "stream",
1416 "stream": "stdout",
1417 "text": [
1418 "0\n"
1419 ]
1420 },
1421 {
1422 "name": "stdout",
1423 "output_type": "stream",
1424 "stream": "stdout",
1425 "text": [
1426 "ipdb> up\n"
1427 ]
1428 },
1429 {
1430 "output_type": "stream",
1431 "stream": "stdout",
1432 "text": [
1433 "> \u001b[0;32m<ipython-input-37-5e708f13c839>\u001b[0m(1)\u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n",
1434 "\u001b[0;32m----> 1 \u001b[0;31m\u001b[0mmod\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
1435 "\u001b[0m\n"
1436 ]
1437 },
1438 {
1439 "name": "stdout",
1440 "output_type": "stream",
1441 "stream": "stdout",
1442 "text": [
1443 "ipdb> exit\n"
1444 ]
1445 }
1446 ],
1447 "prompt_number": 38
1448 },
1449 {
1450 "cell_type": "markdown",
1451 "metadata": {},
1452 "source": [
1453 "Don't foget to exit your debugging session. Raw input can of course be use to ask for user input:"
1454 ]
1455 },
1456 {
1457 "cell_type": "code",
1458 "collapsed": false,
1459 "input": [
1460 "enjoy = raw_input('Are you enjoying this tutorial ?')\n",
1461 "print 'enjoy is :', enjoy"
1462 ],
1463 "language": "python",
1464 "metadata": {},
1465 "outputs": [
1466 {
1467 "name": "stdout",
1468 "output_type": "stream",
1469 "stream": "stdout",
1470 "text": [
1471 "Are you enjoying this tutorial ?Yes !\n"
1472 ]
1473 },
1474 {
1475 "output_type": "stream",
1476 "stream": "stdout",
1477 "text": [
1478 "enjoy is : Yes !\n"
1479 ]
1480 }
1481 ],
1482 "prompt_number": 39
1483 },
1484 {
1485 "cell_type": "heading",
1486 "level": 2,
1487 "metadata": {},
1488 "source": [
1489 "Plotting in the notebook"
1490 ]
1491 },
1492 {
1493 "cell_type": "markdown",
1494 "metadata": {},
1495 "source": [
1496 "This magic configures matplotlib to render its figures inline:"
1497 ]
1498 },
1499 {
1500 "cell_type": "code",
1501 "collapsed": false,
1502 "input": [
1503 "%matplotlib inline"
1504 ],
1505 "language": "python",
1506 "metadata": {},
1507 "outputs": [],
1508 "prompt_number": 46
1509 },
1510 {
1511 "cell_type": "code",
1512 "collapsed": false,
1513 "input": [
1514 "import numpy as np\n",
1515 "import matplotlib.pyplot as plt"
1516 ],
1517 "language": "python",
1518 "metadata": {},
1519 "outputs": [],
1520 "prompt_number": 47
1521 },
1522 {
1523 "cell_type": "code",
1524 "collapsed": false,
1525 "input": [
1526 "x = np.linspace(0, 2*np.pi, 300)\n",
1527 "y = np.sin(x**2)\n",
1528 "plt.plot(x, y)\n",
1529 "plt.title(\"A little chirp\")\n",
1530 "fig = plt.gcf() # let's keep the figure object around for later..."
1531 ],
1532 "language": "python",
1533 "metadata": {},
1534 "outputs": [
1535 {
1536 "metadata": {},
1537 "output_type": "display_data",
1538 "png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEKCAYAAAAcgp5RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXt4VdWZ/78nJBDCJRBCEkgCIQmXgNwsm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rl9rjAOBXv/oVvvWtbzm8MmPU\n1NRg3rx5CAQCCAQCmDNnDm644Qanl2UJN8aYtbW1uO3rSWdtbW24//77caPIKWSc+d3vfof7778f\nLS0tyMvLw8svv+z0kkxx/vx5bN682VBthDZMEQRBeBz3lvsJgiAIQ5DQEwRBeBwSeoIgCI9DQk8Q\nBOFxSOgJgiA8Dgk9QRCExyGhJwiC8Dgk9ARBEB7n/wOimSfhIIMDngAAAABJRU5ErkJggg==\n",
1539 "text": [
1540 "<matplotlib.figure.Figure at 0x3436950>"
1541 ]
1542 }
1543 ],
1544 "prompt_number": 48
1545 },
1546 {
1547 "cell_type": "heading",
1548 "level": 2,
1549 "metadata": {},
1550 "source": [
1551 "The IPython kernel/client model"
1552 ]
1553 },
1554 {
1555 "cell_type": "code",
1556 "collapsed": false,
1557 "input": [
1558 "%connect_info"
1559 ],
1560 "language": "python",
1561 "metadata": {},
1562 "outputs": [
1563 {
1564 "output_type": "stream",
1565 "stream": "stdout",
1566 "text": [
1567 "{\n",
1568 " \"stdin_port\": 50023, \n",
1569 " \"ip\": \"127.0.0.1\", \n",
1570 " \"control_port\": 50024, \n",
1571 " \"hb_port\": 50025, \n",
1572 " \"signature_scheme\": \"hmac-sha256\", \n",
1573 " \"key\": \"b54b8859-d64d-48bb-814a-909f9beb3316\", \n",
1574 " \"shell_port\": 50021, \n",
1575 " \"transport\": \"tcp\", \n",
1576 " \"iopub_port\": 50022\n",
1577 "}\n",
1578 "\n",
1579 "Paste the above JSON into a file, and connect with:\n",
1580 " $> ipython <app> --existing <file>\n",
1581 "or, if you are local, you can connect with just:\n",
1582 " $> ipython <app> --existing kernel-30f00f4a-230c-4e64-bea5-0e5f6a52cb40.json \n",
1583 "or even just:\n",
1584 " $> ipython <app> --existing \n",
1585 "if this is the most recent IPython session you have started.\n"
1586 ]
1587 }
1588 ],
1589 "prompt_number": 43
1590 },
1591 {
1592 "cell_type": "markdown",
1593 "metadata": {},
1594 "source": [
1595 "We can connect automatically a Qt Console to the currently running kernel with the `%qtconsole` magic, or by typing `ipython console --existing <kernel-UUID>` in any terminal:"
1596 ]
1597 },
1598 {
1599 "cell_type": "code",
1600 "collapsed": false,
1601 "input": [
1602 "%qtconsole"
1603 ],
1604 "language": "python",
1605 "metadata": {},
1606 "outputs": [],
1607 "prompt_number": 83
1608 }
1609 ],
1610 "metadata": {}
1611 }
1612 ]
1613 } No newline at end of file
@@ -0,0 +1,275 b''
1 {
2 "metadata": {
3 "name": "",
4 "signature": "sha256:993106eecfd7abe1920e1dbe670c4518189c26e7b29dcc541835f7dcf6fffbb2"
5 },
6 "nbformat": 3,
7 "nbformat_minor": 0,
8 "worksheets": [
9 {
10 "cells": [
11 {
12 "cell_type": "heading",
13 "level": 1,
14 "metadata": {},
15 "source": [
16 "A few things that work best/only at the IPython terminal or Qt console clients"
17 ]
18 },
19 {
20 "cell_type": "markdown",
21 "metadata": {},
22 "source": [
23 "## Running code with `%run`"
24 ]
25 },
26 {
27 "cell_type": "code",
28 "collapsed": false,
29 "input": [
30 "%%writefile script.py\n",
31 "x = 10\n",
32 "y = 20\n",
33 "z = x+y\n",
34 "print 'z is:', z"
35 ],
36 "language": "python",
37 "metadata": {},
38 "outputs": [
39 {
40 "output_type": "stream",
41 "stream": "stdout",
42 "text": [
43 "Writing script.py\n"
44 ]
45 }
46 ],
47 "prompt_number": 1
48 },
49 {
50 "cell_type": "code",
51 "collapsed": false,
52 "input": [
53 "%run script"
54 ],
55 "language": "python",
56 "metadata": {},
57 "outputs": [
58 {
59 "output_type": "stream",
60 "stream": "stdout",
61 "text": [
62 "z is: 30\n"
63 ]
64 }
65 ],
66 "prompt_number": 2
67 },
68 {
69 "cell_type": "code",
70 "collapsed": false,
71 "input": [
72 "x"
73 ],
74 "language": "python",
75 "metadata": {},
76 "outputs": [
77 {
78 "metadata": {},
79 "output_type": "pyout",
80 "prompt_number": 3,
81 "text": [
82 "10"
83 ]
84 }
85 ],
86 "prompt_number": 3
87 },
88 {
89 "cell_type": "heading",
90 "level": 2,
91 "metadata": {},
92 "source": [
93 "Event loop and GUI integration"
94 ]
95 },
96 {
97 "cell_type": "markdown",
98 "metadata": {},
99 "source": [
100 "The `%gui` magic enables the integration of GUI event loops with the interactive execution loop, allowing you to run GUI code without blocking IPython.\n",
101 "\n",
102 "Consider for example the execution of Qt-based code. Once we enable the Qt gui support:"
103 ]
104 },
105 {
106 "cell_type": "code",
107 "collapsed": false,
108 "input": [
109 "%gui qt"
110 ],
111 "language": "python",
112 "metadata": {},
113 "outputs": [],
114 "prompt_number": 4
115 },
116 {
117 "cell_type": "markdown",
118 "metadata": {},
119 "source": [
120 "We can define a simple Qt application class (simplified version from [this Qt tutorial](http://zetcode.com/tutorials/pyqt4/firstprograms)):"
121 ]
122 },
123 {
124 "cell_type": "code",
125 "collapsed": false,
126 "input": [
127 "import sys\n",
128 "from PyQt4 import QtGui, QtCore\n",
129 "\n",
130 "class SimpleWindow(QtGui.QWidget):\n",
131 " def __init__(self, parent=None):\n",
132 " QtGui.QWidget.__init__(self, parent)\n",
133 "\n",
134 " self.setGeometry(300, 300, 200, 80)\n",
135 " self.setWindowTitle('Hello World')\n",
136 "\n",
137 " quit = QtGui.QPushButton('Close', self)\n",
138 " quit.setGeometry(10, 10, 60, 35)\n",
139 "\n",
140 " self.connect(quit, QtCore.SIGNAL('clicked()'),\n",
141 " self, QtCore.SLOT('close()'))"
142 ],
143 "language": "python",
144 "metadata": {},
145 "outputs": [],
146 "prompt_number": 5
147 },
148 {
149 "cell_type": "markdown",
150 "metadata": {},
151 "source": [
152 "And now we can instantiate it:"
153 ]
154 },
155 {
156 "cell_type": "code",
157 "collapsed": false,
158 "input": [
159 "app = QtCore.QCoreApplication.instance()\n",
160 "if app is None:\n",
161 " app = QtGui.QApplication([])\n",
162 "\n",
163 "sw = SimpleWindow()\n",
164 "sw.show()\n",
165 "\n",
166 "from IPython.lib.guisupport import start_event_loop_qt4\n",
167 "start_event_loop_qt4(app)"
168 ],
169 "language": "python",
170 "metadata": {},
171 "outputs": [],
172 "prompt_number": 6
173 },
174 {
175 "cell_type": "markdown",
176 "metadata": {},
177 "source": [
178 "But IPython still remains responsive:"
179 ]
180 },
181 {
182 "cell_type": "code",
183 "collapsed": false,
184 "input": [
185 "10+2"
186 ],
187 "language": "python",
188 "metadata": {},
189 "outputs": [
190 {
191 "metadata": {},
192 "output_type": "pyout",
193 "prompt_number": 7,
194 "text": [
195 "12"
196 ]
197 }
198 ],
199 "prompt_number": 7
200 },
201 {
202 "cell_type": "markdown",
203 "metadata": {},
204 "source": [
205 "The `%gui` magic can be similarly used to control Wx, Tk, glut and pyglet applications, [as can be seen in our examples](https://github.com/ipython/ipython/tree/master/examples/lib)."
206 ]
207 },
208 {
209 "cell_type": "heading",
210 "level": 2,
211 "metadata": {},
212 "source": [
213 "Embedding IPython in a terminal application"
214 ]
215 },
216 {
217 "cell_type": "code",
218 "collapsed": false,
219 "input": [
220 "%%writefile simple-embed.py\n",
221 "# This shows how to use the new top-level embed function. It is a simpler\n",
222 "# API that manages the creation of the embedded shell.\n",
223 "\n",
224 "from IPython import embed\n",
225 "\n",
226 "a = 10\n",
227 "b = 20\n",
228 "\n",
229 "embed(header='First time', banner1='')\n",
230 "\n",
231 "c = 30\n",
232 "d = 40\n",
233 "\n",
234 "embed(header='The second time')"
235 ],
236 "language": "python",
237 "metadata": {},
238 "outputs": [
239 {
240 "output_type": "stream",
241 "stream": "stdout",
242 "text": [
243 "Writing simple-embed.py\n"
244 ]
245 }
246 ],
247 "prompt_number": 12
248 },
249 {
250 "cell_type": "markdown",
251 "metadata": {},
252 "source": [
253 "The example in kernel-embedding shows how to embed a full kernel into an application and how to connect to this kernel from an external process."
254 ]
255 },
256 {
257 "cell_type": "heading",
258 "level": 2,
259 "metadata": {},
260 "source": [
261 "Logging terminal sessions and transitioning to a notebook"
262 ]
263 },
264 {
265 "cell_type": "markdown",
266 "metadata": {},
267 "source": [
268 "The `%logstart` magic lets you log a terminal session with various degrees of control, and the `%notebook` one will convert an interactive console session into a notebook with all input cells already created for you (but no output)."
269 ]
270 }
271 ],
272 "metadata": {}
273 }
274 ]
275 } No newline at end of file
@@ -0,0 +1,380 b''
1 {
2 "name": "flare",
3 "children": [
4 {
5 "name": "analytics",
6 "children": [
7 {
8 "name": "cluster",
9 "children": [
10 {"name": "AgglomerativeCluster", "size": 3938},
11 {"name": "CommunityStructure", "size": 3812},
12 {"name": "HierarchicalCluster", "size": 6714},
13 {"name": "MergeEdge", "size": 743}
14 ]
15 },
16 {
17 "name": "graph",
18 "children": [
19 {"name": "BetweennessCentrality", "size": 3534},
20 {"name": "LinkDistance", "size": 5731},
21 {"name": "MaxFlowMinCut", "size": 7840},
22 {"name": "ShortestPaths", "size": 5914},
23 {"name": "SpanningTree", "size": 3416}
24 ]
25 },
26 {
27 "name": "optimization",
28 "children": [
29 {"name": "AspectRatioBanker", "size": 7074}
30 ]
31 }
32 ]
33 },
34 {
35 "name": "animate",
36 "children": [
37 {"name": "Easing", "size": 17010},
38 {"name": "FunctionSequence", "size": 5842},
39 {
40 "name": "interpolate",
41 "children": [
42 {"name": "ArrayInterpolator", "size": 1983},
43 {"name": "ColorInterpolator", "size": 2047},
44 {"name": "DateInterpolator", "size": 1375},
45 {"name": "Interpolator", "size": 8746},
46 {"name": "MatrixInterpolator", "size": 2202},
47 {"name": "NumberInterpolator", "size": 1382},
48 {"name": "ObjectInterpolator", "size": 1629},
49 {"name": "PointInterpolator", "size": 1675},
50 {"name": "RectangleInterpolator", "size": 2042}
51 ]
52 },
53 {"name": "ISchedulable", "size": 1041},
54 {"name": "Parallel", "size": 5176},
55 {"name": "Pause", "size": 449},
56 {"name": "Scheduler", "size": 5593},
57 {"name": "Sequence", "size": 5534},
58 {"name": "Transition", "size": 9201},
59 {"name": "Transitioner", "size": 19975},
60 {"name": "TransitionEvent", "size": 1116},
61 {"name": "Tween", "size": 6006}
62 ]
63 },
64 {
65 "name": "data",
66 "children": [
67 {
68 "name": "converters",
69 "children": [
70 {"name": "Converters", "size": 721},
71 {"name": "DelimitedTextConverter", "size": 4294},
72 {"name": "GraphMLConverter", "size": 9800},
73 {"name": "IDataConverter", "size": 1314},
74 {"name": "JSONConverter", "size": 2220}
75 ]
76 },
77 {"name": "DataField", "size": 1759},
78 {"name": "DataSchema", "size": 2165},
79 {"name": "DataSet", "size": 586},
80 {"name": "DataSource", "size": 3331},
81 {"name": "DataTable", "size": 772},
82 {"name": "DataUtil", "size": 3322}
83 ]
84 },
85 {
86 "name": "display",
87 "children": [
88 {"name": "DirtySprite", "size": 8833},
89 {"name": "LineSprite", "size": 1732},
90 {"name": "RectSprite", "size": 3623},
91 {"name": "TextSprite", "size": 10066}
92 ]
93 },
94 {
95 "name": "flex",
96 "children": [
97 {"name": "FlareVis", "size": 4116}
98 ]
99 },
100 {
101 "name": "physics",
102 "children": [
103 {"name": "DragForce", "size": 1082},
104 {"name": "GravityForce", "size": 1336},
105 {"name": "IForce", "size": 319},
106 {"name": "NBodyForce", "size": 10498},
107 {"name": "Particle", "size": 2822},
108 {"name": "Simulation", "size": 9983},
109 {"name": "Spring", "size": 2213},
110 {"name": "SpringForce", "size": 1681}
111 ]
112 },
113 {
114 "name": "query",
115 "children": [
116 {"name": "AggregateExpression", "size": 1616},
117 {"name": "And", "size": 1027},
118 {"name": "Arithmetic", "size": 3891},
119 {"name": "Average", "size": 891},
120 {"name": "BinaryExpression", "size": 2893},
121 {"name": "Comparison", "size": 5103},
122 {"name": "CompositeExpression", "size": 3677},
123 {"name": "Count", "size": 781},
124 {"name": "DateUtil", "size": 4141},
125 {"name": "Distinct", "size": 933},
126 {"name": "Expression", "size": 5130},
127 {"name": "ExpressionIterator", "size": 3617},
128 {"name": "Fn", "size": 3240},
129 {"name": "If", "size": 2732},
130 {"name": "IsA", "size": 2039},
131 {"name": "Literal", "size": 1214},
132 {"name": "Match", "size": 3748},
133 {"name": "Maximum", "size": 843},
134 {
135 "name": "methods",
136 "children": [
137 {"name": "add", "size": 593},
138 {"name": "and", "size": 330},
139 {"name": "average", "size": 287},
140 {"name": "count", "size": 277},
141 {"name": "distinct", "size": 292},
142 {"name": "div", "size": 595},
143 {"name": "eq", "size": 594},
144 {"name": "fn", "size": 460},
145 {"name": "gt", "size": 603},
146 {"name": "gte", "size": 625},
147 {"name": "iff", "size": 748},
148 {"name": "isa", "size": 461},
149 {"name": "lt", "size": 597},
150 {"name": "lte", "size": 619},
151 {"name": "max", "size": 283},
152 {"name": "min", "size": 283},
153 {"name": "mod", "size": 591},
154 {"name": "mul", "size": 603},
155 {"name": "neq", "size": 599},
156 {"name": "not", "size": 386},
157 {"name": "or", "size": 323},
158 {"name": "orderby", "size": 307},
159 {"name": "range", "size": 772},
160 {"name": "select", "size": 296},
161 {"name": "stddev", "size": 363},
162 {"name": "sub", "size": 600},
163 {"name": "sum", "size": 280},
164 {"name": "update", "size": 307},
165 {"name": "variance", "size": 335},
166 {"name": "where", "size": 299},
167 {"name": "xor", "size": 354},
168 {"name": "_", "size": 264}
169 ]
170 },
171 {"name": "Minimum", "size": 843},
172 {"name": "Not", "size": 1554},
173 {"name": "Or", "size": 970},
174 {"name": "Query", "size": 13896},
175 {"name": "Range", "size": 1594},
176 {"name": "StringUtil", "size": 4130},
177 {"name": "Sum", "size": 791},
178 {"name": "Variable", "size": 1124},
179 {"name": "Variance", "size": 1876},
180 {"name": "Xor", "size": 1101}
181 ]
182 },
183 {
184 "name": "scale",
185 "children": [
186 {"name": "IScaleMap", "size": 2105},
187 {"name": "LinearScale", "size": 1316},
188 {"name": "LogScale", "size": 3151},
189 {"name": "OrdinalScale", "size": 3770},
190 {"name": "QuantileScale", "size": 2435},
191 {"name": "QuantitativeScale", "size": 4839},
192 {"name": "RootScale", "size": 1756},
193 {"name": "Scale", "size": 4268},
194 {"name": "ScaleType", "size": 1821},
195 {"name": "TimeScale", "size": 5833}
196 ]
197 },
198 {
199 "name": "util",
200 "children": [
201 {"name": "Arrays", "size": 8258},
202 {"name": "Colors", "size": 10001},
203 {"name": "Dates", "size": 8217},
204 {"name": "Displays", "size": 12555},
205 {"name": "Filter", "size": 2324},
206 {"name": "Geometry", "size": 10993},
207 {
208 "name": "heap",
209 "children": [
210 {"name": "FibonacciHeap", "size": 9354},
211 {"name": "HeapNode", "size": 1233}
212 ]
213 },
214 {"name": "IEvaluable", "size": 335},
215 {"name": "IPredicate", "size": 383},
216 {"name": "IValueProxy", "size": 874},
217 {
218 "name": "math",
219 "children": [
220 {"name": "DenseMatrix", "size": 3165},
221 {"name": "IMatrix", "size": 2815},
222 {"name": "SparseMatrix", "size": 3366}
223 ]
224 },
225 {"name": "Maths", "size": 17705},
226 {"name": "Orientation", "size": 1486},
227 {
228 "name": "palette",
229 "children": [
230 {"name": "ColorPalette", "size": 6367},
231 {"name": "Palette", "size": 1229},
232 {"name": "ShapePalette", "size": 2059},
233 {"name": "SizePalette", "size": 2291}
234 ]
235 },
236 {"name": "Property", "size": 5559},
237 {"name": "Shapes", "size": 19118},
238 {"name": "Sort", "size": 6887},
239 {"name": "Stats", "size": 6557},
240 {"name": "Strings", "size": 22026}
241 ]
242 },
243 {
244 "name": "vis",
245 "children": [
246 {
247 "name": "axis",
248 "children": [
249 {"name": "Axes", "size": 1302},
250 {"name": "Axis", "size": 24593},
251 {"name": "AxisGridLine", "size": 652},
252 {"name": "AxisLabel", "size": 636},
253 {"name": "CartesianAxes", "size": 6703}
254 ]
255 },
256 {
257 "name": "controls",
258 "children": [
259 {"name": "AnchorControl", "size": 2138},
260 {"name": "ClickControl", "size": 3824},
261 {"name": "Control", "size": 1353},
262 {"name": "ControlList", "size": 4665},
263 {"name": "DragControl", "size": 2649},
264 {"name": "ExpandControl", "size": 2832},
265 {"name": "HoverControl", "size": 4896},
266 {"name": "IControl", "size": 763},
267 {"name": "PanZoomControl", "size": 5222},
268 {"name": "SelectionControl", "size": 7862},
269 {"name": "TooltipControl", "size": 8435}
270 ]
271 },
272 {
273 "name": "data",
274 "children": [
275 {"name": "Data", "size": 20544},
276 {"name": "DataList", "size": 19788},
277 {"name": "DataSprite", "size": 10349},
278 {"name": "EdgeSprite", "size": 3301},
279 {"name": "NodeSprite", "size": 19382},
280 {
281 "name": "render",
282 "children": [
283 {"name": "ArrowType", "size": 698},
284 {"name": "EdgeRenderer", "size": 5569},
285 {"name": "IRenderer", "size": 353},
286 {"name": "ShapeRenderer", "size": 2247}
287 ]
288 },
289 {"name": "ScaleBinding", "size": 11275},
290 {"name": "Tree", "size": 7147},
291 {"name": "TreeBuilder", "size": 9930}
292 ]
293 },
294 {
295 "name": "events",
296 "children": [
297 {"name": "DataEvent", "size": 2313},
298 {"name": "SelectionEvent", "size": 1880},
299 {"name": "TooltipEvent", "size": 1701},
300 {"name": "VisualizationEvent", "size": 1117}
301 ]
302 },
303 {
304 "name": "legend",
305 "children": [
306 {"name": "Legend", "size": 20859},
307 {"name": "LegendItem", "size": 4614},
308 {"name": "LegendRange", "size": 10530}
309 ]
310 },
311 {
312 "name": "operator",
313 "children": [
314 {
315 "name": "distortion",
316 "children": [
317 {"name": "BifocalDistortion", "size": 4461},
318 {"name": "Distortion", "size": 6314},
319 {"name": "FisheyeDistortion", "size": 3444}
320 ]
321 },
322 {
323 "name": "encoder",
324 "children": [
325 {"name": "ColorEncoder", "size": 3179},
326 {"name": "Encoder", "size": 4060},
327 {"name": "PropertyEncoder", "size": 4138},
328 {"name": "ShapeEncoder", "size": 1690},
329 {"name": "SizeEncoder", "size": 1830}
330 ]
331 },
332 {
333 "name": "filter",
334 "children": [
335 {"name": "FisheyeTreeFilter", "size": 5219},
336 {"name": "GraphDistanceFilter", "size": 3165},
337 {"name": "VisibilityFilter", "size": 3509}
338 ]
339 },
340 {"name": "IOperator", "size": 1286},
341 {
342 "name": "label",
343 "children": [
344 {"name": "Labeler", "size": 9956},
345 {"name": "RadialLabeler", "size": 3899},
346 {"name": "StackedAreaLabeler", "size": 3202}
347 ]
348 },
349 {
350 "name": "layout",
351 "children": [
352 {"name": "AxisLayout", "size": 6725},
353 {"name": "BundledEdgeRouter", "size": 3727},
354 {"name": "CircleLayout", "size": 9317},
355 {"name": "CirclePackingLayout", "size": 12003},
356 {"name": "DendrogramLayout", "size": 4853},
357 {"name": "ForceDirectedLayout", "size": 8411},
358 {"name": "IcicleTreeLayout", "size": 4864},
359 {"name": "IndentedTreeLayout", "size": 3174},
360 {"name": "Layout", "size": 7881},
361 {"name": "NodeLinkTreeLayout", "size": 12870},
362 {"name": "PieLayout", "size": 2728},
363 {"name": "RadialTreeLayout", "size": 12348},
364 {"name": "RandomLayout", "size": 870},
365 {"name": "StackedAreaLayout", "size": 9121},
366 {"name": "TreeMapLayout", "size": 9191}
367 ]
368 },
369 {"name": "Operator", "size": 2490},
370 {"name": "OperatorList", "size": 5248},
371 {"name": "OperatorSequence", "size": 4190},
372 {"name": "OperatorSwitch", "size": 2581},
373 {"name": "SortOperator", "size": 2023}
374 ]
375 },
376 {"name": "Visualization", "size": 16540}
377 ]
378 }
379 ]
380 }
@@ -1,7 +1,7 b''
1 {
1 {
2 "metadata": {
2 "metadata": {
3 "name": "",
3 "name": "",
4 "signature": "sha256:ae010ef95e10f7b6ef5f0b51ab9e540112ad42edc1daf268de29fee0cff73085"
4 "signature": "sha256:180c055843c21d9b1ac1c9ab78517b077ff5d6526a847739908408866ac449b2"
5 },
5 },
6 "nbformat": 3,
6 "nbformat": 3,
7 "nbformat_minor": 0,
7 "nbformat_minor": 0,
@@ -631,9 +631,7 b''
631 "collapsed": false,
631 "collapsed": false,
632 "input": [
632 "input": [
633 "from IPython.display import YouTubeVideo\n",
633 "from IPython.display import YouTubeVideo\n",
634 "# a talk about IPython at Sage Days at U. Washington, Seattle.\n",
634 "YouTubeVideo('sjfsUzECqK0')"
635 "# Video credit: William Stein.\n",
636 "YouTubeVideo('1j_HxD4iLn8')"
637 ],
635 ],
638 "language": "python",
636 "language": "python",
639 "metadata": {},
637 "metadata": {},
@@ -644,7 +642,7 b''
644 " <iframe\n",
642 " <iframe\n",
645 " width=\"400\"\n",
643 " width=\"400\"\n",
646 " height=300\"\n",
644 " height=300\"\n",
647 " src=\"https://www.youtube.com/embed/1j_HxD4iLn8\"\n",
645 " src=\"https://www.youtube.com/embed/sjfsUzECqK0\"\n",
648 " frameborder=\"0\"\n",
646 " frameborder=\"0\"\n",
649 " allowfullscreen\n",
647 " allowfullscreen\n",
650 " ></iframe>\n",
648 " ></iframe>\n",
@@ -652,13 +650,13 b''
652 ],
650 ],
653 "metadata": {},
651 "metadata": {},
654 "output_type": "pyout",
652 "output_type": "pyout",
655 "prompt_number": 17,
653 "prompt_number": 20,
656 "text": [
654 "text": [
657 "<IPython.lib.display.YouTubeVideo at 0x108313810>"
655 "<IPython.lib.display.YouTubeVideo at 0x10a0d8190>"
658 ]
656 ]
659 }
657 }
660 ],
658 ],
661 "prompt_number": 17
659 "prompt_number": 20
662 },
660 },
663 {
661 {
664 "cell_type": "markdown",
662 "cell_type": "markdown",
@@ -791,10 +789,273 b''
791 "cell_type": "markdown",
789 "cell_type": "markdown",
792 "metadata": {},
790 "metadata": {},
793 "source": [
791 "source": [
792 "If you want to write HTML or Javascript straight to the frontend,\n",
793 "you can use `%%html` or `%%javascript` cell magics. These are exactly the same as writing `display(HTML(\"\"\"cell contents\"\"\"))`, etc."
794 ]
795 },
796 {
797 "cell_type": "code",
798 "collapsed": false,
799 "input": [
800 "%%html\n",
801 "<table>\n",
802 "<tr>\n",
803 "<th>Header 1</th>\n",
804 "<th>Header 2</th>\n",
805 "</tr>\n",
806 "<tr>\n",
807 "<td>row 1, cell 1</td>\n",
808 "<td>row 1, cell 2</td>\n",
809 "</tr>\n",
810 "<tr>\n",
811 "<td>row 2, cell 1</td>\n",
812 "<td>row 2, cell 2</td>\n",
813 "</tr>\n",
814 "</table>"
815 ],
816 "language": "python",
817 "metadata": {},
818 "outputs": [
819 {
820 "html": [
821 "<table>\n",
822 "<tr>\n",
823 "<th>Header 1</th>\n",
824 "<th>Header 2</th>\n",
825 "</tr>\n",
826 "<tr>\n",
827 "<td>row 1, cell 1</td>\n",
828 "<td>row 1, cell 2</td>\n",
829 "</tr>\n",
830 "<tr>\n",
831 "<td>row 2, cell 1</td>\n",
832 "<td>row 2, cell 2</td>\n",
833 "</tr>\n",
834 "</table>"
835 ],
836 "metadata": {},
837 "output_type": "display_data",
838 "text": [
839 "<IPython.core.display.HTML object>"
840 ]
841 }
842 ],
843 "prompt_number": 1
844 },
845 {
846 "cell_type": "markdown",
847 "metadata": {},
848 "source": [
794 "Pandas makes use of this capability to allow `DataFrames` to be represented as HTML tables."
849 "Pandas makes use of this capability to allow `DataFrames` to be represented as HTML tables."
795 ]
850 ]
796 },
851 },
797 {
852 {
853 "cell_type": "heading",
854 "level": 2,
855 "metadata": {},
856 "source": [
857 "JavaScript"
858 ]
859 },
860 {
861 "cell_type": "code",
862 "collapsed": false,
863 "input": [
864 "from IPython.display import Javascript"
865 ],
866 "language": "python",
867 "metadata": {},
868 "outputs": [],
869 "prompt_number": 2
870 },
871 {
872 "cell_type": "code",
873 "collapsed": false,
874 "input": [
875 "Javascript(\n",
876 " \"\"\"$.getScript('//cdnjs.cloudflare.com/ajax/libs/d3/3.2.2/d3.v3.min.js')\"\"\"\n",
877 ")"
878 ],
879 "language": "python",
880 "metadata": {},
881 "outputs": [
882 {
883 "javascript": [
884 "$.getScript('//cdnjs.cloudflare.com/ajax/libs/d3/3.2.2/d3.v3.min.js')"
885 ],
886 "metadata": {},
887 "output_type": "pyout",
888 "prompt_number": 8,
889 "text": [
890 "<IPython.core.display.Javascript object>"
891 ]
892 }
893 ],
894 "prompt_number": 8
895 },
896 {
897 "cell_type": "code",
898 "collapsed": false,
899 "input": [
900 "%%html\n",
901 "<style type=\"text/css\">\n",
902 "\n",
903 "circle {\n",
904 " fill: rgb(31, 119, 180);\n",
905 " fill-opacity: .25;\n",
906 " stroke: rgb(31, 119, 180);\n",
907 " stroke-width: 1px;\n",
908 "}\n",
909 "\n",
910 ".leaf circle {\n",
911 " fill: #ff7f0e;\n",
912 " fill-opacity: 1;\n",
913 "}\n",
914 "\n",
915 "text {\n",
916 " font: 10px sans-serif;\n",
917 "}\n",
918 "\n",
919 "</style>"
920 ],
921 "language": "python",
922 "metadata": {},
923 "outputs": [
924 {
925 "html": [
926 "<style type=\"text/css\">\n",
927 "\n",
928 "circle {\n",
929 " fill: rgb(31, 119, 180);\n",
930 " fill-opacity: .25;\n",
931 " stroke: rgb(31, 119, 180);\n",
932 " stroke-width: 1px;\n",
933 "}\n",
934 "\n",
935 ".leaf circle {\n",
936 " fill: #ff7f0e;\n",
937 " fill-opacity: 1;\n",
938 "}\n",
939 "\n",
940 "text {\n",
941 " font: 10px sans-serif;\n",
942 "}\n",
943 "\n",
944 "</style>"
945 ],
946 "metadata": {},
947 "output_type": "display_data",
948 "text": [
949 "<IPython.core.display.HTML object>"
950 ]
951 }
952 ],
953 "prompt_number": 4
954 },
955 {
956 "cell_type": "code",
957 "collapsed": false,
958 "input": [
959 "%%javascript\n",
960 "\n",
961 "// element is the jQuery element we will append to\n",
962 "var e = element.get(0);\n",
963 " \n",
964 "var diameter = 600,\n",
965 " format = d3.format(\",d\");\n",
966 "\n",
967 "var pack = d3.layout.pack()\n",
968 " .size([diameter - 4, diameter - 4])\n",
969 " .value(function(d) { return d.size; });\n",
970 "\n",
971 "var svg = d3.select(e).append(\"svg\")\n",
972 " .attr(\"width\", diameter)\n",
973 " .attr(\"height\", diameter)\n",
974 " .append(\"g\")\n",
975 " .attr(\"transform\", \"translate(2,2)\");\n",
976 "\n",
977 "d3.json(\"data/flare.json\", function(error, root) {\n",
978 " var node = svg.datum(root).selectAll(\".node\")\n",
979 " .data(pack.nodes)\n",
980 " .enter().append(\"g\")\n",
981 " .attr(\"class\", function(d) { return d.children ? \"node\" : \"leaf node\"; })\n",
982 " .attr(\"transform\", function(d) { return \"translate(\" + d.x + \",\" + d.y + \")\"; });\n",
983 "\n",
984 " node.append(\"title\")\n",
985 " .text(function(d) { return d.name + (d.children ? \"\" : \": \" + format(d.size)); });\n",
986 "\n",
987 " node.append(\"circle\")\n",
988 " .attr(\"r\", function(d) { return d.r; });\n",
989 "\n",
990 " node.filter(function(d) { return !d.children; }).append(\"text\")\n",
991 " .attr(\"dy\", \".3em\")\n",
992 " .style(\"text-anchor\", \"middle\")\n",
993 " .text(function(d) { return d.name.substring(0, d.r / 3); });\n",
994 "});\n",
995 "\n",
996 "d3.select(self.frameElement).style(\"height\", diameter + \"px\");"
997 ],
998 "language": "python",
999 "metadata": {},
1000 "outputs": [
1001 {
1002 "javascript": [
1003 "\n",
1004 "// element is the jQuery element we will append to\n",
1005 "var e = element.get(0);\n",
1006 " \n",
1007 "var diameter = 600,\n",
1008 " format = d3.format(\",d\");\n",
1009 "\n",
1010 "var pack = d3.layout.pack()\n",
1011 " .size([diameter - 4, diameter - 4])\n",
1012 " .value(function(d) { return d.size; });\n",
1013 "\n",
1014 "var svg = d3.select(e).append(\"svg\")\n",
1015 " .attr(\"width\", diameter)\n",
1016 " .attr(\"height\", diameter)\n",
1017 " .append(\"g\")\n",
1018 " .attr(\"transform\", \"translate(2,2)\");\n",
1019 "\n",
1020 "d3.json(\"data/flare.json\", function(error, root) {\n",
1021 " var node = svg.datum(root).selectAll(\".node\")\n",
1022 " .data(pack.nodes)\n",
1023 " .enter().append(\"g\")\n",
1024 " .attr(\"class\", function(d) { return d.children ? \"node\" : \"leaf node\"; })\n",
1025 " .attr(\"transform\", function(d) { return \"translate(\" + d.x + \",\" + d.y + \")\"; });\n",
1026 "\n",
1027 " node.append(\"title\")\n",
1028 " .text(function(d) { return d.name + (d.children ? \"\" : \": \" + format(d.size)); });\n",
1029 "\n",
1030 " node.append(\"circle\")\n",
1031 " .attr(\"r\", function(d) { return d.r; });\n",
1032 "\n",
1033 " node.filter(function(d) { return !d.children; }).append(\"text\")\n",
1034 " .attr(\"dy\", \".3em\")\n",
1035 " .style(\"text-anchor\", \"middle\")\n",
1036 " .text(function(d) { return d.name.substring(0, d.r / 3); });\n",
1037 "});\n",
1038 "\n",
1039 "d3.select(self.frameElement).style(\"height\", diameter + \"px\");"
1040 ],
1041 "metadata": {},
1042 "output_type": "display_data",
1043 "text": [
1044 "<IPython.core.display.Javascript object>"
1045 ]
1046 }
1047 ],
1048 "prompt_number": 7
1049 },
1050 {
1051 "cell_type": "heading",
1052 "level": 2,
1053 "metadata": {},
1054 "source": [
1055 "Pandas"
1056 ]
1057 },
1058 {
798 "cell_type": "code",
1059 "cell_type": "code",
799 "collapsed": false,
1060 "collapsed": false,
800 "input": [
1061 "input": [
@@ -803,7 +1064,7 b''
803 "language": "python",
1064 "language": "python",
804 "metadata": {},
1065 "metadata": {},
805 "outputs": [],
1066 "outputs": [],
806 "prompt_number": 22
1067 "prompt_number": 9
807 },
1068 },
808 {
1069 {
809 "cell_type": "markdown",
1070 "cell_type": "markdown",
@@ -816,7 +1077,7 b''
816 "cell_type": "code",
1077 "cell_type": "code",
817 "collapsed": false,
1078 "collapsed": false,
818 "input": [
1079 "input": [
819 "%%file data.csv\n",
1080 "%%writefile data.csv\n",
820 "Date,Open,High,Low,Close,Volume,Adj Close\n",
1081 "Date,Open,High,Low,Close,Volume,Adj Close\n",
821 "2012-06-01,569.16,590.00,548.50,584.00,14077000,581.50\n",
1082 "2012-06-01,569.16,590.00,548.50,584.00,14077000,581.50\n",
822 "2012-05-01,584.90,596.76,522.18,577.73,18827900,575.26\n",
1083 "2012-05-01,584.90,596.76,522.18,577.73,18827900,575.26\n",
@@ -836,7 +1097,7 b''
836 ]
1097 ]
837 }
1098 }
838 ],
1099 ],
839 "prompt_number": 23
1100 "prompt_number": 10
840 },
1101 },
841 {
1102 {
842 "cell_type": "markdown",
1103 "cell_type": "markdown",
@@ -854,7 +1115,7 b''
854 "language": "python",
1115 "language": "python",
855 "metadata": {},
1116 "metadata": {},
856 "outputs": [],
1117 "outputs": [],
857 "prompt_number": 24
1118 "prompt_number": 11
858 },
1119 },
859 {
1120 {
860 "cell_type": "markdown",
1121 "cell_type": "markdown",
@@ -956,7 +1217,7 b''
956 ],
1217 ],
957 "metadata": {},
1218 "metadata": {},
958 "output_type": "pyout",
1219 "output_type": "pyout",
959 "prompt_number": 25,
1220 "prompt_number": 12,
960 "text": [
1221 "text": [
961 " Date Open High Low Close Volume Adj Close\n",
1222 " Date Open High Low Close Volume Adj Close\n",
962 "0 2012-06-01 569.16 590.00 548.50 584.00 14077000 581.50\n",
1223 "0 2012-06-01 569.16 590.00 548.50 584.00 14077000 581.50\n",
@@ -970,7 +1231,122 b''
970 ]
1231 ]
971 }
1232 }
972 ],
1233 ],
973 "prompt_number": 25
1234 "prompt_number": 12
1235 },
1236 {
1237 "cell_type": "heading",
1238 "level": 2,
1239 "metadata": {},
1240 "source": [
1241 "SymPy"
1242 ]
1243 },
1244 {
1245 "cell_type": "code",
1246 "collapsed": false,
1247 "input": [
1248 "from sympy.interactive.printing import init_printing\n",
1249 "init_printing(use_latex='mathjax')"
1250 ],
1251 "language": "python",
1252 "metadata": {},
1253 "outputs": [],
1254 "prompt_number": 13
1255 },
1256 {
1257 "cell_type": "code",
1258 "collapsed": false,
1259 "input": [
1260 "from __future__ import division\n",
1261 "import sympy as sym\n",
1262 "from sympy import *\n",
1263 "x, y, z = symbols(\"x y z\")\n",
1264 "k, m, n = symbols(\"k m n\", integer=True)\n",
1265 "f, g, h = map(Function, 'fgh')"
1266 ],
1267 "language": "python",
1268 "metadata": {},
1269 "outputs": [],
1270 "prompt_number": 14
1271 },
1272 {
1273 "cell_type": "code",
1274 "collapsed": false,
1275 "input": [
1276 "Rational(3,2)*pi + exp(I*x) / (x**2 + y)"
1277 ],
1278 "language": "python",
1279 "metadata": {},
1280 "outputs": [
1281 {
1282 "latex": [
1283 "$$\\frac{3 \\pi}{2} + \\frac{e^{i x}}{x^{2} + y}$$"
1284 ],
1285 "metadata": {},
1286 "output_type": "pyout",
1287 "prompt_number": 15,
1288 "text": [
1289 " \u2148\u22c5x \n",
1290 "3\u22c5\u03c0 \u212f \n",
1291 "\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\n",
1292 " 2 2 \n",
1293 " x + y"
1294 ]
1295 }
1296 ],
1297 "prompt_number": 15
1298 },
1299 {
1300 "cell_type": "code",
1301 "collapsed": false,
1302 "input": [
1303 "a = 1/x + (x*sin(x) - 1)/x\n",
1304 "a"
1305 ],
1306 "language": "python",
1307 "metadata": {},
1308 "outputs": [
1309 {
1310 "latex": [
1311 "$$\\frac{1}{x} \\left(x \\sin{\\left (x \\right )} - 1\\right) + \\frac{1}{x}$$"
1312 ],
1313 "metadata": {},
1314 "output_type": "pyout",
1315 "prompt_number": 16,
1316 "text": [
1317 "x\u22c5sin(x) - 1 1\n",
1318 "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\n",
1319 " x x"
1320 ]
1321 }
1322 ],
1323 "prompt_number": 16
1324 },
1325 {
1326 "cell_type": "code",
1327 "collapsed": false,
1328 "input": [
1329 "(1/cos(x)).series(x, 0, 6)"
1330 ],
1331 "language": "python",
1332 "metadata": {},
1333 "outputs": [
1334 {
1335 "latex": [
1336 "$$1 + \\frac{x^{2}}{2} + \\frac{5 x^{4}}{24} + \\mathcal{O}\\left(x^{6}\\right)$$"
1337 ],
1338 "metadata": {},
1339 "output_type": "pyout",
1340 "prompt_number": 17,
1341 "text": [
1342 " 2 4 \n",
1343 " x 5\u22c5x \u239b 6\u239e\n",
1344 "1 + \u2500\u2500 + \u2500\u2500\u2500\u2500 + O\u239dx \u23a0\n",
1345 " 2 24 "
1346 ]
1347 }
1348 ],
1349 "prompt_number": 17
974 },
1350 },
975 {
1351 {
976 "cell_type": "heading",
1352 "cell_type": "heading",
@@ -993,7 +1369,7 b''
993 "collapsed": false,
1369 "collapsed": false,
994 "input": [
1370 "input": [
995 "from IPython.display import IFrame\n",
1371 "from IPython.display import IFrame\n",
996 "IFrame('http://en.mobile.wikipedia.org/?useformat=mobile', width='100%', height=350)"
1372 "IFrame('http://python.org', width='100%', height=350)"
997 ],
1373 ],
998 "language": "python",
1374 "language": "python",
999 "metadata": {},
1375 "metadata": {},
@@ -1004,7 +1380,7 b''
1004 " <iframe\n",
1380 " <iframe\n",
1005 " width=\"100%\"\n",
1381 " width=\"100%\"\n",
1006 " height=350\"\n",
1382 " height=350\"\n",
1007 " src=\"http://en.mobile.wikipedia.org/?useformat=mobile\"\n",
1383 " src=\"http://python.org\"\n",
1008 " frameborder=\"0\"\n",
1384 " frameborder=\"0\"\n",
1009 " allowfullscreen\n",
1385 " allowfullscreen\n",
1010 " ></iframe>\n",
1386 " ></iframe>\n",
@@ -1012,13 +1388,13 b''
1012 ],
1388 ],
1013 "metadata": {},
1389 "metadata": {},
1014 "output_type": "pyout",
1390 "output_type": "pyout",
1015 "prompt_number": 26,
1391 "prompt_number": 19,
1016 "text": [
1392 "text": [
1017 "<IPython.lib.display.IFrame at 0x10a82db90>"
1393 "<IPython.lib.display.IFrame at 0x10a11ff10>"
1018 ]
1394 ]
1019 }
1395 }
1020 ],
1396 ],
1021 "prompt_number": 26
1397 "prompt_number": 19
1022 },
1398 },
1023 {
1399 {
1024 "cell_type": "heading",
1400 "cell_type": "heading",
General Comments 0
You need to be logged in to leave comments. Login now