Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
And I do not know why there are that many elements in the calculation, as we have only 10 elements in X' and Y'
Your jx and jy are range. So you must select one of it by [0 or ^row(0).
However, Prime 10 shows bugs for these methods.
I'm not sure if I understand what you are trying to say , Can you show me in the attached sheet
I want to apply the atan function to all x and y values
ttkoro the problem is here:
Something like this, but as it is right now it is not taking into account the last element:
But anyway, as there in X' vector there are 2 consecutive elements for which that difference is 0, the obivious error divided by zero will be thrown.
But if we change a little bit X' vector (these elements with yellow), in order at least the calculation to be possible for X':
Of course, the last element is not taken into account here. Maybe others can figure out how could be done in order to include also the last element in calculation (7.395 9.225)
And I do not know why there are that many elements in the calculation, as we have only 10 elements in X' and Y'
Thank you for your help I appreciate it
My answer is not yet fully. I said this already, the last element is not taken into account, and I have a doubt why there are so many elements calculated:
This difference is not calculated:
And there are many elements in below calculation, and I do not know if this is ok or not, as you have only 10 elemets in X' and Y'
Index of Y and X is not integer number but using Range to Vector undocumented technique. But Prime 10 delete the undocumented technique.
So, we must make vector to use [i element operator. 80 means using undocumented technique for untill Prime 9.
@Cornel wrote:
And I do not know why there are that many elements in the calculation, as we have only 10 elements in X' and Y'
That's because you are using two separate range variables to index X' and Y'. Each range runs from 0 to 8 and so you get a data structure with 9*9=81 entries because each X' difference is combined by each Y' difference.
This structure isn't a range and it isn't a vector. Actually its an invalid object. You can see that when you try to assign it a variable - it will fail.
BTW, the division by zero can be avoided by using the atan2 function so you get the 90 degree instead of an error 😉
The additional benefit of using atan2 is that we correct values for the full range from -180° to +180°
Here an attempt
Prime 9 sheet attached