Function tabulation: how to write a program?

Function tabulation is a classic math and programming problem. It consists in sequentially finding the quantity f (x) for varying values ​​of x . The calculation results are most often displayed in a table of two rows. The first corresponds to x , the second to f (x) .

function tabulation




Theory

The algorithm for determining function values ​​consists of six steps.

  1. The choice of the initial and final value of the argument, the number of points.
  2. The calculation of the step is the amount by which the argument will change.
  3. The argument is taken equal to the initial value.
  4. Function calculation.
  5. Increment argument by step value.
  6. Repeat steps 4–5 until the required number of points has been calculated.

, , , . , . , ( 6 ) .

, , . g(x) = x2 + 9. [–2; 2], . , 1.





, g(–2), «–2» – . x ( ) g, .

x

–2

–1

0

1

2

g(x)

13

10

9

10

13

– .

function tabulation program




– . , . – .

«». , , , . f(x) = 18 * x + 5. – x, f(x).

- := ..

- _ := (. – . ) / . .

- FOR ( := 0 . ).

:

- := 18 * + 5.

- := . + * .

- (, ).

.

. "", C+, C# VBA, MS Office.




All Articles