/* Example programs from the book Scientific and Engineering Programming in C++: An Introduction with Advanced Techniques and Examples, Addison-Wesley, 1994. (c) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 1994. ALL RIGHTS RESERVED. See README file for further details. */ #include "examples/ch2/coulombsLaw.h" double coulombsLaw(double q1, double q2, double r) { // Coulomb's law for the force acting on two point charges // q1 and q2 at a distance r. MKS units are used. const float k = 8.9875e9; // nt-m**2/coul**2 return k * q1 * q2 / (r * r); }