Download presentation
Presentation is loading. Please wait.
Published byLeon Richard Modified over 9 years ago
1
Lecture 2 1.Computing 101 2.Developing a Solution 3.Problem Solving
2
Recommendation on taking notes in EGR115 Notebook – slide number in margin. comments on the right. – write down vocabulary words – write down overall ideas – write down things that we repeat 4 or 5 times! – write down possible errors Printout of Slides* – print 2 or 3 slides per page – draw arrows, add your comments – Highlight *We will do our best to have the slides posted by the night before, but no guarantees. 2
3
Computer Hardware 1946 – ENIAC (Electronic Numerical Integrator And Computer) – First general purpose electronic computer. The Von Neumann computer architecture is mostly what we use today. The architecture separates a computer in 3 major parts: – The Central Processing Unit (CPU) – The computer memory – The Input/Output (I/O) devices 3 CPU + memory Screen=output Speakers=output Mouse=input Keyboard=input ? ?
4
The important pieces Computing (as a whole) can be broken into 4 main categories: – Hardware What people generally think of as the computer. You can touch it. (Normally limited to electronic components) – Software Applications, games, programs you run. – Data The stuff applications use and produce – Word documents, saved game files, Excel Spreadsheets, etc. – Media Where things get stored. Hard disks, USB thumb drives, CD/DVD disks, 3.5” floppy disks, magnetic tape.
5
Programming? You will generally be using hardware to write software that uses data and is saved on media. Programming is the act of writing logical instructions that the computer will execute when the software is used. Writing a program can be as difficult as learning to speak a foreign language, since the programmer is constrained to the vocabulary (specific terminology or keywords), grammar (exact syntax), and punctuation (symbols) of programming. 5
6
Categories of software Software contains the instructions the CPU uses to run programs. There are several categories, including: – Operating systems (OS) – manager of the computer system as a whole – Software applications – commercial programs that have been written to solve specific problems – Language compilers - to ‘translate’ programs written by people into something understandable by the machine (sometimes not needed) 6
7
Generations of Languages used to write software 1) Machine language – also called binary language. Sequence of 0’s and 1’s. (rarely written by hand) 2) Assembly language – each line of code produces a single machine instruction (add, subtract…) (Used by specialty professionals) 3) High-level language – slightly closer to spoken languages. (How most programmers program) 7 addb,c adda,b a = a + b + c; This line does the same as the two above.
8
Finally… MATLAB Is both a software application and a language interpreter. Is an interpreted language – does not require compilation, but it does have a conversion step hidden from the user. Has an interactive environment – – “In the MATLAB environment, you can develop and execute programs that contain MATLAB commands. You can execute a MATLAB command, observe the results, and then execute another MATLAB command that interacts with the information in memory, observe its results and so on.” 8
9
Generating a Solution Computers make very fast, very accurate mistakes. They do exactly what you tell them to, not what you mean for them to do. You are looking to design a technique for solving a problem. If the inputs change, then the technique should still work. If the goal is to solve a problem, you have to know how to solve the problem before you can tell the computer how to solve it. The set and order of steps you (and the computer) take to solve a problem is called an algorithm.
10
General Idea of This Lesson Provide you with a method (i.e. a recipe) for solving problems Example problems: “Find the optimum nozzle dimensions for …” “Solve for the optimum path for the robot …” “Find the range of temperatures adequate for …” In EGR115, most tasks will be: “Develop a program that ……”
11
General Terms Keep in mind there are 2 sides to software – The person who writes software: the programmer – The person who uses software: the user (i.e. client) 11
12
General Terms Keep in mind there are 2 sides to software – The person who writes software: the programmer – The person who uses software: the user (i.e. client) As you (the student) develop software, you will constantly jump back and forth between the two roles. Your goal: “The programmer should make the user’s life easy.” -Clear directions -Clear units -Examples of answers -Clean presentation 12
13
Where do I even start? ME408 Clean Thermal Power Systems 13
14
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify result 14
15
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 15 Create a program to “solve” many instances => Create a program to re-use the solution for other sets of givens. Coding is very late in the process.
16
Scientific Problem-Solving Method 1.Problem Statement – Summarize the given information – Must contain all essential information, units included! GET RID OF useless information! – State what is to be determined 16
17
Example – Aerospace Engineering Problem: – Givens Temperature (Kelvin) Volume (meters cubed) n : chemical amount of gas (moles) R : gas constant R = 8.3144 Joules/(moles*Kelvin) – Solve for The pressure (Pascals) 17 http://www.epa.gov/eogapti1/bces/module2/idealgas/idealgas.htm NOTE: There is no full sentence here!!! Do not rewrite the problem. Separate the GIVENS from the SOLVE FOR. (Might use the Ideal Gas Law)
18
Example – Mechanical Engineering Problem: Stress on a beam – Givens Load 1: R1 = 10lb Load 2: R2 = 60lb Load 3: R3 = 20lb Load 4: R4 = 50lb Distances from start of beam to load2: 5ft Distance between load2 and 3: 15ft Distance between load3 and end of beam: 7ft – Solve for shear diagram moment diagram 18 square beam R 1 = 10lb R 2 = 60lb R 3 = 20lb R 4 = 50lb 5ft15ft7ft NOTE: There is no full sentence here!!! Do not rewrite the problem. Separate the GIVENS from the SOLVE FOR.
19
Example – Civil Engineering Problem: Elongation of rod – Givens diameter of rod: 0.5in length of rod: 6ft weight of load: 2000lbs material: steel – Solve for normal stress in rod (psi) strain (elongation for 1 unit) in the rod (inches/in) elongation of rod (inches) 19 2000 lbs 6ft AGAIN… No full sentences
20
Scientific Problem-Solving Method Sometimes it is helpful to think about the problem this way: – What am I trying to get to (e.g., the output)? – What are the constants given in the problem? – What are the things the user will provide (either from the keyboard or a file) – What are the constants I think I will need but that aren’t given (e.g., gravity, pi, etc.) – What things can I calculate with that information? Note, this may be something where you know how to calculate (e.g., area or circumference) or that you know a formula exists for and you just need to find that formula. (e.g., solving for unknown parts of a triangle)
21
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 21
22
Example – Aerospace Engineering 22 http://txchnologist.com/post/31532018204/txchnical- improvements-combining-rockets-and-jets-for http://www.universetoday.com /29317/how-to-keep-asteroids- away-tie-them-up/ http://hsc.csu.edu.au/engineering_studi es/focus/aero/3057/Graphics.html
23
Example – Civil Engineering http://map.ua.edu/resources/ 23
24
Example – Electrical Engineering 24
25
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 25
26
For example… Assume no friction Assume wall thickness is negligible Assume initial speed is zero Assume mass of object is negligible Aerodynamics: Assume laminar flow (i.e. no turbulence) Thermodynamics: Assume geometry of a turkey is that of an American football Solids: assume system is in equilibrium 26
27
Assumptions ASSUMPTIONS ARE NOT FACTS! Assume “Area of a Circle” = π * radius 2 That isn’t an assumption – it’s a fact. Assumptions are things that MIGHT not be true (or that you know AREN’T true). Assuming π = 3.14 is an assumption because you know it isn’t true. They may be necessary to solve the problem, or they may just make the problem easier to solve.
28
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 28
29
Example – General Equations Volume of a sphere V = 4/3*∏*R^3 Volume of a cube V = L^3 Newton’s second law of motion F = m*a Equation of a line y = m*x + b Slope m = Δy/Δx = (y2-y1)/(x2-x1) Weight W = mass * g 29
30
Example – ME/AE Engineering If the system is in equilibrium, ΣF = 0 (“sum of all forces equals zero”) Bernoulli’s Principle (fluid dynamic) 30
31
Example – Electrical/Civil Engineering Ohm’s law V = R*I (V=voltage (V), R=resistance (Ω), I=current (A)) Electrical Power (i.e. Work) P = V * I (P = power, in Watts) Potential Energy P energy = w * h (W=weight (Newtons), h=height (m), P (Joules)) Kinetic Energy K energy = ½*m * v 2 31
32
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 32
33
Examples Number the equations 33 © FrigginPhysics.com
34
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 34
35
Identify Results Make sure the solutions are clearly identified – example: boxed, circled, colored, underlined, centered… 35 © FrigginPhysics.com
36
Verify Do the values match/verify the diagram? Common sense – Time cannot be negative – (Scalar) distance cannot be negative Visually – If you drew a scaled diagram, verify that the results are close to the drawing? Is it realistic? Drive Time = 394,242,305,932 seconds? V runner = 217.5 miles/hr When turning in homework, always work on fixing errors, but if you fail, at least indicate “something wrong, this is unrealistic”… before turning it in.. 36 http://www.hardenedshelters.com/underground.asp
37
Last but not least!!! Presenting the data Paper, or machine Either way: – Clearly present the information – Words and sentences must explain what’s going on each step – Skip lines, space things out! not everything has to fit on the top left corner!!!! 37
38
Bad Presentations 38 inadequate paper size, incomplete (missing data, and units), change of orientation, no breathing room… where are the results?! http://www.math.mcgill.ca/rags/JAC/ddb121.html Semester 2012 Fall
39
HORRIBLE HANDWRITING! You can feel it in your guts… How you can feel “OK” turning this in???? - See this as a draft, & start over!! 39
40
What is this? Lower case b? Lower case c? Lower case e? Capitol G? If we can’t clearly identify it, it is wrong.
41
Scientific Problem-Solving Method 1.Problem Statement a.Diagram b.Assumptions 2.Solution Steps (manual solution) a.Theory / limitations b.Itemize specific steps (in order) as you solve the problem c.Identify results & verify accuracy 3.Computerize the solution a.Express the algorithm as steps general to any instance of the problem b.Translate the algorithm to lines of code c.Test and verify results 41 b. and c. is what will be learned all this semester!
42
3a. Deduce the algorithm In mathematics and computer science, an algorithm is a step-by- step procedure for calculation. (Wikipedia) More precisely, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. (Wikipedia) Algorithms – must not be complex! – should be detailed/organized – must be general enough for different values of inputs – Simple problem = simple algorithm – Complex problem = detailed algorithm 42
43
Example The problemThe algorithm Define base and height Calculate area Display result OR Define side1 and 2’s length Define angle between the two sides Calculate area Display result 43 height=6m base=3m side 1=25m side 2 = 45m angle = 26.5deg “detailed yet general” NOTE: There is neither full sentence here, nor detailed equations!!!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.