Sunday, April 21, 2024

📑 Nested Functions for Polynomials

📑 Task

1) What will be the result of the calculations?
2) Can you write this code in a form of an anonymous function?
3) Can you make this function more universal so that
it builds a polynomial of any degree using arguments as coefficients?

📑 Answer

1) $polynomials(1, 1, 1)(0)$ builds the function $f(x) = x^2 + x + 1$
and finds its value $f(x) = 1$ at $x = 0$ twice
So the program will print out $ 1 $
2)

3)

No comments:

Post a Comment