The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

comphy is an R package accompanying the book This package accompanies the book
Computational Physics with R. It collects all the functions described and used throughout the book, providing ready-to-use implementations of numerical algorithms in computational physics.

The package includes routines for:

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("jfoadi/comphy")

Example

This is a simple example where a numerical derivative of sin(x) is computed using comphy:

library(comphy)

# Grid of known values
x <- seq(0,pi,length.out=11)

# Grid of values at which derivative must be calculated
# Same as x
x0 <- x

# Function known at tabulated points
f <- sin(x)+cos(x)

# Obtain a numerical derivative at those points
# using central differences (discard first and last value)
df <- deriv_reg(x0,x,f)

# Print derivative values
print(df)
#>  [1]         NA  0.6315304  0.2176105 -0.2176105 -0.6315304 -0.9836316
#>  [7] -1.2394482 -1.3739389 -1.3739389 -1.2394482         NA

The two NA’s are there because the derivative is calculated using a centred difference.

Documentation

All exported functions include documentation and usage examples. For a comprehensive discussion and context, see the book Computational Physics with R.

License

GPL (>= 2)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.