Python scripting for computational science:
Gespeichert in:
1. Verfasser: | |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
Berlin [u.a.]
Springer
2006
|
Ausgabe: | 2. ed. |
Schriftenreihe: | Texts in computational science and engineering
3 |
Schlagworte: | |
Online-Zugang: | Inhaltsverzeichnis |
Beschreibung: | XXIV, 736 S. graph. Darst. |
ISBN: | 3540294155 9783540294153 |
Internformat
MARC
LEADER | 00000nam a2200000 cb4500 | ||
---|---|---|---|
001 | BV021510549 | ||
003 | DE-604 | ||
005 | 20070411 | ||
007 | t | ||
008 | 060314s2006 d||| |||| 00||| eng d | ||
020 | |a 3540294155 |9 3-540-29415-5 | ||
020 | |a 9783540294153 |9 978-3-540-29415-3 | ||
035 | |a (OCoLC)181481282 | ||
035 | |a (DE-599)BVBBV021510549 | ||
040 | |a DE-604 |b ger |e rakwb | ||
041 | 0 | |a eng | |
049 | |a DE-20 |a DE-29T |a DE-11 | ||
050 | 0 | |a QA76.73.P98 | |
082 | 0 | |a 004 | |
082 | 0 | |a 502.855133 |2 22 | |
084 | |a ST 250 |0 (DE-625)143626: |2 rvk | ||
084 | |a ST 260 |0 (DE-625)143632: |2 rvk | ||
100 | 1 | |a Langtangen, Hans Petter |d 1962- |e Verfasser |0 (DE-588)1019109599 |4 aut | |
245 | 1 | 0 | |a Python scripting for computational science |c Hans Petter Langtangen |
250 | |a 2. ed. | ||
264 | 1 | |a Berlin [u.a.] |b Springer |c 2006 | |
300 | |a XXIV, 736 S. |b graph. Darst. | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
490 | 1 | |a Texts in computational science and engineering |v 3 | |
650 | 4 | |a Datenverarbeitung | |
650 | 4 | |a Naturwissenschaft | |
650 | 4 | |a Python (Computer program language) | |
650 | 4 | |a Science |x Data processing | |
650 | 0 | 7 | |a Python |g Programmiersprache |0 (DE-588)4434275-5 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a Wissenschaftliches Rechnen |0 (DE-588)4338507-2 |2 gnd |9 rswk-swf |
689 | 0 | 0 | |a Wissenschaftliches Rechnen |0 (DE-588)4338507-2 |D s |
689 | 0 | 1 | |a Python |g Programmiersprache |0 (DE-588)4434275-5 |D s |
689 | 0 | |5 DE-604 | |
830 | 0 | |a Texts in computational science and engineering |v 3 |w (DE-604)BV016971315 |9 3 | |
856 | 4 | 2 | |m HEBIS Datenaustausch Darmstadt |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=014727178&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
999 | |a oai:aleph.bib-bvb.de:BVB01-014727178 |
Datensatz im Suchindex
_version_ | 1804135246336098304 |
---|---|
adam_text | HANS PETTER LANGTANGEN PYTHON SCRIPTING FOR COMPUTATIONAL SCIENCE SECOND
EDITION WITH 62 FIGURES 4Y SPRINGER TABLE OF CONTENTS 1 INTRODUCTION 1
1.1 SCRIPTING VERSUS TRADITIONAL PROGRAMMING 1 1.1.1 WHY SCRIPTING IS
USEFUL IN COMPUTATIONAL SCIENCE. . . 2 1.1.2 CLASSIFICATION OF
PROGRAMMING LANGUAGES 4 1.1.3 PRODUCTIVE PAIRS OF PROGRAMMING LANGUAGES
5 1.1.4 GLUING EXISTING APPLICATIONS 6 1.1.5 SCRIPTING YIELDS SHORTER
CODE 7 1.1.6 EFFICIENCY 8 1.1.7 TYPE-SPECIFICATION (DECLARATION) OF
VARIABLES 9 1.1.8 FLEXIBLE FUNCTION INTERFACES 11 1.1.9 INTERACTIVE
COMPUTING 12 1.1.10 CREATING CODE AT RUN TIME 13 1.1.11 NESTED
HETEROGENEOUS DATA STRUCTURES 14 1.1.12 GUI PROGRAMMING 16 1.1.13 MIXED
LANGUAGE PROGRAMMING 17 1.1.14 WHEN TO CHOOSE A DYNAMICALLY TYPED
LANGUAGE ... 19 1.1.15 WHY PYTHON? 20 1.1.16 SCRIPT OR PROGRAM? 21 1.2
PREPARATIONS FOR WORKING WITH THIS BOOK 22 2 GETTING STARTED WITH PYTHON
SCRIPTING 27 2.1 A SCIENTIFIC HELLO WORLD SCRIPT 27 2.1.1 EXECUTING
PYTHON SCRIPTS 28 2.1.2 DISSECTION OF THE SCIENTIFIC HELLO WORLD SCRIPT
29 2.2 WORKING WITH FILES AND DATA 32 2.2.1 PROBLEM SPECIFICATION 32
2.2.2 THE COMPLETE CODE 33 2.2.3 DISSECTION 33 2.2.4 WORKING WITH FILES
IN MEMORY 36 2.2.5 ARRAY COMPUTING 37 2.2.6 INTERACTIVE COMPUTING AND
DEBUGGING 39 2.2.7 EFFICIENCY MEASUREMENTS 42 2.2.8 EXERCISES 43 2.3
GLUING STAND-ALONE APPLICATIONS 46 2.3.1 THE SIMULATION CODE 47 2.3.2
USING GNUPLOT TO VISUALIZE CURVES 49 2.3.3 FUNCTIONALITY OF THE SCRIPT
50 2.3.4 THE COMPLETE CODE 51 2.3.5 DISSECTION 53 2.3.6 EXERCISES 56 2.4
CONDUCTING NUMERICAL EXPERIMENTS 58 2.4.1 WRAPPING A LOOP AROUND ANOTHER
SCRIPT 59 L. XII TABLE OF CONTENTS 2.4.2 GENERATING AN HTML REPORT 60
2.4.3 MAKING ANIMATIONS 61 2.4.4 VARYING ANY PARAMETER 63 2.5 FILE
FORMAT CONVERSION 66 2.5.1 A SIMPLE READ/WRITE SCRIPT 66 2.5.2 STORING
DATA IN A DICTIONARIES AND LISTS 68 2.5.3 MAKING A MODULE WITH FUNCTIONS
69 2.5.4 EXERCISES 71 3 BASIC PYTHON 73 3.1 INTRODUCTORY TOPICS 74 3.1.1
RECOMMENDED PYTHON DOCUMENTATION 74 3.1.2 CONTROL STATEMENTS 75 3.1.3
RUNNING AN APPLICATION 76 3.1.4 FILE READING AND WRITING 78 3.1.5 OUTPUT
FORMATTING 79 3.2 VARIABLES OF DIFFERENT TYPES 81 3.2.1 BOOLEAN TYPES 81
3.2.2 THE NONE VARIABLE 81 3.2.3 NUMBERS AND NUMERICAL EXPRESSIONS 82
3.2.4 LISTS AND TUPLES 84 3.2.5 DICTIONARIES 90 3.2.6 SPLITTING AND
JOINING TEXT 93 3.2.7 STRING OPERATIONS 94 3.2.8 TEXT PROCESSING 96
3.2.9 THE BASICS OF A PYTHON CLASS 98 3.2.10 COPY AND ASSIGNMENT 100
3.2.11 DETERMINING A VARIABLE S TYPE 104 3.2.12 EXERCISES 105 3.3
FUNCTIONS 109 3.3.1 KEYWORD ARGUMENTS 110 3.3.2 DOC STRINGS ILL 3.3.3
VARIABLE NUMBER OF ARGUMENTS 112 3.3.4 CALL BY REFERENCE 113 3.3.5
TREATMENT OF INPUT AND OUTPUT ARGUMENTS 115 3.3.6 FUNCTION OBJECTS 116
3.4 WORKING WITH FILES AND DIRECTORIES 117 3.4.1 LISTING FILES IN A
DIRECTORY 118 3.4.2 TESTING FILE TYPES 118 3.4.3 REMOVING FILES AND
DIRECTORIES 119 3.4.4 COPYING AND RENAMING FILES 120 3.4.5 SPLITTING
PATHNAMES 121 3.4.6 CREATING AND MOVING TO DIRECTORIES 122 3.4.7
TRAVERSING DIRECTORY TREES 122 3.4.8 EXERCISES 125 TABLE OF CONTENTS
XIII NUMERICAL COMPUTING IN PYTHON 131 4.1 A QUICK NUMPY PRIMER 133
4.1.1 CREATING ARRAYS 133 4.1.2 ARRAY INDEXING 134 4.1.3 ARRAY
COMPUTATIONS 136 4.1.4 TYPE TESTING 138 4.1.5 HIDDEN TEMPORARY ARRAYS
139 4.1.6 EXERCISES 140 4.2 VECTORIZED ALGORITHMS 141 4.2.1 FROM SCALAR
TO ARRAY IN FUNCTION ARGUMENTS 141 4.2.2 SLICING 143 4.2.3 REMARK ON
EFFICIENCY 144 4.2.4 EXERCISES 146 4.3 MORE ADVANCED ARRAY COMPUTING 147
4.3.1 RANDOM NUMBERS 147 4.3.2 LINEAR ALGEBRA 148 4.3.3 THE GNUPLOT
MODULE 150 4.3.4 EXAMPLE: CURVE FITTING 152 4.3.5 ARRAYS ON STRUCTURED
GRIDS 153 4.3.6 FILE I/O WITH NUMPY ARRAYS 157 4.3.7 READING AND WRITING
TABLES WITH NUMPY ARRAYS . . . 158 4.3.8 FUNCTIONALITY IN THE NUMPYTOOLS
MODULE 160 4.3.9 EXERCISES 163 4.4 OTHER TOOLS FOR NUMERICAL
COMPUTATIONS 168 4.4.1 THE SCIENTIFICPYTHON PACKAGE 168 4.4.2 THE SCIPY
PACKAGE 174 4.4.3 THE PYTHON-MATLAB INTERFACE 179 4.4.4 SOME USEFUL
PYTHON MODULES 180 COMBINING PYTHON WITH FORTRAN, C, AND C- *K * 183
5.1 ABOUT MIXED LANGUAGE PROGRAMMING 183 5.1.1 APPLICATIONS OF MIXED
LANGUAGE PROGRAMMING 184 5.1.2 CALLING C FROM PYTHON 184 5.1.3 AUTOMATIC
GENERATION OF WRAPPER CODE 186 5.2 SCIENTIFIC HELLO WORLD EXAMPLES 188
5.2.1 COMBINING PYTHON AND FORTRAN 189 5.2.2 COMBINING PYTHON AND C 194
5.2.3 COMBINING PYTHON AND C++ FUNCTIONS 199 5.2.4 COMBINING PYTHON AND
C++ CLASSES 202 5.2.5 EXERCISES 205 5.3 A SIMPLE COMPUTATIONAL STEERING
EXAMPLE 206 5.3.1 MODIFIED TIME LOOP FOR REPEATED SIMULATIONS 207 5.3.2
CREATING A PYTHON INTERFACE 208 5.3.3 THE STEERING PYTHON SCRIPT 210
5.3.4 EQUIPPING THE STEERING SCRIPT WITH A GUI 213 5.4 SCRIPTING
INTERFACES TO LARGE LIBRARIES 214 XIV TABLE OF CONTENTS 6 INTRODUCTION
TO GUI PROGRAMMING 219 6.1 SCIENTIFIC HELLO WORLD GUI 220 6.1.1
INTRODUCTORY TOPICS 220 6.1.2 THE FIRST PYTHON/TKINTER ENCOUNTER 222
6.1.3 BINDING EVENTS 225 6.1.4 CHANGING THE LAYOUT 226 6.1.5 THE FINAL
SCIENTIFIC HELLO WORLD GUI 230 6.1.6 AN ALTERNATIVE TO TKINTER VARIABLES
232 6.1.7 ABOUT THE PACK COMMAND 233 6.1.8 AN INTRODUCTION TO THE GRID
GEOMETRY MANAGER .... 235 6.1.9 IMPLEMENTING A GUI AS A CLASS 237 6.1.10
A SIMPLE GRAPHICAL FUNCTION EVALUATOR 239 6.1.11 EXERCISES 240 6.2
ADDING GUIS TO SCRIPTS 243 6.2.1 A SIMULATION AND VISUALIZATION SCRIPT
WITH A GUI . . 243 6.2.2 IMPROVING THE LAYOUT 246 6.2.3 EXERCISES 248
6.3 A LIST OF COMMON WIDGET OPERATIONS 249 6.3.1 FRAME 252 6.3.2 LABEL
252 6.3.3 BUTTON 254 6.3.4 TEXT ENTRY 254 6.3.5 BALLOON HELP 256 6.3.6
OPTION MENU 257 6.3.7 SLIDER 257 6.3.8 CHECK BUTTON 258 6.3.9 MAKING A
SIMPLE MEGAWIDGET 258 6.3.10 MENU BAR 259 6.3.11 LIST DATA 261 6.3.12
LISTBOX 262 6.3.13 RADIO BUTTON 265 6.3.14 COMBO BOX 266 6.3.15 MESSAGE
BOX 267 6.3.16 USER-DEFINED DIALOGS 269 6.3.17 COLOR-PICKER DIALOGS 270
6.3.18 FILE SELECTION DIALOGS 273 6.3.19 TOPLEVEL 274 6.3.20 SOME OTHER
TYPES OF WIDGETS 275 6.3.21 ADAPTING WIDGETS TO THE USER S RESIZE
ACTIONS 276 6.3.22 CUSTOMIZING FONTS AND COLORS 278 6.3.23 WIDGET
OVERVIEW 280 6.3.24 EXERCISES 282 TABLE OF CONTENTS XV 7 WEB INTERFACES
AND CGI PROGRAMMING 289 7.1 INTRODUCTORY CGI SCRIPTS 290 7.1.1 WEB FORMS
AND CGI SCRIPTS 291 7.1.2 GENERATING FORMS IN CGI SCRIPTS 293 7.1.3
DEBUGGING CGI SCRIPTS 295 7.1.4 A GENERAL SHELL SCRIPT WRAPPER FOR CGI
SCRIPTS 296 7.1.5 SECURITY ISSUES 298 7.2 ADDING WEB INTERFACES TO
SCRIPTS 300 7.2.1 A CLASS FOR FORM PARAMETERS 301 7.2.2 CALLING OTHER
PROGRAMS 303 7.2.3 RUNNING SIMULATIONS 304 7.2.4 GETTING A CGI SCRIPT TO
WORK 305 7.2.5 USING WEB APPLICATIONS FROM SCRIPTS 308 7.2.6 EXERCISES
310 8 ADVANCED PYTHON 313 8.1 MISCELLANEOUS TOPICS 313 8.1.1 PARSING
COMMAND-LINE ARGUMENTS 313 8.1.2 PLATFORM-DEPENDENT OPERATIONS 316 8.1.3
RUN-TIME GENERATION OF CODE 317 8.1.4 EXERCISES 318 8.2 REGULAR
EXPRESSIONS AND TEXT PROCESSING 320 8.2.1 MOTIVATION 320 8.2.2 SPECIAL
CHARACTERS 323 8.2.3 REGULAR EXPRESSIONS FOR REAL NUMBERS 325 8.2.4
USING GROUPS TO EXTRACT PARTS OF A TEXT 328 8.2.5 EXTRACTING INTERVAL
LIMITS 329 8.2.6 EXTRACTING MULTIPLE MATCHES 333 8.2.7 SPLITTING TEXT
338 8.2.8 PATTERN-MATCHING MODIFIERS 339 8.2.9 SUBSTITUTION AND
BACKREFERENCES 341 8.2.10 EXAMPLE: SWAPPING ARGUMENTS IN FUNCTION CALLS
. . . 342 8.2.11 A GENERAL SUBSTITUTION SCRIPT 345 8.2.12 DEBUGGING
REGULAR EXPRESSIONS 347 8.2.13 EXERCISES 349 8.3 TOOLS FOR HANDLING DATA
IN FILES 357 8.3.1 WRITING AND READING PYTHON DATA STRUCTURES 358 8.3.2
PICKLING OBJECTS 359 8.3.3 SHELVING OBJECTS 361 8.3.4 WRITING AND
READING ZIP AND TAR ARCHIVE FILES 362 8.3.5 DOWNLOADING INTERNET FILES
362 8.3.6 BINARY INPUT/OUTPUT 364 8.3.7 EXERCISES 366 8.4 A DATABASE FOR
NUMPY ARRAYS 367 8.4.1 THE STRUCTURE OF THE DATABASE 367 8.4.2 PICKLING
370 8.4.3 FORMATTED ASCII STORAGE 370 XVI TABLE OF CONTENTS 8.4.4
SHELVING 372 8.4.5 COMPARING THE VARIOUS TECHNIQUES 373 8.5 SCRIPTS
INVOLVING LOCAL AND REMOTE HOSTS 373 8.5.1 SECURE SHELL COMMANDS 374
8.5.2 DISTRIBUTED SIMULATION AND VISUALIZATION 375 8.5.3 CLIENT/SERVER
PROGRAMMING 377 8.5.4 THREADS 378 8.6 CLASSES 379 8.6.1 CLASS
PROGRAMMING 380 8.6.2 CHECKING THE CLASS TYPE 383 8.6.3 PRIVATE DATA 384
8.6.4 STATIC DATA 385 8.6.5 SPECIAL ATTRIBUTES 386 8.6.6 SPECIAL METHODS
386 8.6.7 MULTIPLE INHERITANCE 388 8.6.8 USING A CLASS AS A C-LIKE
STRUCTURE 388 8.6.9 ATTRIBUTE ACCESS VIA STRING NAMES 389 8.6.10
NEW-STYLE CLASSES 390 8.6.11 IMPLEMENTING GET/SET FUNCTIONS VIA
PROPERTIES 390 8.6.12 SUBCLASSING BUILT-IN TYPES 392 8.6.13 BUILDING
CLASS INTERFACES AT RUN TIME 394 8.6.14 BUILDING FLEXIBLE CLASS
INTERFACES 398 8.6.15 EXERCISES 404 8.7 SCOPE OF VARIABLES 408 8.7.1
GLOBAL, LOCAL, AND CLASS VARIABLES 408 8.7.2 NESTED FUNCTIONS 410 8.7.3
DICTIONARIES OF VARIABLES IN NAMESPACES 411 8.8 EXCEPTIONS 413 8.8.1
HANDLING EXCEPTIONS 413 8.8.2 RAISING EXCEPTIONS 415 8.9 ITERATORS 415
8.9.1 CONSTRUCTING AN ITERATOR 416 8.9.2 A POINTWISE GRID ITERATOR 418
8.9.3 A VECTORIZED GRID ITERATOR 421 8.9.4 GENERATORS 423 8.9.5 SOME
ASPECTS OF GENERIC PROGRAMMING 424 8.9.6 EXERCISES 428 8.10
INVESTIGATING EFFICIENCY 429 8.10.1 CPU-TIME MEASUREMENTS 430 8.10.2
PROFILING PYTHON SCRIPTS 433 8.10.3 OPTIMIZATION OF PYTHON CODE 434
8.10.4 CASE STUDY ON NUMERICAL EFFICIENCY 437 TABLE OF CONTENTS XVII 9
FORTRAN PROGRAMMING WITH NUMERICAL PYTHON ARRAYS 443 9.1 PROBLEM
DEFINITION 443 9.2 FILLING AN ARRAY IN FORTRAN 445 9.2.1 THE FORTRAN
SUBROUTINE 445 9.2.2 BUILDING AND INSPECTING THE EXTENSION MODULE 446
9.3 ARRAY STORAGE ISSUES 448 9.3.1 GENERATING AN ERRONEOUS INTERFACE 448
9.3.2 ARRAY STORAGE IN C AND FORTRAN 450 9.3.3 INPUT AND OUTPUT ARRAYS
AS FUNCTION ARGUMENTS . . . 451 9.3.4 F2PY INTERFACE FILES 458 9.3.5
HIDING WORK ARRAYS 462 9.4 INCREASING CALLBACK EFFICIENCY 463 9.4.1
CALLBACKS TO VECTORIZED PYTHON FUNCTIONS 463 9.4.2 AVOIDING CALLBACKS TO
PYTHON 466 9.4.3 COMPILED INLINE CALLBACK FUNCTIONS 466 9.5 SUMMARY 470
9.6 EXERCISES 470 10 C AND C++ PROGRAMMING WITH NUMERICAL PYTHON ARRAYS
475 10.1 C PROGRAMMING WITH NUMPY ARRAYS 476 10.1.1 THE BASICS OF THE
NUMPY C API 476 10.1.2 THE HANDWRITTEN EXTENSION CODE 478 10.1.3 SENDING
ARGUMENTS FROM PYTHON TO C 479 10.1.4 CONSISTENCY CHECKS 480 10.1.5
COMPUTING ARRAY VALUES 480 10.1.6 RETURNING AN OUTPUT ARRAY 483 10.1.7
CONVENIENT MACROS 484 10.1.8 MODULE INITIALIZATION 485 10.1.9 EXTENSION
MODULE TEMPLATE 486 10.1.10 COMPILING, LINKING, AND DEBUGGING THE MODULE
488 10.1.11 WRITING A WRAPPER FOR A C FUNCTION 489 10.2 C++ PROGRAMMING
WITH NUMPY ARRAYS 492 10.2.1 WRAPPING A NUMPY ARRAY IN A C++ OBJECT 493
10.2.2 USING SCXX 495 10.2.3 NUMPY-C++ CLASS CONVERSION 497 10.2.4
MIGRATING LOOPS TO C++ WITH WEAVE 505 10.3 COMPARISON OF THE
IMPLEMENTATIONS 506 10.3.1 EFFICIENCY 506 10.3.2 ERROR HANDLING 509
10.3.3 SUMMARY 510 10.4 EXERCISES 511 XVIII TABLE OF CONTENTS 11 MORE
ADVANCED GUI PROGRAMMING 515 11.1 ADDING PLOT AREAS IN GUIS 515 11.1.1
THE BLT GRAPH WIDGET 516 11.1.2 ANIMATION OF FUNCTIONS IN BLT GRAPH
WIDGETS 522 11.1.3 OTHER TOOLS FOR MAKING GUIS WITH PLOTS 524 11.1.4
EXERCISES 525 11.2 EVENT BINDINGS 527 11.2.1 BINDING EVENTS TO FUNCTIONS
WITH ARGUMENTS 528 11.2.2 A TEXT WIDGET WITH TAILORED KEYBOARD BINDINGS
... 530 11.2.3 A FANCY LIST WIDGET 533 11.3 ANIMATED GRAPHICS WITH
CANVAS WIDGETS 536 11.3.1 THE FIRST CANVAS ENCOUNTER 537 11.3.2
COORDINATE SYSTEMS 538 11.3.3 THE MATHEMATICAL MODEL CLASS 542 11.3.4
THE PLANET CLASS 543 11.3.5 DRAWING AND MOVING PLANETS 545 11.3.6
DRAGGING PLANETS TO NEW POSITIONS 546 11.3.7 USING PMW S SCROLLED CANVAS
WIDGET 550 11.4 SIMULATION AND VISUALIZATION SCRIPTS 552 11.4.1
RESTRUCTURING THE SCRIPT 553 11.4.2 REPRESENTING A PARAMETER BY A CLASS
555 11.4.3 IMPROVED COMMAND-LINE SCRIPT 569 11.4.4 IMPROVED GUI SCRIPT
570 11.4.5 IMPROVED CGI SCRIPT 571 11.4.6 PARAMETERS WITH PHYSICAL
DIMENSIONS 572 11.4.7 ADDING A CURVE PLOT AREA 574 11.4.8 AUTOMATIC
GENERATION OF SCRIPTS 576 11.4.9 APPLICATIONS OF THE TOOLS 577 11.4.10
ALLOWING PHYSICAL UNITS IN INPUT FILES 582 11.4.11 CONVERTING INPUT
FILES TO GUIS 587 12 TOOLS AND EXAMPLES 591 12.1 RUNNING SERIES OF
COMPUTER EXPERIMENTS 591 12.1.1 MULTIPLE VALUES OF INPUT PARAMETERS 592
12.1.2 IMPLEMENTATION DETAILS 595 12.1.3 FURTHER APPLICATIONS 600 12.2
TOOLS FOR REPRESENTING FUNCTIONS 604 12.2.1 FUNCTIONS DEFINED BY STRING
FORMULAS 604 12.2.2 A UNIFIED INTERFACE TO FUNCTIONS 609 12.2.3
INTERACTIVE DRAWING OF FUNCTIONS 615 12.2.4 A NOTEBOOK FOR SELECTING
FUNCTIONS 619 12.3 SOLVING PARTIAL DIFFERENTIAL EQUATIONS 626 12.3.1
NUMERICAL METHODS FOR ID WAVE EQUATIONS 627 12.3.2 IMPLEMENTATIONS OF ID
WAVE EQUATIONS 630 12.3.3 CLASSES FOR SOLVING ID WAVE EQUATIONS 637
12.3.4 A PROBLEM SOLVING ENVIRONMENT 643 12.3.5 NUMERICAL METHODS FOR 2D
WAVE EQUATIONS 649 TABLE OF CONTENTS XIX 12.3.6 IMPLEMENTATIONS OF 2D
WAVE EQUATIONS 652 12.3.7 EXERCISES 661 A SETTING UP THE REQUIRED
SOFTWARE ENVIRONMENT... 663 A.I INSTALLATION ON UNIX SYSTEMS 663 A. 1.1
A SUGGESTED DIRECTORY STRUCTURE 663 A. 1.2 SETTING SOME ENVIRONMENT
VARIABLES 664 A. 1.3 INSTALLING TCL/TK AND ADDITIONAL MODULES 665 A.1.4
INSTALLING PYTHON 666 A.1.5 INSTALLING PYTHON MODULES 668 A.1.6
INSTALLING GNUPLOT 671 A.I.7 INSTALLING SWIG 672 A. 1.8 SUMMARY OF
ENVIRONMENT VARIABLES 672 A. 1.9 TESTING THE INSTALLATION OF SCRIPTING
UTILITIES 673 A.2 INSTALLATION ON WINDOWS SYSTEMS 673 B ELEMENTS OF
SOFTWARE ENGINEERING 679 B.I BUILDING AND USING MODULES 679 B.I.I
SINGLE-FILE MODULES 679 B.1.2 MULTI-FILE MODULES 683 B.I.3 DEBUGGING AND
TROUBLESHOOTING 684 B.2 TOOLS FOR DOCUMENTING PYTHON SOFTWARE 686 B.2.1
DOC STRINGS 686 B.2.2 TOOLS FOR AUTOMATIC DOCUMENTATION 688 B.3 CODING
STANDARDS 692 B.3.1 STYLE GUIDE 692 B.3.2 PYTHONIC PROGRAMMING 696 B.4
VERIFICATION OF SCRIPTS 701 B.4.1 AUTOMATING REGRESSION TESTS 701 B.4.2
IMPLEMENTING A TOOL FOR REGRESSION TESTS 705 B.4.3 WRITING A TEST SCRIPT
709 B.4.4 VERIFYING OUTPUT FROM NUMERICAL COMPUTATIONS .... 710 B.4.5
AUTOMATIC DOC STRING TESTING 714 B.4.6 UNIT TESTING 716 B.5 VERSION
CONTROL MANAGEMENT 718 B.6 EXERCISES 720 BIBLIOGRAPHY 725 INDEX 727
|
adam_txt |
HANS PETTER LANGTANGEN PYTHON SCRIPTING FOR COMPUTATIONAL SCIENCE SECOND
EDITION WITH 62 FIGURES 4Y SPRINGER TABLE OF CONTENTS 1 INTRODUCTION 1
1.1 SCRIPTING VERSUS TRADITIONAL PROGRAMMING 1 1.1.1 WHY SCRIPTING IS
USEFUL IN COMPUTATIONAL SCIENCE. . . 2 1.1.2 CLASSIFICATION OF
PROGRAMMING LANGUAGES 4 1.1.3 PRODUCTIVE PAIRS OF PROGRAMMING LANGUAGES
5 1.1.4 GLUING EXISTING APPLICATIONS 6 1.1.5 SCRIPTING YIELDS SHORTER
CODE 7 1.1.6 EFFICIENCY 8 1.1.7 TYPE-SPECIFICATION (DECLARATION) OF
VARIABLES 9 1.1.8 FLEXIBLE FUNCTION INTERFACES 11 1.1.9 INTERACTIVE
COMPUTING 12 1.1.10 CREATING CODE AT RUN TIME 13 1.1.11 NESTED
HETEROGENEOUS DATA STRUCTURES 14 1.1.12 GUI PROGRAMMING 16 1.1.13 MIXED
LANGUAGE PROGRAMMING 17 1.1.14 WHEN TO CHOOSE A DYNAMICALLY TYPED
LANGUAGE . 19 1.1.15 WHY PYTHON? 20 1.1.16 SCRIPT OR PROGRAM? 21 1.2
PREPARATIONS FOR WORKING WITH THIS BOOK 22 2 GETTING STARTED WITH PYTHON
SCRIPTING 27 2.1 A SCIENTIFIC HELLO WORLD SCRIPT 27 2.1.1 EXECUTING
PYTHON SCRIPTS 28 2.1.2 DISSECTION OF THE SCIENTIFIC HELLO WORLD SCRIPT
29 2.2 WORKING WITH FILES AND DATA 32 2.2.1 PROBLEM SPECIFICATION 32
2.2.2 THE COMPLETE CODE 33 2.2.3 DISSECTION 33 2.2.4 WORKING WITH FILES
IN MEMORY 36 2.2.5 ARRAY COMPUTING 37 2.2.6 INTERACTIVE COMPUTING AND
DEBUGGING 39 2.2.7 EFFICIENCY MEASUREMENTS 42 2.2.8 EXERCISES 43 2.3
GLUING STAND-ALONE APPLICATIONS 46 2.3.1 THE SIMULATION CODE 47 2.3.2
USING GNUPLOT TO VISUALIZE CURVES 49 2.3.3 FUNCTIONALITY OF THE SCRIPT
50 2.3.4 THE COMPLETE CODE 51 2.3.5 DISSECTION 53 2.3.6 EXERCISES 56 2.4
CONDUCTING NUMERICAL EXPERIMENTS 58 2.4.1 WRAPPING A LOOP AROUND ANOTHER
SCRIPT 59 L. XII TABLE OF CONTENTS 2.4.2 GENERATING AN HTML REPORT 60
2.4.3 MAKING ANIMATIONS 61 2.4.4 VARYING ANY PARAMETER 63 2.5 FILE
FORMAT CONVERSION 66 2.5.1 A SIMPLE READ/WRITE SCRIPT 66 2.5.2 STORING
DATA IN A DICTIONARIES AND LISTS 68 2.5.3 MAKING A MODULE WITH FUNCTIONS
69 2.5.4 EXERCISES 71 3 BASIC PYTHON 73 3.1 INTRODUCTORY TOPICS 74 3.1.1
RECOMMENDED PYTHON DOCUMENTATION 74 3.1.2 CONTROL STATEMENTS 75 3.1.3
RUNNING AN APPLICATION 76 3.1.4 FILE READING AND WRITING 78 3.1.5 OUTPUT
FORMATTING 79 3.2 VARIABLES OF DIFFERENT TYPES 81 3.2.1 BOOLEAN TYPES 81
3.2.2 THE NONE VARIABLE 81 3.2.3 NUMBERS AND NUMERICAL EXPRESSIONS 82
3.2.4 LISTS AND TUPLES 84 3.2.5 DICTIONARIES 90 3.2.6 SPLITTING AND
JOINING TEXT 93 3.2.7 STRING OPERATIONS 94 3.2.8 TEXT PROCESSING 96
3.2.9 THE BASICS OF A PYTHON CLASS 98 3.2.10 COPY AND ASSIGNMENT 100
3.2.11 DETERMINING A VARIABLE'S TYPE 104 3.2.12 EXERCISES 105 3.3
FUNCTIONS 109 3.3.1 KEYWORD ARGUMENTS 110 3.3.2 DOC STRINGS ILL 3.3.3
VARIABLE NUMBER OF ARGUMENTS 112 3.3.4 CALL BY REFERENCE 113 3.3.5
TREATMENT OF INPUT AND OUTPUT ARGUMENTS 115 3.3.6 FUNCTION OBJECTS 116
3.4 WORKING WITH FILES AND DIRECTORIES 117 3.4.1 LISTING FILES IN A
DIRECTORY 118 3.4.2 TESTING FILE TYPES 118 3.4.3 REMOVING FILES AND
DIRECTORIES 119 3.4.4 COPYING AND RENAMING FILES 120 3.4.5 SPLITTING
PATHNAMES 121 3.4.6 CREATING AND MOVING TO DIRECTORIES 122 3.4.7
TRAVERSING DIRECTORY TREES 122 3.4.8 EXERCISES 125 TABLE OF CONTENTS
XIII NUMERICAL COMPUTING IN PYTHON 131 4.1 A QUICK NUMPY PRIMER 133
4.1.1 CREATING ARRAYS 133 4.1.2 ARRAY INDEXING 134 4.1.3 ARRAY
COMPUTATIONS 136 4.1.4 TYPE TESTING 138 4.1.5 HIDDEN TEMPORARY ARRAYS
139 4.1.6 EXERCISES 140 4.2 VECTORIZED ALGORITHMS 141 4.2.1 FROM SCALAR
TO ARRAY IN FUNCTION ARGUMENTS 141 4.2.2 SLICING 143 4.2.3 REMARK ON
EFFICIENCY 144 4.2.4 EXERCISES 146 4.3 MORE ADVANCED ARRAY COMPUTING 147
4.3.1 RANDOM NUMBERS 147 4.3.2 LINEAR ALGEBRA 148 4.3.3 THE GNUPLOT
MODULE 150 4.3.4 EXAMPLE: CURVE FITTING 152 4.3.5 ARRAYS ON STRUCTURED
GRIDS 153 4.3.6 FILE I/O WITH NUMPY ARRAYS 157 4.3.7 READING AND WRITING
TABLES WITH NUMPY ARRAYS . . . 158 4.3.8 FUNCTIONALITY IN THE NUMPYTOOLS
MODULE 160 4.3.9 EXERCISES 163 4.4 OTHER TOOLS FOR NUMERICAL
COMPUTATIONS 168 4.4.1 THE SCIENTIFICPYTHON PACKAGE 168 4.4.2 THE SCIPY
PACKAGE 174 4.4.3 THE PYTHON-MATLAB INTERFACE 179 4.4.4 SOME USEFUL
PYTHON MODULES 180 COMBINING PYTHON WITH FORTRAN, C, AND C-\ *K * 183
5.1 ABOUT MIXED LANGUAGE PROGRAMMING 183 5.1.1 APPLICATIONS OF MIXED
LANGUAGE PROGRAMMING 184 5.1.2 CALLING C FROM PYTHON 184 5.1.3 AUTOMATIC
GENERATION OF WRAPPER CODE 186 5.2 SCIENTIFIC HELLO WORLD EXAMPLES 188
5.2.1 COMBINING PYTHON AND FORTRAN 189 5.2.2 COMBINING PYTHON AND C 194
5.2.3 COMBINING PYTHON AND C++ FUNCTIONS 199 5.2.4 COMBINING PYTHON AND
C++ CLASSES 202 5.2.5 EXERCISES 205 5.3 A SIMPLE COMPUTATIONAL STEERING
EXAMPLE 206 5.3.1 MODIFIED TIME LOOP FOR REPEATED SIMULATIONS 207 5.3.2
CREATING A PYTHON INTERFACE 208 5.3.3 THE STEERING PYTHON SCRIPT 210
5.3.4 EQUIPPING THE STEERING SCRIPT WITH A GUI 213 5.4 SCRIPTING
INTERFACES TO LARGE LIBRARIES 214 XIV TABLE OF CONTENTS 6 INTRODUCTION
TO GUI PROGRAMMING 219 6.1 SCIENTIFIC HELLO WORLD GUI 220 6.1.1
INTRODUCTORY TOPICS 220 6.1.2 THE FIRST PYTHON/TKINTER ENCOUNTER 222
6.1.3 BINDING EVENTS 225 6.1.4 CHANGING THE LAYOUT 226 6.1.5 THE FINAL
SCIENTIFIC HELLO WORLD GUI 230 6.1.6 AN ALTERNATIVE TO TKINTER VARIABLES
232 6.1.7 ABOUT THE PACK COMMAND 233 6.1.8 AN INTRODUCTION TO THE GRID
GEOMETRY MANAGER . 235 6.1.9 IMPLEMENTING A GUI AS A CLASS 237 6.1.10
A SIMPLE GRAPHICAL FUNCTION EVALUATOR 239 6.1.11 EXERCISES 240 6.2
ADDING GUIS TO SCRIPTS 243 6.2.1 A SIMULATION AND VISUALIZATION SCRIPT
WITH A GUI . . 243 6.2.2 IMPROVING THE LAYOUT 246 6.2.3 EXERCISES 248
6.3 A LIST OF COMMON WIDGET OPERATIONS 249 6.3.1 FRAME 252 6.3.2 LABEL
252 6.3.3 BUTTON 254 6.3.4 TEXT ENTRY 254 6.3.5 BALLOON HELP 256 6.3.6
OPTION MENU 257 6.3.7 SLIDER 257 6.3.8 CHECK BUTTON 258 6.3.9 MAKING A
SIMPLE MEGAWIDGET 258 6.3.10 MENU BAR 259 6.3.11 LIST DATA 261 6.3.12
LISTBOX 262 6.3.13 RADIO BUTTON 265 6.3.14 COMBO BOX 266 6.3.15 MESSAGE
BOX 267 6.3.16 USER-DEFINED DIALOGS 269 6.3.17 COLOR-PICKER DIALOGS 270
6.3.18 FILE SELECTION DIALOGS 273 6.3.19 TOPLEVEL 274 6.3.20 SOME OTHER
TYPES OF WIDGETS 275 6.3.21 ADAPTING WIDGETS TO THE USER'S RESIZE
ACTIONS 276 6.3.22 CUSTOMIZING FONTS AND COLORS 278 6.3.23 WIDGET
OVERVIEW 280 6.3.24 EXERCISES 282 TABLE OF CONTENTS XV 7 WEB INTERFACES
AND CGI PROGRAMMING 289 7.1 INTRODUCTORY CGI SCRIPTS 290 7.1.1 WEB FORMS
AND CGI SCRIPTS 291 7.1.2 GENERATING FORMS IN CGI SCRIPTS 293 7.1.3
DEBUGGING CGI SCRIPTS 295 7.1.4 A GENERAL SHELL SCRIPT WRAPPER FOR CGI
SCRIPTS 296 7.1.5 SECURITY ISSUES 298 7.2 ADDING WEB INTERFACES TO
SCRIPTS 300 7.2.1 A CLASS FOR FORM PARAMETERS 301 7.2.2 CALLING OTHER
PROGRAMS 303 7.2.3 RUNNING SIMULATIONS 304 7.2.4 GETTING A CGI SCRIPT TO
WORK 305 7.2.5 USING WEB APPLICATIONS FROM SCRIPTS 308 7.2.6 EXERCISES
310 8 ADVANCED PYTHON 313 8.1 MISCELLANEOUS TOPICS 313 8.1.1 PARSING
COMMAND-LINE ARGUMENTS 313 8.1.2 PLATFORM-DEPENDENT OPERATIONS 316 8.1.3
RUN-TIME GENERATION OF CODE 317 8.1.4 EXERCISES 318 8.2 REGULAR
EXPRESSIONS AND TEXT PROCESSING 320 8.2.1 MOTIVATION 320 8.2.2 SPECIAL
CHARACTERS 323 8.2.3 REGULAR EXPRESSIONS FOR REAL NUMBERS 325 8.2.4
USING GROUPS TO EXTRACT PARTS OF A TEXT 328 8.2.5 EXTRACTING INTERVAL
LIMITS 329 8.2.6 EXTRACTING MULTIPLE MATCHES 333 8.2.7 SPLITTING TEXT
338 8.2.8 PATTERN-MATCHING MODIFIERS 339 8.2.9 SUBSTITUTION AND
BACKREFERENCES 341 8.2.10 EXAMPLE: SWAPPING ARGUMENTS IN FUNCTION CALLS
. . . 342 8.2.11 A GENERAL SUBSTITUTION SCRIPT 345 8.2.12 DEBUGGING
REGULAR EXPRESSIONS 347 8.2.13 EXERCISES 349 8.3 TOOLS FOR HANDLING DATA
IN FILES 357 8.3.1 WRITING AND READING PYTHON DATA STRUCTURES 358 8.3.2
PICKLING OBJECTS 359 8.3.3 SHELVING OBJECTS 361 8.3.4 WRITING AND
READING ZIP AND TAR ARCHIVE FILES 362 8.3.5 DOWNLOADING INTERNET FILES
362 8.3.6 BINARY INPUT/OUTPUT 364 8.3.7 EXERCISES 366 8.4 A DATABASE FOR
NUMPY ARRAYS 367 8.4.1 THE STRUCTURE OF THE DATABASE 367 8.4.2 PICKLING
370 8.4.3 FORMATTED ASCII STORAGE 370 XVI TABLE OF CONTENTS 8.4.4
SHELVING 372 8.4.5 COMPARING THE VARIOUS TECHNIQUES 373 8.5 SCRIPTS
INVOLVING LOCAL AND REMOTE HOSTS 373 8.5.1 SECURE SHELL COMMANDS 374
8.5.2 DISTRIBUTED SIMULATION AND VISUALIZATION 375 8.5.3 CLIENT/SERVER
PROGRAMMING 377 8.5.4 THREADS 378 8.6 CLASSES 379 8.6.1 CLASS
PROGRAMMING 380 8.6.2 CHECKING THE CLASS TYPE 383 8.6.3 PRIVATE DATA 384
8.6.4 STATIC DATA 385 8.6.5 SPECIAL ATTRIBUTES 386 8.6.6 SPECIAL METHODS
386 8.6.7 MULTIPLE INHERITANCE 388 8.6.8 USING A CLASS AS A C-LIKE
STRUCTURE 388 8.6.9 ATTRIBUTE ACCESS VIA STRING NAMES 389 8.6.10
NEW-STYLE CLASSES 390 8.6.11 IMPLEMENTING GET/SET FUNCTIONS VIA
PROPERTIES 390 8.6.12 SUBCLASSING BUILT-IN TYPES 392 8.6.13 BUILDING
CLASS INTERFACES AT RUN TIME 394 8.6.14 BUILDING FLEXIBLE CLASS
INTERFACES 398 8.6.15 EXERCISES 404 8.7 SCOPE OF VARIABLES 408 8.7.1
GLOBAL, LOCAL, AND CLASS VARIABLES 408 8.7.2 NESTED FUNCTIONS 410 8.7.3
DICTIONARIES OF VARIABLES IN NAMESPACES 411 8.8 EXCEPTIONS 413 8.8.1
HANDLING EXCEPTIONS 413 8.8.2 RAISING EXCEPTIONS 415 8.9 ITERATORS 415
8.9.1 CONSTRUCTING AN ITERATOR 416 8.9.2 A POINTWISE GRID ITERATOR 418
8.9.3 A VECTORIZED GRID ITERATOR 421 8.9.4 GENERATORS 423 8.9.5 SOME
ASPECTS OF GENERIC PROGRAMMING 424 8.9.6 EXERCISES 428 8.10
INVESTIGATING EFFICIENCY 429 8.10.1 CPU-TIME MEASUREMENTS 430 8.10.2
PROFILING PYTHON SCRIPTS 433 8.10.3 OPTIMIZATION OF PYTHON CODE 434
8.10.4 CASE STUDY ON NUMERICAL EFFICIENCY 437 TABLE OF CONTENTS XVII 9
FORTRAN PROGRAMMING WITH NUMERICAL PYTHON ARRAYS 443 9.1 PROBLEM
DEFINITION 443 9.2 FILLING AN ARRAY IN FORTRAN 445 9.2.1 THE FORTRAN
SUBROUTINE 445 9.2.2 BUILDING AND INSPECTING THE EXTENSION MODULE 446
9.3 ARRAY STORAGE ISSUES 448 9.3.1 GENERATING AN ERRONEOUS INTERFACE 448
9.3.2 ARRAY STORAGE IN C AND FORTRAN 450 9.3.3 INPUT AND OUTPUT ARRAYS
AS FUNCTION ARGUMENTS . . . 451 9.3.4 F2PY INTERFACE FILES 458 9.3.5
HIDING WORK ARRAYS 462 9.4 INCREASING CALLBACK EFFICIENCY 463 9.4.1
CALLBACKS TO VECTORIZED PYTHON FUNCTIONS 463 9.4.2 AVOIDING CALLBACKS TO
PYTHON 466 9.4.3 COMPILED INLINE CALLBACK FUNCTIONS 466 9.5 SUMMARY 470
9.6 EXERCISES 470 10 C AND C++ PROGRAMMING WITH NUMERICAL PYTHON ARRAYS
475 10.1 C PROGRAMMING WITH NUMPY ARRAYS 476 10.1.1 THE BASICS OF THE
NUMPY C API 476 10.1.2 THE HANDWRITTEN EXTENSION CODE 478 10.1.3 SENDING
ARGUMENTS FROM PYTHON TO C 479 10.1.4 CONSISTENCY CHECKS 480 10.1.5
COMPUTING ARRAY VALUES 480 10.1.6 RETURNING AN OUTPUT ARRAY 483 10.1.7
CONVENIENT MACROS 484 10.1.8 MODULE INITIALIZATION 485 10.1.9 EXTENSION
MODULE TEMPLATE 486 10.1.10 COMPILING, LINKING, AND DEBUGGING THE MODULE
488 10.1.11 WRITING A WRAPPER FOR A C FUNCTION 489 10.2 C++ PROGRAMMING
WITH NUMPY ARRAYS 492 10.2.1 WRAPPING A NUMPY ARRAY IN A C++ OBJECT 493
10.2.2 USING SCXX 495 10.2.3 NUMPY-C++ CLASS CONVERSION 497 10.2.4
MIGRATING LOOPS TO C++ WITH WEAVE 505 10.3 COMPARISON OF THE
IMPLEMENTATIONS 506 10.3.1 EFFICIENCY 506 10.3.2 ERROR HANDLING 509
10.3.3 SUMMARY 510 10.4 EXERCISES 511 XVIII TABLE OF CONTENTS 11 MORE
ADVANCED GUI PROGRAMMING 515 11.1 ADDING PLOT AREAS IN GUIS 515 11.1.1
THE BLT GRAPH WIDGET 516 11.1.2 ANIMATION OF FUNCTIONS IN BLT GRAPH
WIDGETS 522 11.1.3 OTHER TOOLS FOR MAKING GUIS WITH PLOTS 524 11.1.4
EXERCISES 525 11.2 EVENT BINDINGS 527 11.2.1 BINDING EVENTS TO FUNCTIONS
WITH ARGUMENTS 528 11.2.2 A TEXT WIDGET WITH TAILORED KEYBOARD BINDINGS
. 530 11.2.3 A FANCY LIST WIDGET 533 11.3 ANIMATED GRAPHICS WITH
CANVAS WIDGETS 536 11.3.1 THE FIRST CANVAS ENCOUNTER 537 11.3.2
COORDINATE SYSTEMS 538 11.3.3 THE MATHEMATICAL MODEL CLASS 542 11.3.4
THE PLANET CLASS 543 11.3.5 DRAWING AND MOVING PLANETS 545 11.3.6
DRAGGING PLANETS TO NEW POSITIONS 546 11.3.7 USING PMW'S SCROLLED CANVAS
WIDGET 550 11.4 SIMULATION AND VISUALIZATION SCRIPTS 552 11.4.1
RESTRUCTURING THE SCRIPT 553 11.4.2 REPRESENTING A PARAMETER BY A CLASS
555 11.4.3 IMPROVED COMMAND-LINE SCRIPT 569 11.4.4 IMPROVED GUI SCRIPT
570 11.4.5 IMPROVED CGI SCRIPT 571 11.4.6 PARAMETERS WITH PHYSICAL
DIMENSIONS 572 11.4.7 ADDING A CURVE PLOT AREA 574 11.4.8 AUTOMATIC
GENERATION OF SCRIPTS 576 11.4.9 APPLICATIONS OF THE TOOLS 577 11.4.10
ALLOWING PHYSICAL UNITS IN INPUT FILES 582 11.4.11 CONVERTING INPUT
FILES TO GUIS 587 12 TOOLS AND EXAMPLES 591 12.1 RUNNING SERIES OF
COMPUTER EXPERIMENTS 591 12.1.1 MULTIPLE VALUES OF INPUT PARAMETERS 592
12.1.2 IMPLEMENTATION DETAILS 595 12.1.3 FURTHER APPLICATIONS 600 12.2
TOOLS FOR REPRESENTING FUNCTIONS 604 12.2.1 FUNCTIONS DEFINED BY STRING
FORMULAS 604 12.2.2 A UNIFIED INTERFACE TO FUNCTIONS 609 12.2.3
INTERACTIVE DRAWING OF FUNCTIONS 615 12.2.4 A NOTEBOOK FOR SELECTING
FUNCTIONS 619 12.3 SOLVING PARTIAL DIFFERENTIAL EQUATIONS 626 12.3.1
NUMERICAL METHODS FOR ID WAVE EQUATIONS 627 12.3.2 IMPLEMENTATIONS OF ID
WAVE EQUATIONS 630 12.3.3 CLASSES FOR SOLVING ID WAVE EQUATIONS 637
12.3.4 A PROBLEM SOLVING ENVIRONMENT 643 12.3.5 NUMERICAL METHODS FOR 2D
WAVE EQUATIONS 649 TABLE OF CONTENTS XIX 12.3.6 IMPLEMENTATIONS OF 2D
WAVE EQUATIONS 652 12.3.7 EXERCISES 661 A SETTING UP THE REQUIRED
SOFTWARE ENVIRONMENT. 663 A.I INSTALLATION ON UNIX SYSTEMS 663 A. 1.1
A SUGGESTED DIRECTORY STRUCTURE 663 A. 1.2 SETTING SOME ENVIRONMENT
VARIABLES 664 A. 1.3 INSTALLING TCL/TK AND ADDITIONAL MODULES 665 A.1.4
INSTALLING PYTHON 666 A.1.5 INSTALLING PYTHON MODULES 668 A.1.6
INSTALLING GNUPLOT 671 A.I.7 INSTALLING SWIG 672 A. 1.8 SUMMARY OF
ENVIRONMENT VARIABLES 672 A. 1.9 TESTING THE INSTALLATION OF SCRIPTING
UTILITIES 673 A.2 INSTALLATION ON WINDOWS SYSTEMS 673 B ELEMENTS OF
SOFTWARE ENGINEERING 679 B.I BUILDING AND USING MODULES 679 B.I.I
SINGLE-FILE MODULES 679 B.1.2 MULTI-FILE MODULES 683 B.I.3 DEBUGGING AND
TROUBLESHOOTING 684 B.2 TOOLS FOR DOCUMENTING PYTHON SOFTWARE 686 B.2.1
DOC STRINGS 686 B.2.2 TOOLS FOR AUTOMATIC DOCUMENTATION 688 B.3 CODING
STANDARDS 692 B.3.1 STYLE GUIDE 692 B.3.2 PYTHONIC PROGRAMMING 696 B.4
VERIFICATION OF SCRIPTS 701 B.4.1 AUTOMATING REGRESSION TESTS 701 B.4.2
IMPLEMENTING A TOOL FOR REGRESSION TESTS 705 B.4.3 WRITING A TEST SCRIPT
709 B.4.4 VERIFYING OUTPUT FROM NUMERICAL COMPUTATIONS . 710 B.4.5
AUTOMATIC DOC STRING TESTING 714 B.4.6 UNIT TESTING 716 B.5 VERSION
CONTROL MANAGEMENT 718 B.6 EXERCISES 720 BIBLIOGRAPHY 725 INDEX 727 |
any_adam_object | 1 |
any_adam_object_boolean | 1 |
author | Langtangen, Hans Petter 1962- |
author_GND | (DE-588)1019109599 |
author_facet | Langtangen, Hans Petter 1962- |
author_role | aut |
author_sort | Langtangen, Hans Petter 1962- |
author_variant | h p l hp hpl |
building | Verbundindex |
bvnumber | BV021510549 |
callnumber-first | Q - Science |
callnumber-label | QA76 |
callnumber-raw | QA76.73.P98 |
callnumber-search | QA76.73.P98 |
callnumber-sort | QA 276.73 P98 |
callnumber-subject | QA - Mathematics |
classification_rvk | ST 250 ST 260 |
ctrlnum | (OCoLC)181481282 (DE-599)BVBBV021510549 |
dewey-full | 004 502.855133 |
dewey-hundreds | 000 - Computer science, information, general works 500 - Natural sciences and mathematics |
dewey-ones | 004 - Computer science 502 - Miscellany |
dewey-raw | 004 502.855133 |
dewey-search | 004 502.855133 |
dewey-sort | 14 |
dewey-tens | 000 - Computer science, information, general works 500 - Natural sciences and mathematics |
discipline | Allgemeine Naturwissenschaft Informatik |
discipline_str_mv | Allgemeine Naturwissenschaft Informatik |
edition | 2. ed. |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01892nam a2200481 cb4500</leader><controlfield tag="001">BV021510549</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20070411 </controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">060314s2006 d||| |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">3540294155</subfield><subfield code="9">3-540-29415-5</subfield></datafield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9783540294153</subfield><subfield code="9">978-3-540-29415-3</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)181481282</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)BVBBV021510549</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">rakwb</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-20</subfield><subfield code="a">DE-29T</subfield><subfield code="a">DE-11</subfield></datafield><datafield tag="050" ind1=" " ind2="0"><subfield code="a">QA76.73.P98</subfield></datafield><datafield tag="082" ind1="0" ind2=" "><subfield code="a">004</subfield></datafield><datafield tag="082" ind1="0" ind2=" "><subfield code="a">502.855133</subfield><subfield code="2">22</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 250</subfield><subfield code="0">(DE-625)143626:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 260</subfield><subfield code="0">(DE-625)143632:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Langtangen, Hans Petter</subfield><subfield code="d">1962-</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)1019109599</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">Python scripting for computational science</subfield><subfield code="c">Hans Petter Langtangen</subfield></datafield><datafield tag="250" ind1=" " ind2=" "><subfield code="a">2. ed.</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Berlin [u.a.]</subfield><subfield code="b">Springer</subfield><subfield code="c">2006</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">XXIV, 736 S.</subfield><subfield code="b">graph. Darst.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="490" ind1="1" ind2=" "><subfield code="a">Texts in computational science and engineering</subfield><subfield code="v">3</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Datenverarbeitung</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Naturwissenschaft</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Python (Computer program language)</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Science</subfield><subfield code="x">Data processing</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Python</subfield><subfield code="g">Programmiersprache</subfield><subfield code="0">(DE-588)4434275-5</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Wissenschaftliches Rechnen</subfield><subfield code="0">(DE-588)4338507-2</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">Wissenschaftliches Rechnen</subfield><subfield code="0">(DE-588)4338507-2</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2="1"><subfield code="a">Python</subfield><subfield code="g">Programmiersprache</subfield><subfield code="0">(DE-588)4434275-5</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="830" ind1=" " ind2="0"><subfield code="a">Texts in computational science and engineering</subfield><subfield code="v">3</subfield><subfield code="w">(DE-604)BV016971315</subfield><subfield code="9">3</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">HEBIS Datenaustausch Darmstadt</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=014727178&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="999" ind1=" " ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-014727178</subfield></datafield></record></collection> |
id | DE-604.BV021510549 |
illustrated | Illustrated |
index_date | 2024-07-02T14:18:41Z |
indexdate | 2024-07-09T20:37:27Z |
institution | BVB |
isbn | 3540294155 9783540294153 |
language | English |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-014727178 |
oclc_num | 181481282 |
open_access_boolean | |
owner | DE-20 DE-29T DE-11 |
owner_facet | DE-20 DE-29T DE-11 |
physical | XXIV, 736 S. graph. Darst. |
publishDate | 2006 |
publishDateSearch | 2006 |
publishDateSort | 2006 |
publisher | Springer |
record_format | marc |
series | Texts in computational science and engineering |
series2 | Texts in computational science and engineering |
spelling | Langtangen, Hans Petter 1962- Verfasser (DE-588)1019109599 aut Python scripting for computational science Hans Petter Langtangen 2. ed. Berlin [u.a.] Springer 2006 XXIV, 736 S. graph. Darst. txt rdacontent n rdamedia nc rdacarrier Texts in computational science and engineering 3 Datenverarbeitung Naturwissenschaft Python (Computer program language) Science Data processing Python Programmiersprache (DE-588)4434275-5 gnd rswk-swf Wissenschaftliches Rechnen (DE-588)4338507-2 gnd rswk-swf Wissenschaftliches Rechnen (DE-588)4338507-2 s Python Programmiersprache (DE-588)4434275-5 s DE-604 Texts in computational science and engineering 3 (DE-604)BV016971315 3 HEBIS Datenaustausch Darmstadt application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=014727178&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis |
spellingShingle | Langtangen, Hans Petter 1962- Python scripting for computational science Texts in computational science and engineering Datenverarbeitung Naturwissenschaft Python (Computer program language) Science Data processing Python Programmiersprache (DE-588)4434275-5 gnd Wissenschaftliches Rechnen (DE-588)4338507-2 gnd |
subject_GND | (DE-588)4434275-5 (DE-588)4338507-2 |
title | Python scripting for computational science |
title_auth | Python scripting for computational science |
title_exact_search | Python scripting for computational science |
title_exact_search_txtP | Python scripting for computational science |
title_full | Python scripting for computational science Hans Petter Langtangen |
title_fullStr | Python scripting for computational science Hans Petter Langtangen |
title_full_unstemmed | Python scripting for computational science Hans Petter Langtangen |
title_short | Python scripting for computational science |
title_sort | python scripting for computational science |
topic | Datenverarbeitung Naturwissenschaft Python (Computer program language) Science Data processing Python Programmiersprache (DE-588)4434275-5 gnd Wissenschaftliches Rechnen (DE-588)4338507-2 gnd |
topic_facet | Datenverarbeitung Naturwissenschaft Python (Computer program language) Science Data processing Python Programmiersprache Wissenschaftliches Rechnen |
url | http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=014727178&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |
volume_link | (DE-604)BV016971315 |
work_keys_str_mv | AT langtangenhanspetter pythonscriptingforcomputationalscience |