Back
Unit 1
Unit 2
Mechanical Engineering, Robotics & Workplace Automation · Course 3 of 11
Computation and Programming for Engineers
Programming and numerical methods as everyday engineering tools — from fundamentals to solving engineering problems on a computer.
0 of 7 done
Start learning
Programming Fundamentals
- 1 Variables, Types, and Control Flow In a Python script, a name first holds the number 5, and a later line gives that same name the text “five”. What happens? Python as an engineering calculator: variables and dynamic typing, int, float, bool, and str, the division operators, comparisons and boolean logic, if/elif/else, for and while loops, indentation… Next up
- 2 Functions and Data Structures You have a list of 10,000 part numbers full of repeats and want each number only once. Which Python container gets you there in one step? Packaging code in functions with parameters, defaults, return values, and docstrings, and choosing among lists, tuples, dicts, and sets; iterating and list comprehensions; and combining the two in a… Next up
- 3 Working with Arrays and Plotting (NumPy and Matplotlib) In NumPy, y is an array of a thousand measurements. What does squaring y, written as one expression with no loop, give you? Why engineers use NumPy arrays instead of loops: vectorized arithmetic, slicing, and broadcasting, then turning arrays into labeled Matplotlib plots of models and measurements. Next up
Numerical Methods
- 4 Floating-Point and Error A program adds the same small decimal number to a running total a billion times. Compared with the exact answer, the computed total is likely to be: Why 0.1 + 0.2 isn't 0.3: IEEE 754 doubles, absolute and relative error, machine epsilon and the spacing of floating-point numbers, accumulation and catastrophic cancellation, and habits that keep… Next up
- 5 Root Finding and Linear Systems The standard equation for friction in a turbulent pipe flow has the unknown friction factor on both sides. How do engineers usually get the number? Solving f(x) = 0 by bisection, Newton, and secant methods and their convergence, SciPy's brentq and newton, a worked Colebrook pipe-friction example, and solving Ax = b by LU factorization without… Next up
- 6 Numerical Integration and Differentiation You need the total area under a curve of noisy sensor readings. Which is the safer way to add it up? Derivatives and integrals from samples: forward and central differences and why shrinking h too far backfires, the trapezoidal and Simpson's rules and their error orders, and SciPy's quad… Next up
- 7 Solving ODEs Numerically A simulation steps forward in time by following the current slope in a straight line for each step. What happens if the steps are too big? Stepping an initial value problem forward: Euler's method and its first-order error, fourth-order Runge-Kutta, step size and stiffness, and handing real problems to SciPy's adaptive solve_ivp. Next up