In reduced units ( )

PHYSICS · Multi-part · Fermi University Physics · Computational Physics · Scientific programming for physicists · Scientific programming for physicists

Scientific Computing for Physicists, Ch Letting the computer do advanced algebra: operators, series and differentiated programs

Problem

In reduced units (ϵ=σ=1\epsilon=\sigma=1), one Lennard-Jones pair with separation components Δx\Delta x, Δy\Delta y, Δz\Delta z contributes three gradient components gα=−48 Δα (rij2)−7+24 Δα (rij2)−4,α=x,y,z,g_\alpha=-48\,\Delta\alpha\,(r_{ij}^2)^{-7}+24\,\Delta\alpha\,(r_{ij}^2)^{-4},\qquad \alpha=x,y,z, where rij2=Δx2+Δy2+Δz2r_{ij}^2=\Delta x^2+\Delta y^2+\Delta z^2. Count operations with one rule: every addition, multiplication, squaring and integer power counts as one, and Δx\Delta x, Δy\Delta y, Δz\Delta z are given. ((a)) How many operations do the three components take when rij2r_{ij}^2 is written out in full everywhere it appears? ((b)) Common-subexpression elimination computes rij2r_{ij}^2, u=(rij2)−7u=(r_{ij}^2)^{-7} and v=(rij2)−4v=(r_{ij}^2)^{-4} once and writes gα=−48 Δα u+24 Δα vg_\alpha=-48\,\Delta\alpha\,u+24\,\Delta\alpha\,v. How many operations now? ((c)) Factor first, gα=Δα (−48u+24v)g_\alpha=\Delta\alpha\,(-48u+24v), then eliminate again. How many operations now, and why could elimination alone not find this saving?

Browse the problem library