-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback #1
base: feedback
Are you sure you want to change the base?
Feedback #1
Conversation
Solution A trial 1
solution updated.
Solution is updated.
Minor Changes
Solution is updated
Solution is updated.
Solution is updated.
Method A Solution Part 1
Method B solution updated
Method C updated.
Updated Solution on Probability
Updated Solution A
Solution for Method B is updated.
Method C solution is updated.
Method C is updated.
Method C updated.
Updated
Method A solution updated.
Method B and Method C are updated.
updated solution
Final Solution is updated
Referencing is updated.
Hello! Well done with coming up with your codes! However, it would be great if you could visualise the random endpoints and random chords using ggplot. Also, it could be better to print the values of the probabilities on the console. |
Hi! Nice work. However, I think it would be better to plot/visualise the chords and endpoints (circle) by using ggplot. |
Hello, the code seems fine. However, the solution is provided in the environment section but there is no output. :( Also, I tried to change the n from n = 100 to n = 100,000 (for checking) but the probability doesn't seem to converge. :( Overall, Well done! and your code styling seems decent as well :D |
The coding style is easy to understand. The probability for all methods can be seen in the environment but it would be nice if you guys printed the probability values and used ggplot to visualise the chords. |
Good effort in writing the code. The comments make it easier to understand. It's unfortunate that the expected outcome (expected Pr(A) values [0.33, 0.5, 0.25]) couldn't be reached, but at least the code runs without any syntax errors and some parts do work correctly e.g. applying trigonometry, finding probability from existing samples Suggestion: Put variables inside round brackets to print their values in the console # Estimated probability of chord being longer than triangle side-----------------
probEstA=mean(lengthA>lengthSide) # Method A
probEstB=mean(lengthB>lengthSide) # Method B
probEstC=mean(lengthC>lengthSide) # Method C
(probEstA)
(probEstB)
(probEstC) EDIT:Just want to quickly bring up the error that prevented the expected results, in case it's found to be useful. It's within the chord endpoint computations for methods A (which is actually method C in the instruction) and B. Original code snippet: # Calculate Chord endpoints - Method A
xA1 = (ax+pA)*(cos_angleA+qA)*(sin_angleA)
yA1 = (ay+pA)*(sin_angleA-qA)*(cos_angleA)
xA2 = (ax+pA)*(cos_angleA-qA)*(sin_angleA)
yA2 = (ay+pA)*(sin_angleA+qA)*(cos_angleA) # Calculate Chord endpoints - Method B
xB1 = (ax+pB)*(cos_angleB+qB)*(sin_angleB)
yB1 = (ay+pB)*(sin_angleB-qB)*(cos_angleB)
xB2 = (ax+pB)*(cos_angleB-qB)*(sin_angleB)
yB2 = (ay+pB)*(sin_angleB+qB)*(cos_angleB) # Original results
> (probEstA)
[1] 0.81553
> (probEstB)
[1] 0.65221
> (probEstC)
[1] 0.33436 Correct code snippet: # Calculate Chord endpoints - Method A
xA1 = (ax+pA)*cos_angleA + qA*sin_angleA
yA1 = (ay+pA)*sin_angleA - qA*cos_angleA
xA2 = (ax+pA)*cos_angleA - qA*sin_angleA
yA2 = (ay+pA)*sin_angleA + qA*cos_angleA # Calculate Chord endpoints - Method B
xB1 = (ax+pB)*cos_angleB + qB*sin_angleB
yB1 = (ay+pB)*sin_angleB - qB*cos_angleB
xB2 = (ax+pB)*cos_angleB - qB*sin_angleB
yB2 = (ay+pB)*sin_angleB + qB*cos_angleB # More precise results
> (probEstA)
[1] 0.24882
> (probEstB)
[1] 0.5001
> (probEstC)
[1] 0.33056 Above is the expected combination of approximate Pr(A) values for random midpoints, random radial points, and random endpoints respectively. |
👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to
main
since the assignment started. Your teacher can see this too.Notes for teachers
Use this PR to leave feedback. Here are some tips:
main
since the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue + (plus sign). To learn more about comments, read “Commenting on a pull request”.main
. Click a commit to see specific changes.For more information about this pull request, read “Leaving assignment feedback in GitHub”.
Subscribed: @Sherlychn @Javenieyong @Venicechua