Python for Scientific Computing.
|
|
|
- Jordan Hunt
- 10 years ago
- Views:
Transcription
1
2 Course Goals Simply: to learn how to use python to do Numerical analysis Data analysis Plotting and visualizations Symbol mathematics Write applications...
3 Why Python? Very high-level language Provides many complex data-structures (lists, dictionaries,...) Your code is shorter than a comparable algorithm in a compiled language Many powerful libraries to perform complex tasks Parse structured inputs files send interact with the operating system make plots make GUIs do scientific computations... Easy to prototype new tools Cross-platform and Free
4 Why Python? Dynamically-typed Object-oriented foundation Extensible (easy to call Fortran, C/C++,...) Automatic memory management (garbage collection) Ease of readability (whitespace matters)... and for this course... Very widely adopted in the scientific community Mostly due to the very powerful array library NumPy
5 Python (xkcd)
6 Hello, World! If you have python installed properly, you can start python simply by typing python at your command line prompt The python shell will come up Our hello world program is simply: print Hello, World! Or, in python 3.x (more on this later...): print( Hello World )
7 Communities Many scientific disciplines have their own python communities that Provide tutorials Cookbooks Libraries to do standard analysis in the field For the most part, these uild on the Open nature of python I've put links on our course page to some information on the python communities for: Astronomy Atmospheric Science Biology Cognitive Science Psychology Let me know of any others!
8 Scientific Python Stack Most scientific libraries in python build on the Scientific Python stack: (scipy.org)
9 Starters... Before we get into python, we'll review some of the core ideas about numerical computing
10 Basics of Computation Computers store information and allow us to operate on it. That's basically it. Computers have finite memory, so it is not possible to store the infinite range of numbers that exist in the real world, so approximations are made. Great floating point reference What Every Computer Scientist Should Know About Floating-Point Arithmetic by D. Goldberg
11 Integers Basic unit of information in a computer is a bit: 0 or 1 8 bits = 1 byte Different types of information require more bits/bytes to store. A logical (T or F) can be stored in a single bit. C/C++: bool datatype Fortran: logical datatype Integers: Standard in many languages is 4-bytes. This allows for distinct values. This can store: -2,147,483,648 to 2,147,483,647 (signed) C/C++: int (usually) or int32_t Fortran: integer or integer*4 Or it can store: 0 to 4,294,967,295 (unsigned) C/C++: uint or uint32_t Fortran (as of 95): unsigned
12 Integers Integers (continued): Sometimes 2-bytes. This allows for distinct values. This can store: -32,768 to 32,767 (signed) C/C++: short (usually) or int16_t Fortran: integer*2 Or it can store: 0 to 65,535 (unsigned) C/C++: uint16_t Fortran (as of 95): unsigned*2 Note for IDL users: the standard integer in IDL is a 2-byte integer. If you do i = 2 that's 2-bytes. To get a 4-byte integer, do: i = 2l
13 Overflow (xkcd) Overflow example...
14 Overflow iold = -1 i = 1 type_init = type(i) print "type currently: ", type_init while (i > iold): print i iold = i i *= 2 if (not type(i) == type_init): print "type changed, now: ", type(i) break print i
15 Integers Python allows for the date size of the integer to scale with the size of the number: Initially, it is the largest value supported in hardware on a machine (64-bits on a 64-bit machine see sys.maxint def fac(x): if (x == 0): return 1 else: return x*fac(x-1) a = fac(52) print a print a.bit_length() This prints: Note: python 3.x does away with the distinction between int and long altogether.
16 Real Numbers Floating point format Infinite real numbers on the number line need to be represented by a finite number of bits Approximations made Finite number of decimal places stored, maximum range of exponents. Not every number can be represented. In base-2 (what a computer uses), 0.1 does not have an exact representation (see S 2.1 of Goldberg)
17 Exact Representations 0.1 as represented by a computer: >>> b = 0.1 >>> print type(b) <type 'float'> >>> print "{:30.20}.format(b) >>> import sys >>> print sys.float_info
18 Floating Point In the floating point format, a number is represented by a significand (or mantissa), and exponent, and a sign. Base 2 is used (since we are using bits) 0.1 ~ ( ) 2-4 All significand's will start with 1, so it is not stored Single precision: significand Sign: 1 bit; exponent: 8 bits; significand: 24 bits (23 stored) = 32 bits Range: in exponent (because of sign) = multiplier ~ Decimal precision: ~6 significant digits Double precision: Sign: 1 bit; exponent: 11 bits; significand: 53 bits (52 stored) = 64 bits Range: in exponent = multiplier ~ Decimal precision: ~15 significant digits
19 Floating Point Overflows and underflows can still occur when you go outside the representable range. The floating-point standard will signal these (and compilers can catch them) Some special numbers: NaN = 0/0 or Inf is for overflows, like 1/0 Both of these allow the program to continue, and both can be trapped (and dealt with) -0 is a valid number, and -0 = 0 in comparison Floating point is governed by an IEEE standard Ensures all machines do the same thing Aggressive compiler optimizations can break the standard
20 Numerical Precision Finite number of bits used to represent #s means there is a finite precision, the machine epsilon, ε One way to find this is to ask when 1 + ε = 1 x = 1.0 eps = 1.0 while (not x + eps == x): eps = eps/2.0 # machine precision is 2*eps, since that was the last # value for which 1 + eps was not 1 print 2*eps This gives e-16
21 Numerical Precision This means that most real numbers do not have an exact representation on a computer. Spacing between numbers varies with the size of numbers Relative spacing is constant
22 Round-off Error Round-off error is the error arising from the fact that no every number is exactly representable in the finite precision floating point format. Can accumulate in a program over many arithmetic operations
23 Round-off Example 1 (Yakowitz & Szidarovszky) Imagine that we can only keep track of 4 significant digits Compute Take Keeping only 4 digits each step of the way, We've lost a lot of precision Instead, consider: Then
24 Comparing Floating Point #s When comparing two floating point #s, we need to be careful If you want to check whether 2 computed values are equal, instead of asking if it is safer to ask whether they agree to within some tolerance
25 Associative Property You learned in grade school that: (a + b) + c = a + (b + c) Not true with floating point You can use parenthesizes to force order of operations If you want to enforce a particular association, use parenthesis
26 Computer Languages You can write any algorithm in any programming language they all provide the necessary logical constructs However, some languages make things much easier than others C Excellent low-level machine access (operating systems are written in C) Multidimensional arrays are kludgy Fortran (Formula Translate) One of the earliest complied languages Large code base of legacy code Modern Fortran offers many more conveniences than old Fortran Great support for arrays Python Offers many high-level data-structures (lists, dictionaries, arrays) Great for quick prototyping, analysis, experimentation Increasingly popular in scientific computing
27 Computer Languages IDL C++ Others Proprietary Great array language Modern (like object-oriented programming) features break the clean-ness of the language Ruby, Perl, shell scripts,...
28 Computer Languages Compiled languages (Fortran, C, C++,...) Compiled into machine code machine specific Produce faster code (no interpretation is needed) Can offer lower level system access (especially C) Interpreted languages (python, IDL, perl, Java (kind-of)...) Not converted into machine code, but instead interpreted by the interpreter Great for prototyping Can modify itself while running Platform independent Often has dynamic typing and scoping Many offer garbage collection
29 Computer Languages Vector languages Some languages are designed to operate on entire arrays at once (python + NumPy, many Fortran routines, IDL,...) For interpreted languages, getting reasonable performance requires operating on arrays instead of explicitly writing loops Low level routines are written in compiled language and do the loop behind the scenes We'll see this in some detail when we discuss python Next-generation computing = GPUs? Hardware is designed to do the same operations on many pieces of data at the same time
30 Object-Oriented Languages Python is an object-oriented language Think of an object as a container that holds both data and functions (methods) that know how to operate on that date. Objects are build from a datatype called a class you can create as many instances (objects) from a class as memory allows Each object will have its own memory allocated Objects provide a convenient way to package up data In Fortran, think of a derived type that also has it's own functions In C, think of a struct that, again, also has it's own functions Everything, even integers, etc. is an object
31 Programming Paradigms (Wikipedia)
32 Roundoff vs. Truncation Error Roundoff error is just one of the errors we deal with Translating continuous mathematical expressions into discrete forms introduces truncation error Consider the Taylor series expansion for sine: If x is small, then we can neglect the higher-order terms (we truncate the series). This introduces an error.
33 Potential Topics General python Plotting / visualization Advanced python / special modules matplotlib Regular expressions MayaVi Command line/input file parsing Workflow management with IPython Filesystem operations NumPy SciPy and numerical methods Integration ODEs Extending python w/ Fortran and C/C++ Symbolic math with SymPy Writing python applications GUI programming Curve fitting/optimization Unit testing Interpolation Signal processing (FFT) Linear algebra Python and the Raspberry Pi? Others?
34 Python 2.x vs. Python 3 See Mostly about cleaning up the language and making things consistent e.g. print is a statement in python 2.x but a function in 3.x Some trivial differences.pyc are now stored in a pycache directory Some gotyas: 1/2 will give different results between python 2 and 3 It's possible to write code that works with both python 2 and 3 often we will do so by importing from future
35 Python 2.x vs. Python 3 Write for both In python 2.6+, do from future import print_function and then use the new print() style exec cmd becomes exec(cmd) Some small changes to how init.py are done (more on this later) One some systems, you can have python 2.x and 3.x installed side by side May need to install packages twice, e.g. python-numpy and python3-numpy
36 Introduction to Python
37 Class Participation We'll learn by interactively trying out some ideas and looking at code I want to learn from all of you share you experiences and expertise We'll use the Discussion Forum on Blackboard to interact with oneanother outside of class. Try out ideas and report to the class what you've learned I can set up an account for you on one of my Linux servers if you want a place to try things out (you would log in remotely)
38 Who Are We? Physics Ecology & Evolution Sociology Biology / Applied Ecology / Evolution Cognitive Science Integrative Neuroscience Applied Math & Statistics Mechanical Engineering Psychology Marine and Atmospheric Science Earth & Space Science Geoscience
39 What Do You Want To Learn? From your posts (in some order by popularity): Replace R / matlab (most popular) General (scientific) programming Data analysis Plotting & Visualization (including 3-d visualization) Interacting with experiments (a la PsychoPy) High performance computing Curve / parameter fitting General scripting / glue for C + Fortran programs
40 Python Shell This is the standard (and most basic) interactive way to use python Runs in a terminal window Provides basic interactivity with the python language Simply type python at your command prompt You can scroll back through the history using the arrows
41 IPython Shell Type ipython at your prompt Like the standard shell, this runs in a terminal, but provides many conviences (type %quickref to see an overview) Scrollback history preserved between sessions Build-in help with? function-name? object? Magics (%lsmagic lists all the magic functions) %run script: runs a script %timeit: times a command Lots of magics to deal with command history (including %history) Tab completion Run system commands (prefix with a!) Last 3 output objects are referred to via _,,
42 IPython Notebooks A web-based environment that combines code and output, plots, plain text/stylized headings, LaTeX (later versions),... Notebooks can be saved and shared Viewable on the web via: Provides a complete view of your entire workflow Start with ipython notebook I'll provide notebooks for a lot of the lectures to follow so you can play along on your own
43 Python Scripts Scripts are a non-interactive means of writing python code filename.py Can be executable by adding: #!/usr/bin/env python as the first line and setting the executable bit for the file This is also the way that you write python modules that can be import-ed into other python code (more on that later...)
44 Intro to Python: Data Types Python has the same basic data types as most languages: integer, floating point, complex, strings data type IPython notebook And it has more complex data structures, including lists and dictionaries built-in advanced data type IPython notebook
45 Lists vs. Arrays Lists (note that python lists are not implemented as a simple linked-list: see ) Implemented as a variable-length array Can store multiple different datatypes in a single list Easy to add items to the end (increasing list length) Accessing a[i] is independent of list length (unlike a traditional linked list) Arrays: Generally used for fixed-length, homogeneous data Less overhead than a list We'll use a special array library (NumPy) for performance later
46 Intro to Python: Control Flow Python uses indentation to denote blocks of code (no explicit endif, enddo,...) Control flow via. while, if, for,... Can iterate over items in a list very useful control flow IPython notebook
47 Intro to Python: Functions No distinction between functions and procedures/subroutines Always return something. If not explicitly set, then None Can have default values for arguments, optional arguments, variable number of arguments Can return multiple values, objects Function examples...
48 Intro to Python: Classes Classes are a fundamental concept of object-oriented programming An object is an instance of a class Carries data (state) and has methods that can act on that data Objects are easy to pass around Simplest use is just as a container to carry associated data together (similar to a struct in C) Inheritance, operator overloading,... all supported. See the tutorial. Classes example...
49 Intro to Python: Modules Modules are a collection of python statements, functions, variables, grouped together in a file ending with.py Can be imported to be used by any routine Python includes a host of useful modules You can define your own. Python will look in the current directory and then in the PYTHONPATH Modules have their own namespace Variables (even global variables) don't clash with those with the same name in the importing program You can change the name of a module on import or import it into the current namespace (*). General practice: put all the imports at the top of your code
50 Intro to Python: Modules Example: profile.py a simple timing module for measuring code performance In the python shell: import profile help(profile) Note that this module can also be run on its own if name == " main ": clause at the end Let's look at an example of using this module in a notebook
51 Intro to Python: Exceptions Exceptions are raised if an action you tried (e.g. opening a file) fails. Left alone, the code will abort, printing the exception You can catch the exception, and take appropriate action to fix the situation Built-in exceptions have particular names that let you check for specific failure modes Allows you to write robust code for other users Exceptions example...
52 Intro to Python: I/O Basic I/O File I/O CSV reading INI file reading
53 Caveats Slicing (we'll look at this with arrays soon) Function defaults: default values are only evaluated once. From python tutorial: def f(a, L=[]): L.append(a) return L Prints: print f(1) print f(2) print f(3) [1] [1, 2] [1, 2, 3] Correct way: def f(a, L=None): if L is None: L = [] L.append(a) return L
Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.
ERRORS and COMPUTER ARITHMETIC Types of Error in Numerical Calculations Initial Data Errors: from experiment, modeling, computer representation; problem dependent but need to know at beginning of calculation.
Intro to scientific programming (with Python) Pietro Berkes, Brandeis University
Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Next 4 lessons: Outline Scientific programming: best practices Classical learning (Hoepfield network) Probabilistic learning
Programming Languages & Tools
4 Programming Languages & Tools Almost any programming language one is familiar with can be used for computational work (despite the fact that some people believe strongly that their own favorite programming
Introduction to Python
Introduction to Python Sophia Bethany Coban Problem Solving By Computer March 26, 2014 Introduction to Python Python is a general-purpose, high-level programming language. It offers readable codes, and
Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies:
Exercise 0 Deadline: None Computer Setup Windows Download Python(x,y) via http://code.google.com/p/pythonxy/wiki/downloads and install it. Make sure that before installation the installer does not complain
ECE 0142 Computer Organization. Lecture 3 Floating Point Representations
ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,
Introduction to Python
1 Daniel Lucio March 2016 Creator of Python https://en.wikipedia.org/wiki/guido_van_rossum 2 Python Timeline Implementation Started v1.0 v1.6 v2.1 v2.3 v2.5 v3.0 v3.1 v3.2 v3.4 1980 1991 1997 2004 2010
Postprocessing with Python
Postprocessing with Python Boris Dintrans (CNRS & University of Toulouse) [email protected] Collaborator: Thomas Gastine (PhD) Outline Outline Introduction - what s Python and why using it? - Installation
We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.
LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.
Scientific Programming, Analysis, and Visualization with Python. Mteor 227 Fall 2015
Scientific Programming, Analysis, and Visualization with Python Mteor 227 Fall 2015 Python The Big Picture Interpreted General purpose, high-level Dynamically type Multi-paradigm Object-oriented Functional
Computational Mathematics with Python
Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40
Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage
Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running
Computational Mathematics with Python
Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
C++ Programming Language
C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract
McGraw-Hill The McGraw-Hill Companies, Inc., 20 1. 01 0
1.1 McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Objectives: To describe the evolution of programming languages from machine language to high-level languages. To understand how a program in a high-level
Computational Mathematics with Python
Numerical Analysis, Lund University, 2011 1 Computational Mathematics with Python Chapter 1: Basics Numerical Analysis, Lund University Claus Führer, Jan Erik Solem, Olivier Verdier, Tony Stillfjord Spring
CIS 192: Lecture 13 Scientific Computing and Unit Testing
CIS 192: Lecture 13 Scientific Computing and Unit Testing Lili Dworkin University of Pennsylvania Scientific Computing I Python is really popular in the scientific and statistical computing world I Why?
Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs 1 Objectives To understand the respective roles of hardware and software in a computing system. To learn what computer
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
CS 40 Computing for the Web
CS 40 Computing for the Web Art Lee January 20, 2015 Announcements Course web on Sakai Homework assignments submit them on Sakai Email me the survey: See the Announcements page on the course web for instructions
Numerical Matrix Analysis
Numerical Matrix Analysis Lecture Notes #10 Conditioning and / Peter Blomgren, [email protected] Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research
Fall 2012 Q530. Programming for Cognitive Science
Fall 2012 Q530 Programming for Cognitive Science Aimed at little or no programming experience. Improve your confidence and skills at: Writing code. Reading code. Understand the abilities and limitations
Crash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs 1 The Universal Machine n A computer -- a machine that stores and manipulates information under the control of a
Data Storage: Each time you create a variable in memory, a certain amount of memory is allocated for that variable based on its data type (or class).
Data Storage: Computers are made of many small parts, including transistors, capacitors, resistors, magnetic materials, etc. Somehow they have to store information in these materials both temporarily (RAM,
Chapter 12 Programming Concepts and Languages
Chapter 12 Programming Concepts and Languages Chapter 12 Programming Concepts and Languages Paradigm Publishing, Inc. 12-1 Presentation Overview Programming Concepts Problem-Solving Techniques The Evolution
Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class
Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs Objectives Introduction to the class Why we program and what that means Introduction to the Python programming language
Python. Python. 1 Python. M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 1 / 25
Python 1 Python M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 1 / 25 Python makes you fly M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 2 / 25 Let s start ipython vs python
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages Nicki Dell Spring 2014 What is a Programming Language? A set of symbols and associated tools that translate (if necessary) collections
Programming Languages
Programming Languages Qing Yi Course web site: www.cs.utsa.edu/~qingyi/cs3723 cs3723 1 A little about myself Qing Yi Ph.D. Rice University, USA. Assistant Professor, Department of Computer Science Office:
Chemical and Biological Engineering Calculations using Python 3. Jeffrey J. Heys
Chemical and Biological Engineering Calculations using Python 3 Jeffrey J. Heys Copyright c 2014 Jeffrey Heys All rights reserved. This version is being made available at no cost. Please acknowledge access
CRASH COURSE PYTHON. Het begint met een idee
CRASH COURSE PYTHON nr. Het begint met een idee This talk Not a programming course For data analysts, who want to learn Python For optimizers, who are fed up with Matlab 2 Python Scripting language expensive
Introduction to Python
Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment
AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables
AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning
DNA Data and Program Representation. Alexandre David 1.2.05 [email protected]
DNA Data and Program Representation Alexandre David 1.2.05 [email protected] Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued
Chapter 13: Program Development and Programming Languages
Understanding Computers Today and Tomorrow 12 th Edition Chapter 13: Program Development and Programming Languages Learning Objectives Understand the differences between structured programming, object-oriented
Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit
Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until
An Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Chapter 1. Dr. Chris Irwin Davis Email: [email protected] Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages
Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: [email protected] Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:
Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how
CS321. Introduction to Numerical Methods
CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506-0633 August 7, 05 Number in
Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1
Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1
Introduction to Python
WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language
COSC 6397 Big Data Analytics. 2 nd homework assignment Pig and Hive. Edgar Gabriel Spring 2015
COSC 6397 Big Data Analytics 2 nd homework assignment Pig and Hive Edgar Gabriel Spring 2015 2 nd Homework Rules Each student should deliver Source code (.java files) Documentation (.pdf,.doc,.tex or.txt
Course MS10975A Introduction to Programming. Length: 5 Days
3 Riverchase Office Plaza Hoover, Alabama 35244 Phone: 205.989.4944 Fax: 855.317.2187 E-Mail: [email protected] Web: www.discoveritt.com Course MS10975A Introduction to Programming Length: 5 Days
CSC230 Getting Starting in C. Tyler Bletsch
CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly
System Structures. Services Interface Structure
System Structures Services Interface Structure Operating system services (1) Operating system services (2) Functions that are helpful to the user User interface Command line interpreter Batch interface
FEEG6002 - Applied Programming 5 - Tutorial Session
FEEG6002 - Applied Programming 5 - Tutorial Session Sam Sinayoko 2015-10-30 1 / 38 Outline Objectives Two common bugs General comments on style String formatting Questions? Summary 2 / 38 Objectives Revise
Getting Started with the Internet Communications Engine
Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2
CHAPTER 5 Round-off errors
CHAPTER 5 Round-off errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any
Numbering Systems. InThisAppendix...
G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal
CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler
CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler 1) Operating systems a) Windows b) Unix and Linux c) Macintosh 2) Data manipulation tools a) Text Editors b) Spreadsheets
6.170 Tutorial 3 - Ruby Basics
6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you
Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1
Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be
Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart
Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart Overview Due Thursday, November 12th at 11:59pm Last updated
Precision & Performance: Floating Point and IEEE 754 Compliance for NVIDIA GPUs
Precision & Performance: Floating Point and IEEE 754 Compliance for NVIDIA GPUs Nathan Whitehead Alex Fit-Florea ABSTRACT A number of issues related to floating point accuracy and compliance are a frequent
Scientific Programming in Python
UCSD March 9, 2009 What is Python? Python in a very high level (scripting) language which has gained widespread popularity in recent years. It is: What is Python? Python in a very high level (scripting)
ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science
ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and
Invitation to Ezhil : A Tamil Programming Language for Early Computer-Science Education 07/10/13
Invitation to Ezhil: A Tamil Programming Language for Early Computer-Science Education Abstract: Muthiah Annamalai, Ph.D. Boston, USA. Ezhil is a Tamil programming language with support for imperative
A Python Tour: Just a Brief Introduction CS 303e: Elements of Computers and Programming
A Python Tour: Just a Brief Introduction CS 303e: Elements of Computers and Programming "The only way to learn a new programming language is by writing programs in it." -- B. Kernighan and D. Ritchie "Computers
Data Storage 3.1. Foundations of Computer Science Cengage Learning
3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how
Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: [email protected] Alfonso Ortega: alfonso.ortega@uam.
Compilers Spring term Mick O Donnell: [email protected] Alfonso Ortega: [email protected] Lecture 1 to Compilers 1 Topic 1: What is a Compiler? 3 What is a Compiler? A compiler is a computer
PGR Computing Programming Skills
PGR Computing Programming Skills Dr. I. Hawke 2008 1 Introduction The purpose of computing is to do something faster, more efficiently and more reliably than you could as a human do it. One obvious point
Programming Languages CIS 443
Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception
Apache Thrift and Ruby
Apache Thrift and Ruby By Randy Abernethy In this article, excerpted from The Programmer s Guide to Apache Thrift, we will install Apache Thrift support for Ruby and build a simple Ruby RPC client and
High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)
High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
Decision Logic: if, if else, switch, Boolean conditions and variables
CS 1044 roject 3 Fall 2009 Decision Logic: if, if else, switch, Boolean conditions and variables This programming assignment uses many of the ideas presented in sections 3 through 5 of the Dale/Weems text
Slides from INF3331 lectures - web programming in Python
Slides from INF3331 lectures - web programming in Python Joakim Sundnes & Hans Petter Langtangen Dept. of Informatics, Univ. of Oslo & Simula Research Laboratory October 2013 Programming web applications
Semester Review. CSC 301, Fall 2015
Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!
Exploring Algorithms with Python
Exploring Algorithms with Python Dr. Chris Mayfield Department of Computer Science James Madison University Oct 16, 2014 What is Python? From Wikipedia: General-purpose, high-level programming language
This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers
This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition
CS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper
Evolution of the Major Programming Languages
142 Evolution of the Major Programming Languages Object Oriented Programming: Smalltalk Object-Oriented: It s fundamental characteristics are: Data abstraction, Inheritance and Dynamic Binding. The essence
CS 51 Intro to CS. Art Lee. September 2, 2014
CS 51 Intro to CS Art Lee September 2, 2014 Announcements Course web page at: http://www.cmc.edu/pages/faculty/alee/cs51/ Homework/Lab assignment submission on Sakai: https://sakai.claremont.edu/portal/site/cx_mtg_79055
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
Charles Dierbach. Wiley
Charles Dierbach Wiley Contents Preface Acknowledgments About the Author XXI xxv xxvii Introduction 1 MOTIVATION 2 FUNDAMENTALS 2 1.1 What Is Computer Science? 2 1.1.1 The Essence of Computational Problem
HPC Wales Skills Academy Course Catalogue 2015
HPC Wales Skills Academy Course Catalogue 2015 Overview The HPC Wales Skills Academy provides a variety of courses and workshops aimed at building skills in High Performance Computing (HPC). Our courses
ANSA and μeta as a CAE Software Development Platform
ANSA and μeta as a CAE Software Development Platform Michael Giannakidis, Yianni Kolokythas BETA CAE Systems SA, Thessaloniki, Greece Overview What have we have done so far Current state Future direction
#820 Computer Programming 1A
Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1
Computer Programming I
Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,
The Clean programming language. Group 25, Jingui Li, Daren Tuzi
The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal
2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal
Introduction to the course, Eclipse and Python
As you arrive: 1. Start up your computer and plug it in. 2. Log into Angel and go to CSSE 120. Do the Attendance Widget the PIN is on the board. 3. Go to the Course Schedule web page. Open the Slides for
7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
Introduction to MATLAB Gergely Somlay Application Engineer [email protected]
Introduction to MATLAB Gergely Somlay Application Engineer [email protected] 2012 The MathWorks, Inc. 1 What is MATLAB? High-level language Interactive development environment Used for: Numerical
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
Advanced Tutorials. Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD
Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT Understanding how SAS stores and displays numeric data is essential
Practical Programming, 2nd Edition
Extracted from: Practical Programming, 2nd Edition An Introduction to Computer Science Using Python 3 This PDF file contains pages extracted from Practical Programming, 2nd Edition, published by the Pragmatic
Availability of the Program A free version is available of each (see individual programs for links).
Choosing a Programming Platform Diane Hobenshield Tepylo, Lisa Floyd, and Steve Floyd (Computer Science and Mathematics teachers) The Tasks Working Group had many questions and concerns about choosing
