5 kyu
MONTE CARLO 3D
87 of 119raulbc777
Loading description...
Fundamentals
Mathematics
Data Structures
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.
JS Node 14. should be enabled
snake_case
Python function name should use
snake_case
New test framework should be used
Description should be language-agnostic
Example tests code blocks should be reformatted
Should also mentioned about
the relative error must be calculated using the unrounded estimate for pi
A small precision :
relError= abs(real Val of Pi - estmimated Val of Pi) / (real Val of Pi) * 100
whereestmimated Val of Pi
is NOT rounded.I don't know if anyone'll see this because it's such an old one, but when I 'attempt' it, some are solved and some aren't. The trouble comes in the radius estimation. When it gets it wrong, it's always like 1 or 2 off. Also, any tips on reducing computing speed because it's running out of time? I'm not really sure how I could make my could more concise.
Relative error should be calculated with unrounded value of estimate pi. Pi should be estimated to 4 places instead of 2 places. Please mention the same in the problem statemnt.
It might be helpful to mention in the description that even though the returned estimated value of pi should be rounded to four decimal places, the relative error must be calculated using the unrounded estimate for pi. Rarely, it makes a difference.
This should be an issue
This comment has been hidden.
nope, but you're heading in the right direction (even if still far from the goal). Basic geometry knowledge still apply, to solve this type of things.
Need help to understand relError "rounded with two decimals". Why 0.0703488232816 expects '7.04%' and 0.0588531595204 expects '5.88%'?
why not 7.03% and 5.89%?
Interesting kata.
Approved
A forgotten kata, now restored. Thanks a lot for solving it.
Cool Kata! Only minor thing is the relative error rounding requirement says 2 decimals, but if the relative error rounds evenly to one digit after the decimal point, the test is expecting only one digit, not two.
It's a very important observation. I'll be thinking on that to create an addition for that special case. I'll edit the kata in some hours. Thanks for the feedback!
Nice Kata, I have a solution, but I'm having real difficulty interpreting the error percentage requirement.
Do you want the answer rounded to 4dp?
Hi, Christian. The relative error should be "rounded with two decimals and expressed as a string with the symbol "%""
Number Pi : "Estimation of Pi as a float with a maximum of four decimals (rounded result)."
But for the boolean
relError < 5
use the relError without rounding it I'll be waiting your answerJob done! :)
Did you update the specification, or did I just completely misread the estimated pi requirment as applying to the percentage error?
No, I did a copy&paste of the details. The details don't have the further explanation for the boolean relError < 5 without rounding, and I'd like to edit it adding this part. What do you think?
Good idea!
Thanks for your solution Christian. I'll add that part so, just in case.
Done!
This comment has been hidden.
Thanks for your solution of this kata, a good one! Well, I have to be sincere, I didn't think on that. But you called my curiosity. I'll be thinking on that!
Thank you for the kata and the compliment :)