2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices

Size: px
Start display at page:

Download "2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices"

Transcription

1 2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices 1

2 Last compiled September 28,

3 Contents 1 Introduction 5 2 Prelab Questions 6 3 Quick check of your skills Introduction to Linux Procedure Series and Sequences Procedure Special Functions and Recurrence Relations Series Representations of Bessel Functions Procedure

4 6 Matrix Arithmetic Background Index Notation Matrix Operations C Arrays and Matrices Rotation Matrices Procedure

5 1 Introduction ATTENTION! You are currently reading the notes for the EXPE- RIENCED coding stream! This means you feel you have a high enough level of coding experience to go straight into the applications your demonstrators want to teach you. You should consider carefully whether the experienced or standard stream is right for you. Changing between streams runs the risk of missing important techniques so you re encouraged to stick to one stream. Occasionally there may be sections that seem a bit basic on the coding side but we felt were important to guarantee you don t skip mathematical techniques you ll need for later examples. Good luck! 5

6 2 Prelab Questions Note: Pseudo-code is just an informal description of the commands that you would pass to the computer and is designed to help you think about how you would structure a real program. You won t be compiling this, so don t worry about using perfect syntax in the pre-labs. 1. Draw a flow chart for how you would recursively compute the factorial, n! for a given integer n. Hint: There should be a termination condition when n = Draw a flow-chart for question 3 of the procedure in section 4.1 showing how you use the Euler Method to find a series expression for π. Translate this to pseudo-code. 3. (Advanced) Ok, enough flow charts. A Fourier series decomposes an arbitrary periodic function into a infinite sum of harmonic functions. The Fourier series for the function f 6

7 can be expressed as: f(x) = a a n cos(nx) + b n sin(nx) n=1 n=1 (1) Where {a n, b n } are Fourier coefficients which can be found via standard orthogonality arguments. You are given the Fourier coefficients as N-dimensional arrays, a i = a[i], b j = b[j], Write pseudo-code for a function that computes the Fourier series, truncated at order N. Assume you can call the trigonometric functions as cos() and sin(). 4. (Advanced) Repeat the above, only now you cannot call predefined trigonometric functions and must use the Taylor series expansions for sin and cos given below, truncated at order M. You will need to make use of nested loops, or alternatively define your own func- 7

8 tions. cos(x) = sin(x) = ( 1) n x2n (2n)! ( 1) n x2n+1 (2n + 1)! n=0 n=0 (2) (3) 8

9 3 Quick check of your skills 3.1 Introduction to Linux The part 2 lab computers are running Linux operating systems. Here are the standard commands: Command Description cd Move to new directory mkdir Create new directory cp Copy file mv Move file rm Remove file ls View contents of current directory touch Create file pwd Display working directory / Location of home directory ; End of line Table 1: List of basic Linux terminal commands. 9

10 The language of choice for these labs is C. We will be using the compiler gcc. To run gcc: gcc list_of_source_files -o executable_name; 1 Question: What does -o tell the compiler to do? The first library we will use is stdio, accessed by including <stdio.h> in the relevant source files. This library contains functions which deals with data input and output, including the function printf, which takes a string of characters inside double parentheses, and prints them in the command line. Note: the newline character is given by \n. 10

11 3.2 Procedure 1. Write a simple function quadratic(a,b,c,x), which returns y(x) = ax 2 + bx + c. 2. Extend this program such that a, b, c and x are entered into the terminal by the user, and the result y(x) is returned and displayed. 3. Evaluate a simple function such as quadratic(a,b,c,x) over the range 1 x 5, with 5 equallyspaced data points. 4. Export a table of arguments and function values to an external file such as quadratic.dat. 5. Read the data from quadratic.dat and use PGPLOT to graph and print this data. (It is OK to copy the PGPLOT segment directly form the example code. Read and understand the comments in the file. Try playing around with the settings.) // Example Code for Plotting data // Author: Julia McCoey

12 //Date: 01/03/2016 // This program plots the function 'quadratic' using the plotting program PGPLOT. #include <stdlib.h> #include <stdio.h> #include <cpgplot.h> #define ARRAY_SIZE 5 // Size of the arrays // Declare functions signatures. // This provides the compiler the input parameter and return types before it actually reads the function DEFINITION defined below main. float quadratic(float a,float b,float c,float x); // This the main program int main() {

13 int plotpointcount = 5; //Number of points to plot int xmin = 0; //Minimum x value on axis int xmax = 6; //Maximum x value on axis int ymin = 0; //Minimum y value on axis int ymax = 80; //Maximum y value on axis float xvalues[array_size]; //Array containing x values float yvalues[array_size]; //Array containing y values float a = 2; //Arbitrary value a float b = 3; //Arbitrary value b float c = 5; //Arbitrary value c FILE *datafile; file // File pointer for data datafile=fopen("quadratic.dat", "r"); // Open the data file // Fill x and y arrays with data. fscanf(datafile, "%f\t%f\n", &xvalues[0], &yvalues[0]); fscanf(datafile, "%f\t%f\n", &xvalues[1],

14 &yvalues[1]); fscanf(datafile, "%f\t%f\n", &xvalues[2], &yvalues[2]); fscanf(datafile, "%f\t%f\n", &xvalues[3], &yvalues[3]); fscanf(datafile, "%f\t%f\n", &xvalues[4], &yvalues[4]); fclose(datafile); ///////////////////////////////// //Code for using PGPLOT: ///////////////////////////////// // The cpgbeg function starts a plotting page cpgbeg(0,"?",1,1); // Sets the active drawing colour: 1-black, 2-red, 3-green, 4-blue cpgsci(1); // Sets the active line drawing style: 1-solid, 2-dashed, 3-dot-dashed, 4-dotted cpgsls(1);

15 // Sets the active character height, larger number = bigger cpgsch(1.); // Sets the axes limits cpgswin(xmin,xmax,ymin,ymax); // Draw the axes cpgbox("bcnst", 0.0, 0, "BCNST", 0.0, 0); // Label the bottom axis cpgmtxt("b",3.,.5,.5,"x axis"); // Label the left axis cpgmtxt("l",3,.5,.5,"y axis"); // Sets character height (this time for the title) cpgsch(2.); // Write the title cpgmtxt("t",1,.5,.5,"title"); // Connect 'plotpointcount' points in 'xvalues' and 'yvalues' with a line

16 } cpgsci(7); cpgline(plotpointcount,xvalues,yvalues); // close all pgplot applications cpgend(); return 0; //The 'quadratic' function is defined here: float quadratic(float a,float b,float c,float x) { return (a*x*x)+(b*x)+c; }

17 4 Series and Sequences Series expressions are extremely useful in mathematics and physics, and are often the only solution to a system of equations. By truncating a series at order N, we can find a numerical approximation of the solution, which gets more accurate as N increases. Such is the case for the Gregory Series expansion of π, which can be obtained from Machins Formula 1 4 π = 4 tan 1 ( ) 1 5 ( ) 1 tan (4) and can be seen in Table 2, along with other valid expansions. The Hayashi expansion uses the Fibonacci sequence F n, given by F n = F n 1 + F n 2 (5) where the sequence is seeded by the values F 1 = F 2 = 1. Given their iterative nature, the numerical evaluation of series should be done with loops. Specifi- 17

18 Name Definition (k!) 2 2 k+1 Newton/Euler (2k + 1)! k=0 ( 1) k+1 Gregory 4 2k 1 k=1 N (2k) 2 Wallis 2 (2k 1)(2k + 1) k=1 ( ) 1 Hayashi 4 arctan k=1 F 2k+1 Table 2: Series expression for π 18

19 cally, given the incremental increase of the summed variable, for loops are the most convenient to use. 4.1 Procedure 1. Write a program which uses a loop to print integers 1-10 in the terminal. 2. Write a loop which calculates the first 10 Fibonacci numbers, and print them to the terminal. 3. Write a function which uses a loop to calculate the series expression for π up to order N, using the Euler Method. 4. Investigate the convergence of the formulae for π in Table.2 (by comparison to its exact value) as a function of series truncation N, and produce a table of results. This means you should write code for all of the other series. 19

20 5. Order these series formulae from most to least convergent. 5 Special Functions and Recurrence Relations 5.1 Series Representations of Bessel Functions As an interesting application of numerical evaluation of series expansions, we will now look at the solutions to Bessel s equation, specifically, at Bessel Functions of the First Kind. Bessel s differential equation is given by x 2d2 y dx 2 + xdy dx + (x2 n 2 )y = 0 (6) It is a 2-dimensional wave equation, and has many applications in physics including the notable examples: description of electromagnetic waves in a cylindrical wave-guide, solutions to the radial Schrodinger 20

21 Equation for a free particle, and modes of vibration on a circular drum. (refs) For integer n it has the series solutions J n (x) = where N. N l=0 ( 1) l 2 2l+n l!(n + l)! x2l+n (7) 5.2 Procedure 1. Use the series solution for J n (x) of arbitrary integer order n 1 to write a function bessj(n,x) 2. Generate and plot a data file bessjn.dat for the zeroth- and first-order Bessel functions J 0 (x) and J 1 (x) between 0 x 10 with 1000 data points, using each of N = {10, 50, 200}. 3. Repeat the above step for all Bessel functions of the first kind, J n (x), up to n = 6, using N = 200 terms in the series. (This will require a nested loop). Plot the results. 21

22 6 Matrix Arithmetic 6.1 Background Index Notation Index notation is a way of representing and manipulating matrices in compact form, without direct reference to their elements. In index form the matrix M ij has two indices i and j, representing rows and columns respectively. In this notation vector have one index, representing either rows or columns. The order of indices is important, and reversing i and j is equivalent to taking the transpose of the matrix, i.e. M ij = (M ji ) T. Repeated indices are summed, and only adjacent indices can be summed. If non-adjacent indices need to be summed, the transpose of the matrix must be taken, for example M ji V j is really (M ij ) T V j. In this notation, the summing of an index is equivalent to taking the inner product of that index. For example, the dot product of two vectors A B, can 22

23 be expressed in index notation as A i B i, and the product of a matrix and a vector as M ij A j, etc. In order to sum two indices, they need to be of the same size. This notation is especially useful when performing matrix multiplications numerically, as loops can easily be employed to sum indices Matrix Operations Operations on matrices, while potentially tedious to do analytically, can be done rapidly with the use of numerical techniques. As hinted above loops can be employed to calculate inner products of matrices and vectors. Table3 show a list of basic matrix operations, expressed in index form C Arrays and Matrices C arrays can be generalised to matrices by declaring 2 indices instead of one, i.e. int matrix[2][2]; 1 23

24 Name Addition Subtraction Matrix Multiplication Matrix-Vector Product Transpose Trace Definition M ij + N ij M ij N ij M ij N jk M ij A j M ij = (M ji ) T M ii Table 3: Matrix operations declares a 2 2 matrix of integers with 0 being the index minimum Rotation Matrices The action of rotation is to transform a vector in 3-space into a vector pointing in a different direction, i.e. a different vector in 3-space. We can therefore represent this transformation as a 3 3 matrix R ij (i, j span from 0 to 2), which acts on a 3- dimensional vector producing a new 3-dimensional 24

25 vector pointing in a new direction, i.e. V i = R ij V j. (8) We can go further and decompose R ij into 3 rotations about the coordinate axes, x, y and z, by angles α, β and γ respectively, i.e. R ij = R x (α) ik R y (β) kl R z (γ) lj. (9) An explicit representation of the rotation matrices is given by: R ij = R x (α) ik R y (β) kl R z (γ) lj = cos α sin α 0 sin α cos α cos β 0 sin β sin β 0 cos β cos γ sin γ c Procedure 1. Draw a flowchart for a matrix multiplication function. 25

26 2. Write this function and confirm that your code output for A + B is correct, as well as A C, using these matrices: A ij = ( ), B ij = ( ) and C ij = (11) ( ) 3. Write a function which reads two matrices from data files and tests whether matrix commutativity holds. Use the following matrices: D ij = Exercise: the rotation matrices. and E ij = (12) (a) Write a procedure that performs a sequence of rotations for angles α, β, γ. (b) Take a vector along y axis and perform rotations R x (α) ik R y (β) kl R z (γ) lj

27 (c) Check the commutativity relations on these matrices by direct test. 27

MEI Casio Tasks for A2 Core

MEI Casio Tasks for A2 Core Task 1: Functions The Modulus Function The modulus function, abs(x), is found using OPTN > NUMERIC > Abs 2. Add the graph y = x, Y1=Abs(x): iyqfl 3. Add the graph y = ax+b, Y2=Abs(Ax+B): iyqaff+agl 4.

More information

MEI GeoGebra Tasks for A2 Core

MEI GeoGebra Tasks for A2 Core Task 1: Functions The Modulus Function 1. Plot the graph of y = x : use y = x or y = abs(x) 2. Plot the graph of y = ax+b : use y = ax + b or y = abs(ax+b) If prompted click Create Sliders. What combination

More information

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and

More information

1 Introduction to Matlab

1 Introduction to Matlab 1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,

More information

Trigonometric Graphs. Inverness College. September 29, 2010

Trigonometric Graphs. Inverness College. September 29, 2010 September 29, 2010 Simple Trigonometric Functions We begin with the standard trigonometric functions sin(x), cos(x) and tan(x). We will then move onto more complex versions of these functions. You will

More information

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates Department of Computer Science and Software Engineering The Lecture outline Introduction Vectors and matrices Translation

More information

LECTURE 0: Introduction and Background

LECTURE 0: Introduction and Background 1 LECTURE 0: Introduction and Background September 10, 2012 1 Computational science The role of computational science has become increasingly significant during the last few decades. It has become the

More information

Graphics and Interaction Transformation geometry and homogeneous coordinates

Graphics and Interaction Transformation geometry and homogeneous coordinates 433-324 Graphics and Interaction Transformation geometry and homogeneous coordinates Department of Computer Science and Software Engineering The Lecture outline Introduction Vectors and matrices Translation

More information

C3 Numerical methods

C3 Numerical methods Verulam School C3 Numerical methods 138 min 108 marks 1. (a) The diagram shows the curve y =. The region R, shaded in the diagram, is bounded by the curve and by the lines x = 1, x = 5 and y = 0. The region

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

Quadratics Functions: Review

Quadratics Functions: Review Quadratics Functions: Review Name Per Review outline Quadratic function general form: Quadratic function tables and graphs (parabolas) Important places on the parabola graph [see chart below] vertex (minimum

More information

Unit 4 Graphs of Trigonometric Functions - Classwork

Unit 4 Graphs of Trigonometric Functions - Classwork Unit Graphs of Trigonometric Functions - Classwork For each of the angles below, calculate the values of sin x and cos x ( decimal places) on the chart and graph the points on the graph below. x 0 o 30

More information

PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1

PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1 PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1 1. Problems from Gilat, Ch. 1.10 Open a terminal window, change to directory /octave, and using your text editor, create the file

More information

MATLAB SUMMARY FOR MATH2070/2970

MATLAB SUMMARY FOR MATH2070/2970 MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should

More information

Numerical Methods Lecture 1

Numerical Methods Lecture 1 Numerical Methods Lecture 1 Basics of MATLAB by Pavel Ludvík The recommended textbook: Numerical Methods Lecture 1 by Pavel Ludvík 2 / 30 The recommended textbook: Title: Numerical methods with worked

More information

Goals: Course Unit: Describing Moving Objects Different Ways of Representing Functions Vector-valued Functions, or Parametric Curves

Goals: Course Unit: Describing Moving Objects Different Ways of Representing Functions Vector-valued Functions, or Parametric Curves Block #1: Vector-Valued Functions Goals: Course Unit: Describing Moving Objects Different Ways of Representing Functions Vector-valued Functions, or Parametric Curves 1 The Calculus of Moving Objects Problem.

More information

ECE264 Fall 2013 Exam 1, September 24, 2013

ECE264 Fall 2013 Exam 1, September 24, 2013 ECE264 Fall 2013 Exam 1, September 24, 2013 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing it.

More information

Computational Modelling 102 (Scientific Programming) Tutorials

Computational Modelling 102 (Scientific Programming) Tutorials COMO 102 : Scientific Programming, Tutorials 2003 1 Computational Modelling 102 (Scientific Programming) Tutorials Dr J. D. Enlow Last modified August 18, 2003. Contents Tutorial 1 : Introduction 3 Tutorial

More information

Module 6: Array in C

Module 6: Array in C 1 Table of Content 1. Introduction 2. Basics of array 3. Types of Array 4. Declaring Arrays 5. Initializing an array 6. Processing an array 7. Summary Learning objectives 1. To understand the concept of

More information

1. Fill in the right hand side of the following equation by taking the derivative: (x sin x) =

1. Fill in the right hand side of the following equation by taking the derivative: (x sin x) = 7.1 What is x cos x? 1. Fill in the right hand side of the following equation by taking the derivative: (x sin x = 2. Integrate both sides of the equation. Instructor: When instructing students to integrate

More information

Introduction to Geogebra

Introduction to Geogebra Aims Introduction to Geogebra Using Geogebra in the A-Level/Higher GCSE Classroom To provide examples of the effective use of Geogebra in the teaching and learning of mathematics at A-Level/Higher GCSE.

More information

MAT 003 Brian Killough s Instructor Notes Saint Leo University

MAT 003 Brian Killough s Instructor Notes Saint Leo University MAT 003 Brian Killough s Instructor Notes Saint Leo University Success in online courses requires self-motivation and discipline. It is anticipated that students will read the textbook and complete sample

More information

Classes 7-8 (4 hours). Graphics in Matlab.

Classes 7-8 (4 hours). Graphics in Matlab. Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.

More information

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS STEPHEN WOLFRAM MATHEMATICADO OO Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS Table of Contents XXI a section new for Version 3 a section new for Version 4 a section substantially modified for

More information

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed. Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.

More information

used to describe all aspects of imaging process: input scene f, imaging system O, and output image g.

used to describe all aspects of imaging process: input scene f, imaging system O, and output image g. SIMG-716 Linear Imaging Mathematics I 03 1 Representations of Functions 1.1 Functions Function: rule that assigns one numerical value (dependent variable) to each of a set of other numerical values (independent

More information

Education Resources. This section is designed to provide examples which develop routine skills necessary for completion of this section.

Education Resources. This section is designed to provide examples which develop routine skills necessary for completion of this section. Education Resources Trigonometry Higher Mathematics Supplementary Resources Section A This section is designed to provide examples which develop routine skills necessary for completion of this section.

More information

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

Dynamics and Vibrations Mupad tutorial

Dynamics and Vibrations Mupad tutorial Dynamics and Vibrations Mupad tutorial School of Engineering Brown University ENGN40 will be using Matlab Live Scripts instead of Mupad. You can find information about Live Scripts in the ENGN40 MATLAB

More information

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

Introduction to Matlab

Introduction to Matlab Technische Universität München WT 21/11 Institut für Informatik Prof Dr H-J Bungartz Dipl-Tech Math S Schraufstetter Benjamin Peherstorfer, MSc October 22nd, 21 Introduction to Matlab Engineering Informatics

More information

used to describe all aspects of imaging process: input scene f, imaging system O, and output image g.

used to describe all aspects of imaging process: input scene f, imaging system O, and output image g. SIMG-716 Linear Imaging Mathematics I 03 1 Representations of Functions 1.1 Functions Function: rule that assigns one numerical value (dependent variable) to each of a set of other numerical values (independent

More information

4 Visualization and. Approximation

4 Visualization and. Approximation 4 Visualization and Approximation b A slope field for the differential equation y tan(x + y) tan(x) tan(y). It is not always possible to write down an explicit formula for the solution to a differential

More information

PART 1 PROGRAMMING WITH MATHLAB

PART 1 PROGRAMMING WITH MATHLAB PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment

More information

PHYS-4007/5007: Computational Physics. Using IDL in Command Line Mode

PHYS-4007/5007: Computational Physics. Using IDL in Command Line Mode PHYS-4007/5007: Computational Physics Using IDL in Command Line Mode 1 Editing a New IDL Procedure File There are two ways to run IDL under Linux: (1) the IDL Workbench Graphic User Interface (GUI) and

More information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

1. Let be a point on the terminal side of θ. Find the 6 trig functions of θ. (Answers need not be rationalized). b. P 1,3. ( ) c. P 10, 6.

1. Let be a point on the terminal side of θ. Find the 6 trig functions of θ. (Answers need not be rationalized). b. P 1,3. ( ) c. P 10, 6. Q. Right Angle Trigonometry Trigonometry is an integral part of AP calculus. Students must know the basic trig function definitions in terms of opposite, adjacent and hypotenuse as well as the definitions

More information

2. EXERCISE SHEET, RETURN DATE MAY 7/8TH 2015, INDIVIDUALLY. to the compiler options. I also suggest you to use the options

2. EXERCISE SHEET, RETURN DATE MAY 7/8TH 2015, INDIVIDUALLY. to the compiler options. I also suggest you to use the options 2. EXERCISE SHEET, RETURN DATE MAY 7/8TH 2015, INDIVIDUALLY (CORRECTED APRIL 24TH) General notes Individually means, that this homework sheet needs to be handed in by everyone seperately. There will be

More information

MEI Desmos Tasks for AS Pure

MEI Desmos Tasks for AS Pure Task 1: Coordinate Geometry Intersection of a line and a curve 1. Add a quadratic curve, e.g. y = x² 4x + 1 2. Add a line, e.g. y = x 3 3. Select the points of intersection of the line and the curve. What

More information

Introduction to MatLab. Introduction to MatLab K. Craig 1

Introduction to MatLab. Introduction to MatLab K. Craig 1 Introduction to MatLab Introduction to MatLab K. Craig 1 MatLab Introduction MatLab and the MatLab Environment Numerical Calculations Basic Plotting and Graphics Matrix Computations and Solving Equations

More information

Objectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014

Objectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014 PS 12a Laboratory 1 Spring 2014 Objectives This session is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started. Throughout the tutorial, the instructors

More information

Warm-up sheet: Programming in C

Warm-up sheet: Programming in C Warm-up sheet: Programming in C Programming for Embedded Systems Uppsala University January 20, 2015 Introduction Here are some basic exercises in the programming language C. Hopefully you already have

More information

MBI REU Matlab Tutorial

MBI REU Matlab Tutorial MBI REU Matlab Tutorial Lecturer: Reginald L. McGee II, Ph.D. June 8, 2017 MATLAB MATrix LABoratory MATLAB is a tool for numerical computation and visualization which allows Real & Complex Arithmetics

More information

EE 301 Signals & Systems I MATLAB Tutorial with Questions

EE 301 Signals & Systems I MATLAB Tutorial with Questions EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This

More information

Unit: Quadratic Functions

Unit: Quadratic Functions Unit: Quadratic Functions Learning increases when you have a goal to work towards. Use this checklist as guide to track how well you are grasping the material. In the center column, rate your understand

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #16 Loops: Matrix Using Nested for Loop In this section, we will use the, for loop to code of the matrix problem.

More information

Structures of Expressions

Structures of Expressions SECONDARY MATH TWO An Integrated Approach MODULE 2 Structures of Expressions The Scott Hendrickson, Joleigh Honey, Barbara Kuehl, Travis Lemon, Janet Sutorius 2017 Original work 2013 in partnership with

More information

Basic Graphs of the Sine and Cosine Functions

Basic Graphs of the Sine and Cosine Functions Chapter 4: Graphs of the Circular Functions 1 TRIG-Fall 2011-Jordan Trigonometry, 9 th edition, Lial/Hornsby/Schneider, Pearson, 2009 Section 4.1 Graphs of the Sine and Cosine Functions Basic Graphs of

More information

ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20

ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20 page 1 of 9 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20 Steve Norman Department of Electrical & Computer Engineering University of Calgary November 2017 Lab instructions and

More information

Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ x + 5y + 7z 9x + 3y + 11z

Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ x + 5y + 7z 9x + 3y + 11z Basic Linear Algebra Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ 1 5 ] 7 9 3 11 Often matrices are used to describe in a simpler way a series of linear equations.

More information

Lab1: Use of Word and Excel

Lab1: Use of Word and Excel Dr. Fritz Wilhelm; physics 230 Lab1: Use of Word and Excel Page 1 of 9 Lab partners: Download this page onto your computer. Also download the template file which you can use whenever you start your lab

More information

Using Arrays and Vectors to Make Graphs In Mathcad Charles Nippert

Using Arrays and Vectors to Make Graphs In Mathcad Charles Nippert Using Arrays and Vectors to Make Graphs In Mathcad Charles Nippert This Quick Tour will lead you through the creation of vectors (one-dimensional arrays) and matrices (two-dimensional arrays). After that,

More information

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,

More information

Exercises C-Programming

Exercises C-Programming Exercises C-Programming Claude Fuhrer (claude.fuhrer@bfh.ch) 0 November 016 Contents 1 Serie 1 1 Min function.................................. Triangle surface 1............................... 3 Triangle

More information

Fall 2017: Numerical Methods I Assignment 1 (due Sep. 21, 2017)

Fall 2017: Numerical Methods I Assignment 1 (due Sep. 21, 2017) MATH-GA 2010.001/CSCI-GA 2420.001, Georg Stadler (NYU Courant) Fall 2017: Numerical Methods I Assignment 1 (due Sep. 21, 2017) Objectives. This class is for you and you should try to get the most out of

More information

HW DUE Floating point

HW DUE Floating point Numerical and Scientific Computing with Applications David F. Gleich CS 314, Purdue In this class: Understand the need for floating point arithmetic and some alternatives. Understand how the computer represents

More information

Lesson 29: Fourier Series and Recurrence Relations

Lesson 29: Fourier Series and Recurrence Relations Lesson 29: Fourier Series and Recurrence Relations restart; Convergence of Fourier series. We considered the following function on the interval f:= t -> t^2; We extended it to be periodic using the following

More information

Tribhuvan University Institute of Science and Technology 2065

Tribhuvan University Institute of Science and Technology 2065 1CSc.102-2065 2065 Candidates are required to give their answers in their own words as for as practicable. 1. Draw the flow chart for finding largest of three numbers and write an algorithm and explain

More information

INTRODUCTION TO MATLAB

INTRODUCTION TO MATLAB 1 of 18 BEFORE YOU BEGIN PREREQUISITE LABS None EXPECTED KNOWLEDGE Algebra and fundamentals of linear algebra. EQUIPMENT None MATERIALS None OBJECTIVES INTRODUCTION TO MATLAB After completing this lab

More information

Laboratory 1 Octave Tutorial

Laboratory 1 Octave Tutorial Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory

More information

MATLAB QUICK START TUTORIAL

MATLAB QUICK START TUTORIAL MATLAB QUICK START TUTORIAL This tutorial is a brief introduction to MATLAB which is considered one of the most powerful languages of technical computing. In the following sections, the basic knowledge

More information

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful

More information

CS 450 Numerical Analysis. Chapter 7: Interpolation

CS 450 Numerical Analysis. Chapter 7: Interpolation Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80

More information

Calculus II (Math 122) Final Exam, 11 December 2013

Calculus II (Math 122) Final Exam, 11 December 2013 Name ID number Sections B Calculus II (Math 122) Final Exam, 11 December 2013 This is a closed book exam. Notes and calculators are not allowed. A table of trigonometric identities is attached. To receive

More information

if you have anything on the screen you can clear it by pressing: CLEAR

if you have anything on the screen you can clear it by pressing: CLEAR Graphing Calculators are really very powerful hand held computing devices. The allow mathematics problems to be investigated by those whose learning styles range from the symbolic to the visual to the

More information

Matlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:

Matlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name: 1 Matlab Tutorial 1- What is Matlab? Matlab is a powerful tool for almost any kind of mathematical application. It enables one to develop programs with a high degree of functionality. The user can write

More information

1 Programs for phase portrait plotting

1 Programs for phase portrait plotting . 1 Programs for phase portrait plotting We are here looking at how to use our octave programs to make phase portraits of two dimensional systems of ODE, adding automatically or halfautomatically arrows

More information

Computer Programming: Skills & Concepts (CP) arithmetic, if and booleans (cont)

Computer Programming: Skills & Concepts (CP) arithmetic, if and booleans (cont) CP Lect 5 slide 1 Monday 2 October 2017 Computer Programming: Skills & Concepts (CP) arithmetic, if and booleans (cont) Cristina Alexandru Monday 2 October 2017 Last Lecture Arithmetic Quadratic equation

More information

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: ####

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: #### Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 Lab partners: Lab#1 Presentation of lab reports The first thing we do is to create page headers. In Word 2007 do the following:

More information

Multiple Choice Questions ( 1 mark)

Multiple Choice Questions ( 1 mark) Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s

More information

Lesson 8 Introduction to Quadratic Functions

Lesson 8 Introduction to Quadratic Functions Lesson 8 Introduction to Quadratic Functions We are leaving exponential and logarithmic functions behind and entering an entirely different world. As you work through this lesson, you will learn to identify

More information

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB

More information

Foundations of Math II

Foundations of Math II Foundations of Math II Unit 6b: Toolkit Functions Academics High School Mathematics 6.6 Warm Up: Review Graphing Linear, Exponential, and Quadratic Functions 2 6.6 Lesson Handout: Linear, Exponential,

More information

Eigen Tutorial. CS2240 Interactive Computer Graphics

Eigen Tutorial. CS2240 Interactive Computer Graphics CS2240 Interactive Computer Graphics CS2240 Interactive Computer Graphics Introduction Eigen is an open-source linear algebra library implemented in C++. It s fast and well-suited for a wide range of tasks,

More information

Getting Started With Linux and Fortran Part 2

Getting Started With Linux and Fortran Part 2 Getting Started With Linux and Fortran Part 2 by Simon Campbell [The K Desktop Environment, one of the many desktops available for Linux] ASP 3012 (Stars) Computer Tutorial 2 1 Contents 1 Some Funky Linux

More information

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

ENCM 339 Fall 2017: Editing and Running Programs in the Lab page 1 of 8 ENCM 339 Fall 2017: Editing and Running Programs in the Lab Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Introduction This document is a

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced

More information

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6 Math background 2D Geometric Transformations CS 4620 Lecture 6 Read: Chapter 2: Miscellaneous Math Chapter 5: Linear Algebra Notation for sets, functions, mappings Linear transformations Matrices Matrix-vector

More information

Quaternion Rotations AUI Course Denbigh Starkey

Quaternion Rotations AUI Course Denbigh Starkey Major points of these notes: Quaternion Rotations AUI Course Denbigh Starkey. What I will and won t be doing. Definition of a quaternion and notation 3 3. Using quaternions to rotate any point around an

More information

Unit 4 Graphs of Trigonometric Functions - Classwork

Unit 4 Graphs of Trigonometric Functions - Classwork Unit Graphs of Trigonometric Functions - Classwork For each of the angles below, calculate the values of sin x and cos x (2 decimal places) on the chart and graph the points on the graph below. x 0 o 30

More information

The Newton Method as a Short WEB Example

The Newton Method as a Short WEB Example The Newton Method as a Short WEB Example August 31, 1996 15:22 Abstract: This is written in John Krommes FWEB but with the output higher level language being C. FWEB is the most supported of the dialects

More information

5.5 Multiple-Angle and Product-to-Sum Formulas

5.5 Multiple-Angle and Product-to-Sum Formulas Section 5.5 Multiple-Angle and Product-to-Sum Formulas 87 5.5 Multiple-Angle and Product-to-Sum Formulas Multiple-Angle Formulas In this section, you will study four additional categories of trigonometric

More information

MAT 275 Laboratory 1 Introduction to MATLAB

MAT 275 Laboratory 1 Introduction to MATLAB MATLAB sessions: Laboratory 1 1 MAT 275 Laboratory 1 Introduction to MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Kristian Sandberg Department of Applied Mathematics University of Colorado Goal The goal with this worksheet is to give a brief introduction to the mathematical software Matlab.

More information

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs

More information

Chapter 18. Geometric Operations

Chapter 18. Geometric Operations Chapter 18 Geometric Operations To this point, the image processing operations have computed the gray value (digital count) of the output image pixel based on the gray values of one or more input pixels;

More information

Math 113 Exam 1 Practice

Math 113 Exam 1 Practice Math Exam Practice January 6, 00 Exam will cover sections 6.-6.5 and 7.-7.5 This sheet has three sections. The first section will remind you about techniques and formulas that you should know. The second

More information

MA 114 Worksheet #17: Average value of a function

MA 114 Worksheet #17: Average value of a function Spring 2019 MA 114 Worksheet 17 Thursday, 7 March 2019 MA 114 Worksheet #17: Average value of a function 1. Write down the equation for the average value of an integrable function f(x) on [a, b]. 2. Find

More information

Fourier transforms and convolution

Fourier transforms and convolution Fourier transforms and convolution (without the agonizing pain) CS/CME/BioE/Biophys/BMI 279 Oct. 26, 2017 Ron Dror 1 Why do we care? Fourier transforms Outline Writing functions as sums of sinusoids The

More information

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA MATLAB for beginners KiJung Yoon, 1 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA 1 MATLAB Tutorial I What is a matrix? 1) A way of representation for data (# of

More information

Programming Project #2: Solving Quadratic Equations Date Due: Monday 25 September 2017

Programming Project #2: Solving Quadratic Equations Date Due: Monday 25 September 2017 CISC 5300 Programming in C++ Fall, 2017 Programming Project #2: Solving Quadratic Equations Date Due: Monday 25 September 2017 Write a program that prompts the user to enter the coefficients of a quadratic

More information

TIME 2014 Technology in Mathematics Education July 1 st -5 th 2014, Krems, Austria

TIME 2014 Technology in Mathematics Education July 1 st -5 th 2014, Krems, Austria TIME 2014 Technology in Mathematics Education July 1 st -5 th 2014, Krems, Austria Overview Introduction Using a 2D Plot Window in a CAS Perspective Plotting a circle and implicit differentiation Helping

More information

Direction Fields; Euler s Method

Direction Fields; Euler s Method Direction Fields; Euler s Method It frequently happens that we cannot solve first order systems dy (, ) dx = f xy or corresponding initial value problems in terms of formulas. Remarkably, however, this

More information

UNIT 5 QUADRATIC FUNCTIONS Lesson 6: Analyzing Quadratic Functions Instruction

UNIT 5 QUADRATIC FUNCTIONS Lesson 6: Analyzing Quadratic Functions Instruction Prerequisite Skills This lesson requires the use of the following skills: factoring quadratic expressions finding the vertex of a quadratic function Introduction We have studied the key features of the

More information

Integer Representation. Variables. Real Representation. Integer Overflow/Underflow

Integer Representation. Variables. Real Representation. Integer Overflow/Underflow Variables Integer Representation Variables are used to store a value. The value a variable holds may change over its lifetime. At any point in time a variable stores one value (except quantum computers!)

More information

Algorithms, Data Structures, and Problem Solving

Algorithms, Data Structures, and Problem Solving Algorithms, Data Structures, and Problem Solving Masoumeh Taromirad Hamlstad University DT4002, Fall 2016 Course Objectives A course on algorithms, data structures, and problem solving Learn about algorithm

More information

Applied Calculus. Lab 1: An Introduction to R

Applied Calculus. Lab 1: An Introduction to R 1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for

More information

Fast Fourier Transform (FFT)

Fast Fourier Transform (FFT) EEO Prof. Fowler Fast Fourier Transform (FFT). Background The FFT is a computationally efficient algorithm for computing the discrete Fourier transform (DFT). The DFT is the mathematical entity that is

More information

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation Chapter 7 Introduction to Matrices This chapter introduces the theory and application of matrices. It is divided into two main sections. Section 7.1 discusses some of the basic properties and operations

More information