Homework on Functions - Questions

  1. A function does the an action that is the same to each unique variable entered.
  2. a)4 b)17
  3. f(x)= (x/4)-5
1 Like
  1. Describe what a function does in your own words?

A function is a mathematical equation which X or Y is a variable.

2.a. 4 b. 17 c. 0

  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.

3 f(x) = x/4 - 5

1 Like
  1. Describe what a function does in your own words
    This function “f” takes one argument “x” which is a number and returns another number based on the following conditions:
    If the number x is even then “f” will calculate and return
    or
    If the number x i odd then “f” will calculate and return x+10

  2. Calculate the output of the following function
    What will be the output for the following inputs?

  • a) f(2) => the result/output will be 2² = 4
  • b) f(7) => the result/output will be 7+10 = 17
  • c) f(0) => the result/output will be 0² = 0
  1. 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
1 Like
  1. A function is simply a mathematical equation whereby you input a number, this number get computed (i.e. calculated using the formula that’s been provided) and then another number is produced as the output.

a) f(2) = 2^2 = 4
b) f(7) = 7+10 = 17
c) f(0) = 0

  1. f(x) = (x/4) - 5
1 Like

Question 1. A function shows the relationship between two variables by taking an input and mapping it to an output e.g f(X) = X + 1

Question 2:
f(2) = 4
f(7) = 17
f(0) = 0

Question 3:
f(X) = (X/4) - 5

1 Like

1.) A function is a formula that will take the input given and creates an output.
2.)
a.) f(2) = 4
b.) f(7) = 17
c.) f(o) = 0
3.)
f(x) = (x/4)-5

1 Like

A Function is a computation of a variable, taking an input and showing an output.
a) 4
b) 17
c) 0
f(x) = (x/4)-5

1 Like

Is this a typo? :slight_smile:

1 Like

Oh yeah, thanks for pointing it out
Thank you

  1. A function is a computation (mathematical calculation) which has an input in brackets that calculates an output.

a. f(2) = 4
b. f(7) = 17
c. f(o) = 0

  1. f (x) = ( x / 0.25) -5
1 Like

https://www.mathsisfun.com/sets/function.html

Can anyone help me to understand the following example and where function fn(y) gets it’s value from? I think I understand that multiple(x)'s value comes from when it is called below with the (3) value

function multiple(x) {

    function fn(y)
    {
        return x * y;
    }
    
    return fn;
}

var triple = multiple(3);
triple(2); // returns 6
triple(3); // returns 9
  1. You input something, set the terms and you obtain an output.
  2. a = 4, b=17, c=0
  3. f(x) ={ x/4-5}
1 Like

The multiple function is returning a function, that function take a parameter, so the triple is the returning function"

function fn(y)
    {
        return x * y;
    }
", in order to call that returning function you should do like this

triple(here you put the parameter)

and the value of y is coming from that parameter. if you take the first example first you have to assign the returning value to a variable, in that case, the returning value is a function and it is assigned to triple.
const triple = multiple(3); X = 3
triple(2)=> here we are calling the returning function and 2 is y, that function will then return the multiple of these numbers = 6.

1 Like
  1. It “does something” to an input to obtain an output.
    2a) 4
    2b) 17
    2c) 0
  2. f(x) = {(x/4)-5}
1 Like

Hi Maki. Thank you for your very helpful breakdown of the block. I haven’t gone over it it yet, I just had a quick look through your answer but need some quiet time to absorb it. probably in bed tonight . I’ll let you know how I’ve gone on.

  1. A function can be thought of as a black box - data is passed in, it is processed, data is passed out.
  2. see below
    2a. 4
    2b. 17
    2c. 0

def div4sub5(x): return x/4-5

1 Like

1 - Gives you an output after calculating inputs provided.

2 - What will be the output for the following inputs?

a) f(2) = 4

b) f(7) = 17

c) f(0) = 0

3 - f(x)= {(x /4) – 5}

1 Like
  1. A function allows you to create an input and output. It’s basically a math equation where you decide what the input does is, add, subtract or multiply, and the function creates an output based on this.

  2. a - 4 / b - 17 / c - 0

  3. f(x/4) = x-5

1 Like
  1. A function executes a specific calculation (Output) for a certain variable (Input).

  2. f(2) = 2up2 = 4
    f(7) = 7+10 = 17
    f(0) = 0

  3. f(x) = (x/4)-5

1 Like