Skip to content
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

Sign error in k3 calculation in Bk class #9

Open
graemecan opened this issue Sep 16, 2021 · 1 comment
Open

Sign error in k3 calculation in Bk class #9

graemecan opened this issue Sep 16, 2021 · 1 comment

Comments

@graemecan
Copy link

Hello, I think there is a small error in this line:

k3 = np.sqrt((k2*np.sin(theta))**2 + (k2*np.cos(theta)+k1)**2)

The sign in front of k1 should be a minus, otherwise this expression doesn't correspond to the cosine rule and the calculated value of k3 is incorrect.

@suicee
Copy link

suicee commented Nov 14, 2022

I think the input theta is the angle between k1 and k2, therefore the corresponding angle between k1 and k2 in the triangle is actually (pi-theta). In other words, you can just verify the results using |k3|^2=|k1+k2|^2, this will yield the same formula in this line of code. If your change the sign in front of k1, you are actually calculating |k1-k2|^2. But I guess it's OK if you change the sign here and interpret the input theta as the theta in the triangle. I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants