Home > Back-end >  Inquire of c language implementation of piecewise function inequality problem
Inquire of c language implementation of piecewise function inequality problem

Time:10-05

For example validate a piecewise function of his upper bound less than or equal to a formula that's about how to implement in c language for leaders help give an idea

CodePudding user response:

The first theory is that the
X % 2=1 and % 2 x=0 is actually x is odd or even number; So y
Odd: x=2 * m + 1, y=2 * n + 1
Even: x=2 * m, y=2 * n
Prove in four different conditions, f (x, y) & lt; X * y=x * * y

Here x and y must be an integer, otherwise it's meaningless to % operation


Program to prove:
Constructs the piecewise function:
Int f (int x, int y) {return x % 2? (y % 2? X * y: 2 * (y + 1)) : (y % 2? (x + 1) * y: 2 * x * y); };

And then to compare for different x and y
F (x, y) and the size of the x * x * y * y problems

This time by exhaustive method, if given the range of x and y
If there is no scope, that is, x and y are arbitrary integer, held the poor law invalid

Program cannot prove, only to simulate, and only limited range of
  • Related