PH2150 Scientific Computing Skills

Slides:



Advertisements
Similar presentations
Maths for Computer Graphics
Advertisements

4.2 Adding and Subtracting Matrices 4.3 Matrix Multiplication
COMPUTER SCIENCE FEBRUARY 2011 Lists in Python. Introduction to Lists Lists (aka arrays): an ordered set of elements  A compound data type, like strings.
Computation for Physics 計算物理概論
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Class Opener:. Identifying Matrices Student Check:
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 8 Lists and Tuples.
I Power Higher Computing Software Development High Level Language Constructs.
Computation for Physics 計算物理概論 Introduction to NumPy and SciPy.
Matrix Algebra Section 7.2. Review of order of matrices 2 rows, 3 columns Order is determined by: (# of rows) x (# of columns)
8.4 Use Scientific Notation Algebra. Scientific Notation Numbers such as 1,000,000, 153,000 and are written in standard form. Another way to write.
Multiplying Matrices Algebra 2—Section 3.6. Recall: Scalar Multiplication - each element in a matrix is multiplied by a constant. Multiplying one matrix.
MATRICES MATRIX OPERATIONS. About Matrices  A matrix is a rectangular arrangement of numbers in rows and columns. Rows run horizontally and columns run.
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
1.8 – Basic Matrix Operations. Unit 1 – Algebra: Linear Systems, Matrices, & Vertex-Edge Graphs  1.8 – Basic Matrix Operations  Georgia Performance.
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
Department of Computer Science Western Michigan University
Introduction to python programming
PH2150 Scientific Computing Skills
13.4 Product of Two Matrices
Multiplying Matrices.
Linear Algebra review (optional)
Two-Dimensional Arrays
Chapter 7 Matrix Mathematics
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Other Kinds of Arrays Chapter 11
Multiplying Matrices Algebra 2—Section 3.6.
Mr. Hartzer, Hamtramck High School
FP1 Matrices Introduction
CSE Social Media & Text Analytics
Multiplying Matrices.
WarmUp 2-3 on your calculator or on paper..
Numerical Computing in Python
Creation, Traversal, Insertion and Removal
INTEGER RULES Positives & negatives.
All About Matrices.
Taking Unit 1 Test #2 Today --- AL
Vectorized Code, Logical Indexing
Matrices Elements, Adding and Subtracting
Vectors and Matrices I.
CSCI N207 Data Analysis Using Spreadsheet
Numpy (Numerical Python)
1 Introduction to Algebra: Integers.
MATLAB Programming Indexing Copyright © Software Carpentry 2011
D2 Indices and matrices Matrix representation in computer systems:
Data Types and Data Structures
Topics Sequences Introduction to Lists List Slicing
Multidimensional array
Presented By Farheen Sultana Ist Year I SEM
MATLAB Programming Basics Copyright © Software Carpentry 2011
Multiplying Matrices.
15-110: Principles of Computing
INC 161 , CPE 100 Computer Programming
INTEGER RULES Positives & negatives.
Section 2.1 Properties of Numbers
Java SE 7 One and Multi Dimensional Arrays Module 6
Multi-Dimensional Arrays
Dr. Sampath Jayarathna Cal Poly Pomona
3.5 Perform Basic Matrix Operations
Dimensions matching Rows times Columns
Topics Sequences Introduction to Lists List Slicing
Linear Algebra review (optional)
Dr. Sampath Jayarathna Old Dominion University
Multiplying Matrices.
Multiplying Matrices.
Introduction to Matrices
Multiplying Matrices.
INTRODUCING PYTHON PANDAS:-SERIES
Chapter 7 Section 7.2 Matrices.
Presentation transcript:

PH2150 Scientific Computing Skills The NumPy Array https://docs.scipy.org/doc/numpy/reference/arrays.html The number of elements in an array is fixed. You cannot add elements to an array once it is created, or remove them. The elements of an array must all be of the same type, such as all floats or all integers. You cannot mix elements of different types in the same array and you cannot change the type of the elements once an array is created.

PH2150 Scientific Computing Skills The NumPy Array Lists, as we have seen, have neither of these restrictions. Why would we ever use an array if lists are more flexible? The answer is that arrays have several significant advantages over lists as well: Arrays can be two-dimensional, like matrices in algebra. That is, rather than just a one-dimensional row of elements, we can have a grid of them. Indeed, arrays can in principle have n-dimensions. Lists, by contrast, are always just one-dimensional containers. Arrays behave roughly like vectors or matrices: you can do arithmetic with them, such as adding them together, and you will get the result you expect. As we have seen this is not true with lists, addition results in concatenation of the list. Arrays work faster than lists. Especially if you have a very large array with many elements then calculations may be significantly faster using an array.

PH2150 Scientific Computing Skills #Creating Arrays in Numpy import numpy as np x=np.array([[1,2,3,4],[5,6,7,8]]) print 'size of array', np.size(x) print 'shape of array', np.shape(x) print 'x=', x y=np.linspace(0,1,20)  print 'y=',y

PH2150 Scientific Computing Skills The NumPy Array: Indexing and Slicing

PH2150 Scientific Computing Skills The NumPy Array: Indexing and Slicing