cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

integer value error

YA_10963798
14-Alexandrite

integer value error

Can I know why this function is not working 

YA_10963798_0-1713504340544.png

 

ACCEPTED SOLUTION

Accepted Solutions
Cornel
19-Tanzanite
(To:Cornel)

And I do not know why there are that many elements in the calculation, as we have only 10 elements in X' and Y'

Cornel_3-1713511198368.png

View solution in original post

11 REPLIES 11
ttokoro
20-Turquoise
(To:YA_10963798)

Your jx and jy are range. So you must select one of it by [0 or ^row(0).

image.pngimage.pngimage.pngimage.png

However, Prime 10 shows bugs for these methods.image.pngimage.png

YA_10963798
14-Alexandrite
(To:ttokoro)

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

 

Cornel
19-Tanzanite
(To:ttokoro)

ttkoro the problem is here:

Cornel_0-1713509686825.png

 

Cornel
19-Tanzanite
(To:Cornel)

Something like this, but as it is right now it is not taking into account the last element:

Cornel_0-1713510106176.png

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.

 

Cornel
19-Tanzanite
(To:Cornel)

But if we change a little bit X' vector (these elements with yellow), in order at least the calculation to be possible for X':

Cornel_0-1713510734338.png

 

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)

 

Cornel
19-Tanzanite
(To:Cornel)

And I do not know why there are that many elements in the calculation, as we have only 10 elements in X' and Y'

Cornel_3-1713511198368.png

YA_10963798
14-Alexandrite
(To:Cornel)

Thank you for your help I appreciate it 

Cornel
19-Tanzanite
(To:YA_10963798)

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:

Cornel_0-1713512204110.png


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'

Cornel_0-1713512024816.png

Cornel_1-1713512049348.png

 

 

ttokoro
20-Turquoise
(To:Cornel)

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.

Werner_E
25-Diamond I
(To:Cornel)


@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

Werner_E_0-1713526551662.png

 

Prime 9 sheet attached

MartinHanak_0-1713525030612.png

 


Martin Hanák
Announcements

Top Tags