Test 1 Flashcards
(48 cards)
What is scientific computing
coding for the purpose of science
consider ven diagram
We want to use coding to:
-Manage large amounts of data
-Apply some math/algorythms (comptute something from data)
-Visualize our data
-Answer really cool questions
What Scientific computing is not
We are not trying to be:
-Computer scientists- solving complex problems with math and computations. Eg cryptocurrency developers
-Software engineers- design and develop user-freindly software. Eg developers of platforms for crytocurrency
Why can’t we just use excel?
-Highly ineffcient- for large amounts of data
-Greater chance of introducing errors
-No permentant record (Code: raw data- update processing- output)
-Not reporducable
How to pick a language
depends on your background, task, goal, ect
big 3: R, python, matlab
R
-Developed fpr statistical computing
-many statistical libraries
-used primarily by researchers
-free to use
Python
-general purpose language
-larger user base- lots of examples and Q/As available
-variety of libraries for data
-free to use
-widespread use across industry
Matlab
-Heavily used in engineering
-Excellent for signal processing
-Standard toolboxes (ie. Libraries)
-Requires a license ($$$)
Integrated Development environements (IDEs)
python can be used in a variety of IDEs
-IDEs allow us to write, edit, and execute pythin code
-IDEs have many features that make it easier to code (eg. Automatic formatting, syntax, highlighting, debugging support, ect) ie spyder and jupyter
Modular prograaming in python
Breaking up larg programming tasks into smaller more manageable ones
3 levels: functions, modules, packages/libraries
Modular programming in python: functions
-Block of code that only runs when you call it
-smallest unit of coding
ie functiong calculating average in excel
-“scatter is a function for creating a 2D scatter plot
Modular programming in python: Modules
-Grouping of functions for similar tasks
-average and STD DV
-pyplot is one module for interactive plotting
Modular programming in python: Packages/Libraries
-Grouping of modules for similar projects
-“matplot lib” is a library for plotting data
Anaconda
-A distribution of the Python (and R) for scientific computing and data science, that aims aims to simply package amanagement and deployment
–One downlaod of 1500+ packages for scientific computing
–User friendly interface to manage it all
–Free to use, with a large user base
Jupyter notebook
-one of the primary IDEs for python programming
-included in the anaconda download
-allows for interactive text, coding, and plotting is an easy-to-use format
Google colab
-A cloud-based platform for writing and executing python code
-hosted on Google, requiring only a google account
-Provides free access to computational resources
Strings
Variables that contains numbers, letters or other characters, but cannot be used in computations
Numbers
Only contains numbers and can be used in computations
Using the stored variables
Stored variables can be used in basic math equations (ie computation of BMI)
Types of number- Float
precision numbers that carry decimal places and as such these are what we would most commonly use for sorting data. Although, sometimes only storing whole numbers without decimals is useful too– convert to interger
Types of numbers: integer
A whole number- converted from a float using the int command
Boolean
only represent one of two values: true or false (ie 1 vs 0). Can be used to evaluate if some content is true. If the content is a single item, most will return true (unless it is false or left blank-also false) Can be useful to determine if data was left blank. Can also be useful in comparing two variables or finding (ie. Indexing) specific rows of data.
Lists
Lists allow us to store multiple items in a single variable. This can be useful if you have a lot of things to store and don’t want a bunch of separate variables. Also, info is stored in a specific order so that it is easy to find and this order (or index) always starts a 0. Lists are defined with [].
Finding Items in Lists
Once have set of dats, important to be able to find the index (postion of item) in the list. We can ass the syntax “index()” after the name of the list with the item we are looking for in the (). We can enter a specific string in this to find a match in the list. Recall the index always starts at 0.