Designing a multi-variable equation based on known output
up vote
0
down vote
favorite
First of all, I apologize for my lack of proper math vocabulary. I'm mainly a programmer.
I need to write an equation that relates variables s
and p
. (s
is
star mass, p
is planet radius). The equation needs to roughly fit these parameters:
When s = 2, changing p between 0.01 and 2 makes the output range from 340 to 350.
When s = 1, changing p makes the output range from 0 to 150.
When s = 0.5, changing p makes the output range from 0 to 50.
s
is limited to the range 0.5 to 2, and p
is limited to 0.01 to 2.
Here's a visual representation of what I'm talking about:
--
How do I go about solving something like this? I've been doing trial and error for a little too long, so I figured I'd open up a question on here.
What I have so far is something like:
$f(s, p) = (30 + (s * 4)^2) * (p * 4)$
But it's not quite right.
For some context, what I'm doing is putting together an equation to output the width of the planet orbit line in this simulation, when the planet radius and star mass variables are altered:
https://cse.unl.edu/~astrodev/flashdev2/transitSimulator/transitSimulator017.html (requires Flash)
algebra-precalculus systems-of-equations
add a comment |
up vote
0
down vote
favorite
First of all, I apologize for my lack of proper math vocabulary. I'm mainly a programmer.
I need to write an equation that relates variables s
and p
. (s
is
star mass, p
is planet radius). The equation needs to roughly fit these parameters:
When s = 2, changing p between 0.01 and 2 makes the output range from 340 to 350.
When s = 1, changing p makes the output range from 0 to 150.
When s = 0.5, changing p makes the output range from 0 to 50.
s
is limited to the range 0.5 to 2, and p
is limited to 0.01 to 2.
Here's a visual representation of what I'm talking about:
--
How do I go about solving something like this? I've been doing trial and error for a little too long, so I figured I'd open up a question on here.
What I have so far is something like:
$f(s, p) = (30 + (s * 4)^2) * (p * 4)$
But it's not quite right.
For some context, what I'm doing is putting together an equation to output the width of the planet orbit line in this simulation, when the planet radius and star mass variables are altered:
https://cse.unl.edu/~astrodev/flashdev2/transitSimulator/transitSimulator017.html (requires Flash)
algebra-precalculus systems-of-equations
1
Your question isn't clear yet. For example, you say "When sm = 2, changing pr makes the output range from 340 to 350" but don't tell us anything about how that happens. I suggest that you post a picture of the graph of the function you want, marking the points and ranges that you require. Then perhaps we can help you find a formula. A neat hand sketch would be fine. (No flash please.)
– Ethan Bolker
Nov 28 at 17:17
@EthanBolker, sorry, I wasn't clear. Whem sm = 2, changing pr between 0.01 and 2 makes output range between 340 to 350.
– nnyby
Nov 28 at 17:19
@EthanBolker Alright I've added a sketch of what I'm talking about. I hope it makes sense.
– nnyby
Nov 28 at 17:42
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
First of all, I apologize for my lack of proper math vocabulary. I'm mainly a programmer.
I need to write an equation that relates variables s
and p
. (s
is
star mass, p
is planet radius). The equation needs to roughly fit these parameters:
When s = 2, changing p between 0.01 and 2 makes the output range from 340 to 350.
When s = 1, changing p makes the output range from 0 to 150.
When s = 0.5, changing p makes the output range from 0 to 50.
s
is limited to the range 0.5 to 2, and p
is limited to 0.01 to 2.
Here's a visual representation of what I'm talking about:
--
How do I go about solving something like this? I've been doing trial and error for a little too long, so I figured I'd open up a question on here.
What I have so far is something like:
$f(s, p) = (30 + (s * 4)^2) * (p * 4)$
But it's not quite right.
For some context, what I'm doing is putting together an equation to output the width of the planet orbit line in this simulation, when the planet radius and star mass variables are altered:
https://cse.unl.edu/~astrodev/flashdev2/transitSimulator/transitSimulator017.html (requires Flash)
algebra-precalculus systems-of-equations
First of all, I apologize for my lack of proper math vocabulary. I'm mainly a programmer.
I need to write an equation that relates variables s
and p
. (s
is
star mass, p
is planet radius). The equation needs to roughly fit these parameters:
When s = 2, changing p between 0.01 and 2 makes the output range from 340 to 350.
When s = 1, changing p makes the output range from 0 to 150.
When s = 0.5, changing p makes the output range from 0 to 50.
s
is limited to the range 0.5 to 2, and p
is limited to 0.01 to 2.
Here's a visual representation of what I'm talking about:
--
How do I go about solving something like this? I've been doing trial and error for a little too long, so I figured I'd open up a question on here.
What I have so far is something like:
$f(s, p) = (30 + (s * 4)^2) * (p * 4)$
But it's not quite right.
For some context, what I'm doing is putting together an equation to output the width of the planet orbit line in this simulation, when the planet radius and star mass variables are altered:
https://cse.unl.edu/~astrodev/flashdev2/transitSimulator/transitSimulator017.html (requires Flash)
algebra-precalculus systems-of-equations
algebra-precalculus systems-of-equations
edited Nov 28 at 17:50
asked Nov 28 at 17:12
nnyby
1012
1012
1
Your question isn't clear yet. For example, you say "When sm = 2, changing pr makes the output range from 340 to 350" but don't tell us anything about how that happens. I suggest that you post a picture of the graph of the function you want, marking the points and ranges that you require. Then perhaps we can help you find a formula. A neat hand sketch would be fine. (No flash please.)
– Ethan Bolker
Nov 28 at 17:17
@EthanBolker, sorry, I wasn't clear. Whem sm = 2, changing pr between 0.01 and 2 makes output range between 340 to 350.
– nnyby
Nov 28 at 17:19
@EthanBolker Alright I've added a sketch of what I'm talking about. I hope it makes sense.
– nnyby
Nov 28 at 17:42
add a comment |
1
Your question isn't clear yet. For example, you say "When sm = 2, changing pr makes the output range from 340 to 350" but don't tell us anything about how that happens. I suggest that you post a picture of the graph of the function you want, marking the points and ranges that you require. Then perhaps we can help you find a formula. A neat hand sketch would be fine. (No flash please.)
– Ethan Bolker
Nov 28 at 17:17
@EthanBolker, sorry, I wasn't clear. Whem sm = 2, changing pr between 0.01 and 2 makes output range between 340 to 350.
– nnyby
Nov 28 at 17:19
@EthanBolker Alright I've added a sketch of what I'm talking about. I hope it makes sense.
– nnyby
Nov 28 at 17:42
1
1
Your question isn't clear yet. For example, you say "When sm = 2, changing pr makes the output range from 340 to 350" but don't tell us anything about how that happens. I suggest that you post a picture of the graph of the function you want, marking the points and ranges that you require. Then perhaps we can help you find a formula. A neat hand sketch would be fine. (No flash please.)
– Ethan Bolker
Nov 28 at 17:17
Your question isn't clear yet. For example, you say "When sm = 2, changing pr makes the output range from 340 to 350" but don't tell us anything about how that happens. I suggest that you post a picture of the graph of the function you want, marking the points and ranges that you require. Then perhaps we can help you find a formula. A neat hand sketch would be fine. (No flash please.)
– Ethan Bolker
Nov 28 at 17:17
@EthanBolker, sorry, I wasn't clear. Whem sm = 2, changing pr between 0.01 and 2 makes output range between 340 to 350.
– nnyby
Nov 28 at 17:19
@EthanBolker, sorry, I wasn't clear. Whem sm = 2, changing pr between 0.01 and 2 makes output range between 340 to 350.
– nnyby
Nov 28 at 17:19
@EthanBolker Alright I've added a sketch of what I'm talking about. I hope it makes sense.
– nnyby
Nov 28 at 17:42
@EthanBolker Alright I've added a sketch of what I'm talking about. I hope it makes sense.
– nnyby
Nov 28 at 17:42
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Your picture suggests that for each value of $s$ the function can be linear in $p$. So what you want to start with is two functions $L(s)$ and $H(s)$ (for "low" and "high") that give the correct values for $f$ when $p=0.01$ and $p=2$ respectively. Suppose you have those functions (we'll get to that later). Then for each $p$ you want to interpolate linearly between $L$ and $H$ to get $f$. So your formula is
$$
f(s,p) =
frac{2-p}{2 - 0.01} L(s) +
frac{p-0.01}{2 - 0.01} H(s).
$$
(You can simplify that formula a lot, but I wrote it that way so you can see the linear interpolation.)
Now what should $L$ and $H$ be? I think you have to do that with cases
$$
L(s) =
begin{cases}
0 & 0.01 le s le 0.5 \
frac{s-0.5}{2-0.5} times 340 & 0.5 le s le 2
end{cases} .
$$
That should be enough examples of linear interpolation for you to write the cases for $H$.
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',
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%2f3017406%2fdesigning-a-multi-variable-equation-based-on-known-output%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
up vote
1
down vote
Your picture suggests that for each value of $s$ the function can be linear in $p$. So what you want to start with is two functions $L(s)$ and $H(s)$ (for "low" and "high") that give the correct values for $f$ when $p=0.01$ and $p=2$ respectively. Suppose you have those functions (we'll get to that later). Then for each $p$ you want to interpolate linearly between $L$ and $H$ to get $f$. So your formula is
$$
f(s,p) =
frac{2-p}{2 - 0.01} L(s) +
frac{p-0.01}{2 - 0.01} H(s).
$$
(You can simplify that formula a lot, but I wrote it that way so you can see the linear interpolation.)
Now what should $L$ and $H$ be? I think you have to do that with cases
$$
L(s) =
begin{cases}
0 & 0.01 le s le 0.5 \
frac{s-0.5}{2-0.5} times 340 & 0.5 le s le 2
end{cases} .
$$
That should be enough examples of linear interpolation for you to write the cases for $H$.
add a comment |
up vote
1
down vote
Your picture suggests that for each value of $s$ the function can be linear in $p$. So what you want to start with is two functions $L(s)$ and $H(s)$ (for "low" and "high") that give the correct values for $f$ when $p=0.01$ and $p=2$ respectively. Suppose you have those functions (we'll get to that later). Then for each $p$ you want to interpolate linearly between $L$ and $H$ to get $f$. So your formula is
$$
f(s,p) =
frac{2-p}{2 - 0.01} L(s) +
frac{p-0.01}{2 - 0.01} H(s).
$$
(You can simplify that formula a lot, but I wrote it that way so you can see the linear interpolation.)
Now what should $L$ and $H$ be? I think you have to do that with cases
$$
L(s) =
begin{cases}
0 & 0.01 le s le 0.5 \
frac{s-0.5}{2-0.5} times 340 & 0.5 le s le 2
end{cases} .
$$
That should be enough examples of linear interpolation for you to write the cases for $H$.
add a comment |
up vote
1
down vote
up vote
1
down vote
Your picture suggests that for each value of $s$ the function can be linear in $p$. So what you want to start with is two functions $L(s)$ and $H(s)$ (for "low" and "high") that give the correct values for $f$ when $p=0.01$ and $p=2$ respectively. Suppose you have those functions (we'll get to that later). Then for each $p$ you want to interpolate linearly between $L$ and $H$ to get $f$. So your formula is
$$
f(s,p) =
frac{2-p}{2 - 0.01} L(s) +
frac{p-0.01}{2 - 0.01} H(s).
$$
(You can simplify that formula a lot, but I wrote it that way so you can see the linear interpolation.)
Now what should $L$ and $H$ be? I think you have to do that with cases
$$
L(s) =
begin{cases}
0 & 0.01 le s le 0.5 \
frac{s-0.5}{2-0.5} times 340 & 0.5 le s le 2
end{cases} .
$$
That should be enough examples of linear interpolation for you to write the cases for $H$.
Your picture suggests that for each value of $s$ the function can be linear in $p$. So what you want to start with is two functions $L(s)$ and $H(s)$ (for "low" and "high") that give the correct values for $f$ when $p=0.01$ and $p=2$ respectively. Suppose you have those functions (we'll get to that later). Then for each $p$ you want to interpolate linearly between $L$ and $H$ to get $f$. So your formula is
$$
f(s,p) =
frac{2-p}{2 - 0.01} L(s) +
frac{p-0.01}{2 - 0.01} H(s).
$$
(You can simplify that formula a lot, but I wrote it that way so you can see the linear interpolation.)
Now what should $L$ and $H$ be? I think you have to do that with cases
$$
L(s) =
begin{cases}
0 & 0.01 le s le 0.5 \
frac{s-0.5}{2-0.5} times 340 & 0.5 le s le 2
end{cases} .
$$
That should be enough examples of linear interpolation for you to write the cases for $H$.
answered Nov 28 at 18:28
Ethan Bolker
40.7k546108
40.7k546108
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
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%2f3017406%2fdesigning-a-multi-variable-equation-based-on-known-output%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
1
Your question isn't clear yet. For example, you say "When sm = 2, changing pr makes the output range from 340 to 350" but don't tell us anything about how that happens. I suggest that you post a picture of the graph of the function you want, marking the points and ranges that you require. Then perhaps we can help you find a formula. A neat hand sketch would be fine. (No flash please.)
– Ethan Bolker
Nov 28 at 17:17
@EthanBolker, sorry, I wasn't clear. Whem sm = 2, changing pr between 0.01 and 2 makes output range between 340 to 350.
– nnyby
Nov 28 at 17:19
@EthanBolker Alright I've added a sketch of what I'm talking about. I hope it makes sense.
– nnyby
Nov 28 at 17:42