[tex](adsbygoogle = window.adsbygoogle || []).push({});

A=-[(x_i-X_j)cos\theta_j + (y_i-Y_J)sin\theta_j]

[/tex]

[tex]

B = (x_i-X_j)^2+(y_i-Y_j)^2

[/tex]

[tex]

E=(B-A^2)^{1/2}=(x_i-X_j)sin\theta_j+(y_i-Y_j)\theta_j

[/tex]

I implemented this in C++ as follows

A = -(p_c(0)(i) - p_v(0)(j))*cos(angle(j)) - (p_c(1)(i) - p_v(1)(j))*sin(angle(j))

B = (p_c(0)(i) - p_v(0)(j))*(p_c(0)(i) - p_v(0)(j)) + (p_c(1)(i) - p_v(1)(j))*(p_c(1)(i) - p_v(1)(j))

E=(p_c(0)(i) - p_v(0)(j))*sin(angle(j)) + (p_c(1)(i) - p_c(1)(j))*cos(angle(j))

F= sqrt(B-A*A)

(All parantheses instead of square brackets in arrays to avoid HTML encoding)

where

p_c(0)(i) =[tex]x_i[/tex]

p_c(1)(i) = [tex]y_i[/tex]

p_v(0)(j) = [tex]X_j[/tex]

p_v(1)(j) = [tex]Y_j[/tex]

angle(j) = [tex]\theta_j[/tex]

Well, here's the deal. Mathematically

[tex]E=(B-A^2)^{1/2}=(x_i-X_j)sin\theta_j+(y_i-Y_j)\theta_j[/tex]

However in C++, I am gettingdifferentvalues for E and F in C++ when mathematically they are the same. I am going insane.

Please help

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# I'm going crazy

Loading...

Similar Threads - going crazy | Date |
---|---|

Stay with windows 10 or go with Linux | Sep 20, 2016 |

What is going to be the future of computer industry?? | Jun 5, 2016 |

Computer going into hibernate mode by itself | Sep 11, 2015 |

What's going on with databases? Why so prone to attacks yet still used | Sep 3, 2014 |

Don't print the crazy offset! | Jun 18, 2006 |

**Physics Forums - The Fusion of Science and Community**