Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Similar documents
ENGR 105: Introduction to Scientific Computing. Dr. Graham. E. Wabiszewski

CVEN 302. Computer Applications in Engineering and Construction. Dr. Tony Cahill Environmental and Water Resources Division

Introduction to Engineering gii

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

CS2303 C14 Systems Programming Concepts. Bob Kinicki

Chapter 4: Basic C Operators

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

Introduction to Computer Science I

Introduction to Programming

Welcome to CS 115 (Winter 2018)

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2014 Euiseong Seo

CSCI 3136 Principles of Programming Languages

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

CSE 115. Introduction to Computer Science I

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial

b) develop mathematical thinking and problem solving ability.

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

ENGG1811 Computing for Engineers Week 1 Introduction to Programming and Python

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2015 Euiseong Seo

PROGRAMMING WITH MATLAB DR. AHMET AKBULUT

Programming in QBasic

CSc 372 Comparative Programming Languages

San José State University College of Science/Department of Computer Science CS 152, Programming Language Paradigms, Section 03/04, Fall, 2018

ENGR 102 Engineering Lab I - Computation

9 Using Equation Networks

Welcome to CS 115 (Winter 2019)

Lecture 1 arithmetic and functions

AMS 27L LAB #1 Winter 2009

CIS 086 : Week 1. Web Development with PHP and MySQL

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics

FOR ALL STUDENTS TAKING PRE CALCULUS

Goals for This Lecture:

CS 101: Computer Programming and Utilization. Abhiram Ranade

Python Programming Exercises 1

CS 3030 Scripting Languages Syllabus

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

(0) introduction to the course. how to learn a programming language. (0) course structure

COMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

Computers and programming languages introduction

CSE 333 Lecture 1 - Systems programming

CS1 Lecture 3 Jan. 22, 2018

CS 3110 Lecture 1 Course Overview

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified

CS240: Programming in C

Trigonometry

Skill 1: Multiplying Polynomials

CS120 Computer Science I. Instructor: Jia Song

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

AP Computer Science A Summer Assignment

C++ Programming Lecture 11 Functions Part I

Expressions in JavaScript. Jerry Cain CS 106AJ October 2, 2017

Introduction to the course and basic programming concepts

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

CS 3304 Comparative Languages. Lecture 1: Introduction

Variable and Data Type 2

Total Test Questions: 43 Levels: Grades Units of Credit:.50

CSC 015: FUNDAMENTALS OF COMPUTER SCIENCE I

CS/SE 153 Concepts of Compiler Design

Welcome to Introduction to Computer Science I

CS 240 Fall Mike Lam, Professor. Just-for-fun survey:

Organisation. Assessment

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

2 Making Decisions. Store the value 3 in memory location y

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Objectives. Structure. Munster Programming Training

CSE 142. Lecture 1 Course Introduction; Basic Java. Portions Copyright 2008 by Pearson Education

Copyright 2005 Department of Computer & Information Science

CSI Lab 02. Tuesday, January 21st

Welcome to CS 135 (Winter 2018)

Computer Organization & Assembly Language Programming (CSE 2312)

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Administration Computers Software Algorithms Programming Languages

Introduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003

Numerical Analysis First Term Dr. Selcuk CANKURT

Compiler Design Spring 2018

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Prerequisites: Completed Algebra 1 and Geometry and passed Algebra 2 with a C or better

ANSI C Programming Simple Programs

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST)

Chapter 3. Computer Science & Engineering 155E Computer Science I: Systems Engineering Focus. Existing Information.

Course Outline. TERM EFFECTIVE: Spring 2016 CURRICULUM APPROVAL DATE: 10/12/2015

CS 241 Data Organization. August 21, 2018


Python Lists: Example 1: >>> items=["apple", "orange",100,25.5] >>> items[0] 'apple' >>> 3*items[:2]

Com S 541. Programming Languages I

Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

Lab 1 Intro to MATLAB and FreeMat

Curriculum Map: Mathematics

San José State University Department of Computer Science CS-174, Server-side Web Programming, Section 2, Spring 2018

4. Java Project Design, Input Methods

Introduction to MATLAB

Simple Java Programming Constructs 4

Chapter 2. Outline. Simple C++ Programs

1 Introduction to Matlab

Transcription:

Lecture 1 Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Welcome to ENGR 102

Syllabus review

Your Time Expectations (in class) ENGR 102 is a 2-credit class: 1 hour per week of lecture (1 credit) 3 hours per week of lab (1 credit) So, we meet 4 hours a week. About 1 hour each week will be instructor-driven About 3 hours each week will be hands-on work (programming, team work, quizzes/exams) Attendance is required Quizzes and exams during meeting times Lab work may involve working in teams Attendance will affect lab grade

Your Time Expectations (outside class) For every credit hour, you should expect to spend 2-3 hours outside of class on the subject, weekly. So, for ENGR 102, you should expect to spend 4-6 hours a week, beyond the time spent in class. You should expect to spend time on: College of Engineering Homework based on online video modules (0.5 hours/week) Reading (Zybook) (up to 1 hour/week) Lab assignments (3-5 hours/week) Studying (regularly, but exam study time will be given in lieu of lab assignments)

Why Are We Studying Programming? Computer programs are a fundamental tool across all of engineering Computing will be used in your classes (especially Engineering classes) Computing will be used in your job This will include using programs, modifying programs, and writing programs Even if just using computing programs as a tool, understanding how your tools work can make you more proficient with them! Computing is transforming all of engineering (and every other field) For some of you, computing will be the central focus of your study Computer programming is an element of engineering on its own

Why Are We Studying Programming? Computer programs are a fundamental tool across all of engineering Computing is transforming all of engineering (and every other field) Over the last 20 years, computing has revolutionized most of society Internet, social networks, portable/ubiquitous computing (smartphones), data analytics, etc. This trend is likely to continue! Many of the recent advancements and current research directions in engineering are closely tied to computing For some of you, computing will be the central focus of your study Computer programming is an element of engineering on its own

Why Are We Studying Programming? Computer programs are a fundamental tool across all of engineering Computing is transforming all of engineering (and every other field) For some of you, computing will be the central focus of your study Computer Science and Computer Engineering especially Several other majors will require additional computing, often as a fundamental aspect of the field This material will provide a basis for further more advanced studies Computer programming is an element of engineering on its own

Why Are We Studying Programming? Computer programs are a fundamental tool across all of engineering Computing is transforming all of engineering (and every other field) For some of you, computing will be the central focus of your study Computer programming is an element of engineering on its own Involves designing and building a solution to solve some problem, or enable something new to be done Producing software is similar to building other things Involves design, analysis, construction, testing, etc. The material used to build with is computer code Not all engineering involves physical devices Some fields focus on processes, for instance!

Recent Survey In a recent survey of Texas A&M Engineering graduates, asking them what their job involved, Computing was listed more frequently than every other topic! As we prepare you for being engineering leaders for the next decades, computing skills will be a critical component of your skill set.

What Aggie Engineering Grads are Doing *As self-reported by engineering grads (BS,MS/ME, PhD) for the past three graduation ceremonies 46% Fortune 500 companies posted jobs for ENGR students in HireAggies.com 35% ENGR graduates went to work for Fortune 500 companies

ENGR 102 and the Common Curriculum In 2017, faculty representatives from several departments met to discuss how the common Engineering curriculum should be updated. The committee discussed what topics were important enough that all Engineering students should have them, and what order those topics should be encountered. The result of this meeting was that a programming course should be the first course for Engineering students. ENGR 102 was created to meet this goal.

Programming

Computer Programming The Basic Process A programmer writes commands / instructions, called a program, for the computer to follow. command command command command A compiler or interpreter takes those commands and converts them to instructions that the computer can understand 01010010 10010101 00101110 10101011 10101010 10111101 00101000 10101000 10111 When a program is run, the instructions are executed on the computer Computer Program Machine Instructions

The Program A program is just a text file with computer commands in it. You can, generally, use any editor you want to write a program Saving as a text file, with the right extension:.py for python, for instance Some editors are designed to help write programs Can color-code text, give hints, autofill, etc. Often, an editor is tied together with a compiler and other features into an Integrated Development Environment (IDE) We will be using an IDE for this course

Compiler/Interpreter The compiler or interpreter translates the program into machine instructions. Think of a compiler as pulling all the information in the program together, then generating machine instructions. Since it can look at the whole program, it can possibly create more optimal machine instructions The machine instructions are typically saved to a file Think of an interpreter as translating line by line. Often, the execution happens as it is interpreted, so there is no intermediate file saved Python is usually thought of as interpreted.

Execution For a compiled program, the execution involves running the program. Most applications and programs you would run are compiled programs, ready to be executed For an interpreted program, execution often happens right as the program is interpreted So, the program that is run is just the original program the machine instructions might not be saved to a separate file Sometimes, the original program is called a script With an IDE, the execution often takes place in a window or part of the IDE itself

Programming Languages The computer processor understands commands in binary. It is incredibly painful for people to write significant amounts of code in binary Assembly language provides a direct mapping between the binary commands and something a person can read Essentially, it just translates from binary to a text representation It is still difficult to write significant amounts of code in this form Programming languages have been developed to help people understand the instructions given to a computer. Although they are still commands to the computer, they are conceptually easier to understand It is usually much easier to comprehend the ideas/purpose of a program in a programming language It is usually more efficient: one statement in a programming language can replace many assembly/machine instructions

Programming Languages Many languages have been developed. Each has its own benefits and drawbacks They have increased and decreased in popularity over time There is no best language, though some languages are better than others for particular tasks R Perl C++ COBOL Scheme Haskell Java Prolog Lisp Python PHP Matlab C ML C# Ruby Fortran Pascal Javascript Scheme Basic

Why Python? Our main focus in this class will be on Python programming Python is generally considered Easy to learn Powerful (real applications are written with it) Flexible (can be used for many different applications lots of library support) Popular (it is being used more and more) Random note: Python gets its name from Monty Python, the British comedy troupe!

Python and Matlab Concurrent with this class, in MATH 151, you should see some Matlab Matlab will support most of the programming constructs we ll learn here And, it s easier to do some things, especially some numerical calculations, in Matlab But, Matlab is more limited in its overall range of capabilities We ll provide, as online resources, some notes about how the topics we cover here can be used in Matlab Keep in mind that the topics we cover also have equivalents in many other languages. Learning a new programming language after knowing one is much easier.

Getting Set Up In the lab portion, you will work on getting the environment set up, and writing your first programs. What you ll need for our class: A Python interpreter (Python Anaconda Distribution) A Python IDE (PyCharm) We will be using the IDE to develop our programs, compile them, and execute them. But, if you just save your.py files on your computer, and have the Python interpreter installed, you can execute them directly

Your First Program We will develop more advanced programs as the course goes on, but will start out with some basic ones. The traditional first program people write is called Hello, World We ll adapt it slightly. We can do this with one line of code: print("howdy, World!")

The print statement Program print("howdy, World!") print(1) Output Howdy, World! 1 The print command instructs the computer to print whatever is in the parentheses to the screen For text, the text to print should be in quotation marks Numerical values can be placed directly

Printing Each print statement will print one value on one line We can put multiple print statements into one program We ll see more about how to use print statements later in the course But, feel free to experiment, or learn on your own! Note: print is a generic term for display (usually to the screen), in contexts like this. It does not mean print on paper using a printer.

Mathematical Calculations Mathematical computations are one of the most common things we ll do in this class And are a core part of almost all computer programs Python has support for the basic arithmetic operations + Addition - Subtraction * Multiplication / Division Order of operations is enforced So, 2+3*4 = 14 Parentheses are also enforced So, (2+3)*4 = 20

More Mathematical operations (built in) Power: ** 2**10 = 1024 Integer Division (division without remainder): // 7//3 = 2 Modulus (remainder from division): 7%3 = 1 100%10 = 0

More mathematical functions We will add one line to our programs to give us access to additional mathematical functions. We ll see exactly what this is doing later on For now, put the following line at the top of your program: from math import * Mathematical functions will have a name and parentheses that enclose the value to take the function of e.g. cos(0) is the cosine of 0

Common mathematical functions Remember to start program with: from math import * sqrt(x) = square root of x cos(x), sin(x), tan(x) = trigonometric functions acos(x),asin(x),atan(x) = inverse trigonometric fucntions log(x), log10(x) = logarithm, base e or base 10 exp(x) = e**x (e is the base for natural logarithm) There are many more Note: trig functions use radians, not degrees

What would the following program print? from math import * print("engr") print(((3**3)+4*5)*(sqrt(25)//2)+(28%10))

What would the following program print? from math import * print("engr") print(((3**3)+4*5)*(sqrt(25)//2)+(28%10)) Output: ENGR 102.0

Why? ((3**3)+4*5)*(sqrt(25)//2)+(28%10) (( 27 )+ 20)*( 5 //2)+( 8 ) ( 47 )*( 2 )+( 8 ) ( 94 )+( 8 ) 102 Why is 102.0 printed instead of 102? We ll see in 2 weeks.

A comment about comments Code can also include comments These start with a # character Everything on the line after the # is ignored by the computer Comments are there to help users We ll come back to these in more detail, later For now, we will use comments to write information at the top of our program, for class purposes. To record your name, etc.

First week s activities/goals Install the Python Compiler Install the IDE Write your first Howdy, World! program Practice computing mathematical values