Draft
Three Body Problem
18 of 19Mo0dy
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
This comment has been hidden.
What other tags would this belong to?
that's not really important. Tags behave the same way than the search engine, on CW: weird & inconsistent... x) Moreover, you'll see that sometimes, tags you set in the edit panel don't even show up in the kata/detail pages. So just choose what you think is appropriate and don't bother with that... ;)
lol
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Edit: How do you remove comments? :')
you can't... x) (unless it's the first comment of a thread without answers... CW feature! x) )
Mmmmh, what did you change? because crazy things are here again, even with 15000 steps :/
EDIT; note that you can use
test.asser_approx_equals
rather than building your assertion like you did. (doc)looking into it
Try incrementing the positions first then the velocities. Edit: Either way works for me with your code (as it should with sufficiently small step sizes)
ah yeah, the solution is valid again (wasn't the case before).
I passed the kata, but not the example test. I think the expected output changed, but it doesn't look like the input changed?
fixed that bug
well, that's not really funny anymore, now... x) Trying using different sizes of steps, but even rounding to the unit seems not enough to allow correct solutions, if the rounding/computations aren't done exactly the same way than you do:
I tried several values from 1000 to 30000 and the general behavior feels like very chaotic. Even with large precisions, I can end up with input where my final p1 as completely nothing in commom with the expected one. I didn't prospect yet on the input side, but I fear that the task itself is too much "unsafe" about the precision so that it's possible to get the same result than yours without having the almost exact same implementation.
Btw, are you sure that your random generator cannot generate a "choatic" system? Because when I see that:
I feel like there is a problem somewhere :o
Not even sure that the task is completable as it currently is (though, seems someone already completed it? :o Maybe my computations are actually wrong...? x) )
XD lol... just found what to change. x)
Small mistake in the description:
rounded to the next natural number
implies to useceil
while you actually just wanna around
operation =>nearest
, notnext integer
.I might have to add a stability analysis for the inputs. It is possible that the equations lay outside of the region of stability that my euler-cauchy solver operates in.
I'll change the description.
ok, I poked at it a bit more and here is what I found:
Meaning, either you have to give the number of steps you want or... I don't know, but keeping it like that means the user will have to do a trail/error process a bit weird (and rather without that much of an interest), where too much steps lead to troubles too. :/ Could become cumbersome in a useless manner.
A quick Idea might be to check if the total energy of the system stays bounded in the numerical solution if not discard the random inputs
Well, there I'd be completely off my charts to even try to answer to/comment that. x))
Just giving the number of steps won't work because different integrators will have different order of consistencies. Maybe I have to use RK3 or something like that and if I only allow for stable systems the error might be small enough to match the correct solution close enough. which means that potential warriors will have to write a solver good enough to have a small enough error. (which would make sense). Would you recommend leaving this in the beta program or closing this kata for now?
I honestly don't know (about putting it in draft again or not). Since it's actually doable, I believe you can leave it here, to get other feebacks. But if you prefer to unpublish it for now, to have the time to do the modification, it's totally up to you.
btw, some last things:
G=10000
-> you doesn't provide the set of units used for the problem, but I usually see that constant as6,67e-11
x). So if it's an arbitrary value, just say "we will use...", if not, might be sympathetic to tell about the context (damn metric system, right? x) )t+dt
using the velocity att+dt
. But why not using the one att
? Or "even better" (?), a mean of the two values? Does that make sense? are these only different possible approaches? If so, might be that some people chose one of these ways, ending with completely different outputs, couldn't they?Sounds perfect! \o/
great work!
ok I know I added something that should work yet i'm suprised it did
I think the only thing left is adding a Runge Rutta 3 solution or something comparable and checking if this will work as well
(there I cannot do anything for you: I don't even know what you're talking about! x) )
This comment has been hidden.
there is something I don't follow about
dt
: are we supposed to return the result of a one step calculation? Usually,dt
is used for an infinitesimal time duration, tho, reading further in the description, it seems you actually expect it as being an amount of "total elapsed time". That's it? If so, might be good to change the notation.Any proposal for a better variable name? Maybe sim_time? I had the same issue when I wanted to use dt for my stepsize :)
duration
? ;)it's sim_time now xD
hi,
'just poking at it for now:
pass
statement in the body of the function, in the solution setup. That ofc changes nothing to the task but that makes the code runnable (...for a user who is just poking at the test suite... x) )EDIT: bigger troubles here, about the description:
x
in there, those should bep
Thanks for the comment. I will fix it now.
Fixed the erros and incorporated your proposal about clarifying that these are vector equations. Thanks for the input.
This is my first Kata. I would appreciate all feedback :D