Upload
rebecca-jones
View
628
Download
1
Embed Size (px)
Citation preview
UNIT 18 COMPUTATIONAL THINKINGP2; identify linear and quadratic functions obtain the equation of a straight line from a graph
Functions
What are they?• Why are they useful to us in Computing?
Functions
What are they?“Functions are a relation or expression involving one or more variables”i.e They are a way of writing down a problem or sum when you don’t know all the figures or answers.e.g.
Functions
Why are functions useful to us in Computing?They help us keep clear what we know and don’t know. They help us write problems in a way that start to help us work out the answer
FunctionsWhat are they?“Functions are a relation or expression involving one or more variables”i.e They are a way of writing down a problem or sum when you don’t know all the figures or answers.e.g. here is a simple sum to help us do harder ones later
Two students bought 10 cans of cokeIf one student bought 4 cans, how many were bought by the other student?We would write it like this;10 cans bought = (1 * 4 cans) + (1 * x cans)10 = 4 + x or we can write;x + 4 = 10 (to get the one thing we need to know (x) on the left)(Rule to Remember if we move a number to the opposite side we have to change the sign plus (+) becomes minus (-) and times (x) becomes divide (÷) )
x = 10 – 4x = 6 so the other student bought 6 cans
FunctionsExercise
Two lecturers bought 10 pensIf one lecturer bought 4 pens, how many were bought by the lecturer?Write out your working;…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..Answer: The other lecturer bought …… pens
FunctionsIt’s your birthday and you are buying cakes for all your groupYou decide to buy bakewell tarts which come in boxes of 6. You have 18 in your group How many boxe do you need to buy?We would write it like this;No of boxes multiplied by 6 per box = 18 tarts (at least)x * 6 = 18(we need to know (x) on the left on its own)(Rule to Remember if we move a number to the opposite side we have to change the sign plus (+) becomes minus (-) and times (x) becomes divide (÷) )
x = 18 ÷ 6x = 18/6 x = 3Answer: I need to buy 3 boxes
FunctionsExercise
It’s your birthday and you are buying cakes for all your friendsYou decide to buy bakewell tarts which come in boxes of 6. You have 30 friends How many boxes do you need to buy?Write out your working;…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..…………………………………………………………………………………..Answer: I need to buy …….. boxes
FunctionsExerciseWrite out the answers
What are functions?…………………………………………………………………………………..…………………………………………………………………………………..
Why are they useful to us in Computing?…………………………………………………………………………………..…………………………………………………………………………………..
Graphs – x and y axis
x
y
Graphs let us see figures in a graphical way and help us understand them more easily.• There is an x and a y axis marked with their values• Usually only the top right hand corner with positive
values of x and y is shown
Graphs – x and y axis
x
y
Remember the game ‘Battleships’ ?Battleships have a location based on columns and rows named by letters and numbers – called coordinates. Eg B7 and A3Graphs have points with coordinates eg (2,4) (where x=2 and y=4)• If x = 2 then location of the point is somewhere on the red line• If y = 4 then location of the point is somewhere on the blue lineIf x = 2 and y = 4 then location of the point is exactly where the red line and the blue line cross (or intersect)
Gradients - uphill
x
y
A GRADIENT IS: Rise over Run i.e. distance up ÷ distance along
1 ÷ 7 = 1 in 7Gradient = 1 in 7 or 0.143 or 14.3%
What is the gradient?
Gradients - downhill
x
y
A GRADIENT IS: Rise over Run i.e. distance up ÷ distance along
1 ÷ 7 = 1 in 7Gradient = 1 in 7 or -0.143 or 14.3%
This is easier for whole numbers but what if the numbers are decimals
What is the gradient?
Gradients - if you don’t know the distances
x
y
A GRADIENT IS: Rise over Runi.e. distance up/down ÷ distance along – but if you only have coordinates;Take the coordinates (x1,y1) of a point on a line graph eg 1,1Take the coordinates (x2,y2) of another point on a graph eg 3,3
y2 - y1 3-1 2 1Gradient = ------ = --------- = ------- = ---------- = +1
x2 - x1 3-1 2 1
What is the gradient?
Getting equations from a straight line graph
x
y
x = 0 1 2 3 4 5 6M*x=
+C=
y =
Therefore the equation for this graph is: y =
What is the equation?
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = 1C is where it crosses over = 0
Getting the equation from a graph 1
x
y
Therefore the equation for this graph is: y = …………………………..
What is the equation?
x 0 1 2 3 4 5 6Mx
+C
y =
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = 1C is where it crosses over = 1
Getting the equation from a graph 2
x
y
x 0 1 2 3 4 5 6Mx
+C
y =
Therefore the equation for this graph is: y = …………………………..
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = 1C is where it crosses over = 2
What is the equation?
Getting the equations from graphs 3 + 4
x
y
x 0 1 2 3 4 5 6Mx 1*0 1*1 1*2 1*3 1*4 1*5 1*6
+C
y =
The equation for the Red graph is: y = (1 * x) + …. or y = x + ….The equation for the Blue graph is: y = (1 * x) + …. or y = x + ….
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = 1C is where it crosses over = ?
What is the equation for the red and blue graphs?
Getting the equation from a graph 5
x
y
x 0 1 2 3 4 5 6Mx
+C
y =
Therefore the equation for this graph is: y = …………………………..
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = -1C is where it crosses over = 0
What is the equation?
Getting the equation from a graph 6
x
y
x 0 1 2 3 4 5 6Mx
+C
y =
Therefore the equation for this graph is: y = …………………………..
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = -1C is where it crosses over = 2
What is the equation?
Getting the equation from a graph 7
x
y
x 0 1 2 3 4 5 6Mx
+C
y =
Therefore the equation for this graph is: y = …………………………..
A STRAIGHT LINE GRAPH EQUATION IS ALWAYS: y = Mx + C Where M = gradient = ………..?C where it crosses over = …..?
What is the equation?
Well Done!
You have used functionsYou have worked out the equation for a straight line graph