HP Forums
Problem with polar_coordinates() - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Problem with polar_coordinates() (/thread-10314.html)



Problem with polar_coordinates() - Lamas - 03-12-2018 06:02 PM

Bonjour,

Windows 10 Pro Rev : 1709
HP Prime virtual calculator Build 2018 1 24 Rev : 13333

iPhone IOS V : 11.2.6
IOS HP Prime V : 1.4.1.13513

Problem with polar_coordinates() (in degree mode)

Functions Library extract …
------------------
// Conversion R-P
EXPORT rp(X,Y)
BEGIN
M0:=polar_coordinates(X,Y);
MSGBOX(X) ;
MSGBOX(Y) ;
MSGBOX(M0) ;

RETURN(M0) ;
END ;
------------
This function works on iPhone with keyboard input (X, Y and M0 msgboxes are OK).
This function does not work in program mode with iPhone, (M0 stay [0,0] with msgbox).

The same program work exhaustively with HP Prime virtual calculator on my desktop without any problem.

Is there a bug on the new IOS HP Prime or there is a problem with my function. (With old IOS HP Prime version, funtion worked correctly).
I have uninstalled and installed IOS HP Prime, switched off an on IOS device several times without change.

Thanks a lot for your attention


RE: Problem with polar_coordinates() - Tim Wessman - 03-12-2018 06:24 PM

I'm not seeing this on a version I just built and am running in the iOS simulator. I don't have any hardware handy to check on.

I tried running the function directly from the HOME screen

rp(10,10) [ENTER] for example. I then see a 10 box, 10 box and then [14.14..., .0785...] in a box. The vector is returned.

Is that what I should be testing? Anyone else see this issue?


RE: Problem with polar_coordinates() - Lamas - 03-12-2018 09:58 PM

Bonsoir,

I found an elegant solution from Michael de Estrada :

// Conversion P-R
EXPORT pr(X,Y)
BEGIN
RETURN[X*COS(Y),X*SIN(Y)];
//RETURN(X*COS(Y),X*SIN(Y));
END;

// Conversion R-P
EXPORT rp(X,Y)
BEGIN
RETURN[ABS((X,Y)),ARG((X,Y)) MOD 360];
//RETURN(ABS((X,Y)),ARG((X,Y)) MOD 360);
END;

Thanks a lot for your attention.


RE: Problem with polar_coordinates() - cyrille de brébisson - 03-13-2018 09:41 AM

Hello,

I do not think that the mod 360 is a good idea.
First, ARG should only return values from 0 to 360.
Furthemore, this code is assuming degree mode (which is not a given).

I would therefore suggest removing it.

Cyrille


RE: Problem with polar_coordinates() - Lamas - 03-13-2018 09:54 AM

Bonjour,

Ok, If ARG() returns the correct value (for me), I agree with you to remove "MOD 360" but it does not.

Thank you for your comment.


RE: Problem with polar_coordinates() - Joe Horn - 03-13-2018 08:38 PM

(03-13-2018 09:41 AM)cyrille de brébisson Wrote:  ARG should only return values from 0 to 360.

(03-13-2018 09:54 AM)Lamas Wrote:  Ok, If ARG() returns the correct value (for me), I agree with you to remove "MOD 360" but it does not.

Lamas is right. They are different. In degree mode, ARG returns angles in the interval (-180,180], whereas MOD 360 returns values in the interval [0,360).


RE: Problem with polar_coordinates() - YEDERF - 03-14-2018 06:02 PM

aquí un vídeo del tema que tratas de solucionar





RE: Problem with polar_coordinates() - compsystems - 03-14-2018 07:33 PM

On Home Mode fail

phasor1 := ( √(2) ∡ 3*(π/4) ); "Syntax Error"

More info
http://www.hpmuseum.org/forum/thread-7988-post-70023.html


RE: Problem with polar_coordinates() - cyrille de brébisson - 03-15-2018 06:47 AM

Hello,

I did not realize that the result was in the -180, 180 range. Then, maybe the mod should be with 2*acos(-1))

Cyrille


RE: Problem with polar_coordinates() - DrD - 03-16-2018 02:04 PM

A couple of years ago I requested that atan2 be put on a list for future release enhancements. This would be useful for programs that need the inverse tangent mapped to the interval [0,2*pi). Polar coordinates, and navigation software are typical examples. It's easy to create a stand-alone program for this, but with all the other tools in the toolbox, atan2 seems like it would be a useful addition.

https://en.wikipedia.org/wiki/Atan2

-Dale-


RE: Problem with polar_coordinates() - chromos - 03-16-2018 04:45 PM

(03-16-2018 02:04 PM)DrD Wrote:  A couple of years ago I requested that atan2 be put on a list for future release enhancements. This would be useful for programs that need the inverse tangent mapped to the interval [0,2*pi). Polar coordinates, and navigation software are typical examples. It's easy to create a stand-alone program for this, but with all the other tools in the toolbox, atan2 seems like it would be a useful addition.

https://en.wikipedia.org/wiki/Atan2

-Dale-

+1


RE: Problem with polar_coordinates() - John Keith - 03-16-2018 07:43 PM

(03-16-2018 02:04 PM)DrD Wrote:  A couple of years ago I requested that atan2 be put on a list for future release enhancements. This would be useful for programs that need the inverse tangent mapped to the interval [0,2*pi). Polar coordinates, and navigation software are typical examples. It's easy to create a stand-alone program for this, but with all the other tools in the toolbox, atan2 seems like it would be a useful addition.

https://en.wikipedia.org/wiki/Atan2

-Dale-

Note that the linked article has an RPL equivalent, but it is incorrect. It should be
\<< R\->C ARG \>>


RE: Problem with polar_coordinates() - toml_12953 - 04-02-2018 05:49 AM

(03-12-2018 06:02 PM)Lamas Wrote:  Bonjour,

Windows 10 Pro Rev : 1709
HP Prime virtual calculator Build 2018 1 24 Rev : 13333

iPhone IOS V : 11.2.6
IOS HP Prime V : 1.4.1.13513

This function works on iPhone with keyboard input (X, Y and M0 msgboxes are OK).
This function does not work in program mode with iPhone, (M0 stay [0,0] with msgbox).


I ran the same program on iOS 11.3 with Prime Pro app 1.4.1.13513 and it works fine. Maybe the newer version of iOS fixed the problem.


RE: Problem with polar_coordinates() - Lamas - 04-03-2018 07:04 AM

Bonjour,

I just checked with the last firmwares update and I found, like you, that the problem disappeared. It is OK now.

Thanks a lot for your reply.


RE: Problem with polar_coordinates() - Tim Wessman - 04-03-2018 07:31 PM

Well that is kind of bizarre... :?