Developing a Solution How to create the computer-based solution for a real-world problem. The steps - Examples for each step
General Idea of This Lesson Give you methodology (i.e. a recipe) 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 ……”
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)
“The programmer should make the user’s life easy.” 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
Scientific Problem-Solving Method An everyday part of the engineer’s thought process. “If these steps are properly executed during the solution of problems in this text and all other courses, it is our belief that you will gradually develop an ability to solve a wide range of complex problems.” Engineering Fundamentals and Problem Solving, Eide, Jenison, Mashaw and Northup
Where do I even start? ME408 Clean Thermal Power Systems
Scientific Problem-Solving Method Problem Statement Diagram Theory Assumptions Solution Steps Identify Results & Verify Accuracy Computerize the solution Deduce the algorithm from step 5 Translate the algorithm to lines of code Verify Results
Scientific Problem-Solving Method Problem Statement Diagram Theory Assumptions Solution Steps Identify Results & Verify Accuracy Computerize the solution Deduce the algorithm from step 5 Translate the algorithm to lines of code Verify Results “coding” is very late in the process. NEVER create a program to “solve” a problem. => Create a program to re-use the solution for other sets of givens.
Scientific Problem-Solving Method Problem Statement Summarize the given information Must contain all essential information, units included! GET RID OF useless information! State what is to be determined Diagram Theory Assumptions Solution Steps Identify Results & Verify Accuracy Computerize the solution
Example – Aerospace Engineering Pb: ideal gas law 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) http://www.epa.gov/eogapti1/bces/module2/idealgas/idealgas.htm
Example – Mechanical Engineering R2 = 60lb R3 = 20lb Pb: 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 5ft 15ft 7ft square beam R1 = 10lb R4 = 50lb
Example – Civil Engineering Pb: 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 (in./in) elongation of rod (inches) 6ft 2000 lbs
Scientific Problem-Solving Method Problem Statement Diagram Sketch Diagrams Indicate all dimensions Theory Assumptions Solution Steps Identify Results & Verify Accuracy Computerize the solution
Example – Aerospace Engineering http://hsc.csu.edu.au/engineering_studies/focus/aero/3057/Graphics.html http://www.universetoday.com/29317/how-to-keep-asteroids-away-tie-them-up/ http://txchnologist.com/post/31532018204/txchnical-improvements-combining-rockets-and-jets-for
Example – Civil Engineering http://map.ua.edu/resources/
Example – Electrical Engineering
Scientific Problem-Solving Method Problem Statement Diagram Theory State/List all equations that will be used Explain all variables This step will be simple as a Freshmen, but may get to pages and pages of derivations in Senior year! Assumptions Solution Steps Identify Results & Verify Accuracy Computerize the solution
Example – General Equations Volume of a sphere Equation of a line V = 4/3*∏*R^3 y = m*x + b Volume of a cube Slope V = L^3 m = Δy/Δx = (y2-y1)/(x2-x1) Newton’s second law of motion Weight W = mass * g F = m*a
Example – ME/AE Engineering If the system is in equilibrium, ΣF = 0 (“sum of all forces equals zero”) Bernoulli’s Principle (fluid dynamic)
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 Penergy = w * h (W=weight (Newtons), h=height (m), P (Joules)) Kinetic Energy Kenergy = ½*m * v2
Scientific Problem-Solving Method Problem Statement Diagram Theory Assumptions List any assumptions (physical, mathematical, …) Make them clear to the reader Solution Steps Identify Results & Verify Accuracy Computerize the solution
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
Scientific Problem-Solving Method Problem Statement Diagram Theory Assumptions Solution Steps Show all complete steps and equations Number the equations if it helps you Detail each step precisely, even those that seem trivial to you Choose actual numerical values if needed The READER is the one who needs to understand Identify Results & Verify Accuracy Computerize the solution
Examples Number the equations © FrigginPhysics.com
Scientific Problem-Solving Method Problem Statement Diagram Theory Assumptions Solution Steps Identify Results & Verify Accuracy Circle your answer(s), draw a square around it, underline Make sure they have units VERIFY that the answer is plausible, realistic Computerize the solution
Identify Results Make sure the solutions are clearly identified example: boxed, circled, colored, underlined, centered… © FrigginPhysics.com
Verify Do the values match/verify the diagram? Common sense Visually Time cannot be negative Distance cannot be negative Visually If you drew a scaled diagram, verify that the results match the drawing? Is it realistic? Drive Time = 394,242,305,932seconds? Vrunner = 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.. http://www.hardenedshelters.com/underground.asp
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!!!!
Bad Presentations inadequate paper size, incomplete (missing data, and units), change of orientation, no breathing room… where are the results?! Semester 2012 Fall http://www.math.mcgill.ca/rags/JAC/ddb121.html
Scientific Problem-Solving Method Problem Statement Diagram Theory Assumptions Solution Steps Identify Results & Verify Accuracy Computerize the solution Deduce the algorithm from step 5 Translate the algorithm to lines of code Verify Results If all steps above were done thoroughly, this step 7 should not be mind-stressing. b. and c. is what will be learned all this semester!
7.a. 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
Example The problem The algorithm Define base and height Calculate area Display result OR Define side1 and 2’s length Define angle between the two sides height=6m base=3m “detailed yet general” side 1=25m side 2 = 45m angle = 26.5deg
Wrapping Up Determine what the problem is about: givens/solve for Use diagrams to help, if possible to scale! Careful with units Solve step by step – DETAILED. Make clear where are the results VERIFY the 1)reality and 2)accuracy of your result then code… NEVER code immediately Vocabulary: user, programmer, algorithm
Try it yourself Apply steps 1 through 7a. for the following problem You’re buying this odd shaped land. Cost of land is $100,000/acre. Given the following data (expressed in meters), how much do you expect to pay for this land?