Week 1

Matrices do:

  • Control AI
  • Servers
  • Graphic realisation

Functions of matrices – similar to vectors but easier

what is a matrices?

Vector of vectors

Arrangment of data by column and row

(formula)

Represent the data by 2D array.

 

Why are they handy?

Example – Represent two equations in a matrices equation

(sheet)

 

Matrices Operations

Adding matrices

All first ones added to together and same for the others

(sheet)

 

Subracting matrices

Works the same as adding – all first ones get subtracted from each other etc.

(sheet)

 

Scalar Multipication

Multiplying matrices by a given factor – multiple all the numbers by the factor.

 

 

Matrix transpositions

Matrices can be arranged by columns or row. So depending on which you need to use you may need o convert a matrix of one type to the other – TRANSPOSITION.

Stick to a style!

 

Matrix multiplaction

Multiplication of 2 matrices using the dot product .

Only possible to multiple 2 together, if the number of rows in matrix 1 matched the number if columns in matrix 2.

 

(sheet)

 

First matrixs do across and second matrix go down.

(sheet)

 

 

Connection between matrices and designs/ Connection between matrices equations and then their multipled products

2 times 3 pieces of data and then it turns out to be 2times for 2 pieces of data so information has been lost and so the outcome has become 2D – Used to represent 3D elements in a 2D space.

 

 

C++ Main Space

We are using

  • terminal
  • Sublime Text

 

c++ must contain main method to return intriguer screen-shot-2016-10-04-at-10-38-58

Including library

screen-shot-2016-10-04-at-10-40-52

 

First Code

screen-shot-2016-10-04-at-10-43-04

Must put .cpp at the end of the code when saving, so the computer knows it is a c++ code.

screen-shot-2016-10-04-at-10-43-48

Inputting into the terminal.

cd means change directory – navigating – like clicking on a folder (enter)

press ‘ls’ to see what is on the desktop

screen-shot-2016-10-04-at-10-47-44

 

 

 

Had to remove the ; from the code in order to make it run (error in the code). Also remain file so that it was all one word (firstcode not First code). Still errors but not sure why?

screen-shot-2016-10-04-at-10-55-22

Returns Hi there on the terminal.

screen-shot-2016-10-04-at-11-01-06

Removing std  – using a namespace instead (neater). Though try to not use namespaces as much as possible as it makes it difficult to identify which

screen-shot-2016-10-04-at-10-58-00

Put std back into the code.

 

screen-shot-2016-10-04-at-11-02-55

 

Whatever gets typed in my the user and it will add that name to the output.

screen-shot-2016-10-04-at-11-06-40

 

Type in name and outputs ‘Hi there Claudia’

screen-shot-2016-10-04-at-11-10-26

 

Functions in c++

Making a new function to put greeting messages in but leave the return function out.

screen-shot-2016-10-04-at-11-13-10

 

Forward deceleration

Stop the computer getting confused not thinking no greeting existed, so we can forward declare the function and then it knows there is a function called greeting, so it will search the rest of the file to find it.

screen-shot-2016-10-04-at-11-16-11

screen-shot-2016-10-04-at-11-16-42

 

Our own Text Based program

screen-shot-2016-10-04-at-11-41-53

screen-shot-2016-10-04-at-11-41-44

 

screen-shot-2016-10-04-at-11-51-45

 

screen-shot-2016-10-04-at-11-51-35