Moderators: phlip, Prelates, Moderators General
PerchloricAcid wrote:Time step size is a familiar term. Thank you for the clarification.
I actually had that in mind.
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.
Sagekilla wrote:Also, realize that r(t) is not a scalar value. It's vector valued. There's the x and y components.
You may be familiar with Newton's Law of Gravity as F = -G M1 M2 / r^2.
Try computing the vector form of this expression. Then, compute higher order derivatives. You'll realize that
because two bodies are fixed, something special happens with the derivatives.
PerchloricAcid wrote:Sagekilla wrote:Also, realize that r(t) is not a scalar value. It's vector valued. There's the x and y components.
You may be familiar with Newton's Law of Gravity as F = -G M1 M2 / r^2.
Try computing the vector form of this expression. Then, compute higher order derivatives. You'll realize that
because two bodies are fixed, something special happens with the derivatives.
Higher order derivatives of what?
If you mean r, that is v=r'(t) and a=r''(t), they will be equal to zero as r doesn't change over time, but I believe that wasn't what you meant.
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.
r12 = sqrt((x1 - x2)*(x1 - x2) + (z1 - z2)*(z1 - z2)),
r13 = sqrt((x1 - x3)*(x1 - x3) + (z1 - z3)*(z1 - z3)),
r23 = sqrt((x2 - x3)*(x2 - x3) + (z2 - z3)*(z2 - z3));
ax3 = - G*m1*(x3 - x1)/(r13*r13*r13) - G*m2*(x3 - x2)/(r23*r23*r23)
az3 = - G*m1*(z3 - z1)/(r13*r13*r13) - G*m2*(z3 - z2)/(r23*r23*r23);
PerchloricAcid wrote:Yakk, could I keep the values that would represent "the state of the universe at a particular point in time" in a vector, without using classes or structs?
[I might add the option of taking the values from a file on my disk after I make something functional, but this user-interactive thing works for me for now.]
struct vector_2 {
double x, z;
};
double norm(vector_2 v) {
return v.x * v.x + v.z * v*z;
}
double magnitude(vector_2 v) {
return sqrt(norm(v));
}
vector_2 add( vector_2 left, vector_2 right )
{
vector_2 result;
result.x = left.x+right.x;
result.z = left.z+right.z;
return result;
}
vector_2 negate( vector_2 v )
{
v.x = -v.x;
v.z = -v.z;
return v;
}
vector_2 subtract( vector_2 left, vector_2 right )
{
return add( left, negate(right) );
}
double r12 = norm( subtract(v1, v2) );
double r13 = norm( subtract(v1, v3) );
double r23 = norm( subtract(v2, v3) );
Yakk wrote:Debugging a program will take you longer than writing it, so write a program to make it easy to be debugged as your primary goal. You can make it faster later, after it works.
Yakk wrote:I'm not sure what you mean by "vector" -- the physics, or the C++ std::vector?
Zamfir wrote:One thing about animations: for scientific problems, graphing is nearly always more useful than moving animations. If you have Matlab or something similar (or simply Excel) around, you should just use it read in your output files, and make plots of x, y, energy, momentum, rotational momentum vs time, and x vs y to see the orbits.
PerchloricAcid wrote:Hm, if doing this in C++ would be masochistic, I would do as you did.
My simulation already outputs the data to a file, and from what you wrote, it seems to me that it wouldn't be so time-consuming to do it in C#. [Other exams have yet to be studied for, and I won't really have much time for other than studying.]
A colleague of mine [with much more experience than me] suggested I use C#, too.
Btw, I came up with an idea that seems pretty neat to me, but opinions from others are always welcome. While I was coding, I fucked around with different integration methods, and the code is written in such a way that the integration method is included from another file, so it would be easier to modify it. Even though I wasn't smart enough to save all I was doing, I figured I might make a comparison between the results that different integration methods produce (Euler-Cromer, RK4, Verlet (haven't tried this one yet, but willing to), Leapfrog...). That shouldn't even take up too much time, all I have to do is make the algorithm for integration and "call" it.
If this animation thing works out fine, it'd be easy to compare the integration methods.
The idea itself seems fun to me, and I'd definitely profit from practice. What do others think?
sigsfried wrote:That is fine, except some otherwise very poor solver, will solve perfectly that system.
I would recommend using the solvers on some other potential for example an anharmonic potential well.
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.
sigsfried wrote:I'm well aware of that, but there are schemes that can solve such systems perfectly, I was using one the other day I will look it up. They are mostly rubbish for more realistic systems.
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.
You may be but the OP certainly isn't -- that's why I posted that.
sigsfried wrote:I may be wrong, but isn't the 3 body problem in a rotating reference frame? If so you have to be careful when dealing with conservation of energy.
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.
Users browsing this forum: kbbbbbbb and 10 guests