2 an interesting function is shown below and this pattern continues fo
2. An interesting function is shown below, and this pattern continues for all x. For x between 0 and
4, the function takes on these values (pattern repeats itself indefinitely):
f(x)=0 for 0 < x < 1
f(x) = 10 for 1 ≤ x < 2
f(x) = 20 for 2 <x<3
f(x) = 10 for 3 ≤ x < 4 ... and so on.
1 2 3 4 5 6 7 8
Write a VBA function called Periodic that returns the value f(x) of the function above for a given
value of x. If a negative value for x is input, the function should just be the same (mirror image
about the y-axis). Importantly, x should not only be constrained to integers, but x can take on any
Strategy. When faced with a repeating pattern, as is in this problem, it can be valuable to utilize
the Mod operator in VBA, which yields the remainder when two numbers are divided./nCHEN 1310
result = number1 Mod number2
The modulus, or remainder, operator divides number1 by number2 (rounding floating-point
numbers to integers) and returns only the remainder as result.
In this problem, there is a pattern that repeats itself every 4 units of x. In other words,
f(x)=f(x+4.n), where n is a positive integer. So, a statement of the form x Mod 4 will convert
any x > 4 to a "transformed" 0<x< 4. Then, f(x) can easily be determined.
The only other caveat is the fact that the Mod operator first converts number1 to an integer
(rounding to the nearest integer); therefore, 7.5 Mod 4 is not equal to 3.5 nor 3, but rather is equal
to 0 (the 3.5 is first rounded up to 4 so when divided by 4 there is no remainder). This problem can
be circumvented by prudent use of the Int function, which returns the integer value of a number,
e.g., Int(3.5) = 3.
Create the function and verify that it is working properly. What is f(2873)?
*The amount will be in form of wallet points that you can redeem to pay upto 10% of the price for any assignment. **Use of solution provided by us for unfair practice like cheating will result in action from our end which may include permanent termination of the defaulter’s account.Disclaimer:The website contains certain images which are not owned by the company/ website. Such images are used for indicative purposes only and is a third-party content. All credits go to its rightful owner including its copyright owner. It is also clarified that the use of any photograph on the website including the use of any photograph of any educational institute/ university is not intended to suggest any association, relationship, or sponsorship whatsoever between the company and the said educational institute/ university. Any such use is for representative purposes only and all intellectual property rights belong to the respective owners.