Skip to main content
added 5 characters in body
Source Link

I actually found a descent enough function. I started with the conditions on the second derivative I wanted to satisfy. So I construct the following function, which is just the sum of two gaussians, such that the entire function is odd about the origin $$ a(x) = - e^{-\frac{(x+a)^2}{\sigma}} + e^{-\frac{(x-a)^2}{\sigma}}$$$$ \alpha(x) = - e^{-\frac{(x+a)^2}{\sigma}} + e^{-\frac{(x-a)^2}{\sigma}}$$ with $a,\sigma \in \mathbb{R}$. Now, this function is what I want the second derivative to look like. To get the original function, I integrated this function twice to get

$$ \phi(x) = \frac{1}{2}\Bigg( e^{-\frac{(x-a)^2}{\sigma}} - e^{-\frac{(x+a)^2}{\sigma}}\Bigg)\sigma + C_1 + C_2 x + \frac{\sqrt{\pi \sigma}}{2}\Bigg( (a-x)ERF\bigg(\frac{a-x}{\sqrt{\sigma}}\bigg) - (a+x)ERF\bigg(\frac{a+x}{\sqrt{\sigma}}\bigg)\Bigg)$$

where $C_1, C_2$ are integration constants and $ERF$ is the error function from integrating a gaussian. Now, to have a linear function at large values of x and a flat function near the origin, we just massage the parameters until the function has vanishing derivative at the origin (flat) and constant non-zero at large x (linear). For example, I find $C_1=0$, $C_2 = 1.5$, and $a \approx 1.0087$ gives me:

enter image description here

Now, differentiating this twice yields the original function:

enter image description here

Hope this helps someone else in the future if you ever look for a function like this!

I actually found a descent enough function. I started with the conditions on the second derivative I wanted to satisfy. So I construct the following function, which is just the sum of two gaussians, such that the entire function is odd about the origin $$ a(x) = - e^{-\frac{(x+a)^2}{\sigma}} + e^{-\frac{(x-a)^2}{\sigma}}$$ with $a,\sigma \in \mathbb{R}$. Now, this function is what I want the second derivative to look like. To get the original function, I integrated this function twice to get

$$ \phi(x) = \frac{1}{2}\Bigg( e^{-\frac{(x-a)^2}{\sigma}} - e^{-\frac{(x+a)^2}{\sigma}}\Bigg)\sigma + C_1 + C_2 x + \frac{\sqrt{\pi \sigma}}{2}\Bigg( (a-x)ERF\bigg(\frac{a-x}{\sqrt{\sigma}}\bigg) - (a+x)ERF\bigg(\frac{a+x}{\sqrt{\sigma}}\bigg)\Bigg)$$

where $C_1, C_2$ are integration constants and $ERF$ is the error function from integrating a gaussian. Now, to have a linear function at large values of x and a flat function near the origin, we just massage the parameters until the function has vanishing derivative at the origin (flat) and constant non-zero at large x (linear). For example, I find $C_1=0$, $C_2 = 1.5$, and $a \approx 1.0087$ gives me:

enter image description here

Now, differentiating this twice yields the original function:

enter image description here

Hope this helps someone else in the future if you ever look for a function like this!

I actually found a descent enough function. I started with the conditions on the second derivative I wanted to satisfy. So I construct the following function, which is just the sum of two gaussians, such that the entire function is odd about the origin $$ \alpha(x) = - e^{-\frac{(x+a)^2}{\sigma}} + e^{-\frac{(x-a)^2}{\sigma}}$$ with $a,\sigma \in \mathbb{R}$. Now, this function is what I want the second derivative to look like. To get the original function, I integrated this function twice to get

$$ \phi(x) = \frac{1}{2}\Bigg( e^{-\frac{(x-a)^2}{\sigma}} - e^{-\frac{(x+a)^2}{\sigma}}\Bigg)\sigma + C_1 + C_2 x + \frac{\sqrt{\pi \sigma}}{2}\Bigg( (a-x)ERF\bigg(\frac{a-x}{\sqrt{\sigma}}\bigg) - (a+x)ERF\bigg(\frac{a+x}{\sqrt{\sigma}}\bigg)\Bigg)$$

where $C_1, C_2$ are integration constants and $ERF$ is the error function from integrating a gaussian. Now, to have a linear function at large values of x and a flat function near the origin, we just massage the parameters until the function has vanishing derivative at the origin (flat) and constant non-zero at large x (linear). For example, I find $C_1=0$, $C_2 = 1.5$, and $a \approx 1.0087$ gives me:

enter image description here

Now, differentiating this twice yields the original function:

enter image description here

Hope this helps someone else in the future if you ever look for a function like this!

Source Link

I actually found a descent enough function. I started with the conditions on the second derivative I wanted to satisfy. So I construct the following function, which is just the sum of two gaussians, such that the entire function is odd about the origin $$ a(x) = - e^{-\frac{(x+a)^2}{\sigma}} + e^{-\frac{(x-a)^2}{\sigma}}$$ with $a,\sigma \in \mathbb{R}$. Now, this function is what I want the second derivative to look like. To get the original function, I integrated this function twice to get

$$ \phi(x) = \frac{1}{2}\Bigg( e^{-\frac{(x-a)^2}{\sigma}} - e^{-\frac{(x+a)^2}{\sigma}}\Bigg)\sigma + C_1 + C_2 x + \frac{\sqrt{\pi \sigma}}{2}\Bigg( (a-x)ERF\bigg(\frac{a-x}{\sqrt{\sigma}}\bigg) - (a+x)ERF\bigg(\frac{a+x}{\sqrt{\sigma}}\bigg)\Bigg)$$

where $C_1, C_2$ are integration constants and $ERF$ is the error function from integrating a gaussian. Now, to have a linear function at large values of x and a flat function near the origin, we just massage the parameters until the function has vanishing derivative at the origin (flat) and constant non-zero at large x (linear). For example, I find $C_1=0$, $C_2 = 1.5$, and $a \approx 1.0087$ gives me:

enter image description here

Now, differentiating this twice yields the original function:

enter image description here

Hope this helps someone else in the future if you ever look for a function like this!