Why are the solutions different?
02-29-2020, 07:51 PM
Post: #1
 tom234 Member Posts: 116 Joined: Aug 2016
Why are the solutions different?
I am comparing the answers of the same equation between HP Prime G2 and HP27S.
I am entering a formula for distance between points using:
"
//MATH
//COS A = SIN LT1 SIN LT2 + COS LT1 COS LT2 COS(LG1-LG2)
//DISTANCE=C*ACOS(SIN(HRS(LT1))*SIN(HRS(LT2))+
// COS(HRS(LT1))*COS(HRS(LT2)) *(HRS(LG1)-HRS(LG2)))

// 1 DEGREE OF ARC = 60 NAUTICAL MILES = PI X D/360 STATUTE MILES
// WHERE D IS THE DIAMETER OF THE EARTH, 7917.59
//DEGREES.MINUTESSECOND FORMAT(D.MM.SSss)
//EAST LONGITURDE ARE NEGATIVE NUMBERS. THE CALCULATOR MUST BE IN DEGREE MODE.

// WHERE C IS CONSTANT:
// C= 60 TO COMPUTE NATICAL MILES.
// C=69.0940 TO COMPUTE STATUTE MILES.

"N.B.
When I enter the equation below into the Solver I get the answer:2,434.2929Statute Miles. The same answer if I ented the for PPL program.
HMS-> entry goes to decimal form.
D=69.094*ACOS(SIN(HMS→(40.35))*SIN(HMS→(44.35))+COS(HMS→(40.35))*COS(HMS→(44.35)​)*COS((HMS→(75.1)-HMS→(123.16))))"

However, when I use My HP27s I get 2,426.9794 Statute Miles. This is correct for the formula backed up by my HP27s text.
This discrepancy or difference in the answer is quite distressing.

"wish PPL was QB/QuickC which one could program in a language of their choice...just trying to learn this program It's me I have to adapt.
PS I am in degree mode.
Thank You for your help, your attention to this matter would be greatly appreciated.
02-29-2020, 09:37 PM
Post: #2
 Albert Chan Senior Member Posts: 2,097 Joined: Jul 2018
RE: Why are the solutions different?
(02-29-2020 07:51 PM)tom234 Wrote:  When I enter the equation below into the Solver I get the answer:2,434.2929Statute Miles.
The same answer if I ented the for PPL program.
HMS-> entry goes to decimal form.
D=69.094*ACOS(SIN(HMS→(40.35))*SIN(HMS→(44.35))+COS(HMS→(40.35))*COS(HMS→(44.35)​)*COS((HMS→(75.1)-HMS→(123.16))))"

However, when I use My HP27s I get 2,426.9794 Statute Miles. This is correct for the formula backed up by my HP27s text.
This discrepancy or difference in the answer is quite distressing.

D seems to be calculated with latitudes 40.35°, 44.35°, longitudes 75.10°, 123.16°
02-29-2020, 10:10 PM
Post: #3
 ijabbott Senior Member Posts: 1,210 Joined: Jul 2015
RE: Why are the solutions different?
(02-29-2020 09:37 PM)Albert Chan Wrote:
(02-29-2020 07:51 PM)tom234 Wrote:  When I enter the equation below into the Solver I get the answer:2,434.2929Statute Miles.
The same answer if I ented the for PPL program.
HMS-> entry goes to decimal form.
D=69.094*ACOS(SIN(HMS→(40.35))*SIN(HMS→(44.35))+COS(HMS→(40.35))*COS(HMS→(44.35)​)*COS((HMS→(75.1)-HMS→(123.16))))"

However, when I use My HP27s I get 2,426.9794 Statute Miles. This is correct for the formula backed up by my HP27s text.
This discrepancy or difference in the answer is quite distressing.

D seems to be calculated with latitudes 40.35°, 44.35°, longitudes 75.10°, 123.16°

Indeed, they need to be entered as 40°35, 44°35, 75°10, and 123°16 on the Prime.

Also, there is a COS missing in the HP-27S version shown by tom234, although he must have typed it into the calculator correctly.

— Ian Abbott
02-29-2020, 10:21 PM (This post was last modified: 02-29-2020 10:26 PM by ijabbott.)
Post: #4
 ijabbott Senior Member Posts: 1,210 Joined: Jul 2015
RE: Why are the solutions different?
I always thought the old HP and TI way of doing HMS (or DMS) conversions was a bit of a kludge, TBH. I much prefer the Casio way of doing them.

— Ian Abbott
02-29-2020, 11:24 PM
Post: #5
 tom234 Member Posts: 116 Joined: Aug 2016
RE: Why are the solutions different?
Is anyone having problems with HMS NOT going from decimal to degree

or otherwise?
03-01-2020, 12:51 AM
Post: #6
 Jacob Wall Member Posts: 157 Joined: Dec 2013
RE: Why are the solutions different?
Something like HMS→(40.35) doesn't do anything, the HMS format on the Prime is for display only, internally the value is a decimal. If the argument to that command is not in H°M'S" format, there is no change, not even visually.

If you want to convert a packed-format DMS number to decimal, then you will need your own conversion routine, something like this:

Code:
// convert a real number in DMS format to decimal degrees real number HMS2DD(a) BEGIN   LOCAL d, m, s;   d:=IP(a);   m:=IP((a-d)*100);   s:=(((a-d)*100)-m)*100;   RETURN d+(m/60)+(s/3600); END;
03-01-2020, 02:30 AM
Post: #7
 tom234 Member Posts: 116 Joined: Aug 2016
RE: Why are the solutions different?
I was going to think that was what I had to do make it...you saved me the though but yes that will work...
It is simple but how many times is this going to be the case making a function that was included in HP27s and previous HP calculators...it seems like three steps forward and two steps back.

Thank You
appreciated.
03-01-2020, 10:47 AM (This post was last modified: 03-01-2020 11:13 AM by ijabbott.)
Post: #8
 ijabbott Senior Member Posts: 1,210 Joined: Jul 2015
RE: Why are the solutions different?
On the Prime, you just need to enter HMS/DMS values in sexagesimal format instead of the decimal format that you're used to. It's no big deal as there is a Math Template to enter sexagesimal numbers. Admittedly, it's not as convenient as entering sexagesimal numbers on Casio calculators.

You also don't need to use the HMS→ function inside the SIN function to convert the sexagesimal number to decimal. The SIN function can work on the sexagesimal number directly, treating it as DMS. For example, SIN(40°35’00”) ≈ 0.650553326665.

— Ian Abbott
03-01-2020, 12:59 PM
Post: #9
 Albert Chan Senior Member Posts: 2,097 Joined: Jul 2018
RE: Why are the solutions different?
(03-01-2020 12:51 AM)Jacob Wall Wrote:  Something like HMS→(40.35) doesn't do anything, the HMS format on the Prime is for display only, internally the value is a decimal.
(03-01-2020 10:47 AM)ijabbott Wrote:  SIN function can work on the sexagesimal number directly, treating it as DMS. For example, SIN(40°35’00”) ≈ 0.650553326665.

It may be better to think sexagesimal number as shorthand, D°M’S” ≡ (S/60+M)/60+D
There is no need for adding code for any functions to understand sexagesimal format.

SIN(40°35’00”) = SIN(40+35/60)

This is an improvement to packed 40.35, since that may be interpreted either way, decimal or DD.MMSS
Also, packed format might introduce conversion errors, see H->HMS conversion HP-15C vs. HP42S vs HP67
03-01-2020, 01:55 PM
Post: #10
 ijabbott Senior Member Posts: 1,210 Joined: Jul 2015
RE: Why are the solutions different?
DISTANCE=C*ACOS(SIN(LT1)*SIN(LT2)+COS(LT1)*COS(LT2)*COS(LG1-LG2))

— Ian Abbott
03-01-2020, 01:57 PM
Post: #11
 tom234 Member Posts: 116 Joined: Aug 2016
RE: Why are the solutions different?
HP had enough room to add the function HMS(x) Converts x in decimal hours(degrees)
to H.MMSS(D.MMSS) format.

or

HRS(x) Converts x in H.MMSS(D.MMSS) format to decimal.

just like the old days!
TY
03-01-2020, 01:59 PM
Post: #12
 tom234 Member Posts: 116 Joined: Aug 2016
RE: Why are the solutions different?
(03-01-2020 01:55 PM)ijabbott Wrote:  DISTANCE=C*ACOS(SIN(LT1)*SIN(LT2)+COS(LT1)*COS(LT2)*COS(LG1-LG2))

yes, I had to enter it with all the degree minutes second marks for it to understand
Code:
 it. So time-consuming
.
03-01-2020, 02:26 PM (This post was last modified: 03-01-2020 02:31 PM by ijabbott.)
Post: #13
 ijabbott Senior Member Posts: 1,210 Joined: Jul 2015
RE: Why are the solutions different?
(03-01-2020 01:59 PM)tom234 Wrote:  yes, I had to enter it with all the degree minutes second marks for it to understand
Code:
 it. So time-consuming
.

You don't necessarily need all the marks. These all input the same value:

40°35
40°35’
40°35’”
40°35’0
40°35’0”
40°35’00
40°35’00”

The calculator will expand the input on entry to the full form.

— Ian Abbott
03-01-2020, 08:31 PM
Post: #14
 Joe Horn Senior Member Posts: 1,902 Joined: Dec 2013
RE: Why are the solutions different?
(03-01-2020 10:47 AM)ijabbott Wrote:  On the Prime, you just need to enter HMS/DMS values in sexagesimal format instead of the decimal format that you're used to. It's no big deal as there is a Math Template to enter sexagesimal numbers. Admittedly, it's not as convenient as entering sexagesimal numbers on Casio calculators.

A faster and easier method than using the math template key is to use the [ ° ' " ] key, which is [Shift] [a b/c]. It works just like the Casio [ ° ' " ] key.

Example: 1 [ ° ' " ] 2 [ ° ' " ] 3 --> 1°2'3''

<0|ɸ|0>
-Joe-
03-01-2020, 08:59 PM
Post: #15
 ijabbott Senior Member Posts: 1,210 Joined: Jul 2015
RE: Why are the solutions different?
(03-01-2020 08:31 PM)Joe Horn Wrote:
(03-01-2020 10:47 AM)ijabbott Wrote:  On the Prime, you just need to enter HMS/DMS values in sexagesimal format instead of the decimal format that you're used to. It's no big deal as there is a Math Template to enter sexagesimal numbers. Admittedly, it's not as convenient as entering sexagesimal numbers on Casio calculators.

A faster and easier method than using the math template key is to use the [ ° ' " ] key, which is [Shift] [a b/c]. It works just like the Casio [ ° ' " ] key.

Example: 1 [ ° ' " ] 2 [ ° ' " ] 3 --> 1°2'3''

Thanks for the tip! TBH, I can't read half the stuff on the Prime keyboard.

— Ian Abbott
03-03-2020, 07:50 AM
Post: #16
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: Why are the solutions different?
Hello,

To confirm what was said earlier....
HMS on Prime is a DISPLAY only thing, it does not change the number...
This allows user to enter number in any format they want. Decimal, or HMS without the program having to force things out on you...

Also, as pointed out, a HMS number, when used as an input for a trig function will be treated as being in Degree, EVEN if the current mode is radian...

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.
08-03-2021, 12:06 PM
Post: #17
 tom234 Member Posts: 116 Joined: Aug 2016
RE: Why are the solutions different?
(03-01-2020 08:31 PM)Joe Horn Wrote:
(03-01-2020 10:47 AM)ijabbott Wrote:  On the Prime, you just need to enter HMS/DMS values in sexagesimal format instead of the decimal format that you're used to. It's no big deal as there is a Math Template to enter sexagesimal numbers. Admittedly, it's not as convenient as entering sexagesimal numbers on Casio calculators.

A faster and easier method than using the math template key is to use the [ ° ' " ] key, which is [Shift] [a b/c]. It works just like the Casio [ ° ' " ] key.

Example: 1 [ ° ' " ] 2 [ ° ' " ] 3 --> 1°2'3''

TY that printing on the key in blue was so small didn't see it. Nice.
 « Next Oldest | Next Newest »

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