Description Usage Arguments Details Value See Also Examples

Evaluate the density of a wave function model

1 | ```
dwavefunction(x, w, log = FALSE, amplitude = FALSE)
``` |

`x` |
a numeric vector |

`w` |
a vector of coefficients from |

`log` |
if |

`amplitude` |
if |

The elements of the returned vector *p* are (when `log`

and
`amplitude`

are `FALSE`

):

*
p[i] = (w[1] H[0](x) / e[1] + ... + w[K+1] H[k](x) / e[K+1])^2 * exp(-x^2)
where e[k] = sqrt(sqrt(pi) * 2^k * k!)
*

Here, *K* is the maximum degree, equal to `length(w)-1`

, and
*H[k]* is the Hermite polynomial of degree *k*. Note that
`w`

, being an R vector, is one-indexed, so *w[k]* is associated
with the Hermite polynomial of degree *k-1*.

a numeric vector of the same length as `x`

Madeleine B. Thompson, “Wave function representation of probability distributions,” 2017, https://arxiv.org/abs/1712.07764.

1 2 3 | ```
x <- rnorm(100)
w <- wavefunction_fit(x, degree = 6)
p <- dwavefunction(x, w)
``` |

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.