Extracting Work Optimally with Imprecise Measurements

Measurement and feedback allows for an external agent to extract work from a system in contact with a single thermal bath. The maximum amount of work that can be extracted in a single measurement and the corresponding feedback loop is given by the information that is acquired via the measurement, a result that manifests the close relation between information theory and stochastic thermodynamics. In this paper, we show how to reversibly confine a Brownian particle in an optical tweezer potential and then extract the corresponding increase of the free energy as work. By repeatedly tracking the position of the particle and modifying the potential accordingly, we can extract work optimally, even with a high degree of inaccuracy in the measurements.


Introduction
Modern techniques have allowed the manipulation of objects at the microscale.A paradigmatic example are colloidal particles trapped by optical tweezers.At this scale -the scale of Brownian motion-not only the motion of particles but the energy fluxes, work or heat, become stochastic.Nevertheless, the combination of manipulation and imaging or other detection techniques allow for some degree of control [1].For instance, in driven systems, the external driving may be modified based on outcomes of measurements, as in feedback control, leading for example to (efficient) confinement in small region of space [2] or to the reduction of thermal fluctuations, i.e. cooling, a technique implemented both in classical or quantum systems [3,4] .Other application of feedback is an increase of the performance of certain motors operating at the microscale such as Brownian ratchets or micro-motors [5][6][7][8][9].
Feedback exploits the information acquired through measurement as a thermodynamic resource.It is now known that the work needed to perform an isothermal feedback process, for a system in contact with an environment at constant temperature T , is bounded by the following extension of the second law of thermodynamics [9,10]: where ∆F is the free energy difference between the final and initial states of the process, k the Boltzmann's constant, and I is the amount of information gained in the measurement, quantified by the mutual information from information theory.Information is always positive (or zero) and thus, in a cycle (∆F = 0) it is possible to extract work (W < 0) from a single thermal bath with measurement and feedback.Equation ( 1) also shows that a given level of accuracy in the measurement, quantified by the mutual information, limits the amount of work that can be extracted in one feedback operation.Some especially tailored protocols saturate that bound (1) and may be used to convert all the information acquired into useful work.These are processes that are reversible under feedback [11][12][13].In this article, we first review these protocols and show how to use their special properties to extract energy with the same efficiency and 1 arXiv:2401.09993v1[cond-mat.stat-mech]18 Jan 2024 even power when operating with higher measurement errors.To fix ideas we use a well known model that we proceed to describe in the following section.

Model description and cycle operation
As our system, we consider an overdamped Brownian particle in contact with a thermal bath, which acts as its environment.The particle feels a harmonic potential.This is a well proven theoretical model for an experimental system formed by a colloidal particle in water at constant temperature and trapped by optical tweezers.The potential V κ,x0 = 1 2 κ(x − x 0 ) 2 has tunable parameters x 0 , the position of the center of the trap, and κ, the stiffness.As the Brownian particle position fluctuates, the energy transfers and thermodynamic potentials become also fluctuating, in fact, they are stochastic variables.The framework to analyse energetics for these fluctuating systems in the mesoscale is stochastic thermodynamics [14][15][16] .We review the main concepts in the following.The Brownian particle may, due to a collision with the solvent, absorb some energy and climb the potential well.Or it may transfer energy back to the thermal bath via viscosity and go down in the potential.These energy transfers with the thermal bath constitute heat Q and, and since this energy can be stored as potential energy, this is the internal energy Ê of the particle.In our system then the internal energy is [17][18][19][20].We will use â to denote a stochastic variable and the regular letter a for the average over realizations, i.e., E = ⟨ Ê⟩.Another form of energy transfer is work Ŵ : an external agent may modify the harmonic potential (changing the parameters) and increase or decrease the potential energy of the particle.If the internal energy depends on a parameter λ that is modified from λ 0 to λ f then, formally, the definition of work is: This is best seen with an example.For instance, consider a fast increase of the stiffness of the potential from k i to k f .If the increase is very fast so that the particle does not modify its position x during the time the stiffness is changing, the energy of the particle increases by an amount ∆V = 1 2 (x − x 0 ) 2 (k f − k i ).This energy is supplied by the agent controlling the potential who has performed then a work Ŵ = ∆V > 0. As a result, the particle is in a tighter parabola and the equilibrium dispersion of the position of the particle decreases, so that this is commonly referred to as a compression.If the stiffness is decreased, work is exerted on the agent by the system and since the distribution of particle positions will eventually widen, this corresponds to an expansion.
To extract energy from the thermal bath we propose the following cyclic operation in two stages: 1. Confinement of the Brownian particle by (repeated) measuring and feedback

Isothermal expansion
If the work obtained in the isothermal expansion exceeds the work needed for confinement, the system works as a motor.During a compression, the free energy of the system increases (due to the entropy decrease).Using reversible feedback confinement [2], we can minimize the work needed for stage 1, which turns out to vanish, and extract all the free energy increase of stage 1 as work during stage 2. Let us analyze each stage in more detail.

2..1 Optimal confinement
Confinement of a system to a small region of the phase space (at constant temperature) implies a decrease of entropy of the system.For the entropy of a Brownian particle we use the standard choice of Shannon's entropy, S = −k ρ(x) log(x)dx, where ρ(x) is the probability distribution of the particle position.With this choice, the second law of thermodynamics is fulfilled on average and the thermodynamic relation F = E −T S is recovered for a system in contact with a thermal bath.Although strictly speaking, this is a generalization of the free energy to non-equilibrium systems, in systems in contact to a thermal bath it plays a similar role as the standard thermodynamic free energy, and stochastic thermodynamics for our system closely resembles macroscopic thermodynamics [9].
Let us consider for simplicity that the internal energy change between the initial and final states of the confinement process vanishes (we will see later that this is the case in our particular system).A reduction of entropy then corresponds to an increase of free energy ∆F = ∆E − T ∆S.This increase in free energy could then be extracted as work in an isothermal expansion.However, the whole process cannot operate as a motor as this will defeat the second law (extracting work from a single thermal bath).Indeed, the second law states for the confinement and then for the isothermal expansion back to the initial state (∆F 2 = −∆F 1 ) so that W total = W 1 + W 2 ≥ 0 and the system dissipates energy into the thermal bath.However, as explained above, when measuring and feeding back to the system, W is bounded by (1) instead.Thus, the work needed for the confinement may be reduced and the work output of the cyclic process (∆F cycle = 0) may be negative: Notice that mutual information is always a positive quantity.
Following [2] we propose a reversible feedback confinement that can confine the particle with W 1 = 0, and as will be shown later (see equation ( 13)), without dissipating heat to the thermal bath, so that the increase in free energy produced by the confinement can later be completely recovered as work during a quasistatic expansion in stage 2.
For a system in contact with a thermal bath, a feedback process is reversible if the Hamiltonian is modified after the measurement so that probability of the state of the system conditioned on the measurement outcome is the Gibbsian state of the new Hamiltonian.After a measurement, the probability to find a given state changes instantaneously, the new probability distribution takes into account the information obtained and must be updated according to Bayesian inference.If the Hamiltonian changes also rapidly and the Gibbs state of the new Hamiltonian matches the posterior probability distribution, the system remains at equilibrium, no further evolution of the probability distribution ensues until a new measurement is taken.
In our model we take the common assumption of Gaussian measurement errors.If the particle is located at a position x then the measurement outcome m is Gaussian distributed around x and the dispersion σ m quantifies the measurement error: After a measurement, the probability distribution of the position of the particle updates according to Bayes' theorem from the initial distribution ρ: where π(m) = dxq(m|x)ρ(x) is the marginal distribution of the measurement outcome.For a Brownian particle in a potential, the equilibrium distribution is its corresponding Gibbs distribution:  (10) gives σ ′ = 2.12 which matches the sample standard deviation of 2.10.
In a harmonic potential it is a Gaussian, centered in the trap position x 0 and with variance given by σ 2 = kT /κ.It can be shown [7] that after a measurement the new distribution computed according to (7) remains Gaussian.If the initial distribution has mean x and standard deviation σ, after a measurement, the distribution updates to a Gaussian with mean and deviation given by [2]: We can make the post-measurement distribution an equilibrium distribution by setting a new center of the trap position x ′ 0 and stiffness κ ′ as Notice that κ ′ > κ, hence the particle is more tightly bound or confined after this change.This process of measurement and feedback can be repeated and a new, more confined state could be achieved.Figure 2 (top) shows the confining effect of repeating this procedure.Also, equation ( 10) implies σ ′ < σ so that every measurement and feedback step further reduces the variance of the particle distribution.
To check this reduction of variance in simulation, we have computed the particle distribution after a measurement.For this, we first generate a large number of trajectories, starting from an initial equilibrium distribution for a harmonic potential centered in position x 0 = 0 and corresponding dispersion σ = 3.0, as depicted in Figure 1(left).After some time interval, for each trajectory, we measure its position by generating a (Gaussian) random measurement outcome m around the actual position x with dispersion σ m = 3.0 (see details in section 5.).We can then fix a small interval around a given measurement of the position (m, m + ∆m) of our choice, for instance (0.89,0.98), and check only the realizations which gave a measurement in that interval.The distribution of the actual positions x of these particular realizations are distributed as in (7).In our case, as a Gaussian with new reduced standard deviation σ ′ = 2.12 given by (10).This can be checked in Figure 1(right).
In every measurement and feedback step, the trapped Brownian particle stays in equilibrium with the thermal bath at temperature T .Consequently, the average energy is not modified by the feedback process.The average internal energy E of a trapped particle in one dimension is given by the equipartition theorem as E = kT /2.Since the process is isothermal, ∆E = 0. On the other hand, being always in equilibrium, there is no relaxation of the particle distribution and the heat transferred from the heat bath vanishes on average Q = 0. Therefore, according to the first law, the average work done on the system also vanishes: This has been checked in simulations, as shown in Figure 2 (bottom).Details about work computation during measurement and feedback can be found in section 5..In general, for other feedback protocols where the stiffness of the trap is suddenly changed, work is performed on average [21], as in the simple example described after equation (2).The feedback process used here is different (in addition to a sudden increase of stiffness, trap position is also modified in a precisely combined manner) and is special in the sense that average work vanishes.As encoded in equation ( 1), this can solely be achieved by using information about the position through measurement in the feedback (see equation (9) for the new trap position).To see why this matters, consider our Brownian particle in a harmonic potential where the observer happens to know that the particle is exactly at the bottom of the well.This would allow this external agent to increase the stiffness of the potential well with an abrupt change, without performing work, since the energy of the particle is always zero at the bottom of the well, for any stiffness.The confining protocol is a refinement of this idea that works for any position of the particle, by displacing the bottom of the potential well towards the measured particle position and changing the stiffness in a suitable manner.
Furthermore, one can compute the mutual information obtained in the process of measurement and evaluate the increase in free energy ∆F 1 for the confinement stage.From the definition of mutual information: Considering that the measurement outcome distribution q(m|x) and the marginal distribution π(m) are Gaussian with variance σ 2 m and σ 2 +σ 2 m = σ 2 m σ 2 /σ ′2 , respectively, the information acquired in a measurement is Mutual information intuitively measures the decrease in uncertainty of variable x if we know the value of m, or viceversa [22].In our case, from (10), if the measurement error σ m is very large then σ ′ ≈ σ and we extract almost no information from measuring (I ≈ 0).Conversely, for infinite precise measurement σ m → 0, then σ ′ → 0 and we obtain infinite information from a measurement, as an infinite precise description of a position would require infinite number of bits to store it.The entropy of a Gaussian of variance σ 2 is S(ρ) = k log σ √ 2πe.In the measurement process, the distribution changes from a Gaussian of variance σ 2 to a Gaussian of variance σ ′2 and we have Since ∆E = 0, we finally obtain This is valid for every measurement and feedback step using the reversible feedback protocol.In a sequence of confinement steps with successive variances σ 0 , σ 1 , . . ., σ n , the total information is σ 2 n can be obtained from ( 10) by recursion, giving: Finally, the free energy difference between the final and initial states in the confinement stage is Every bit of information extracted in the measurement is turned into an increase of free energy during the confinement stage and can be converted into useful work in the subsequent expansion.

2..2 Work extraction by isothermal expansion
As explained above, if an external agent changes the stiffness of the optical trap from κ i to κ f < κ i , energy is recovered as work.In a quasistatic process, the work done by the system is given by the free energy difference.Since stage 2 completes the cycle of operation of the motor ending in the initial state, we have ∆F 2 = −∆F 1 and which corresponds to extracted work.In fact, it saturates expression (5) and is the maximum possible work that can be extracted using the information obtained in the measurements.This result can be recovered also by direct computation of the work of a process changing stiffness from κ i to κ f and taking into account that for a quasistatic process one can use the equipartition theorem stating ⟨x 2 ⟩ = kT /κ(t), with κ(t) the instantaneous value of the stiffness.Then the average work during the expansion, according to (2), reads: The expansion starts at the end of the confinement process with a distribution of variance σ n and ends at σ 0 .Then, using the relation between stiffness and variance in the confinement stage (11), we have Notice that both during the confinement and the expansion the system must be at equilibrium in order to transform every bit of information into useful work.In practice though, for a process changing the stiffness of the potential to be approximately quasistatic, it is enough that the time of the process is large compared to the inverse frequency of the trap given by ν = κ/γ.This is the criterion that we have used for simulations.Also, it is worth noting that, even though the work in every realization of the expansion may differ in principle in a stochastic system, work is -in this particular example-a self-averaging quantity: for a quasistatic expansion the total work obtained in any realization is very similar to its average value.The argument for self-averaging of the work is the following: from work definition (2), work in a single realization when expanding is Ŵ = x 2 2 dκ.If the expansion is very slow, in the time κ is modified a certain small amount, the particle position has time to fluctuate and sample the whole quasi-equilibrium distribution and x 2 approximately can be replaced by its average value (see full computation in [14]).
The complete diagram of the proposed cycle is depicted in Figure 3. Finally, one could also define an efficiency η as the ratio between extracted thermodynamic resource (work) and the thermodynamic resource consumed to make the engine run, in this case information.With this definition, this reversible feedback engine attains the maximum efficiency: as in a similar system [23] with just one measurement per cycle.

3..1 Work is optimal
We have performed computer simulations of the model system described above.Figure 4 depicts part of two consecutive cycles, each of them with a confinement stage composed of 10 measurement and feedback steps, followed by an isothermal expansion.The top panel depicts the particle position (gray line), trap center (blue line), and measurement outcomes (red dots), whereas the bottom panel shows the evolution of the stiffness along the cycle.
Figure 5 shows the cumulative work done on the system along the time of a single cycle.The thick solid line represents the average over 200 cycles.Every cycle consists of a confinement achieved by measuring the particle position 10 times and the subsequent isothermal expansion.Average work extracted (W < 0) by the end of the cycle approaches the expected result given by equations ( 18),( 19) and ( 21), marked with dashed black line.Shaded area represent the variance of the work, which is substantially large.As is apparent from the figure, most of the variance comes from the confinement step, being the quasistatic work a self-averaging quantity.Finally, work corresponding to two particular cycles is shown by thin blue lines.

3..2 Power and efficiency with higher measurement errors
Consider two setups, A and B, with different measurement errors given by variances σ 2 mA and σ 2 mB = 2σ 2 mA .Suppose that only one measurement step is performed in each system before the expansion.According to our discussion above, the measurement information that can be later transformed into work is smaller in system B than in A: We can however obtain as much information in system B with two measurements as in system A with one measurement.After two measurements, using the reversible confinement protocol, the variance of the equilibrium distribution σ 2 B2 in system B is equal to the variance in system A after 1 measurement σ 2 A1 : Using (18), we obtain: As explained above, this implies that the same work can be extracted in the subsequent quasistatic expansion.In fact, both systems run with the same efficiency η = 1, hence, every bit of information is turned into work in the expansion.Furthermore, system B can also be run in principle at the same power as system A. During the confinement process, after the adjustment of the potential, the particle distribution is at equilibrium.No relaxation occurs as explained previously.Therefore, a new measurement and feedback step could in principle be taken immediately after, in rapid succession.Thus, halving the time between measurements in system B as compared to system A ensures the same cycle time.As the work obtained is also the same, both systems operate with the same power.This is depicted in Figure 6 where we show simulation results for system A with one measurement and expansion and system B with two (faster) measurements and expansion.Approximately the same work is obtained in both systems.For reference, we have also marked the expected extracted work for a system with measurement error given by σ mB but using just one measurement.

Discussion
Reversible feedback confinement is an optimal way of reducing the entropy of a system to be later used for work extraction.It nevertheless requires a high degree of control over the Hamiltonian, to adapt it to the new probabilistic state after the measurement.This might be a limitation for experimental realizations, although a low dissipation is expected even if a similar or approximate protocol is implemented.Theoretically, the dissipation could be accounted for by using the Kullback-Leibler distance between the post-measurement particle distribution and the equilibrium distribution of the potential after feedback [24] , if they were different due to a less precise tuning of the potential.
In principle, for a measurement and feedback protocol, imprecision in the measurement, which will inevitably arise in an experimental setup, will limit the work extraction or power.We have nevertheless shown here that this limitation can be overcome by adding more measurement steps before the quasistatic expansion, as long as the reversible feedback confinement protocol is used.In principle, the application of this protocol is instantaneous.In practice, this means that the confinement may be applied in a very short time, limited maybe by the response time of the feedback mechanism or the measurement acquisition time.Thus, if response times of measurement, feedback and Hamiltonian modification are fast compared to system's relaxation time, optimal work extraction is feasible even with a high degree of inaccuracy in the measurement, using repeated optimal feedback.

Materials and Methods
The confined Brownian particle evolves according to Langevin equation: with ξ(t) Gaussian white noise ⟨ξ(t)ξ(t ′ )⟩ = 2kT γδ(t − t ′ ), T bath temperature and k Boltzmann's constant.The potential V κ,x0 (x) is defined above and controlled through measurement and feedback.Model simulations were performed in C language, solving Langevin evolution equation with Heun method for stochastic differential equation [25].We provide in the following some details on work computation, measurement and feedback steps.For full details, code is available here • Measurement.To perform a measurement in the simulation, a Gaussian number "r" with zero average and standard deviation 1 is generated.Then, if particle position is x, the measurement outcome m is Notice that m is then distributed according to equation (6) • Feedback.Immediately after measurement, and using the measurement outcome m just computed, potential parameters κ and x 0 are recomputed according to equations ( 9) to (12).Notice that the old values need to be stored in an auxiliary variable for the work computation, as explained in the following step.
• Work computation during feedback process.According to its definition for a trajectory, work is the difference in potential energy when the potential is changed.If κ → κ ′ and x 0 → x ′ 0 as a result of measurement and feedback, then work is computed as

Figure 1 :
Figure 1: Reduction of variance after measuring.Left: Initial distribution.Histogram of 40000 random Gaussian numbers centered in 0 with standard deviation σ = 3.0 (blue bars) and a theoretical Gaussian distribution with the same parameters (red continuous line).Right: Posterior distribution.Histogram of particle positions with measurement outcomes in a given interval (0.89,0.98) (blue bars) and prediction according to Bayes' theorem (7) (red).Measurement outcomes where performed with measurement error σ m = 3.0.Using σ m = 3.0 and σ = 3.0 in(10) gives σ ′ = 2.12 which matches the sample standard deviation of 2.10.

Figure 2 :
Figure 2: Confinement.Top: particle trajectory (gray line), measurement outcome (red dots) and trap center position (blue line).Bottom: Cumulative work for different realizations (color lines) and its average over 200 realizations (thick black line) for confinement in 10 measurement steps.See simulation details in section 5.. Initial trap stiffness κ = 0.1 and position x 0 = 0. Initial condition is equilibrium with trap potential to avoid transient due to equilibration.Particle diffusion coefficient D = 1 and friction γ = 1.

Figure 3 :
Figure 3: Cycle for extracting work from a thermal bath with inaccurate measurements

Figure 5 :
Figure 5: Average cumulative work along the confinement-expansion cycle (thick blue line) computed from 200 realizations.Shaded area corresponds to one standard deviation from the average.Thin blue lines represent cumulative in two representative cycles.Simulation parameters are: ∆t = 0.001, time between measurements τ = 0.1, number of measurements before expansion is 10, measurement error σ 2 m = 1, initial stiffness of the trap κ = 1, diffusion coefficient D = kT /γ = 1, drag coefficient γ = 1.

Figure 6 :
Figure 6: Average work extraction for 2 different measurement errors, using 1 measurement with variance σ 2 mA = 1 (blue thick line) and using 2 measurements with variance σ 2 mB = 2 (red thick line).Dashed line represents expected work extraction and fine dashed line corresponds to expected work extraction with just 1 measurement of variance σ mB .Thin lines represent single realizations of the work in system A (blue) and B (red).