Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 962 Bytes

File metadata and controls

31 lines (22 loc) · 962 Bytes

Constant and Balanced Functions

This code shows the difference between a constant and a balanced function

Running the sample

To run this application, simply run mvn clean javafx:run

The expected outcome on the console looks similar to this

f2 is a balanced function
f4 is a constant function
f2 is a balanced function
f2 is a balanced function
f3 is a balanced function
f3 is a balanced function
f4 is a constant function
f1 is a constant function
f2 is a balanced function
f1 is a constant function

What it is doing

In this 100% classic sample, a number of constant and balanced functions are created. We need 2 evaluations before we can determine a random function is contant or balanced.

You can learn more about this sample in Chapter 9 of Quantum Computing for Java Developers. It is discussed in 9.2: "Properties of functions"