# creating some smooth density functions

I would like to create some density functions based on some distance measure $D$. As a base density function lets say I have a Gaussian density $f$ with mean $-1$ and variance $1$. I would like to create some smooth and nice density functions $g$ randomly which are at least $\epsilon$ close to my base density $f$. The set of all possible densities can be written down as

$${\cal{F}}=\{g_0: D(g,f)\leq \epsilon\}$$

with

$$D(g,f)=\int_{-\infty}^\infty g(y)\log \left(\frac{g(y)}{f(y)}\right)\mathrm{d}y$$

and since $g$ are densities, we also have additionally

$$\int_{-\infty}^\infty g(y)\mathrm{d}y=1,\quad g(y)>0 \quad\forall y$$

How can I create such $g$ functions in Mathematica? is there a simple way?

Thank you very much for reading this post and thanks in advance for any help.

-
You could pick an arbitrary "smooth and nice" random function $h:\mathbb R\to\mathbb R$ and let $g(y) := f(y)\exp(\alpha h(y)+\beta)$. Then by choosing $\alpha$ sufficiently small and $\beta$ to satisfy $\int g(y)\,\mathrm dy=1$, you can get your desired properties. So the problem reduces to creating an arbitrary real-valued "smooth and nice" function. You are sampling from an infinite-dimensional function space, so you will probably have to narrow it down somehow. –  Rahul Oct 30 '13 at 5:01
(Note that the expression for $D(f,g)$ becomes very simple with this approach. Unfortunately $D$ is not symmetric in $f$ and $g$, but if they are "close together" the difference should be small.) –  Rahul Oct 30 '13 at 5:04
@Rahul Narain :) thanks for the suggestion. –  Seyhmus Güngören Oct 30 '13 at 7:58
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "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, "math_score": 0.9259798526763916, "perplexity": 212.91952171693782}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-49/segments/1416931006716.69/warc/CC-MAIN-20141125155646-00004-ip-10-235-23-156.ec2.internal.warc.gz"}