Evaluate the travel time of a particle over a broken line on the gravity field
$begingroup$
Given a list of 2-uples on python [(x_0,y_0),(x_1,y_1)...(x_n,y_n)], i need to evaluate the travel time of a particle placed at the point (x_0,y_0) with the initial velocity v_0 through the broken line formed by the point of the previous list.
exemple
By application of the second Newton's law, i came up with this algorithm, but i'm not confident about it :
def travel_time(v_0,l):
n=len(l)
t=0
v=v_0
a=0
T=0
g=9.8
for k in range(n-1):
a=np.arctan(abs((l[k][1]-l[k+1][1])/(l[k][0]-l[k+1][0])))
t=(l[k+1][0]-l[k][0])/(v*np.cos(a))
v=np.sqrt((np.cos(a)*v)**2+(-g*t+v*np.sin(a))**2)
T += t
return T
Can you help me to spot some potential mistakes, or submit improvements for the algorithm?
algorithms mathematical-physics
$endgroup$
add a comment |
$begingroup$
Given a list of 2-uples on python [(x_0,y_0),(x_1,y_1)...(x_n,y_n)], i need to evaluate the travel time of a particle placed at the point (x_0,y_0) with the initial velocity v_0 through the broken line formed by the point of the previous list.
exemple
By application of the second Newton's law, i came up with this algorithm, but i'm not confident about it :
def travel_time(v_0,l):
n=len(l)
t=0
v=v_0
a=0
T=0
g=9.8
for k in range(n-1):
a=np.arctan(abs((l[k][1]-l[k+1][1])/(l[k][0]-l[k+1][0])))
t=(l[k+1][0]-l[k][0])/(v*np.cos(a))
v=np.sqrt((np.cos(a)*v)**2+(-g*t+v*np.sin(a))**2)
T += t
return T
Can you help me to spot some potential mistakes, or submit improvements for the algorithm?
algorithms mathematical-physics
$endgroup$
add a comment |
$begingroup$
Given a list of 2-uples on python [(x_0,y_0),(x_1,y_1)...(x_n,y_n)], i need to evaluate the travel time of a particle placed at the point (x_0,y_0) with the initial velocity v_0 through the broken line formed by the point of the previous list.
exemple
By application of the second Newton's law, i came up with this algorithm, but i'm not confident about it :
def travel_time(v_0,l):
n=len(l)
t=0
v=v_0
a=0
T=0
g=9.8
for k in range(n-1):
a=np.arctan(abs((l[k][1]-l[k+1][1])/(l[k][0]-l[k+1][0])))
t=(l[k+1][0]-l[k][0])/(v*np.cos(a))
v=np.sqrt((np.cos(a)*v)**2+(-g*t+v*np.sin(a))**2)
T += t
return T
Can you help me to spot some potential mistakes, or submit improvements for the algorithm?
algorithms mathematical-physics
$endgroup$
Given a list of 2-uples on python [(x_0,y_0),(x_1,y_1)...(x_n,y_n)], i need to evaluate the travel time of a particle placed at the point (x_0,y_0) with the initial velocity v_0 through the broken line formed by the point of the previous list.
exemple
By application of the second Newton's law, i came up with this algorithm, but i'm not confident about it :
def travel_time(v_0,l):
n=len(l)
t=0
v=v_0
a=0
T=0
g=9.8
for k in range(n-1):
a=np.arctan(abs((l[k][1]-l[k+1][1])/(l[k][0]-l[k+1][0])))
t=(l[k+1][0]-l[k][0])/(v*np.cos(a))
v=np.sqrt((np.cos(a)*v)**2+(-g*t+v*np.sin(a))**2)
T += t
return T
Can you help me to spot some potential mistakes, or submit improvements for the algorithm?
algorithms mathematical-physics
algorithms mathematical-physics
asked Jan 18 at 13:24
brachisto123brachisto123
61
61
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
There are several things you should correct.
1) Your formula for the final velocity $v$ is wrong: you should use instead
$$
v=sqrt{v_0+2gLsinalpha},
quadtext{where}quad
L={x_{k+1}-x_kovercosalpha}quad
text{is the length of $k$-th segment}.
$$
(Side note: you'd better use $L=sqrt{(x_{k+1}-x_k)^2+(y_{k+1}-y_k)^2}$ )
2) You compute travel time on $k$-th segment as $L/v_0$, but that is not accurate as velocity is not constant; you should use instead
$$
t={2Lover v_0+v},
$$
where $v$ is the final velocity computed above.
Of course you should at the end of each cycle set $v_0=v$.
$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%2f3078240%2fevaluate-the-travel-time-of-a-particle-over-a-broken-line-on-the-gravity-field%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$
There are several things you should correct.
1) Your formula for the final velocity $v$ is wrong: you should use instead
$$
v=sqrt{v_0+2gLsinalpha},
quadtext{where}quad
L={x_{k+1}-x_kovercosalpha}quad
text{is the length of $k$-th segment}.
$$
(Side note: you'd better use $L=sqrt{(x_{k+1}-x_k)^2+(y_{k+1}-y_k)^2}$ )
2) You compute travel time on $k$-th segment as $L/v_0$, but that is not accurate as velocity is not constant; you should use instead
$$
t={2Lover v_0+v},
$$
where $v$ is the final velocity computed above.
Of course you should at the end of each cycle set $v_0=v$.
$endgroup$
add a comment |
$begingroup$
There are several things you should correct.
1) Your formula for the final velocity $v$ is wrong: you should use instead
$$
v=sqrt{v_0+2gLsinalpha},
quadtext{where}quad
L={x_{k+1}-x_kovercosalpha}quad
text{is the length of $k$-th segment}.
$$
(Side note: you'd better use $L=sqrt{(x_{k+1}-x_k)^2+(y_{k+1}-y_k)^2}$ )
2) You compute travel time on $k$-th segment as $L/v_0$, but that is not accurate as velocity is not constant; you should use instead
$$
t={2Lover v_0+v},
$$
where $v$ is the final velocity computed above.
Of course you should at the end of each cycle set $v_0=v$.
$endgroup$
add a comment |
$begingroup$
There are several things you should correct.
1) Your formula for the final velocity $v$ is wrong: you should use instead
$$
v=sqrt{v_0+2gLsinalpha},
quadtext{where}quad
L={x_{k+1}-x_kovercosalpha}quad
text{is the length of $k$-th segment}.
$$
(Side note: you'd better use $L=sqrt{(x_{k+1}-x_k)^2+(y_{k+1}-y_k)^2}$ )
2) You compute travel time on $k$-th segment as $L/v_0$, but that is not accurate as velocity is not constant; you should use instead
$$
t={2Lover v_0+v},
$$
where $v$ is the final velocity computed above.
Of course you should at the end of each cycle set $v_0=v$.
$endgroup$
There are several things you should correct.
1) Your formula for the final velocity $v$ is wrong: you should use instead
$$
v=sqrt{v_0+2gLsinalpha},
quadtext{where}quad
L={x_{k+1}-x_kovercosalpha}quad
text{is the length of $k$-th segment}.
$$
(Side note: you'd better use $L=sqrt{(x_{k+1}-x_k)^2+(y_{k+1}-y_k)^2}$ )
2) You compute travel time on $k$-th segment as $L/v_0$, but that is not accurate as velocity is not constant; you should use instead
$$
t={2Lover v_0+v},
$$
where $v$ is the final velocity computed above.
Of course you should at the end of each cycle set $v_0=v$.
answered Jan 22 at 22:59
AretinoAretino
23.6k21443
23.6k21443
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%2f3078240%2fevaluate-the-travel-time-of-a-particle-over-a-broken-line-on-the-gravity-field%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