# Mathematics for Chemistry/Some Useful Aspects of Calculus

## Limits

Many textbooks go through the proper theory of differentiation and integration by using limits. As chemists it is possible to live without knowing this so we might well not have it as an examinable topic. However here is how we differentiate sin from 1st principles.

${\displaystyle {\frac {{\rm {d}}y}{{\rm {d}}x}}=\left({\frac {{\delta }y}{{\delta }x}}\right)_{{\rm {limit}}~~~~\delta x\rightarrow 0}}$

${\displaystyle ={\frac {\sin(x+\delta x)-\sin x}{\delta x}}}$

${\displaystyle ={\frac {\sin x\cos \delta x+\sin \delta x\cos x-\sin x}{\delta x}}}$

${\displaystyle ={\frac {\sin x}{\delta x}}-{\frac {\sin x}{\delta x}}+{\frac {\sin \delta x}{\delta x}}\cos x}$

As ${\displaystyle \sin \delta x=\delta x}$  for small ${\displaystyle x}$  this expression is ${\displaystyle \cos x}$ .

Similarly for ${\displaystyle \cos \theta }$

${\displaystyle {\frac {{\rm {d}}y}{{\rm {d}}\theta }}={\frac {\cos(\theta +\delta \theta )-\cos \theta }{\delta \theta }}}$

${\displaystyle ={\frac {\cos \theta \cos \delta \theta -sin\theta \sin \delta \theta -\cos \theta }{\delta \theta }}}$

${\displaystyle ={\frac {\cos \theta }{\delta \theta }}-{\frac {\sin \theta ~~\delta \theta }{\delta \theta }}-{\frac {\cos \theta }{\delta \theta }}}$

This is equal to ${\displaystyle -\sin \theta }$ .

## Numerical differentiation

You may be aware that you can fit a quadratic to 3 points, a cubic to 4 points, a quartic to 5 etc. If you differentiate a function numerically by having two values of the function ${\displaystyle \delta x}$  apart you get an approximation to ${\displaystyle {\frac {{\rm {d}}y}{{\rm {d}}x}}}$  by constructing a triangle and the gradient is the tangent. There is a forward triangle and a backward triangle depending on the sign of ${\displaystyle \delta x}$ . These are the forward and backward differentiation approximations.

If however you have a central value with a ${\displaystyle \delta }$  either side you get the central difference formula which is equivalent to fitting a quadratic, and so is second order in the small value of ${\displaystyle \delta x}$  giving high accuracy compared with drawing a tangent. It is possible to derive this formula by fitting a quadratic and differentiating it to give:

${\displaystyle {\frac {{\rm {d}}y}{{\rm {d}}x}}={\frac {f^{+}+f^{-}-2f^{0}}{\delta ^{2}}}}$


HCl   r-0.02
sigma (iso)       32.606716      142.905788     -110.299071

HCl   r-0.01
sigma (iso)       32.427188      142.364814     -109.937626

HCl   r0         Total shielding: paramagnetic  : diamagnetic
sigma (iso)       32.249753      141.827855     -109.578102

HCl   r+0.01
sigma (iso)       32.074384      141.294870     -109.220487

HCl   r+0.02
sigma (iso)       31.901050      140.765819     -108.864769



This is calculated data for the shielding in ppm of the proton in HCl when the bondlength is stretched or compressed by 0.01 of an Angstrom (not the approved unit pm). The total shielding is the sum of two parts, the paramagnetic and the diamagnetic. Notice we have retained a lot of significant figures in this data, always necessary when doing numerical differentiation.

Exercise - use numerical differentiation to calculated ${\displaystyle d\sigma /dr}$ and ${\displaystyle d^{2}\sigma /dr^{2}}$ using a step of 0.01 and also with 0.02. Use 0.01 to calculate ${\displaystyle d\sigma (para)/dr}$  and ${\displaystyle d\sigma (dia)/dr}$

## Numerical integration

Wikipedia has explanations of the Trapezium rule and Simpson's Rule. Later you will use computer programs which have more sophisticated versions of these rules called Gaussian quadratures inside them. You will only need to know about these if you do a numerical project later in the course. Chebyshev quadratures are another version of this procedure which are specially optimised for integrating noisy data coming from an experimental source. The mathematical derivation averages rather than amplifies the noise in a clever way.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 22, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}