Creating exponential decay function $f$ such that $int_0^1 f = 1$
$begingroup$
I am working on a project where I would like to take a weighted average of values in a set, with the weights decreasing exponentially. To do this, I am trying to find a function $f$ such that $int_0^1 f = 1$. $f$ will be used in the following formula:
$$sum_{n=0}^{|S|}S_n * frac{fleft(frac{n}{|S|}right) + fleft(frac{n + 1}{|S|}right)}{2} * frac{1}{|S|} $$
I would appreciate help with two aspects of this.
- It has been a while since I took calculus, so I am at a bit of a loss as to how to move forward with finding a function $f$ suitable for these purposes, generally. I have been able to find a few functions which have integrals close to 1, but have only been able to use guess-and-check to find these approximations.
- I wonder if I am on the right track here with doing this weighted average, and am curious if I am over-complicating it.
Thanks!
definite-integrals
$endgroup$
add a comment |
$begingroup$
I am working on a project where I would like to take a weighted average of values in a set, with the weights decreasing exponentially. To do this, I am trying to find a function $f$ such that $int_0^1 f = 1$. $f$ will be used in the following formula:
$$sum_{n=0}^{|S|}S_n * frac{fleft(frac{n}{|S|}right) + fleft(frac{n + 1}{|S|}right)}{2} * frac{1}{|S|} $$
I would appreciate help with two aspects of this.
- It has been a while since I took calculus, so I am at a bit of a loss as to how to move forward with finding a function $f$ suitable for these purposes, generally. I have been able to find a few functions which have integrals close to 1, but have only been able to use guess-and-check to find these approximations.
- I wonder if I am on the right track here with doing this weighted average, and am curious if I am over-complicating it.
Thanks!
definite-integrals
$endgroup$
$begingroup$
I am probably confused, so please forgive me for asking, but doesn't $int_0^1{e^{-x}} = -frac{1}{e} + 1$?
$endgroup$
– Erik
Dec 1 '18 at 0:08
1
$begingroup$
Indeed it does! Hence I removed my comment and (hopefully) answered your question below.
$endgroup$
– Aditya Dua
Dec 1 '18 at 0:11
$begingroup$
If you do it this way, the weights will not sum to 1.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:25
$begingroup$
Can you elaborate @eyeballfrog? I understand that it is only an approximation of the integral, but with larger values of $|S|$, the error should be reasonably small, no? Is there another approach that you can recommend?
$endgroup$
– Erik
Dec 1 '18 at 0:31
1
$begingroup$
The error is proportional to $1/|S|$, which may not be good enough unless $S$ is very large. Still, you can just use the fact that $sum_0^n a^i = (1 - a^n)/(1-a)$ to quickly normalize the weights without needing the integral at all.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:52
add a comment |
$begingroup$
I am working on a project where I would like to take a weighted average of values in a set, with the weights decreasing exponentially. To do this, I am trying to find a function $f$ such that $int_0^1 f = 1$. $f$ will be used in the following formula:
$$sum_{n=0}^{|S|}S_n * frac{fleft(frac{n}{|S|}right) + fleft(frac{n + 1}{|S|}right)}{2} * frac{1}{|S|} $$
I would appreciate help with two aspects of this.
- It has been a while since I took calculus, so I am at a bit of a loss as to how to move forward with finding a function $f$ suitable for these purposes, generally. I have been able to find a few functions which have integrals close to 1, but have only been able to use guess-and-check to find these approximations.
- I wonder if I am on the right track here with doing this weighted average, and am curious if I am over-complicating it.
Thanks!
definite-integrals
$endgroup$
I am working on a project where I would like to take a weighted average of values in a set, with the weights decreasing exponentially. To do this, I am trying to find a function $f$ such that $int_0^1 f = 1$. $f$ will be used in the following formula:
$$sum_{n=0}^{|S|}S_n * frac{fleft(frac{n}{|S|}right) + fleft(frac{n + 1}{|S|}right)}{2} * frac{1}{|S|} $$
I would appreciate help with two aspects of this.
- It has been a while since I took calculus, so I am at a bit of a loss as to how to move forward with finding a function $f$ suitable for these purposes, generally. I have been able to find a few functions which have integrals close to 1, but have only been able to use guess-and-check to find these approximations.
- I wonder if I am on the right track here with doing this weighted average, and am curious if I am over-complicating it.
Thanks!
definite-integrals
definite-integrals
asked Nov 30 '18 at 23:58
ErikErik
1033
1033
$begingroup$
I am probably confused, so please forgive me for asking, but doesn't $int_0^1{e^{-x}} = -frac{1}{e} + 1$?
$endgroup$
– Erik
Dec 1 '18 at 0:08
1
$begingroup$
Indeed it does! Hence I removed my comment and (hopefully) answered your question below.
$endgroup$
– Aditya Dua
Dec 1 '18 at 0:11
$begingroup$
If you do it this way, the weights will not sum to 1.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:25
$begingroup$
Can you elaborate @eyeballfrog? I understand that it is only an approximation of the integral, but with larger values of $|S|$, the error should be reasonably small, no? Is there another approach that you can recommend?
$endgroup$
– Erik
Dec 1 '18 at 0:31
1
$begingroup$
The error is proportional to $1/|S|$, which may not be good enough unless $S$ is very large. Still, you can just use the fact that $sum_0^n a^i = (1 - a^n)/(1-a)$ to quickly normalize the weights without needing the integral at all.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:52
add a comment |
$begingroup$
I am probably confused, so please forgive me for asking, but doesn't $int_0^1{e^{-x}} = -frac{1}{e} + 1$?
$endgroup$
– Erik
Dec 1 '18 at 0:08
1
$begingroup$
Indeed it does! Hence I removed my comment and (hopefully) answered your question below.
$endgroup$
– Aditya Dua
Dec 1 '18 at 0:11
$begingroup$
If you do it this way, the weights will not sum to 1.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:25
$begingroup$
Can you elaborate @eyeballfrog? I understand that it is only an approximation of the integral, but with larger values of $|S|$, the error should be reasonably small, no? Is there another approach that you can recommend?
$endgroup$
– Erik
Dec 1 '18 at 0:31
1
$begingroup$
The error is proportional to $1/|S|$, which may not be good enough unless $S$ is very large. Still, you can just use the fact that $sum_0^n a^i = (1 - a^n)/(1-a)$ to quickly normalize the weights without needing the integral at all.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:52
$begingroup$
I am probably confused, so please forgive me for asking, but doesn't $int_0^1{e^{-x}} = -frac{1}{e} + 1$?
$endgroup$
– Erik
Dec 1 '18 at 0:08
$begingroup$
I am probably confused, so please forgive me for asking, but doesn't $int_0^1{e^{-x}} = -frac{1}{e} + 1$?
$endgroup$
– Erik
Dec 1 '18 at 0:08
1
1
$begingroup$
Indeed it does! Hence I removed my comment and (hopefully) answered your question below.
$endgroup$
– Aditya Dua
Dec 1 '18 at 0:11
$begingroup$
Indeed it does! Hence I removed my comment and (hopefully) answered your question below.
$endgroup$
– Aditya Dua
Dec 1 '18 at 0:11
$begingroup$
If you do it this way, the weights will not sum to 1.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:25
$begingroup$
If you do it this way, the weights will not sum to 1.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:25
$begingroup$
Can you elaborate @eyeballfrog? I understand that it is only an approximation of the integral, but with larger values of $|S|$, the error should be reasonably small, no? Is there another approach that you can recommend?
$endgroup$
– Erik
Dec 1 '18 at 0:31
$begingroup$
Can you elaborate @eyeballfrog? I understand that it is only an approximation of the integral, but with larger values of $|S|$, the error should be reasonably small, no? Is there another approach that you can recommend?
$endgroup$
– Erik
Dec 1 '18 at 0:31
1
1
$begingroup$
The error is proportional to $1/|S|$, which may not be good enough unless $S$ is very large. Still, you can just use the fact that $sum_0^n a^i = (1 - a^n)/(1-a)$ to quickly normalize the weights without needing the integral at all.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:52
$begingroup$
The error is proportional to $1/|S|$, which may not be good enough unless $S$ is very large. Still, you can just use the fact that $sum_0^n a^i = (1 - a^n)/(1-a)$ to quickly normalize the weights without needing the integral at all.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:52
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You can start with the function $f(x) = ae^{-x}$ for some $a > 0$. Now, you have:
$int_0^1 f(x)dx = aint_0^1 e^{-x} dx = aleft(1 - frac{1}{e} right) = 1$. This implies a = $frac{e}{e-1}$ and
$f(x) = frac{e^{1-x}}{e-1}$.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3020831%2fcreating-exponential-decay-function-f-such-that-int-01-f-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You can start with the function $f(x) = ae^{-x}$ for some $a > 0$. Now, you have:
$int_0^1 f(x)dx = aint_0^1 e^{-x} dx = aleft(1 - frac{1}{e} right) = 1$. This implies a = $frac{e}{e-1}$ and
$f(x) = frac{e^{1-x}}{e-1}$.
$endgroup$
add a comment |
$begingroup$
You can start with the function $f(x) = ae^{-x}$ for some $a > 0$. Now, you have:
$int_0^1 f(x)dx = aint_0^1 e^{-x} dx = aleft(1 - frac{1}{e} right) = 1$. This implies a = $frac{e}{e-1}$ and
$f(x) = frac{e^{1-x}}{e-1}$.
$endgroup$
add a comment |
$begingroup$
You can start with the function $f(x) = ae^{-x}$ for some $a > 0$. Now, you have:
$int_0^1 f(x)dx = aint_0^1 e^{-x} dx = aleft(1 - frac{1}{e} right) = 1$. This implies a = $frac{e}{e-1}$ and
$f(x) = frac{e^{1-x}}{e-1}$.
$endgroup$
You can start with the function $f(x) = ae^{-x}$ for some $a > 0$. Now, you have:
$int_0^1 f(x)dx = aint_0^1 e^{-x} dx = aleft(1 - frac{1}{e} right) = 1$. This implies a = $frac{e}{e-1}$ and
$f(x) = frac{e^{1-x}}{e-1}$.
answered Dec 1 '18 at 0:08
Aditya DuaAditya Dua
1,00418
1,00418
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3020831%2fcreating-exponential-decay-function-f-such-that-int-01-f-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
I am probably confused, so please forgive me for asking, but doesn't $int_0^1{e^{-x}} = -frac{1}{e} + 1$?
$endgroup$
– Erik
Dec 1 '18 at 0:08
1
$begingroup$
Indeed it does! Hence I removed my comment and (hopefully) answered your question below.
$endgroup$
– Aditya Dua
Dec 1 '18 at 0:11
$begingroup$
If you do it this way, the weights will not sum to 1.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:25
$begingroup$
Can you elaborate @eyeballfrog? I understand that it is only an approximation of the integral, but with larger values of $|S|$, the error should be reasonably small, no? Is there another approach that you can recommend?
$endgroup$
– Erik
Dec 1 '18 at 0:31
1
$begingroup$
The error is proportional to $1/|S|$, which may not be good enough unless $S$ is very large. Still, you can just use the fact that $sum_0^n a^i = (1 - a^n)/(1-a)$ to quickly normalize the weights without needing the integral at all.
$endgroup$
– eyeballfrog
Dec 1 '18 at 0:52