cmps 1371 introduction to computing for engineers principles of problem solving
TRANSCRIPT
![Page 1: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/1.jpg)
CMPS 1371Introduction to
Computing for Engineers
PRINCIPLES OF PROBLEM SOLVING
![Page 2: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/2.jpg)
Problem Solving
Define the Problem Identify given information. Identify other available information. Design and implement your solution to the
problem. Verify your solution. Reflect on your solution.
![Page 3: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/3.jpg)
Example
Suppose you work for a company that produces packaging. You are told that a new material is available to protect the package if dropped, provided the package hits the ground at less than 25 ft/sec. The average package weight is 20 pounds with rectangular dimensions of 12 by 12 by 8 inches.
You must determine whether the packaging material provides enough protection when carried by a delivery person.
![Page 4: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/4.jpg)
Problem Solving
Define the Problem What problem are you trying to solve? "What would success look like?" What should the program output? Computed
values? A plot or series of plots?
The implication is that the package is to be protected from an accidental drop while being carried (not falling off the delivery truck)
![Page 5: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/5.jpg)
Problem Solving
Identify given information. What constants or data are supplied? What theory, principles, models and
equations have you been given?
The known information is the package’s weight, dimensions, and the maximum allowed impact speed.
![Page 6: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/6.jpg)
Problem Solving
Identify other available information. What theory, principles, models and
equations can you find in other sources (text books, lecture notes, etc.)?
Although not explicitly stated, you need to know the maximum height from which the package can be dropped without damage.
You need to find a relationship between the speed of impact and the height of the dropped package
![Page 7: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/7.jpg)
Problem Solving
Basic assumptions The package is dropped from rest with no
vertical or horizontal velocity The package does not tumble The effect of air drag is negligible Assume maximum height of 6 feet (ignore
those 8ft delivery men) The acceleration, g, due to gravity is constant
since only a 6 ft drop
![Page 8: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/8.jpg)
Problem Solving
Design and implement your solution to the problem. How can you break the larger problem into smaller
problems? Can you sketch the problem? Look at the problem from the top down or bottom up? What programming techniques might you use to
convert input to output? What variables do you need? Vectors? Arrays? What principles and equations apply to convert input to
output?
![Page 9: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/9.jpg)
Problem Solving
Since the problem involves mass in motion, we can apply Newton’s Laws: Height vs time to impact
h = ½ g t2
Impact speed vs time to impact v = g t
Conservation of mechanical energy
m g h = ½ m v2
m
h
ground
v
g
![Page 10: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/10.jpg)
Problem Solving
We could solve for any three of the equations, but notice the 3rd equation does not involve the impact time: m g h = ½ m v2
h = ½ v2 / g
Notice the mass cancelled out; hence, weight of the package does not affect the relation between the impact speed and the height dropped
![Page 11: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/11.jpg)
Problem Solving
Solution:h = ½ v2 / g
v = 25 ft/sec, g = 32.2 ft/sec2
h = ½ (25)2 / 32.2 = 9.7 ft
>>v = 25;>>g = 32.2;>>h = v.^2./(2.*g)h =
9.7050
![Page 12: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/12.jpg)
Problem Solving
Verify your solution. How do you know your solution is correct?
If the computed height was negative, we would know we did something wrong.
If the height was very large, we might be suspicious Computed height of 9.7 ft seems reasonable
To be conservative, we would report that the protective packaging works for heights less than 9 ft when dropped.
![Page 13: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/13.jpg)
Problem Solving
Reflect on your solution.
What worked?
What didn't?
![Page 14: CMPS 1371 Introduction to Computing for Engineers PRINCIPLES OF PROBLEM SOLVING](https://reader036.vdocuments.us/reader036/viewer/2022070402/56649f225503460f94c3a3ac/html5/thumbnails/14.jpg)
Fundamental Operations
List of possible operations we may expect to perform on collections
Build / Insert - Create a collection of elements Traverse - Create a new collection by operating
on an existing collection Map - Transform a collection with same length Filter - Remove items with specified criteria Fold - Collection is summarized Search - Locate specified element Sort - Re-ordering of elements