Computer Algebra and Technical Computing

Module Co-ordinator: BVorselaars@lincoln.ac.uk (Bart Vorselaars) The module gives an introduction to the modern computer packages for analytic formulas manipulation (computer algebra) and technical computing. The students will be learning how to use these state of art tools. They will also be developing skills at using a logbook as a factual record and as reflective self-assessment to support their learning.

Portfolio

MTH1006 Logbook (1st draft)

Examples

Course Components

  1. Portfolio Assignment (80%)
  2. In-Class Assignment (20%)

Outline Syllabus

  • Computer Algebra: Numerical calculations, built in functions & constants, basic algebraic operations, naming and evaluating expressions, defining and evaluating functions, plotting graphs (cartesian, polar and parametric, 3D, contour, surfaces), differentiation, 1st and 2nd derivatives, integration, approximating integrals, area, solids of revolution, partial differentiation, polynomial arithmetic, manipulating polynomials, factorisation of polynomials, limits, sequence and series, convergence tests, Taylor & Maclaurin series, simple differential equations, matrices, matrix operations, inverse, determinant. Linear systems of equations, row operations, eigenvalues and eigenvectors.
  • Technical Computing (MatLab): Control structures of a procedural language including for-loops and while-loops ; if, if-else, nested-if and switch statements, designing solutions of coding problems, programming language syntax, data input & output, graphical display of data, creating functions and script files, variables and data types including integers, floating point numbers, strings, 1D and 2D arrays and how to address and modify the elements in these arrays, writing and debugging computer programs.

Learning Outcomes

  • LO1 Use computer algebra to tackle simple mathematical problems.
  • LO2 Implement simple numerical algorithms using technical computing.
  • LO3 Maintain a well structured computational laboratory log-book.

Flashcards

Automatically ported into Anki TARGET DECK University::MTH1006 Computer Algebra and Technical Computing

  • STARTI [Basic] What is the MTH1006 module? Back: Computer Algebra and Technical Computing. ENDI
  • STARTI [Basic] Question: How do you create a row vector in MATLAB? Back: A = [1, 2, 3, 4]. ENDI
  • STARTI [Basic] Question: How do you create a column vector? Back: A = [1; 2; 3; 4]. ENDI
  • STARTI [Basic] Question: How to access the third element of a vector ‘A’? Back: A(3). ENDI
  • STARTI [Basic] Question: How to generate numbers from 1 to 5 with step of 0.5? Back: 1:0.5:5. ENDI
  • STARTI [Basic] Question: How to define a matrix in MATLAB? Back: A = [1, 2; 3, 4]. ENDI
  • STARTI [Basic] Question: How to get the transpose of a matrix ‘A’? Back: A’. ENDI
  • STARTI [Basic] Question: How to multiply two matrices ‘A’ and ‘B’? Back: A * B. ENDI
  • STARTI [Basic] Question: How to perform element-wise multiplication? Back: A .* B. ENDI
  • STARTI [Basic] Question: How to compute the inverse of a matrix ‘A’? Back: inv(A). ENDI
  • STARTI [Basic] Question: How to get the size of matrix ‘A’? Back: size(A). ENDI
  • STARTI [Basic] Question: What function is used for element-wise square root? Back: sqrt(A). ENDI
  • STARTI [Basic] Question: How to create a script file in MATLAB? Back: Save the file with a ‘.m’ extension. ENDI
  • STARTI [Basic] Question: How to add a comment in MATLAB code? Back: % This is a comment. ENDI
  • STARTI [Basic] Question: How to generate a 3x3 matrix of ones? Back: ones(3). ENDI
  • STARTI [Basic] Question: How to generate a 4x4 matrix of zeros? Back: zeros(4). ENDI
  • STARTI [Basic] Question: How to generate a 5x5 identity matrix? Back: eye(5). ENDI
  • STARTI [Basic] Question: How to get the sum of all elements in a vector ‘A’? Back: sum(A). ENDI
  • STARTI [Basic] Question: How to find the maximum element in vector ‘A’? Back: max(A). ENDI
  • STARTI [Basic] Question: How to find the minimum element in vector ‘A’? Back: min(A). ENDI
  • STARTI [Basic] Question: How to generate random numbers between 0 and 1? Back: rand(). ENDI
  • STARTI [Basic] Question: How to solve a system of linear equations ‘Ax = b’? Back: x = A\b. ENDI
  • STARTI [Basic] Question: How to generate a linear space between a and b with n points? Back: linspace(a, b, n). ENDI
  • STARTI [Basic] Question: How to plot a vector ‘A’ against vector ‘B’? Back: plot(A, B). ENDI
  • STARTI [Basic] Question: How to add a title to a plot? Back: title(‘Your Title’). ENDI
  • STARTI [Basic] Question: How to label the x-axis of a plot? Back: xlabel(‘Your Label’). ENDI
  • STARTI [Basic] Question: How to label the y-axis of a plot? Back: ylabel(‘Your Label’). ENDI
  • STARTI [Basic] Question: How to display a legend on a plot? Back: legend(‘Label1’, ‘Label2’). ENDI
  • STARTI [Basic] Question: How to plot in red color? Back: plot(A, B, ‘r’). ENDI
  • STARTI [Basic] Question: How to generate a histogram for a vector ‘A’? Back: hist(A). ENDI
  • STARTI [Basic] Question: How to clear the MATLAB command window? Back: clc. ENDI
  • STARTI [Basic] Question: How to clear all variables from the workspace? Back: clear. ENDI
  • STARTI [Basic] Question: How to find the eigenvalues of a matrix ‘A’? Back: eig(A). ENDI
  • STARTI [Basic] Question: How to concatenate two matrices ‘A’ and ‘B’ vertically? Back: [A; B]. ENDI
  • STARTI [Basic] Question: How to concatenate two matrices ‘A’ and ‘B’ horizontally? Back: [A, B]. ENDI
  • STARTI [Basic] Question: How to use a for-loop in MATLAB? Back: for i = 1:n, statements, end. ENDI
  • STARTI [Basic] Question: How to use a while-loop in MATLAB? Back: while condition, statements, end. ENDI
  • STARTI [Basic] Question: How to define a function in MATLAB? Back: function [output] = functionName(input). ENDI
  • STARTI [Basic] Question: How to use the if-statement in MATLAB? Back: if condition, statements, end. ENDI
  • STARTI [Basic] Question: How to use the else-if in MATLAB? Back: elseif condition, statements. ENDI
  • STARTI [Basic] Question: How to use the else statement in MATLAB? Back: else, statements, end. ENDI
  • STARTI [Basic] Question: How to find the determinant of matrix ‘A’? Back: det(A). ENDI
  • STARTI [Basic] Question: How to find the length of a vector ‘A’? Back: length(A). ENDI
  • STARTI [Basic] Question: How to reshape a matrix ‘A’ into a 3x2 matrix? Back: reshape(A, 3, 2). ENDI
  • STARTI [Basic] Question: How to convert a string to a number? Back: str2double(‘string’). ENDI
  • STARTI [Basic] Question: How to convert a number to a string? Back: num2str(number). ENDI
  • STARTI [Basic] Question: How to round a number to the nearest integer? Back: round(number). ENDI
  • STARTI [Basic] Question: How to compute the factorial of a number? Back: factorial(number). ENDI
  • STARTI [Basic] Question: How to compute the sin of an angle in radians? Back: sin(angle). ENDI
  • STARTI [Basic] Question: How to compute the cosine of an angle in radians? Back: cos(angle). ENDI
  • STARTI [Basic] Question: How to compute the tangent of an angle in radians? Back: tan(angle). ENDI
  • STARTI [Basic] Question: What does the MATLAB command “fprintf” do? Back: It writes formatted data to a file or to the command window. ENDI
  • STARTI [Basic] Question: In MATLAB, how do you use “fprintf” to print a number with two decimal places? Back: fprintf(‘%.2f’, number) ENDI
  • STARTI [Basic] Question: What does the MATLAB command “sprintf” do? Back: It formats data into a string instead of printing it. ENDI
  • STARTI [Basic] Question: In MATLAB, how do you use “sprintf” to format a number as a string with two decimal places? Back: str = sprintf(‘%.2f’, number) ENDI
  • STARTI [Basic] Question: When using “fprintf” in MATLAB, what does “%d” represent? Back: An integer. ENDI
  • STARTI [Basic] Question: When using “sprintf” in MATLAB, what does “%s” represent? Back: A string. ENDI
  • STARTI [Basic] Question: How can you print a new line using “fprintf” in MATLAB? Back: Use the newline character “\n”. Example: fprintf(‘This is line one.\nThis is line two.\n’) ENDI
  • STARTI [Basic] Question: In MATLAB, how can you use “fprintf” to display a string variable named “text”? Back: fprintf(‘%s’, text) ENDI

Weeks Content

Week 1

slides-session1.pdf exercises-session1.pdf

Week 2

slides-session2.pdf exercises-session2.pdf

Week 3

slides-session3.pdf exercises-session3.pdf

Week 4

slides-session4.pdf exercises-session4.pdf

Week 5

slides-session5.pdf exercises-session5.pdf

Week 6

slides-session6.pdf exercises-session6.pdf

switch_test.m

Week 8

slides-session7.pdf exercises-session7.pdf

nexthour.m test_nexthour.m

Week 9

slides-session8.pdf exercises-session8.pdf

fileex.m temp.txt time.txt sample.txt subjexp.txt

Week 10

exercises-session9.pdf slides-session9.pdf

yearmalefemale.txt