Lecture A: Welcome and Installation

Welcome to MTLE-4720

Welcome to MTLE-4720, Mathematical Methods in Materials Science! In this class I will be showing you some practical methods for solving the kinds of problems that emerge in Materials Engineering. This will also give me an opportunity to teach you some software tools that are probably new to you, but are widely used by computational scientists.

The skill of framing your problems analytically or numerically is something I have found to be very useful through my career. I feel like I learned a lot of things the "very hard way" and I'm hoping that I can help you get up to speed more quickly than I did when I was a student.

Getting Ready for Class

Each class will be composed of a short video lecture that I will use to set the stage for the problem or technique you will be working on.

I'm organizing the class in such a way that I will ask you to review the lecture videos prior to class time. We will spend the class time working together in a laboratory style environment where I will occasionally ask you to share your screen so that you can demonstrate the problems you are solving or the problems you are having. I will frequently share my screen to demonstrate my approaches during class.

Your Workspace and Resources for Reference

  • I'm not qualified to advise on the topic of ergonomics. Rensselaer Human Resources has an ergonomic self evaluation checklist that you may find useful. Being safe while you work will help you focus - so take care of your health, take breaks, and focus intently for short periods of time.
  • Solving problems in computing can be very rewarding. When you encounter problems, it could be that your approach needs modification, or that you have made a logical error in computing, or that you have made a syntatical error. I will try and teach you various strategies for solving problems through this class. One extremely important aspect of problem solving is to read the documentation of the software you are using. Many functions and programs that we will use are very well documented, but can be confusing to use at first. Take the time to figure out how to access that documentation.
  • Things I keep close at hand:
    • My notebook. Sometimes there isn't enough "screen space" to keep things in my vision or my short term memory isn't enough to hold on to an idea. Have a notebook handy to jot ideas or make sketches.
    • Water. You will need to stay hydrated.
    • Reference texts. There are some good references that I will call out in the lecture materials. I keep those books close at hand for various chapters or descriptions of mathematical ideas.
    • WebEx Teams or Slack or similar. When I'm working on a project - I sometimes need help from collaborators. Chat tools like these are a good way to establish a workgroup communication channel. We have one for the class that we will use.

Software and Languages Needed for Class

I will introduce a few new tools for you in this class. I'll list them below with a short description. I'll provide links to the sites and tools below and you can explore the documentation and help provided at each of those sites. For now, don't dive too deeply into the tools. I'll help you along the way.

Git and GitHub.com

  • The first tool is a software program called Git. This is a distributed version control system that can keep your code and changes organized. At first the workflow in nonintuitive - but after a few examples you will see how things work.
  • GitHub.com is a subsidiary of Microsoft and works to host software development using Git and provides a way to use Git from your web browser. There are numerous collaboration features through the web site and many big open source projects are hosted there.

GitHub Desktop

This is a front end to git and it provides an application that lets you work with repositories locally and interact with GitHub from your desktop. Many people have leared git "the hard way" from the command line, this software will help you accomplish many basic development tasks.

Help with Git

Two sites will be helpful for you to learn the basics of Git, GitHub and GitHub desktop:

Please have a look at both of those and refer to them from time to time.

Anaconda Python

The only software we need for this class is a python distribution and packages that we can install from within that distribution. For this class we will use Continuum's Anaconda distribution. We will use Python 3 for this class.

Download the Anaconda Python 3 distribution from: https://www.anaconda.com/products/individual and start up the Anaconda Navigator. This will provide a graphical front end to some common command line tasks.

Python

Why Python?

My main reasons for using Python with in the classroom setting are pragmatic.

Computer literacy is not a barrier.

Knowing that engineering students are generally used to "apps" and "office" suites, setting up a new programming/coding workflow on a student's computer is a barrier. Python distributions (Anaconda specifically) provide a one-click install that provides the student with the necessary tools to start working in my classroom. These environments are available for Linux, Windows and OSX. With some modest tutorials I can get the students into a notebook environment and reading my course notes with little effort. Approximately 2 out of 15 (or so) students will need direct intervention to help them get started on their personal computers. I can usually sort this out on the first day of class. This approach works well at schools where students all have (or are required to have) a laptop computer.

Alternatively, a shared filesystem and computer lab can be used. I worked with a very good team of computer technicians and was able to create the environment on a set of Windows PCs in two days.

Python is dynamically typed.

In some languages (e.g. C, Fortran) you must declare the type of the variable to allocate storage. In Python this happens dynamically. In the early stages of learning computation this is beneficial. I can postpone the discussion on representation of real numbers and memory allocation to later lectures where we discuss how to speed up code.

Python is interpreted rather than compiled.

This, plus the notebook format help the student make rapid progress in development of code and understanding of course material. Incremental, statement-by-statment development and assembly of complex functions from functioning parts can be used as a development paradigm right in the classroom.

The Jupyter Notebook is Immersive.

The documentation and interactive nature of Python/IPython/Notebook help the learning and development occur directly in the browser. You never have to take your eyes off the main window. (I will provide an example of this later.)

Markdown

What is Markdown?

A markup language uses a command syntax inline with the content of a document. You are probably most familiar with HTML, but there are others.

These languages can be challenging to use if you are starting out or if you are not used to programming. HTML, in partcular, looks more like computer code then what you (ultimately) want to see on a webpage. This is off-putting for content developers.

Attitudes now favor writing the content of documents so that they are human readable, and then permitting software (that other people write) to transform your document into something that looks different (usually nicer or more professional) or displays the content in a different type of software where the software controls the formatting. LaTeX is a very mature example of a markup language that scientists and engineers use to prepare formal reports and journal articles. For the most part, a LaTeX document can easily be read by a non-LaTeX programmer.

Recently the idea of more humane markup languages has emerged. These languages can easily be read in raw form but they can also be translated by other computer programs into other types of documents.

If you've ever sent a text message and used quotes: " ", asterisks: , or underlines: around a word, then you've already written in a type of "markdown". Software intended for the web generally will have some form of markdown available.

We feel that focusing on human readable content is an appropriate activity for faculty. Sticking to markdown syntax makes it possible for other software packages to interpret your content and create interactive notebooks, slides, homework assignments, course notes, etc.

The Jupyter Notebook

The Jupyter Notebook

The notebook provides a single interface for me and the student to interact with the course notes, presentation materials, and homework development. This is consciously part of what I call my "all-in-one" materials distribution strategy. The Notebook is a recent and still evolving project and that can be a bit of a challenge when major updates are released requiring minor tweaks to my code. In defense of the project, my code was the problem each time!

The Notebook works in the browser and this provides a familarity for the student as it is my impression that students spend a lot of their "idle" computer time in-app or in-browser. (E-mail, document creation, commerce, etc.)

Some good "notebook habits" have to be developed by the students, especially if they are used to programming in an IDE or with a compiled languge. The notebook launches a kernel for the selected language (there is more than just Python) and acts like a "state machine" where all the variables and symbols are accessed. This can be a problem at times, but can be remedied easily by re-launching and re-executing the cells when things go wrong.

A major strength of the Notebook is related to the synthesis of text input, equations, visualization and coding. I think students (and we) are used to compartmentalizing each of these activities. One familiar workflow might be to write a document in a word processor, manipulate data in a spreadsheet, edit equations in a plug-in, write code in a code editor or IDE and visualize data in a stand-alone visualization package.

I feel that this compartmentalization de-emphasizes the need of an engineer or researcher to explain their approach and methods, data collected, calculations, and intellectual contributions. To use the Notebook to develop a solution to a problem puts all of the options in front of the user - and the conspicuous absence of these elements could (should?) prompt the author to act to improve their communication.

Lastly, I use features that permit me to project my live-coding to the class. I feel that students' observation of my problem solving abilities and methods is instructive. Although it can be challenging for a student to see the meta-activity if they are focused on the results.

Scientific Computing With Python

This series of notebooks is an excellent introductory textbook for the class. The content is self explanatory and I use the material for reference often. You can find that material at https://github.com/jrjohansson/scientific-python-lectures.

Lecture Notes for Class

Your class notes will be distributed by GitHub. Head over to https://mathinmse.github.io/ to get started.