{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PHYS 5P10 - Introduction to Scientific Computing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "
\n", "

\n", "Most problem solving in science and engineering uses scientific computing. A scientist might devise a system of differential equations to model a physical system, then use a computer to calculate their solutions. An engineer might develop a formula to predict cost as a function of several variables, then use a computer to find the combination of variables that minimizes that cost. A scientist or engineer needs to know science or engineering to make the models. He or she needs the principles of scientific computing to find out what the models predict.\n", "

\n", "\n", "

\n", "Scientific computing is challenging partly because it draws on many parts of mathematics and computer science. Beyond this knowledge, it also takes discipline and practice. A problem-solving code is built and tested procedure by procedure. Algorithms and program design are chosen based on onsiderations of accuracy, stability, robustness, and performance. Modern software development tools include programming environments and debuggers, visualization, profiling, and performance tools, and high-quality libraries. The training, as opposed to just teaching, is in integrating all the knowledge and the tools and the habits to create high quality computing software “solutions.”\n", "

\n", "\n", "

\n", "Principles of Scientific Computing, by David Bindel and Jonathan Goodman\n", "

\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Linux is the (invisible) operating system layer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", "
\"[R.Stallman]\"
R.Stallman
\"[L.Torvalds]\"
L.Torvalds
\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Linux has a hierarchical architecture\n", "\n", "\"[Linux\n", " \n", "

From www.tutorialspoint.com/unix/

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Linux is a \"collection of small programs that do one thing well\"\n", "\n", "\n", "

\n", "Open a terminal window to interact with Linux\n", "\"[Linux\n", "

" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bash: /usr/bin/bash /usr/share/man/man1/bash.1.gz\n" ] } ], "source": [ "%%bash\n", "whereis bash" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-rwxr-xr-x 1 root root 964536 Oct 27 2021 /usr/bin/bash\n" ] } ], "source": [ "%%bash\n", "ls -la /usr/bin/bash" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Linux file system\n", "\n", "\"[Linux\n", "\n", "

\n", "

\n", "

\n", "\n", "Typical Linux directories\n", "

\n", "

\n", "

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A tutorial on basic shell commands\n", "\n", "By next Thursday:\n", "" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "5P10/Lab1/house/BR:cat\n", "5P10/Lab1/house/kitchen:cat2\n", "5P10/Lab1/house/BR:cat\n" ] } ], "source": [ "%%bash\n", "# start in home directory\n", "cd\n", "\n", "# create this course' work space, with a full parent directory chain\n", "mkdir -p 5P10/Lab1/house\n", "\n", "echo cat > 5P10/Lab1/house/BR\n", "echo dog >> 5P10/Lab1/house/BR\n", "\n", "grep -R ^cat 5P10\n", "\n", "echo cat2 > 5P10/Lab1/house/kitchen\n", "\n", "grep -R ^cat 5P10" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "5P10/Lab1/house/kitchen:dog2\n", "5P10/Lab1/house/BR:dog\n" ] } ], "source": [ "%%bash\n", "cd\n", "sed -ie 's/cat/dog/g' 5P10/Lab1/house/kitchen\n", "grep -R ^dog 5P10" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "15119 ? 00:00:00 Thunar\n" ] } ], "source": [ "%%bash\n", "ps -u pstudent | grep Thunar" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "We will be killing PID = 15119\n" ] } ], "source": [ "%%bash\n", "PID=`ps -u pstudent | grep Thunar | cut -f1 -d\\ `\n", "echo \"We will be killing PID = $PID\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "hide_input": false, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" }, "toc": { "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "toc_cell": false, "toc_position": { "height": "860.6px", "left": "0px", "right": "1185px", "top": "79.4px", "width": "387px" }, "toc_section_display": "block", "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 4 }