Skills Quiz - Python Edition Solutions
|
|
- Edmund Tucker
- 5 years ago
- Views:
Transcription
1 'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2016 Skills Quiz - Python Edition Solutions Rebecca A. Simmons and & Michael R. Gustafson II Name (please print): NetID (please print): In keeping with the Community Standard, I have neither provided nor received any assistance on this test. I understand if it is later determined that I gave or received assistance, I will be brought before the Undergraduate Conduct Board and, if found responsible for academic dishonesty or academic contempt, fail the class. I also understand that I am not allowed to speak to anyone except the instructor about any aspect of this test until the instructor announces it is allowed. I understand if it is later determined that I did speak to another person about the test before the instructor said it was allowed, I will be brought before the Undergraduate Conduct Board and, if found responsible for academic dishonesty or academic contempt, fail the class. Signature: Notes You will be turning in each problem in a separate pile. Most of these problems will require working on additional pieces of paper - Make sure that you do not put work for more than any one problem on any one piece of paper. For this test, you will be turning in four different sets of work. Again, Please do not work on multiple problems on the same sheet of paper. Also - please do not put work for one problem on the back of another problem. Be sure your name and NetID show up on every page of the test. If you are including work on extra sheets of paper, put your name and NetID on each and be sure to staple them to the appropriate problem. Problems without names will incur at least a 25% penalty for the problem. Work must be down in dark ink and on only one side of the page. This first page should have your name, NetID, and signature on it. It should be stapled on top of and turned in with your submission for Problem I. Every other pile should have your test page on top followed by any previously blank paper used for that problem. You will not need and can not use a calculator on this test. You will be asked to write several lines of code on this test. Make sure what you write is Python code and not mathematics. Be very careful with any symbols you use. You do not need to put the honor code statement in your codes. The honor code statement on this page and your NetID on each problem stands in for that. You may assume that the following have been run for any code you write: import math as m import numpy as np import matplotlib. pyplot as plt If you specifically want to import things in a different way, you need to show that explicitly on each code.
2 Name (please print): Community Standard (print NetID): Problem I: [30 its.] Investigation See CS 101 tests, specifically first problems, for similar code.
3 Name (please print): Community Standard (print NetID): Problem II: [25 its.] Flyin A drone has sensors on board in order to register the drone s location and temperature as it flies. It stores the data set in a rectangular array of text that can be downloaded from the drone and saved as a text file. The data files i called TempData.dat and has six columns of information: the reading number, the time (in seconds), the x and y and z coordinates measured relative to some fixed point on the ground (in meters), and the temperature measured at that time at that location (in Kelvin). The drone takes measurements approximately every two seconds. The start of the data table might resemble: 1.00e e e e e e e e e e e e e e e e e e e e e e e e+02 <etc> but there are potentially more than 4 lines. Write Python code that will perform all the following tasks: (1) Load the data set into an array called temp_data. (2) Copy the reading times into an array called times. (3) Copy the x locations into an array called x. (4) Copy the y locations into an array called y. (5) Copy the z locations into an array called z. (6) Copy the temperatures into an array called temps. (7) Make a plot of the temperatures as a function of time using black squares at each reading. The squares should not be connected to each other. Add a proper title, axis labels, and grid. Save this first plot to a color Encapsulated Postscript file called temp_plot.eps. (8) Make a plot of the distance from the origin as a function of time using red diamonds at each reading. The diamonds should not be connected to each other. Add a proper title, axis labels, and grid. Save this first plot to a color Encapsulated Postscript file called dist_plot.eps. Note that: ρ = x 2 + y 2 + z 2 where ρ is measuring the distance from a point (x,y,z) to the origin. (9) Determine the highest recorded temperature and then report back all the times and locations at which it occurred. You should print the information to the screen using the following as a template: High temp: 2.966e+02 Time: 2.01e+00 Loc: (-2.38e e e-01) Time: 1.42e+01 Loc: (-1.24e e e+00) Time: 1.97e+01 Loc: (-1.92e e e+00) Note that the highest temperature may occur at more than one reading.
4 1 # %% Imports 2 import numpy as np 3 import matplotlib.pyplot as plt 4 5 # %% (1) 6 temp_data = np.loadtxt( ³TempData.dat ³) 7 8 # %% (2) - (6) 9 times = temp_data[:, 1].copy() 10 x = temp_data[:, 2].copy() 11 y = temp_data[:, 3].copy() 12 z = temp_data[:, 4].copy() 13 temps = temp_data[:, 5].copy() # %% (7) 16 plt.figure(1) 17 plt.clf() 18 plt.plot(times, temps, ³ks ³) 19 plt.title( ³Temperature vs. Time ³) 20 plt.xlabel( ³Time, s ³); plt.ylabel( ³Temp, K ³); plt.grid() 21 plt.savefig( ³temp_plot.eps ³) # %% (8) 24 rho = np.sqrt(x**2 + y**2 + z**2) 25 plt.figure(2) 26 plt.clf() 27 plt.plot(times, rho, ³rd ³) 28 plt.title( ³Distance vs. Time ³) 29 plt.xlabel( ³Time, s ³); plt.ylabel( ³Distance, m ³); plt.grid(1) 30 plt.savefig( ³dist_plot.eps ³) # %% (9) 33 max_temp = max(temps) 34 print( ³High temp: {:0.3e} ³.format(max_temp)) 35 # Several ways to do this next part: 36 # Get indices where temps==max_temps - pick one of the following 37 idx_1 = np.where(temps == max_temp)[0] # array -- note [0] is required! 38 idx_2 = [m for m in range(len(temps)) if temps[m] == max_temp] # list # a: loop through locations where temps==max_temp 41 for k in idx_1: # or idx_2 42 print( ³Time: {:0.2e} Loc: ({:+0.2e} {:+0.2e} {:+0.2e}) ³.format( 43 times[k], x[k], y[k], z[k])) # b: find how often temps==max_temp and loop that many times 46 for k in range(len(idx_1)): # or idx_2 47 print( ³Time: {:0.2e} Loc: ({:+0.2e} {:+0.2e} {:+0.2e}) ³.format( 48 times[idx_1[k]], x[idx_1[k]], y[idx_1[k]], z[idx_1[k]])) # c: slice values corresponding to where temps==max_temp and 51 # loop through those 52 times_max = times[idx_1] # in all cases, or idx_2 53 x_max = x[idx_1] 54 y_max = y[idx_1] 55 z_max = z[idx_1] for k in range(len(times_max)): 58 print( ³Time: {:0.2e} Loc: ({:+0.2e} {:+0.2e} {:+0.2e}) ³.format( 59 times_max[k], x_max[k], y_max[k], z_max[k]))
5 Name (please print): Community Standard (print NetID): Problem III: [25 its.] Functions (1) Write a function called just_add_red.m that takes a string as an input - the string will be a paint color. The returned variable will contain a string that indicates what color paint you get if you combine that paint with red paint. You will only be required to have your function identify the following combinations: Input Output blue purple yellow orange For any other inputs, your program should print Unknown color! and return None. You may assume the user has given you an all-lowercase string as an input. Here are some sample runs: In [1]: just_add_red(³blue ³) Out[2]: ³purple ³ In [2]: just_add_red(³green ³) Unknown color! (2) Write a function called bump that takes two arguments - a period T and a list of locations x - and returns the following expression for a single T value and a list of x values: 0 x < T/4 bump(t,x) = cos ( 2π T x) T/4 x T/4 0 x > T/4 (3) Write a function file called int_times that will take two inputs and returns an output. Your program needs to make sure that each input is a single integer value (no lists, tuples, or strings). If the rules are broken, your function should print an appropriate complaint and return None. Otherwise, the output should merely be the product of your two inputs. Here are some example runs: In [1]: int_times(1.2, 3.4) Function requires two single integer inputs! In [2]: int_times([1, 2], 3) Function requires two single integer inputs! In [3]: int_times(3, 4.5) Function requires two single integer inputs! In [4]: int_times(3.4, 5) Function requires two single integer inputs! In [5]: int_times(4, 5) Out[5]: 20
6 1 def just_add_red(orig): 2 if orig == ³blue ³: 3 return ³purple ³ 4 elif orig == ³yellow ³: 5 return ³orange ³ 6 else: 7 print( ³Unknown color! ³) 8 return None 1 # %% Imports 2 import math as m 3 import numpy as np 4 import matplotlib.pyplot as plt 5 6 def bump(t, x): # using a loop; appending values each time 7 out = [] 8 for k in range(len(x)): 9 if (-T / 4) <= x[k] <= T / 4: 10 out += [m.cos(2 * m.pi * x[k] / T)] 11 else: 12 out += [0] 13 return out def bump2(t, x): # using logical masks 16 xa = np.array(x) 17 return ((-T / 4 <= xa) & (xa <= T / 4)) * np.cos(2 * m.pi * xa / T) def bump3(t, x): # list comprehensions; initial list of 0s 20 out = [0] * len(x) 21 for k in [m for m in range(len(x)) if -T / 4 < x[m] < T / 4]: 22 out[k] = m.cos(2 * m.pi * x[k] / T) 23 return out if name == ³ main ³: 26 # %% shows usage; not part of test 27 t = np.linspace(-1, 1, 100) 28 plt.figure(1) 29 plt.clf() 30 plt.plot(t, bump(1, t), ³k-³) 1 def int_times(val_1, val_2): 2 # Check number of arguments first, then sizes, then if integers 3 if not isinstance(val_1, int) or not isinstance(val_2, int): 4 print( ³Function requires two single integer inputs! ³) 5 return None 6 else: 7 return val_1 * val_2
7 Name (please print): Community Standard (print NetID): Problem IV: [20 its.] Loops (1) Determine the values of A, B, and C at the end of the following code: B = [0] C = 0; for A in range(1,6,2): B += [A] C += A (2) Write a script called stay_odd.m which asks the user for odd integers. The script should store the odd values in a list called keepers and keep running until the users inputs a number that is not an odd integer. You may assume that the user only enters single integers. After the user inputs the non-odd value, your script should report how many numbers were entered and how many of them were positive. Here is an example run: Odd number: 1 Odd number: 5 Odd number: -3 Odd number: -9 Odd number: 21 Odd number: 6 5 odd value(s) 3 positive odd value(s) In [2]: print(keepers) [1, 5, -3, -9, 21]
8 In [1]: A Out[1]: 5 In [2]: B Out[2]: [0, 1, 3, 5] In [3]: C Out[3]: 9 1 # %% Get first value 2 x = int(input( ³Odd number: ³)) 3 count = 0 4 pos_count = 0 5 keepers = [] 6 7 # %% Run loop as long as entries are odd 8 while x % 2 == 1: 9 # if you are here, store, addto the count; check if it is positive 10 keepers += [x] 11 count += 1 12 if x > 0: 13 pos_count += 1 14 # get the next value 15 x = int(input( ³Odd number: ³)) # %% Print information 18 print( ³{:d} odd value(s) ³.format(count)) 19 print( ³{:d} positive odd value(s) ³.format(pos_count)) # could delete count and use: 22 # len(keepers) 23 # in first print statement #could delete pos_count and use: 26 # len([m for m in keepers if m>0]) 27 # in second print statement
Skills Quiz - Python Edition Solutions
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2017 Skills Quiz - Python Edition Solutions Michael R. Gustafson II Name (please print): NetID (please print): In keeping with the Community
More information'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Skills Quiz. Rebecca A. Simmons and & Michael R.
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2014 Skills Quiz Rebecca A. Simmons and & Michael R. Gustafson II NET ID (please print): In keeping with the Community Standard, I have neither
More informationTest 1 - Python Edition
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Spring 2018 Test 1 - Python Edition Shaundra B. Daily & Michael R. Gustafson II NetID (please print): In keeping with the Community Standard, I
More informationTest 2 - Python Edition
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 13L Spring 218 Test 2 - Python Edition Shaundra B. Daily & Michael R. Gustafson II Name (please print): NetID (please print): In keeping with the Community
More information'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test I. Rebecca A. Simmons & W. Neal Simmons Michael R.
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 53L Fall 2007 Test I Rebecca A. Simmons & W. Neal Simmons Michael R. Gustafson II Name (please print) In keeping with the Community Standard, I have
More information'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test I. Rebecca A. Simmons & Michael R. Gustafson II
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 53L Fall 2009 Test I Rebecca A. Simmons & Michael R. Gustafson II Name and NET ID (please print) In keeping with the Community Standard, I have neither
More informationNAVIGATING UNIX. Other useful commands, with more extensive documentation, are
1 NAVIGATING UNIX Most scientific computing is done on a Unix based system, whether a Linux distribution such as Ubuntu, or OSX on a Mac. The terminal is the application that you will use to talk to the
More informationIntro to Research Computing with Python: Visualization
Intro to Research Computing with Python: Visualization Erik Spence SciNet HPC Consortium 20 November 2014 Erik Spence (SciNet HPC Consortium) Visualization 20 November 2014 1 / 29 Today s class Today we
More informationPython review. 1 Python basics. References. CS 234 Naomi Nishimura
Python review CS 234 Naomi Nishimura The sections below indicate Python material, the degree to which it will be used in the course, and various resources you can use to review the material. You are not
More informationComputational Physics Programming Style and Practices & Visualizing Data via Plotting
Computational Physics Programming Style and Practices & Visualizing Data via Plotting Prof. Paul Eugenio Department of Physics Florida State University Jan 30, 2018 http://comphy.fsu.edu/~eugenio/comphy/
More informationENGR (Socolofsky) Week 07 Python scripts
ENGR 102-213 (Socolofsky) Week 07 Python scripts A couple programming examples for this week are embedded in the lecture notes for Week 7. We repeat these here as brief examples of typical array-like operations
More informationPython Crash Course Numpy, Scipy, Matplotlib
Python Crash Course Numpy, Scipy, Matplotlib That is what learning is. You suddenly understand something you ve understood all your life, but in a new way. Doris Lessing Steffen Brinkmann Max-Planck-Institut
More informationMATPLOTLIB. Python for computational science November 2012 CINECA.
MATPLOTLIB Python for computational science 19 21 November 2012 CINECA m.cestari@cineca.it Introduction (1) plotting the data gives us visual feedback in the working process Typical workflow: write a python
More informationLab 4: Structured Programming I
4.1 Introduction Lab 4: Structured Programming I Lab this week is going to focus on selective structures and functions. 4.2 Resources The additional resources required for this assignment include: 0 Books:
More informationHW0 v3. October 2, CSE 252A Computer Vision I Fall Assignment 0
HW0 v3 October 2, 2018 1 CSE 252A Computer Vision I Fall 2018 - Assignment 0 1.0.1 Instructor: David Kriegman 1.0.2 Assignment Published On: Tuesday, October 2, 2018 1.0.3 Due On: Tuesday, October 9, 2018
More informationMath 1MP3, final exam
Math 1MP3, final exam 23 April 2015 Please write your name and student number on this test and on your answer sheet You have 120 minutes No external aids (calculator, textbook, notes) Please number your
More informationLab 6. COMP9021, Session 2, one solution is obtained by selecting 1 and both occurrences of 2 ( = 5);
Lab 6 COMP9021, Session 2, 2016 1 R Obtaining a sum from a subsequence of digits Write a program sum_of_digits.py that prompts the user for two numbers, say available_digits and desired_sum, and outputs
More informationPartial Differential Equations II: 2D Laplace Equation on 5x5 grid
Partial Differential Equations II: 2D Laplace Equation on 5x5 grid Sam Sinayoko Numerical Methods 5 Contents 1 Learning Outcomes 2 2 Introduction 3 3 Laplace equation in 2D 3 4 Discretisation 3 4.1 Meshing:
More informationCS 111X - Fall Test 1
CS 111X - Fall 2016 - Test 1 1/9 Computing ID: CS 111X - Fall 2016 - Test 1 Name: Computing ID: On my honor as a student, I have neither given nor received unauthorized assistance on this exam. Signature:
More informationMath-2. Lesson 3-1. Equations of Lines
Math-2 Lesson 3-1 Equations of Lines How can an equation make a line? y = x + 1 x -4-3 -2-1 0 1 2 3 Fill in the rest of the table rule x + 1 f(x) -4 + 1-3 -3 + 1-2 -2 + 1-1 -1 + 1 0 0 + 1 1 1 + 1 2 2 +
More informationVisualisation in python (with Matplotlib)
Visualisation in python (with Matplotlib) Thanks to all contributors: Ag Stephens, Stephen Pascoe. Introducing Matplotlib Matplotlib is a python 2D plotting library which produces publication quality figures
More informationNeatly print first and last names: Exam II. "On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work.
Fry Texas A&M University! Math 150 Precalculus Fall 2015! 1 Neatly print first and last names: Lecture Time:!! 12:45 PM!!! 2:20 PM!! (Circle one.) Exam II "On my honor, as an Aggie, I have neither given
More informationAll written answers are limited to their question boxes. Make sure all answers are easily legible.
All written answers are limited to their question boxes. Make sure all answers are easily legible. 1. (1 point) Print your name and email id. 2. (2 points) What makes functions so important? Ability to
More informationIntroduction to Scientific Computing with Python, part two.
Introduction to Scientific Computing with Python, part two. M. Emmett Department of Mathematics University of North Carolina at Chapel Hill June 20 2012 The Zen of Python zen of python... fire up python
More informationCS 1301 Exam 2 Fall 2010
CS 1301 Exam 2 Fall 2010 Name : Grading TA: Devices: If your cell phone, pager, PDA, beeper, ipod, or similar item goes off during the exam, you will lose 10 points on this exam. Turn all such devices
More information4. BASIC PLOTTING. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman
4. BASIC PLOTTING JHU Physics & Astronomy Python Workshop 2016 Lecturer: Mubdi Rahman INTRODUCING MATPLOTLIB! Very powerful plotting package. The Docs: http://matplotlib.org/api/pyplot_api.html GETTING
More informationUNIVERSITETET I OSLO
UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: IN1900 Introduction to programming with scientific applications Day of examination: Tuesday, October 10, 2017 Examination
More informationTutorial 2 PHY409 Anadi Canepa Office, TRIUMF MOB 92 B ( )
Tutorial 2 PHY409 Anadi Canepa canepa@triumf.ca Office, TRIUMF MOB 92 B (1-604- 222-7330) Alan Manning mannin2@phas.ubc.ca Mohammad Samani samani@physics.ubc.ca During the 1 st tutorial We learnt What
More informationPart 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)
EECS 183 Fall 2013 Exam 1 Part 1 (80 points) Closed Book Closed Notes Closed Electronic Devices Closed Neighbor Turn off Your Cell Phones We will confiscate all electronic devices that we see including
More informationAMath 483/583 Lecture 28 June 1, Notes: Notes: Python scripting for Fortran codes. Python scripting for Fortran codes.
AMath 483/583 Lecture 28 June 1, 2011 Today: Python plus Fortran Comments on quadtests.py for project Linear vs. log-log plots Visualization Friday: Animation: plots to movies Binary I/O Parallel IPython
More informationLab 1 - Basic ipython Tutorial (EE 126 Fall 2014)
Lab 1 - Basic ipython Tutorial (EE 126 Fall 2014) modified from Berkeley Python Bootcamp 2013 https://github.com/profjsb/python-bootcamp and Python for Signal Processing http://link.springer.com/book/10.1007%2f978-3-319-01342-8
More informationUNIVERSITETET I OSLO
(Continued on page 2.) UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: INF1100 Introduction to programming with scientific applications Day of examination: Thursday, October
More informationMAS212 Assignment #1 (2018): Rational approximations
MAS212 Assignment #1 (2018): Rational approximations Dr Sam Dolan (sdolan@sheffieldacuk) In this assignment you will use Python to find rational approximations to real numbers such as π, 2 and the golden
More informationUsing the Matplotlib Library in Python 3
Using the Matplotlib Library in Python 3 Matplotlib is a Python 2D plotting library that produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.
More informationBasic Beginners Introduction to plotting in Python
Basic Beginners Introduction to plotting in Python Sarah Blyth July 23, 2009 1 Introduction Welcome to a very short introduction on getting started with plotting in Python! I would highly recommend that
More informationScientific Programming. Lecture A08 Numpy
Scientific Programming Lecture A08 Alberto Montresor Università di Trento 2018/10/25 Acknowledgments: Stefano Teso, Documentation http://disi.unitn.it/~teso/courses/sciprog/python_appendices.html https://docs.scipy.org/doc/numpy-1.13.0/reference/
More informationThe SciPy Stack. Jay Summet
The SciPy Stack Jay Summet May 1, 2014 Outline Numpy - Arrays, Linear Algebra, Vector Ops MatPlotLib - Data Plotting SciPy - Optimization, Scientific functions TITLE OF PRESENTATION 2 What is Numpy? 3rd
More informationPyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as
Geog 271 Geographic Data Analysis Fall 2015 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found
More informationINTRODUCTION TO DATA VISUALIZATION WITH PYTHON. Working with 2D arrays
INTRODUCTION TO DATA VISUALIZATION WITH PYTHON Working with 2D arrays Reminder: NumPy arrays Homogeneous in type Calculations all at once Indexing with brackets: A[index] for 1D array A[index0, index1]
More information(DRAFT) PYTHON FUNDAMENTALS II: NUMPY & MATPLOTLIB
(DRAFT) PYTHON FUNDAMENTALS II: NUMPY & MATPLOTLIB TROY P. KLING Contents 1. Importing Libraries 1 2. Introduction to numpy 2 3. Introduction to matplotlib 5 4. Image Processing 8 5. The Mandelbrot Set
More informationTF Mutiple Hidden Layers: Regression on Boston Data
TF Mutiple Hidden Layers: Regression on Boston Data This is adapted from Frossard's tutorial (http://www.cs.toronto.edu/~frossard/post/tensorflow/). This approach is not batched, and the number of layers
More informationBi 1x Spring 2014: Plotting and linear regression
Bi 1x Spring 2014: Plotting and linear regression In this tutorial, we will learn some basics of how to plot experimental data. We will also learn how to perform linear regressions to get parameter estimates.
More informationCS 2316 Exam 1 Spring 2014
CS 2316 Exam 1 Spring 2014 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam
More informationCS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY
CS 111X - Fall 2016 - Test 1 1/9 Computing ID: CS 111X - Fall 2016 - Test 1 - KEY KEY KEY KEY KEY KEY KEY Name: Computing ID: On my honor as a student, I have neither given nor received unauthorized assistance
More informationCS1110 Lab 6 (Mar 17-18, 2015)
CS1110 Lab 6 (Mar 17-18, 2015) First Name: Last Name: NetID: The lab assignments are very important and you must have a CS 1110 course consultant tell CMS that you did the work. (Correctness does not matter.)
More informationLecture 15: High Dimensional Data Analysis, Numpy Overview
Lecture 15: High Dimensional Data Analysis, Numpy Overview Chris Tralie, Duke University 3/3/2016 Announcements Mini Assignment 3 Out Tomorrow, due next Friday 3/11 11:55PM Rank Top 3 Final Project Choices
More informationLECTURE 22. Numerical and Scientific Computing Part 2
LECTURE 22 Numerical and Scientific Computing Part 2 MATPLOTLIB We re going to continue our discussion of scientific computing with matplotlib. Matplotlib is an incredibly powerful (and beautiful!) 2-D
More informationContinental Mathematics League
Continental Mathematics League 2015-2016 Computer Science Contest Grades 3-5 The contest consists of three meets. Each meet has six questions for 30 minutes. Note: Some questions have multiple answers.
More informationSection 2 0: The Rectangular Coordinate System. The Coordinate System
Section 2 : The Rectangular Coordinate System The rectangular coordinate system is based on two number lines. A horizontal line called the x axis and a vertical line called the y axis. Each axis has marks
More informationlof April 23, Improving performance of Local outlier factor with KD-Trees
lof April 23, 2014 1 Improving performance of Local outlier factor with KD-Trees Local outlier factor (LOF) is an outlier detection algorithm, that detects outliers based on comparing local density of
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationCS 1301 Exam 1 Fall 2010
CS 1301 Exam 1 Fall 2010 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in
More informationCh.5: Array computing and curve plotting (Part 1)
Ch.5: Array computing and curve plotting (Part 1) Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Simula Research Laboratory 1 University of Oslo, Dept. of Informatics 2 Sep 20, 2017 (Adjusted) Plan for
More informationIntroduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15
1 LECTURE 1: INTRO Introduction to Scientific Python, CME 193 Jan. 9, 2014 web.stanford.edu/~ermartin/teaching/cme193-winter15 Eileen Martin Some slides are from Sven Schmit s Fall 14 slides 2 Course Details
More informationMatplotlib Python Plotting
Matplotlib Python Plotting 1 / 6 2 / 6 3 / 6 Matplotlib Python Plotting Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive
More informationPyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as
Geog 271 Geographic Data Analysis Fall 2017 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found
More informationCPSC 217 Midterm (Python 3 version)
CPSC 217 Midterm (Python 3 version) Duration: 60 minutes 7 March 2011 This exam has 81 questions and 14 pages. This exam is closed book. No notes, books, calculators or electronic devices, or other assistance
More informationARTIFICIAL INTELLIGENCE AND PYTHON
ARTIFICIAL INTELLIGENCE AND PYTHON DAY 1 STANLEY LIANG, LASSONDE SCHOOL OF ENGINEERING, YORK UNIVERSITY WHAT IS PYTHON An interpreted high-level programming language for general-purpose programming. Python
More information: Intro Programming for Scientists and Engineers Final Exam
Final Exam Page 1 of 6 600.112: Intro Programming for Scientists and Engineers Final Exam Peter H. Fröhlich phf@cs.jhu.edu December 20, 2012 Time: 40 Minutes Start here: Please fill in the following important
More informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationProject activity sheet 3
1 Macmillan English Project activity sheet 3 Project: Food bar chart Units 13 18 Learning outcomes By the end of the project, children will have: practised language from Units 13 18 through a group project
More informationReview Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts
Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts Simple Data Types There are a number of data types that are considered primitive in that they contain only a single value. These data
More informationUser Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy
User Interfaces 1 Command Line Interfaces getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy 2 Encapsulation by Object Oriented Programming
More informationCSci 127: Introduction to Computer Science
CSci 127: Introduction to Computer Science hunter.cuny.edu/csci CSci 127 (Hunter) Lecture 11: tinyurl.com/yb8lcvl7 15 November 2017 1 / 48 Lecture Slip: tinyurl.com/yb8lcvl7 CSci 127 (Hunter) Lecture 11:
More informationReview 4. Lists and Sequences
Review 4 Lists and Sequences Overview of List Syntax x = [0, 0, 0, 0] x.append(2) 3 in x x[2] = 5 x[0] = 4 k = 3 x[k] = 2 * x[0] x[k 2] = 6 Create list of length 4 with all zeroes Append 2 to end of list
More informationUnit T Student Success Sheet (SSS) Graphing Trig Functions (sections )
Unit T Student Success Sheet (SSS) Graphing Trig Functions (sections 4.5-4.7) Standards: Trig 4.0, 5.0,6.0 Segerstrom High School -- Math Analysis Honors Name: Period: Thinkbinder Study Group: www.bit.ly/chatunitt
More informationA. Python Crash Course
A. Python Crash Course Agenda A.1 Installing Python & Co A.2 Basics A.3 Data Types A.4 Conditions A.5 Loops A.6 Functions A.7 I/O A.8 OLS with Python 2 A.1 Installing Python & Co You can download and install
More informationCS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck!
CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, 2011 Name: EID: Section Number: Friday discussion time (circle one): 9-10 10-11 11-12 12-1 2-3 Friday discussion TA(circle one): Wei Ashley Answer
More informationL15. 1 Lecture 15: Data Visualization. July 10, Overview and Objectives. 1.2 Part 1: Introduction to matplotlib
L15 July 10, 2017 1 Lecture 15: Data Visualization CSCI 1360E: Foundations for Informatics and Analytics 1.1 Overview and Objectives Data visualization is one of, if not the, most important method of communicating
More informationPS6-DCT-Soln-correction
PS6-DCT-Soln-correction Unknown Author March 18, 2014 Part I DCT: Discrete Cosine Transform DCT is a linear map A R N N such that the N real numbers x 0,..., x N 1 are transformed into the N real numbers
More informationUser-Defined Function
ENGR 102-213 (Socolofsky) Week 11 Python scripts In the lecture this week, we are continuing to learn powerful things that can be done with userdefined functions. In several of the examples, we consider
More informationLab Five. COMP Advanced Artificial Intelligence Xiaowei Huang Cameron Hargreaves. October 29th 2018
Lab Five COMP 219 - Advanced Artificial Intelligence Xiaowei Huang Cameron Hargreaves October 29th 2018 1 Decision Trees and Random Forests 1.1 Reading Begin by reading chapter three of Python Machine
More informationDerek Bridge School of Computer Science and Information Technology University College Cork
CS468: Artificial Intelligence I Ordinary Least Squares Regression Derek Bridge School of Computer Science and Information Technology University College Cork Initialization In [4]: %load_ext autoreload
More informationMATH SPEAK - TO BE UNDERSTOOD AND MEMORIZED DETERMINING THE INTERSECTIONS USING THE GRAPHING CALCULATOR
FOM 11 T15 INTERSECTIONS & OPTIMIZATION PROBLEMS - 1 1 MATH SPEAK - TO BE UNDERSTOOD AND MEMORIZED 1) INTERSECTION = a set of coordinates of the point on the grid where two or more graphed lines touch
More informationCS 1110 Prelim 2 April 21, 2015
CS 1110 Prelim 2 April 21, 2015 (Print Last Name) (Print First Name) (Net ID) Circle Your Lab: ACCEL: Tue 12:20 Tue 1:25 Tue 2:30 Tue 3:35 ACCEL : Wed 10:10 Wed 11:15 Wed 12:20 Wed 1:25 Wed 2:30 Wed 3:35
More informationAdapted to TKT4140 Numerical Methods
Adapted to TKT4140 Numerical Methods Hans Petter Langtangen Center for Biomedical Computing, Simula Research Laboratory & Department of Informatics, University of Oslo Leif Rune Hellevik 1,2 Biomechanichs
More informationThis is a very quick intro to Python programming. Adapted to TKT4140 Numerical Methods. Mathematical example. A program for evaluating a formula
This is a very quick intro to Python programming Adapted to TKT4140 Numerical Methods Hans Petter Langtangen Center for Biomedical Computing, Simula Research Laboratory & Department of Informatics, University
More informationWithout fully opening the exam, check that you have pages 1 through 11.
Name: Section: Recitation Instructor: INSTRUCTIONS Fill in your name, etc. on this first page. Without fully opening the exam, check that you have pages 1 through 11. Show all your work on the standard
More informationOverview of List Syntax
Lists and Sequences Overview of List Syntax x = [0, 0, 0, 0] Create list of length 4 with all zeroes x 4300112 x.append(2) 3 in x x[2] = 5 x[0] = 4 k = 3 Append 2 to end of list x (now length 5) Evaluates
More informationData Science with Python Course Catalog
Enhance Your Contribution to the Business, Earn Industry-recognized Accreditations, and Develop Skills that Help You Advance in Your Career March 2018 www.iotintercon.com Table of Contents Syllabus Overview
More informationWeek Two. Arrays, packages, and writing programs
Week Two Arrays, packages, and writing programs Review UNIX is the OS/environment in which we work We store files in directories, and we can use commands in the terminal to navigate around, make and delete
More informationCS 1301 Exam 1 Fall 2010
CS 1301 Exam 1 Fall 2010 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in
More informationHomework 11 - Debugging
1 of 7 5/28/2018, 1:21 PM Homework 11 - Debugging Instructions: Fix the errors in the following problems. Some of the problems are with the code syntax, causing an error message. Other errors are logical
More informationCS 1110 Prelim 1 March 10, 2015
CS 1110 Prelim 1 March 10, 2015 (Print Last Name) (Print First Name) (Net ID) Circle Your Lab: ACCEL: Tue 12:20 Tue 1:25 Tue 2:30 Tue 3:35 ACCEL : Wed 10:10 Wed 11:15 Wed 12:20 Wed 1:25 Wed 2:30 Wed 3:35
More informationcosmos_python_ Python as calculator May 31, 2018
cosmos_python_2018 May 31, 2018 1 Python as calculator Note: To convert ipynb to pdf file, use command: ipython nbconvert cosmos_python_2015.ipynb --to latex --post pdf In [3]: 1 + 3 Out[3]: 4 In [4]:
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationInterpolation and curve fitting
CITS2401 Computer Analysis and Visualization School of Computer Science and Software Engineering Lecture 9 Interpolation and curve fitting 1 Summary Interpolation Curve fitting Linear regression (for single
More informationCS 1301 Post Exam 3 Practice Spring 2016
CS 1301 Post Exam 3 Practice Spring 2016 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking
More informationPlotting With matplotlib
Lab Plotting With matplotlib and Mayavi Lab Objective: Introduce some of the basic plotting functions available in matplotlib and Mayavi. -D plotting with matplotlib The Python library matplotlib will
More informationSearch. The Nearest Neighbor Problem
3 Nearest Neighbor Search Lab Objective: The nearest neighbor problem is an optimization problem that arises in applications such as computer vision, pattern recognition, internet marketing, and data compression.
More informationSummary of chapters 1-5 (part 1)
Summary of chapters 1-5 (part 1) Ole Christian Lingjærde, Dept of Informatics, UiO 6 October 2017 Today s agenda Exercise A.14, 5.14 Quiz Hint: Section A.1.8 explains how this task can be solved for the
More informationChapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1
Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values
More informationProgramming with Python
Programming with Python EOAS Software Carpentry Workshop September 21st, 2016 https://xkcd.com/353 Getting started For our Python introduction we re going to pretend to be a researcher studying inflammation
More informationCS 1110 Prelim 2 April 21, 2015 GRADING GUIDE
CS 1110 Prelim 2 April 21, 2015 GRADING GUIDE Problem 1 15 points Problem 2 15 points Problem 3 15 points Problem 4 20 points Problem 5 20 points Problem 6 15 points Problem Total 20 points 95-100 xxxxxxxxxxxxxxxxxxxxxxxxx
More information1 Check it out! : Fundamentals of Programming and Computer Science, Fall Homework 3 Programming: Image Processing
15-112 Homework 3 Page 1 of 5 15-112: Fundamentals of Programming and Computer Science, Fall 2017 Homework 3 Programming: Image Processing Due: Tuesday, September 26, 2017 by 22:00 This programming homework
More informationMeasuring argument passing in Go and C++
Measuring argument passing in Go and C++ Raphael kena Poss August 2018 1 Contents Introduction 3 Experimental setup 3 Data preparation 5 Data transformation......................................... 5 Data
More informationLab 16 - Multiclass SVMs and Applications to Real Data in Python
Lab 16 - Multiclass SVMs and Applications to Real Data in Python April 7, 2016 This lab on Multiclass Support Vector Machines in Python is an adaptation of p. 366-368 of Introduction to Statistical Learning
More informationCS 1301 Exam 1 Spring 2014
CS 1301 Exam 1 Spring 2014 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam
More informationPython Tutorial. CS/CME/BioE/Biophys/BMI 279 Oct. 17, 2017 Rishi Bedi
Python Tutorial CS/CME/BioE/Biophys/BMI 279 Oct. 17, 2017 Rishi Bedi 1 Python2 vs Python3 Python syntax Data structures Functions Debugging Classes The NumPy Library Outline 2 Many examples adapted from
More informationData Science and Machine Learning Essentials
Data Science and Machine Learning Essentials Lab 3C Evaluating Models in Azure ML By Stephen Elston and Graeme Malcolm Overview In this lab, you will learn how to evaluate and improve the performance of
More information