ME 350 deals with three main ideas.
- MATLAB software
- Numerical methods
- Computational thinking
These ideas overlap and interact. As we study different problems during the term, the emphasis or perspective on the problem will shift between these three ideas.
MATLAB Software
When engineers are first exposed to MATLAB they tend to focus on the syntax and the mechanical use of MATLAB as a software application. This is important because until you know how to use MATLAB, it is hard to use MATLAB to perform higher level conceptual tasks.
In this course you will gain enough MATLAB programming skill that you will be able to apply MATLAB in other courses of the BSME curriculum.
You should already have some exposure to MATLAB in prior courses. At least, that is what the prerequisites from the first two years of the BSME program specify. In this course we will solidify and expand your MATLAB skills. If you don't have prior MATLAB experience, don't worry, we won't expect you to become expert programmers in this short class.
In fact, programming, like speaking a language, takes years of practice to do well. Some of you will enjoy programming and develop a high level of skill as you continue to use MATLAB and other computer languages. Mechanical engineers with good programming skills have good job mobility and are in high demand in many areas from robotics to building energy analysis.
Even if you don't have programming skills, and if you think that you hate programming, learning basic programming skills will help in many aspects of engineering. Computers and the use of computational tools are likely to become more powerful and pervasive. Even if you don't practice programming in the conventional sense of writing computer programs, you already think algorithmically. Developing even a basic skill with programming will help you recognize the algorithmic thinking you already do, and it will help you think better.
Here is an outline of the MATLAB software topics that we will cover this term.
- MATLAB as a programming language
- Creating scalar, vector and matrix variables
- Mathematical operations with variables: matrix operations and array operations
- Loops
- Branching ("if" constructs)
- Functions:
- Using input and output parameters
- Organizing a problem into re-usable parts (computational thinking)
- Creating and saving plots
- 2D Plot types
- Symbols and lines
- Linear and logarithmic scaling of axes
- Multiple curves (data sets)
- Annotation
- Axis labels
- Legends
- Incorporating plots into reports and documents
- Writing re-usable code
- Functions with input and output parameters
- Commenting code
- Finding good ways to decompose problems (computational thinking)
Not every engineer needs to become a modestly skilled programmer. However, all engineers need to understand how software can be used to solve engineering problems. That understanding requires basic knowledge in programming, numerical methods and computational thinking. Therefore, in addition to basic programming in MATLAB, we will also teach you some basic numerical methods and some computational thinking that you can use immediately as you develop your programming skills.
Numerical methods
Numerical methods encompasses a large set of techniques for quantitative analysis of problems that either are not practical to solve with exact analytical methods, or that may be impossible to solve with exact analytical methods. As software tools become both more pervasive and easier to use, it is important to study the fundamentals that underly numerical problem-solving.
For example, engineers can easily write the differential equation that describe how a simply supported beam with a uniform cross section will deform under a point load or a distributed load. The solution to that differential equation is published in many books. However, an analytical solution is not practical if the cross section of the beam varies in a complex way along its length, or if the beam is supported in complex ways, or if the load is non-uniform or time dependent. For these more complicated, and in many ways more realistic problems, a computer model is the only way to perform the engineering analysis. The computer models that engineers to solve complex structural problems (and many other types of practical problems) use a combination of several numerical methods. Understanding the basic ideas of numerical methods will help you understand that even the slickest looking software has limits.
In ME 350 we will introduce and use three types of numerical methods
- Root-finding
- Solving linear systems
- Solving ordinary differential equations (ODEs)
This is a very small set of numerical methods that we have chosen to fit into the limited time available in the term. These three methods provide you with a foundational exposure to numerical problem-solving.
In this class we will use a two-step approach to numerical methods, especially for root-finding and solving ODEs. The first step will be to learn one or more basic methods for solving a given class of problems. The basic methods are implemented in simple MATLAB programs that allow you to see how the method works. We then introduce ideas or sample problems that the simple methods are not good at handling. This motivates an understanding of the more advanced methods. In the second step, for the same class of problems we show how to use the much more sophisticated tools that are built-into MATLAB. The two-step approach to numerical methods can be summarized as
- Learn the details of a simple method
- Learn how to use the more sophisticated methods that are part of MATLAB
Computational thinking
Computational thinking is using an understanding of how computers, algorithms and numerical analysis work in order to solve problems. The solution may or may not involve computers. In other words, you can, and should, become skillful at computational thinking without needing to use a computer to do carry out and apply the thought process.
For example, at the grocery store, if you choose a check-out line by scanning and comparing the number of shoppers, the size of their purchases, and the body language of the check-out clerk, you are practicing computational thinking. Your thinking factors in the load for each line, with your understanding of the algorithm for checking, bagging and paying, along with empirical and heuristic evidence for the customers and checkers in each line.
If you factor in the cost of running an experiment (time, materials, personnel) and consider the cost of running a simulation (time, software license, computer upgrade, personnel) and decide to combine the strengths of both methods, then you are practicing computational thinking. The key idea is that you are not just using experience and making a gut call. You are manipulating models that trade off efficiency and accuracy, and scheduling versus opportunity costs, and weighing these factors against other potential external forces that could interfere with the execution of either or both approaches.
These two examples are not only about executive decision-making. Computational thinking occurs when you combine algorithms, models of computing efficiency and human decision-making as you do engineering analysis.
Here is a list of ways that computational thinking is demonstrated.
- Awareness of how numerical methods complement analytical methods
- Develop an ability to work with approximate models.
- Use analytical models as prototypes for numerical models.
- Use analytical models to develop order-of-magnitude estimates.
- Know when to take an approach that is completely unlike the analytical model.
- Know when an analytical model is sufficient or superior, thereby making a computational model unnecessary.
- Algorithmic thinking
- Develop precise and repeatable steps to solving a problem, i.e. avoid ad hoc methods that work by luck, or that only work in a very limited circumstance (input parameters, boundary conditions, etc.).
- Develop an ability to create abstract models from specific cases – seeing the pattern of the problem, not just the details of one instance.
- Decompose complex problems into manageable chunks
- Use recognizable sub-problems with known solution methods.
- Craft components that solve chunks of the problem.
- Put the chunks together, in a constructive order, to solve a larger problem.
- Reuse the chunks!
- Devise ways to test your algorithms and code
- Understand that getting an answer is not the same as getting the right answer or even a useful answer.
- Use analytical solutions of simpler problems as benchmarks.
- Develop a testing habit and mind-set: devise tests that your solution must pass before you even have a solution.
- Develop an ability to expect and accept limited accuracy, and incorporate uncertainty into decisions.
Putting the pieces together
We begin the course by focusing on learning MATLAB as a software system. However, we will not wait, we cannot afford to wait, for you to master MATLAB (as software) before you use numerical methods to solve otherwise unsolvable problems. In other words, your MATLAB programming skills will grow and develop as you gain knowledge of numerical methods.
Along the way, we will using ideas from computational thinking to motivate different approaches to problem-solving. We will also use algorithmic and abstract thinking to guide the choice of a particular numerical method and its implementation in a MATLAB program.
References
- Wing, J., Computational Thinking, Communications of the ACM, March 2006, Vol. 49, No. 3, downloaded from https://www.cs.cmu.edu/~15110-s13/Wing06-ct.pdf on 8 January 2017.