Post Reply 
Problem with polar_coordinates()
03-12-2018, 06:02 PM (This post was last modified: 03-12-2018 06:58 PM by Lamas.)
Post: #1
Problem with polar_coordinates()
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
Find all posts by this user
Quote this message in a reply
03-12-2018, 06:24 PM (This post was last modified: 03-12-2018 06:28 PM by Tim Wessman.)
Post: #2
RE: Problem with polar_coordinates()
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?

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
03-12-2018, 09:58 PM
Post: #3
RE: Problem with polar_coordinates()
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.
Find all posts by this user
Quote this message in a reply
03-13-2018, 09:41 AM
Post: #4
RE: Problem with polar_coordinates()
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
03-13-2018, 09:54 AM (This post was last modified: 03-13-2018 10:37 AM by Lamas.)
Post: #5
RE: Problem with polar_coordinates()
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.
Find all posts by this user
Quote this message in a reply
03-13-2018, 08:38 PM
Post: #6
RE: Problem with polar_coordinates()
(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).

X<> c
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
03-14-2018, 06:02 PM
Post: #7
RE: Problem with polar_coordinates()
aquí un vídeo del tema que tratas de solucionar


Find all posts by this user
Quote this message in a reply
03-14-2018, 07:33 PM
Post: #8
RE: Problem with polar_coordinates()
On Home Mode fail

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

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

new RPL
Visit this user's website Find all posts by this user
Quote this message in a reply
03-15-2018, 06:47 AM
Post: #9
RE: Problem with polar_coordinates()
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
03-16-2018, 02:04 PM
Post: #10
RE: Problem with polar_coordinates()
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-
Find all posts by this user
Quote this message in a reply
03-16-2018, 04:45 PM
Post: #11
RE: Problem with polar_coordinates()
(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

Geocaching Coords Solver, Number of triangles Puzzle
Find all posts by this user
Quote this message in a reply
03-16-2018, 07:43 PM
Post: #12
RE: Problem with polar_coordinates()
(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 \>>
Find all posts by this user
Quote this message in a reply
04-02-2018, 05:49 AM
Post: #13
RE: Problem with polar_coordinates()
(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.

Tom L

DM42 SN: 00025 (Beta)
SN: 00221 (Production)
Find all posts by this user
Quote this message in a reply
04-03-2018, 07:04 AM
Post: #14
RE: Problem with polar_coordinates()
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.
Find all posts by this user
Quote this message in a reply
04-03-2018, 07:31 PM
Post: #15
RE: Problem with polar_coordinates()
Well that is kind of bizarre... :?

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)