Post Reply 
Program for converting degrees to radians and vise versa (HP Prime)
04-03-2022, 06:39 PM
Post: #1
Program for converting degrees to radians and vise versa (HP Prime)
I remember on the previous update I created a program that could convert degrees to radians and radians to degrees in maybe 1 or 2 keystrokes. Unfortunately, this program is no longer supported on my calculator. Rather than go through the units and do the tedious process of conversions. Is there a quicker and more effective method to do this. I remember the program being called D2R (Degrees to radians) and R2D (Radians to degrees).
Find all posts by this user
Quote this message in a reply
04-04-2022, 05:33 AM
Post: #2
RE: Program for converting degrees to radians and vise versa (HP Prime)
(04-03-2022 06:39 PM)IsaiahG0701 Wrote:  I remember on the previous update I created a program that could convert degrees to radians and radians to degrees in maybe 1 or 2 keystrokes. Unfortunately, this program is no longer supported on my calculator. Rather than go through the units and do the tedious process of conversions. Is there a quicker and more effective method to do this. I remember the program being called D2R (Degrees to radians) and R2D (Radians to degrees).

Bonjour
Voici ce que j'utilise, si ça peut vous aider.

Hello
Here's what I use, if it helps.

Code:

EXPORT D_R(d)
// Valeur en °
BEGIN
 UVAL(CONVERT(d*1_deg,0_rad));
END;
EXPORT R_D(r)
// Valeur en radians
BEGIN
 UVAL(CONVERT(r*1_rad,0_deg));
END;

Sorry for my english
Find all posts by this user
Quote this message in a reply
04-04-2022, 05:42 AM
Post: #3
RE: Program for converting degrees to radians and vise versa (HP Prime)
Thank you so much! To start this would I go to the program tab?
Find all posts by this user
Quote this message in a reply
04-04-2022, 10:53 AM
Post: #4
RE: Program for converting degrees to radians and vise versa (HP Prime)
(04-04-2022 05:42 AM)IsaiahG0701 Wrote:  Thank you so much! To start this would I go to the program tab?

Oui vous allez dans l'onglet programme et vous créez un nouveau programme
puis vous entrez le code de ces 2 fonctions.

Yes you go to the program tab and create a new program
then you enter the code of these 2 functions.

Sorry for my english
Find all posts by this user
Quote this message in a reply
04-04-2022, 12:15 PM (This post was last modified: 04-04-2022 12:16 PM by Didier Lachieze.)
Post: #5
RE: Program for converting degrees to radians and vise versa (HP Prime)
As these programs are single line programs you can also define user functions using the Shift Define key (to the right of the Units key):

       

Just use upper case letters for the variables : D and R instead of d and r.
Find all posts by this user
Quote this message in a reply
04-05-2022, 04:42 PM
Post: #6
RE: Program for converting degrees to radians and vise versa (HP Prime)
Thank you so much! With these programs would I be able to simplify a decimal number into radian form? Like if I were to do 7.5*(4pi/135) and get .698. Would I be able to have this simplified into 2pi/9
Find all posts by this user
Quote this message in a reply
04-07-2022, 12:36 PM
Post: #7
RE: Program for converting degrees to radians and vise versa (HP Prime)
(04-05-2022 04:42 PM)IsaiahG0701 Wrote:  Would I be able to have this simplified into 2pi/9

Not with the programs above, but this:

Code:
EXPORT radexact(D)
BEGIN
 CAS(EVAL("exact("+(D/π)+")"))*CAS(π);
END;

program does do what you want.
Find all posts by this user
Quote this message in a reply
10-13-2022, 10:15 PM
Post: #8
RE: Program for converting degrees to radians and vise versa (HP Prime)
(04-07-2022 12:36 PM)roadrunner Wrote:  
(04-05-2022 04:42 PM)IsaiahG0701 Wrote:  Would I be able to have this simplified into 2pi/9

Not with the programs above, but this:

Code:
EXPORT radexact(D)
BEGIN
 CAS(EVAL("exact("+(D/π)+")"))*CAS(π);
END;

program does do what you want.

Hi,

I know this is late to the game... but I tried the above radexact program and it gives a strange result. I entered 45 degrees and it returned 38,646,433/2,698,030*pi when I would have expected pi/4. Is that an issue with Prime or the results that I can expect, which are not correct.

Thanks to anyone still "listening" to this thread.

Bob
Find all posts by this user
Quote this message in a reply
10-23-2022, 08:26 PM (This post was last modified: 10-23-2022 08:27 PM by Ioncubekh.)
Post: #9
RE: Program for converting degrees to radians and vise versa (HP Prime)
Python math library has radians() & degrees() functions. Remember beforehand do
Code:
from math import *

HP Prime G1
Python via Android Termux...
Find all posts by this user
Quote this message in a reply
Post Reply 




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