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
Including library
First Code
Must put .cpp at the end of the code when saving, so the computer knows it is a c++ code.
Inputting into the terminal.
cd means change directory – navigating – like clicking on a folder (enter)
press ‘ls’ to see what is on the desktop
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?
Returns Hi there on the terminal.
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
Put std back into the code.
Whatever gets typed in my the user and it will add that name to the output.
Type in name and outputs ‘Hi there Claudia’
Functions in c++
Making a new function to put greeting messages in but leave the return function out.
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.
Our own Text Based program