Homework on Functions - Questions

  1. A function is a computation that allows to insert an input and gives an output.

  2. a) 4
    b) 17
    c) 0

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

1 Like
  1. A function is a computation whereby an input is given certain directions within the function to come out with an output.
    2). a) 4
    b) 17
    c). 0

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

2 Likes

Thanks Fabrice for explanation. Now I know what that ^ means. At school we never used that star gate symbol. It was always like this - 3².

1 Like
  1. A function is a computation that takes in an input with specific rules and returns an output.

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

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

2 Likes

Question a. is correct but it’s not an addition. It’s an exponent.

1 Like
  1. Describe what a function does in your own words
  • the value of x is squared if x is even, and is added to 10 if odd.
  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.
myFunc(x) = {
 var newVal;
 newVal = (x/4) - 5;
return newVal;
}

*quick update after remembering to use the code format button - * - Thanks @thecil. =)
https://forumtest.ivanontech.com/t/asynchronous-programming-reading-assignment/3128/275

2 Likes

Homework on Functions - Questions

  1. Describe what a function does in your own words
  • A function is a computation. It computes your input and gives you an proper mathematical output.
  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

Thank you I will correct it , I am coming back to Math after many many years :smile:

2 Likes
  1. A function is a subroutine that recieves information as an input, applies a process to that input and returns an out put based on the results.

  2. a) f(2)=4
    b) f(7)=17
    c) f(0)=0 (honestly it depends on how the language you are programming in handles 0, another likely outcome is an error)

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

  1. Describe what a function does in your own words.
    A function is a computation that has an input and an output.

  2. Calculate the output of the following function.
    a. f(2)
    f(2) = 2 x 2 = 4

b. f(7)
f(7) = 7 + 10 = 17

c. 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.
Answer: f(x)=/4-5

1 - A function is a piece of code or a set of instructions that receives an input, does something with it and gets an output.

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

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

1 Like

You’re lucky that 2+2 = 2^2
Check this post for the meaning of ^

2 Likes

Yes, in written language we use it like this. In computer science, we use that symbol ^ for power relations.

2 Likes

0^2 will never have errors. (defined) It’s perfectly fine. However, dividing by zero is another issue.

1 Like

You forgot an ‘x’, you can’t start with a division without a numerator.

f(x) = x/4 - 5

1 Like

1- A function is a variable “instruction” that is applied to the input.

2- a) 4
b) 17
c) 0

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

1 Like
  1. A function takes an input, which can be anything, and turns it into an output by running it through an equation.
    2a. 4
    2b. 17
    2c. 0
  2. f(x)= (x/4)-5
1 Like

1.)A function is a math equation , by having a variable with an input that computes an output. In this case “X” being the variable.

2.)
a.) 4
b.) 17
c.)0

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

1 Like
  1. A function f(x) is a mathematical concept. We talk about it when we have an input and output.
    2 f(x)=4
    f(x)=odd
    f(1)=11

@marsrvr - you must dream in infographics. (☞゚ヮ゚)☞

1 Like