liveBook · Manning

Sinusoidal function

As explained in Building Quantum Software with Python

A sinusoid is a waveform described by a sine or cosine function and characterized by a frequency and phase.

A sinusoidal function describes a repeating waveform using sine or cosine. Its shape is determined by amplitude, frequency, and phase: amplitude sets peak height, frequency counts cycles over an interval, and phase shifts the wave horizontally. Sine and cosine have the same shape, offset by π/2 radians. section 7.1.1

Sampling a cosine signal

The general form A cos(2πft + φ) makes the parameters explicit. For eight samples, a normalized cosine can be generated with `samples = [1/sqrt(8) * cos(2 * pi * frequency * (t / 8)) for t in range(8)]` and plotted alongside a continuous curve to compare the discrete signal with its waveform. section 7.1.1

Composite sound waves can be decomposed into simpler sinusoids. A glass harmonica provides an intuitive example: glasses of different sizes vibrate at different frequencies, and the heard sound combines their components. section 7.1.1

In quantum-state representations, normalized complex sinusoids encode periodic patterns while satisfying the requirement that squared amplitude magnitudes sum to one. The real and imaginary components correspond to cosine and sine projections. section 7.1.2

Geometric sequence state

A reusable construction creates amplitudes with equal magnitude and phase advancing by θ: `geom(n, theta) = [sqrt(1/2**n) * cis(k*theta) for k in range(2**n)]`, where `cis(theta)` returns `cos(theta) + 1j*sin(theta)`. For three qubits and θ = π/3, the phase repeats because of sine and cosine periodicity. section 7.1.2

Figure 7.3 The sinusoidal wave sin(x) for real values x has amplitude 1, phase 0, and frequency 1.
figure

Use the waveform diagram to inspect amplitude, zero phase, and frequency one for sin(x). section 7.1.1

Figure 7.6 Projections of the sine and cosine parts of a complex sinusoid
figure

Use the projection diagram to see how a complex sinusoid combines cosine and sine components. section 7.1.2

How Building Quantum Software with Python covers it

How deep it goes
Defines amplitude, frequency, phase, and sine-cosine relations, then implements sampled and complex sinusoidal states.
Examples
Uses glass harmonicas, sin(x), sampled cosine values, unit-circle phases, and geometric sequence states.
What it assumes
Assumes basic trigonometric functions and complex numbers while introducing waveform parameters and normalized quantum amplitudes.
What you can do after
Build it from scratch using sine, cosine, discrete samples, complex amplitudes, and geometric-sequence state functions.
How it connects
Connects sinusoidal functions with frequency, amplitude, phase, Fourier analysis, complex numbers, and quantum states.

Also explained in

Compare how 2 books explain sinusoidal function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.