Skip to content

Conversation

earthfail
Copy link
Contributor

sorry guys for not contributing much but some topics are really hard like FFT

@earthfail
Copy link
Contributor Author

btw could someone explain why the division by r2
here julia monte carlo

@leios
Copy link
Member

leios commented Jun 16, 2018

You are essentially solving for pi in the formula: Area = pi*r^2 so pi = Area / (r^2). Because you are only using a quarter, the final formula is pi = 4*Area / (r^2)

@earthfail
Copy link
Contributor Author

haskell monte carlo yeah but What is confusing is the haskell code it doesn't even have r2<\sup> , and honesly I tried both formulas and got different results

@leios
Copy link
Member

leios commented Jun 17, 2018

That's because he set the radius to be 1 and excluded it from the formula.

@Gathros Gathros added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jun 17, 2018
@earthfail
Copy link
Contributor Author

sorry @leios it doesn't seem to work with me when using different radiuses so I'm sticking with my code

@earthfail
Copy link
Contributor Author

hey @Gathros how did you add a label

@Gathros
Copy link
Contributor

Gathros commented Jun 17, 2018

It's on the right hand side, just click labels and select the label.

@leios
Copy link
Member

leios commented Jun 17, 2018

@earthfail As a note: I typed the original equation wrong. It should be pi = 4*Area / (r^2)

Does it work with that formula?

@earthfail
Copy link
Contributor Author

well from what I understand Area is ration * Area of the square
ratio= pi_count/n
Area of the square = r^2

@earthfail
Copy link
Contributor Author

My Code runs fine and gets close results to pi. Just wanted to point out what I didn't understand

@leios
Copy link
Member

leios commented Jun 28, 2018

Hey @earthfail Sorry it's taking so long for this PR, we don't have enough people who understand clojure to review it.

@earthfail
Copy link
Contributor Author

That got me think should I link to a guide where people can get a repl or something to play with code.

@jiegillet
Copy link
Member

@earthfail do you still have trouble understanding the normalization? I can try to explain if you want. In my Haskell code I hardcoded the radius to 1, since it's the best value anyway, but I can justify it ^^

@jiegillet
Copy link
Member

After looking at your code, I understand why you don't need to renormalize. leios is using a random number between 0 and 1, you are using a random number between 0 and r. The scale of your box and your circle are matching so you don't need to renormalize. Does that make sense?

@earthfail
Copy link
Contributor Author

Thanks @jiegillet , you guys are the best

@jiegillet
Copy link
Member

I read the code, I think I understood it and it's ready to go. Could I ask that you add some kind of main function that tests the function and prints out the value of pi and the error percentage? Just so that people who don't know Clojure (like me) can play around and test the function.

@jiegillet jiegillet self-requested a review June 29, 2018 12:26
@jiegillet jiegillet self-assigned this Jun 29, 2018
@earthfail
Copy link
Contributor Author

sorry @Butt4cak3 I tried your method from discord but couldn't make it less than two commits
@jiegillet tell me if that what you meant

have a nice weekend guys

@Butt4cak3
Copy link
Contributor

Uhm... What's that "image modification" commit? Are you running Windows? Could you tell me what the output of git --version is? I assume this has to do with our new .gitattributes and a bug in an old version of git.

@earthfail
Copy link
Contributor Author

I'm using ubuntu linux with git 2.7.4

What I done is: git clone my repo
Saw a bunch of Images needs a commit
Try bunch of stuff to ignore it
Delete repo and just add them as a commit
Works :)

@jiegillet
Copy link
Member

Thanks for the modification, @earthfail, that's what I wanted.
What no one wants is the modification of 30+ images, so you have to find a way to get rid of these :)

@earthfail
Copy link
Contributor Author

Do you think if I remove my remote repo it will work?

@leios
Copy link
Member

leios commented Jul 1, 2018

@earthfail You will probably need to revert your changes to a previous state before the images were modified, and then pull the latest changes from the AAA upstream repo. Removing your repo doesn't change the commit history.

@Butt4cak3
Copy link
Contributor

@earthfail Yeah, that version of git is a bit old. We changed our .gitattributes file and there's a bug in older versions of git (including the one you have installed) that would change the line endings of binary files, which is nonsense. That means you added a commit that converts all the "line endings" of the images to lf.

Removing your repo won't work as long as you have the old version of git installed. It will always mark the images as modified. I'm afraid the only way to get around this is to update git.

@earthfail earthfail closed this Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)

5 participants