MA400: Financial Mathematics

Similar documents
EP241 Computer Programming

Scientific Computing

COMP322 - Introduction to C++ Lecture 01 - Introduction

CSI33 Data Structures

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements

Introduction to Programming using C++

(0) introduction to the course. how to learn a programming language. (0) course structure

EC 413 Computer Organization

Introductory Lecture. CS319: Scientific Computing (with C++) Week 1: 11 Jan, Lecturer: Niall Madden.

Computer Programming : C++

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs

CS 376b Computer Vision

C++ for Python Programmers

CE221 Programming in C++ Part 1 Introduction

C, C++, Fortran: Basics

ENERGY 211 / CME 211. Evolution

Compulsory course in Computer Science

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

Programmazione. Prof. Marco Bertini

CSC209. Software Tools and Systems Programming.

Announcements. CSCI 334: Principles of Programming Languages. Lecture 18: C/C++ Announcements. Announcements. Instructor: Dan Barowy

6.096 Introduction to C++ January (IAP) 2009

Partha Sarathi Mandal

Streams. Ali Malik

Tutorial-2a: First steps with C++ programming

Spring 2018 NENG 202 Introduction to Computer Programming

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Chapter 15 - C++ As A "Better C"

CSC209. Software Tools and Systems Programming.

Introduction. Instructor: Jia Xu CSCI-135

Distributed Real-Time Control Systems. Lecture 17 C++ Programming Intro to C++ Objects and Classes

CS11 Intro C++ Spring 2018 Lecture 1

6.S096 Lecture 4 Style and Structure

Introduction to C/C++

Computer Science II Lecture 1 Introduction and Background

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

Introduction to C++ Dr M.S. Colclough, research fellows, pgtas

CSE 333 Lecture 9 - intro to C++

Operator overloading

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

C++ Quick Guide. Advertisements

Cours de C++ Introduction

Introduction to Computing using C++ Biomedical applications WELCOME TO CIS 1.5. Introduction to the course. Course structure

Why C++? C vs. C Design goals of C++ C vs. C++ - 2

CS 102 Lecture 1. Syllabus, history, intro

AN OVERVIEW OF C++ 1

Multimedia-Programmierung Übung 3

CS

Lab 1: First Steps in C++ - Eclipse

Professor Terje Haukaas University of British Columbia, Vancouver C++ Programming

ANSI C. Data Analysis in Geophysics Demián D. Gómez November 2013

CSE 333. Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington

Programming, numerics and optimization

Introduction to C++ Introduction to C++ 1

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

COMP6771 Advanced C++ Programming

Spring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques

APPENDIX A : KEYWORDS... 2 APPENDIX B : OPERATORS... 3 APPENDIX C : OPERATOR PRECEDENCE... 4 APPENDIX D : ESCAPE SEQUENCES... 5

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++

Introduction to C++ with content from

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.

Fundamentals of Programming CS-110. Lecture 2

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

Dr. Md. Humayun Kabir CSE Department, BUET

Unit 1 : Principles of object oriented programming

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

ECE 2036 Lab 1: Introduction to Software Objects

Basic Computer Programming for ISNE. Santi Phithakkitnukoon ผศ.ดร.ส นต พ ท กษ ก จน ก ร

Introduction to Linux

CS 31 Discussion 1A, Week 1. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50

Introduction to C ++

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay

CMPT 115. C tutorial for students who took 111 in Java. University of Saskatchewan. Mark G. Eramian, Ian McQuillan CMPT 115 1/32

Senthil Kumaran S

Table of Contents EVALUATION COPY

Computer Programming C++ (wg) CCOs

Syllabus for Computer Applications

CS 11 C++ track: lecture 1

Looping and Counting. Lecture 3 Hartmut Kaiser hkaiser/fall_2012/csc1254.html

The current topic: Python. Announcements. Python. Python

This tutorial adopts a simple and practical approach to describe the concepts of C++.

CSCE 110 PROGRAMMING FUNDAMENTALS

Lecture 1: Preliminaries

4. Structure of a C++ program

Introduction to Programming

Introduction to C++ Systems Programming

Preview from Notesale.co.uk Page 3 of 79

Review&Preview 1/23/15, 4:08:07 PM 1. 3rd edition - standardized, and standard library allows programmer to start from a higher level

Week 7. Statically-typed OO languages: C++ Closer look at subtyping

Introduction to Scientific Programming with C++

Using the Dev C++ Compiler to Create a Program

Reliable C++ development - session 1: From C to C++ (and some C++ features)

How to declare an array in C?

Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon.

Transcription:

MA400: Financial Mathematics Introductory Course Lecture 1: Overview of the course

Preliminaries A brief introduction Beginning to program Some example programs

Aims of this course Students should have a familiarity with the basics of C++ programming. In particular, you will see fundamental data types arithmetic and operators tests and loops functions (encapsulating code) pointers and arrays That is, you will see the C of C++. However, this is not a software programming course.

Recommended reading Find one that suits your learning requirements. Introducing C++ for Scientists, Engineers and Mathematicians, 2nd Ed. D.M.Capper. The C++ Programming Language, Special Edition. Bjarne Stroustrup. Online C++ language tutorial at http://www.cplusplus.com/doc/tutorial/ Thinking in C++ Vols 1 & 2. Bruce Eckel. http://www.mindview.net/books/ticpp/thinkingincpp2e.html There are also a lot of free online tutorials and resources.

Structure of this course This is a 11 hour course, of which 2 hour (supervised) lab session [worksheet] 9 hours of lectures Week 1 (3 hours): Introduction to the course Fundamental types and operators Control structure Week 2 (6 hours): Functions Pointers and arrays Summary and tips. A look forwards. MA417 - Computational Methods in Finance

What is C++? C++ is a general purpose programming language that is itself a superset of the C programming language. It is a compiled language, so that source files are used to generate executables, rather than executed themselves. It is a general-purpose programming language that is designed to support: data abstraction object-oriented programming, generic programming.

Data abstraction User-defined types which allow the user to model a particular entity in their system, together with various operations on it. This is done through classes For example: matrices, complex numbers, even the term structure of interest rates!

The term structure of interest rates as an object Note that the term structure of interest rates can be equivalently specified in terms of either discount factors, spot interest rates, or forward interest rates.

Complex numbers as an object class complex { private: double re, im; public: complex(double r, double i) { re = r ; im = i ; } complex() { re = 0 ; im = 0 ; } friend complex operator+(complex, complex);... friend bool operator==(complex, complex);... };

Complex numbers as an object complex operator+(complex a1, complex a2) { return complex ( a1.re + a2.re, a1.im + a2.im ); }

Object-oriented programming Consider the following situations Suppose we have defined a Shape class, and alongside this we also had a Disc class, a Triangle class and a Square class. Consider a Matrix class, and a class representing all invertible matrices. Consider a Vector class, and a class representing all 3-vectors. In all these cases, the latter classes clearly inherit, or derive, properties from the former, parent, class. Languages which allow such class hierarchies to be expressed and used support object-oriented programming.

Generic programming Using templates, or parameterised types, C++ allows us to implement algorithms that are independent of the data types they are used on. E.g. arrays, lists and vectors are all data structures which are amenable to sorting, copying and searching functions. Integers and floating numbers are also amenable to the same sorts of functions and operators, such as finding the maximum of two numbers.

Programming experience C/C++ Java Other (Perl, Python, etc) Maple/Mathematica/Matlab/etc

Learning to program Program. Think. Document.

Your programming environment What do you need to start programming in C++? A pencil and some paper. A text-editor to write the source code A compiler (GCC) Access to the command prompt However, you may prefer to work within an IDE (Integrated Development Environment) Bloodshed Dev-C++ Eclipse A comparison of various C/C++ IDEs can be found at Wikipedia: http://tinyurl.com/comparison-of-cpp-ides

The simplest program possible int main() {}

Hello, world! // Print "Hello, world!" to the standard output stream #include <iostream> // I/O stream facilities int main() { /* Use "put to" operator >> to print "Hello, world!" to standard output stream */ std::cout << "Hello, world!\n"; // Note the newline } // Return 0 to indicate successful execution return(0);

Compile (Ctrl + F9) Run (Ctrl + F10) Compile & Run (F9)

Running from the command line H:\>dir 09/11/2009 05:24 PM <DIR>. 09/11/2009 05:24 PM <DIR>.. 09/11/2009 05:23 PM 576 hello.cpp 09/11/2009 05:24 PM 475,852 hello.exe 2 File(s) 476,238 bytes 2 Dir(s) 37,365,292,800 bytes free H:\>quadratic.exe

Compiling from the command line Using the Gnu C Compiler (gcc): Windows C:\Dev-Cpp\bin\g++ -o hello hello.cpp Linux, Mac OS X gcc -lstdc++ -o hello hello.cpp

A basic program template // Describe the program s function #include <iostream> // For input/output streams #include <cstdlib> // For EXIT_SUCCESS using namespace std; // Make all std names global int main() { } // Program code system("pause"); return(exit_success);