Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I'm trying to write this expression in mathcad to get the same results which I have in Excel
However, I'm getting that wrong answers, can you please help me
Solved! Go to Solution.
Maybe you can make use of this Atan2 function which returns angles in the range from -pi/2 to 3 pi /2 which seems to be what you want.
In Prime atan2 returns angles in the range from -180 degree to 180 degree.
So you get -135° instead of 225°. Both angles are equivalent, their difference is 360°.
BTW, the ARCTAN2 (ATAN2) function in Excel shows the very same behaviour and returns angles in the range of -pi to pi.
So as you show a value of 225 in your picture, a different formula seems to have been used in Excel to get that value.
One way I could imagine is that arctan(x/y) is used and if x<0 then pi (180°) is added to the result. This will result in returning angles in the range from -90° to 270°.
In the picture you show the normal arctan function is used. This function by default only returns angles in the range from -pi/2 (-90°) to pi/2 (+90°), so you never would get neither -135° nor 225° but just +45°.
I have to get 225 . the same results in Excel , because I will use this number again in different equation.
how to add an if statement?
Thanks in advance
@YA_10963798 wrote:
I have to get 225 . the same results in Excel , because I will use this number again in different equation.
how to add an if statement?
Thanks in advance
If you want the same results as in Excel, you have to use the same formula as in Excel. We don't know which formula that is but is sure not the one you showed in the picture, because the arctan function will only return values from -90 to +90.
Adding an if-statement means programming:
If you need help doing so, you would have to post both the Excel sheet as well as your Prime sheet and state which version of Prime you are using.
Maybe you can make use of this Atan2 function which returns angles in the range from -pi/2 to 3 pi /2 which seems to be what you want.
I really appreciate your help and taking the time to help . Thank you