- A function is a mathematical computation that applies a predetermined calculation to a variable as input, and computes an output.
a) 4
b) 17
c) 0
f(x) = (x/4)-5
a) 4
b) 17
c) 0
f(x) = (x/4)-5
Describe what a function does in your own words:
A singular input/output calculation.
Calculate the output of the following function
f(x) = {
x^2 if x is even
x+10 if x is odd
}
What will be the output for the following inputs?
* a) f(2)
f(2)=2^2
f(2)=4
* b) f(7)
f(7)=7+10
f(7)=17
* c) f(0)
f(0)=0^2
f(0)=0
3. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
f(x)=(x/4)-5
2 a) when f(2) output = 4
2 b) when f(7); output = 17
2 c) when f(0); output = 0
a) f(2) = 4;
b) f(7) = 17;
c) f(0) = 0;
3.f(x) = x/4 - 5;
A function uses an input, processes it and produces an output.
a) 4, b) 17, c) 0
f(x) = (x/4) - 5
Homework on Functions - Questions
Describe what a function does in your own words
A function associates the relation of one set of numbers, to a second set, and exacts an amount.
Calculate the output of the following function
f(x) = {
x^2 if x is even
x+10 if x is odd
}
What will be the output for the following inputs?
a) f(2)
**4**
b) f(7)
**17**
c) f(0) Two answers because function zero is both odd *and* even
**10 & 0**
F(x) = {(x/4) -5}
A function does something to the input and gives us an output. What it does is defined by the function.
Example: f(x) = x+1 β f(7) = 8
f(x)=(x/4)-5
1.A function is a block of code which only runs when it is called or a special relationship where each input has a single output.
Output
a) f(2) = 2^2 = 4
b) f(7) = 7 + 10 = 17
c) f(0) = 0^2 = 0
Function
f(x) = (x/4) - 5
okay, that makes sense. zero is even because the number 10 is even, also zero is not null.
2 Outputs:
a) f(2) even = 2^2
f = 4
b) f(7) odd = 7 + 10
f = 17
c) f(0) even = 0^0
f = 0
1. Describe what a function does in your own words
A function is a calculation of a certain input* which then results in a certain output*
2.
β’ a. 4
β’ b. 17
β’ c. 0
3. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
f= (x/4)-5
Function is a computation, that you give it an input, and through some mathematical calculation, it gives you an output.
βxβ is variable.
a) f(2) = 2^2 = 4 because 2 is even
b) f(7) = 7+10 = 17 because 7 is add
c) f(0) = 0^0 = 0 because 0 is even
f(x) = (x/4) -5
2.a) 4 // b) 17 // c) 0
1- computes inputs
2- a/4, b/17, c/0
3- f(x)=(x/4)-5
A function enables you to determine the output when the value of the input is determined or entered.
a=4
b=17
c=0
f(x)=x/4-5