Evaluates the contour integral along the disc given the centre and the radius of a disc. The function is first parametrised so the real and imaginary part can be evaluated seperately using the `R` built-in `integrate` function.

1 2 | ```
disc.integrate(f, z0, R = 0, gamma = c(0, 2 * pi),
rel.tol = .Machine$double.eps^0.5, subdivisions = 100L)
``` |

`f` |
A function whose integral to be evaluated. |

`z0` |
The centre of the disc, usually an isolated singularity. |

`R` |
The radius of the disc (hence a non-negative real number). If the default of zero is used, a sequence of very small radius (starting from 1e-12) will be used sequentially until a solution is sought. Also see details below for using the default radius. |

`gamma` |
A vector of two real numbers indicating the argument of the starting and end point of the disc. Therefore, the default is set as |

`rel.tol` |
The relative tolerance in calculating the integral of the real and imaginary part. |

`subdivisions` |
The number of subdivisions in calculating the integral of the real and imaginary part. |

This function works well regardless of the type of the isolated singularity (i.e. removable singularity, pole & essential singularity).

Note that, due to the rounding error, the value of the integral evaluated at a removable singularity is not exactly but very close to zero (see Examples).

In the case where a branch cut or point is wihtin the disc and the radius is well defined, this function still works well.
However, if the radius is not well defined, one should consider a contour integral shrunk around to a singularity and/or use `line.integrate` to evaluate the integral alone the branch line.

In the case where a singularity is on the branch line (see Examples below), the function `residue` should be used instead.

`value` |
The output of evaluating the integral. |

`abs.error` |
The absolute error. |

`record` |
Only if |

Char Leung

1 2 3 4 5 6 7 8 9 | ```
## integral evaluated at a removable singularity
disc.integrate(function(z){sin(z)/z},0)
## evaluating an integral in the presence of a branch cut
disc.integrate(function(z){sqrt(z)},0,R=1) #still works
#evaluate the integral along the branch cut
-line.integrate(function(z){sqrt(z)},0,1)+line.integrate(function(z){sqrt(z)},1,0)
## Incorrect result: evaluating an integral at a pole on a branch cut
disc.integrate(function(z){log(z)/(1+z)},-1,R=1) #Incorrect
residue(function(z){log(z)/(1+z)},-1) #Correct (using residue)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.