2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices
|
|
- Kathlyn Newman
- 5 years ago
- Views:
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
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 informationMEI 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 informationVALLIAMMAI 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 information1 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 informationTrigonometric 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 informationCOMP30019 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 informationLECTURE 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 informationGraphics 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 informationC3 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 informationPROGRAMMING 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 informationQuadratics 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 informationUnit 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 informationPHYS 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 informationMATLAB 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 informationNumerical 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 informationGoals: 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 informationECE264 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 informationComputational 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 informationModule 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 information1. 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 informationIntroduction 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 informationMAT 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 informationClasses 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 informationSTEPHEN 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 information12 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 informationused 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 informationEducation 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 informationOpenGL 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 informationDynamics 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 informationM4.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 informationSubject: 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 informationIntroduction 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 informationused 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 information4 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 informationPART 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 informationPHYS-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 informationSolution Notes. COMP 151: Terms Test
Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms
More information1. 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 information2. 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 informationMEI 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 informationIntroduction 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 informationObjectives. 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 informationWarm-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 informationMBI 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 informationEE 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 informationUnit: 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 informationIntroduction 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 informationStructures 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 informationBasic 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 informationENCM 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 informationLinear 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 informationLab1: 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 informationUsing 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 informationIntroduction 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 informationExercises 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 informationFall 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 informationHW 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 informationLesson 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 informationTribhuvan 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 informationINTRODUCTION 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 informationLaboratory 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 informationMATLAB 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 informationWhat 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 informationCS 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 informationCalculus 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 informationif 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 informationMatlab 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 information1 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 informationComputer 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 informationName: 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 informationMultiple 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 informationLesson 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 informationUNIVERSITI 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 informationFoundations 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 informationEigen 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 informationGetting 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 informationENCM 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 informationDr 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 informationMath 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 informationQuaternion 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 informationUnit 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 informationThe 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 information5.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 informationMAT 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 informationIntroduction 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 informationMAT 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 informationChapter 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 informationMath 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 informationMA 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 informationFourier 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 informationMATLAB 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 informationProgramming 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 informationTIME 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 informationDirection 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 informationUNIT 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 informationInteger 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 informationAlgorithms, 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 informationApplied 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 informationFast 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 informationMatrices. 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