Homework on Functions - Questions

Describe what a function does in your own words
A function gives an output based on a set of inputs according to a code.

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)
b) f(7)
c) f(0)
a) f(2) = 4
b) f(7) = 17
c) f(0) = 0

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 a basic concept in Mathematic, it is a computation.
2.exercise:
f(2)=x^2=4
f(7)=x+10=17
f(0)=0^2=0
3. Formule:
f(x)=(x/4)-5

1 Like

1 A function is an equation that produces variable outputs or solutions depending on variable inputs
2
a) f(2) =4
b) f(7) =17
c) f(0) = 0

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

1 Like
  1. A function is a set of rules that happens when a variable is given.

  2. a) 4
    b) 17
    c) 0

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

1 Like
  1. A function gives a result (output) given an initial value (input) in a mathematical computation.

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

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

1 Like

Answers on Functions homework :

  1. a function takes an input and transforms it into an output as per some predefined rule.

  2. f(2) = 4; f(7) = 17; f(0) = 0

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

1 Like
  1. Describe what a function does in your own words
    A function is a computation that has been pre-defined to run every time we call it. Functions take an input, and will result in an output.

  2. 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) = 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 a computation where you provide an input, does some calculation and produce an output.

  2. a) 4

  3. b) 17

  4. c) 0

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

1 Like
  1. Describe what a function does in your own words
    A function performs computations given certain parameters or conditions.
  2. Calculate the output of the following function
  • a) f(2) = 4
  • b) f(7) = 17
  • c) f(0) = 0
  1. f(x) = 5-(x/4)
1 Like
  1. Functions are mathematical computation that has input and output.

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

  3. f (x/4) - 5 =

1 Like
  1. A function is a unit of code that perform some specific task within a larger block of code.

a) returns 4
b) returns 17
c) return 0

function may look like this in javascript:
function myfunc(x)
{
if (x % 2 == 0)
{
return (x * x);
}
else
{
return x + 10;
}
};

let x = myfunc(0);

alert(x)

For second question: Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5

function f(x)
{
let result = x / 4
return result - 5;
};

let x = f(4);

alert(x);

1 Like

This function doesn’t do what it was intended, which was to divide by 4 and subtract 5 :wink:

That function was for the prior question. I think this would be the function you were referring to.

function f(x)
{
let result = x / 4
return result - 5;
};

let x = f(4);

alert(x);

1 Like
  1. It is an algorithm performed on a number.
  2. 4, 17, 0
  3. f(x) = (xá4)-5
1 Like
  1. A function is a math formula that determines the output when given an input

a) 4
b) 17
c) 0

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

[quote=“ivan, post:1, topic:8429, full:true”]
Homework on Functions - Questions

  1. Describe what a function does in your own words
  • a function is an equation or code you have entered to perform a task that you wish.
  1. 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) = 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. Function in general is some event which acts on given input and provides a result output.

a) 4
b) 17
c) (<- no output provided, if in this case we assume a “general rule” that 0 is not odd, nor even)

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

0 is an even number, f(0) = 0^2= 0.

1 Like

A function calculates the output depending on the input.

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

F(x)=x/4-5

1 Like