-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8ad229
commit 9ba9f2e
Showing
104 changed files
with
3,632 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
|
||
const logger = require('../src/logger')() | ||
const utility = require('../src/utility') | ||
const Bits = require('../src/bits') | ||
|
||
let bits = null | ||
|
||
bits = Bits.fromNumber(12, 4) | ||
console.log('bits.toNumber(): ' + bits.toNumber()) | ||
console.log('bits.toString("01"): ' + bits.toString('01')) | ||
logger.log('bits.toNumber(): ' + bits.toNumber()) | ||
logger.log('bits.toString("01"): ' + bits.toString('01')) | ||
|
||
bits = Bits.fromNumber(3, 4) | ||
console.log('bits.toNumber(): ' + bits.toNumber()) | ||
console.log('bits.toString("01"): ' + bits.toString('01')) | ||
logger.log('bits.toNumber(): ' + bits.toNumber()) | ||
logger.log('bits.toString("01"): ' + bits.toString('01')) | ||
|
||
bits = Bits.fromString('0101', '01') | ||
console.log('bits.toNumber(): ' + bits.toNumber()) | ||
console.log('bits.toString("01"): ' + bits.toString('01')) | ||
logger.log('bits.toNumber(): ' + bits.toNumber()) | ||
logger.log('bits.toString("01"): ' + bits.toString('01')) | ||
|
||
bits = Bits.fromString(' x x', ' x') | ||
console.log('bits.toNumber(): ' + bits.toNumber()) | ||
console.log('bits.toString(" x"): ' + bits.toString(' x')) | ||
console.log('bits.toString("01"): ' + bits.toString('01')) | ||
logger.log('bits.toNumber(): ' + bits.toNumber()) | ||
logger.log('bits.toString(" x"): ' + bits.toString(' x')) | ||
logger.log('bits.toString("01"): ' + bits.toString('01')) | ||
|
||
bits = Bits.fromString('111000100001001', '01') | ||
console.log('bits.toNumber(): ' + bits.toNumber()) | ||
logger.log('bits.toNumber(): ' + bits.toNumber()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
|
||
let math = require('mathjs') | ||
const math = require('mathjs') | ||
const logger = require('../src/logger')() | ||
|
||
console.log() | ||
console.log('Math.sqrt(-2): ' + Math.sqrt(-2)) // cannot find the square root of a negative number | ||
console.log('math.sqrt(math.complex(-2)): ' + math.sqrt(math.complex(-2))) | ||
console.log('math.sqrt(math.complex(2)): ' + math.sqrt(math.complex(2))) | ||
console.log() | ||
logger.log() | ||
logger.log('Math.sqrt(-2): ' + Math.sqrt(-2)) // cannot find the square root of a negative number | ||
logger.log('math.sqrt(math.complex(-2)): ' + math.sqrt(math.complex(-2))) | ||
logger.log('math.sqrt(math.complex(2)): ' + math.sqrt(math.complex(2))) | ||
logger.log() | ||
|
||
console.log('math.pi: ', math.pi) | ||
logger.log('math.pi: ', math.pi) | ||
const degree = math.pi / 180 | ||
console.log('1 degree = math.pi / 180: ', degree, math.pi / 180) | ||
console.log('360 degrees = math.pi * 2: ', 360 * degree, math.pi * 2) | ||
console.log('180 degrees = math.pi: ', 180 * degree, math.pi) | ||
console.log('90 degrees = math.pi / 2: ', 90 * degree, math.pi / 2) | ||
console.log('45 degrees = math.pi / 4: ', 45 * degree, math.pi / 4) | ||
console.log('22.5 degrees = math.pi / 8: ', 22.5 * degree, math.pi / 8) | ||
console.log() | ||
logger.log('1 degree = math.pi / 180: ', degree, math.pi / 180) | ||
logger.log('360 degrees = math.pi * 2: ', 360 * degree, math.pi * 2) | ||
logger.log('180 degrees = math.pi: ', 180 * degree, math.pi) | ||
logger.log('90 degrees = math.pi / 2: ', 90 * degree, math.pi / 2) | ||
logger.log('45 degrees = math.pi / 4: ', 45 * degree, math.pi / 4) | ||
logger.log('22.5 degrees = math.pi / 8: ', 22.5 * degree, math.pi / 8) | ||
logger.log() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
const logger = require('../src/logger')() | ||
|
||
// illustrate probability recording with multiple runs | ||
// because internal circuit probabilities can never really be known |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
|
||
const logger = require('../src/logger')() | ||
|
||
// illustrate through measuring why it is necessary to run a circuit perhaps hundreds of times | ||
// to get a glimpse of the real certainty of an answer | ||
// measuring only gives reveals the state vector combination - not probabilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.