Post Reply 
wp34s doesn't give correct zeta function value
03-06-2022, 07:18 AM
Post: #1
wp34s doesn't give correct zeta function value
I'm using wp34s emulator on iPhone. Zeta function doesn't work as I expected.

0 ZETA > -0.5
1 ZETA > -5.17682194565
2 ZETA > -2.87602208383E-32
3 ZETA > 204.372738634

Can you guess why these number appeared? Double precision mode doesn't matter.

S.Korean / HP-50G | fx-570EX | fx-570CW | HP-200LX
Visit this user's website Find all posts by this user
Quote this message in a reply
03-06-2022, 08:40 AM
Post: #2
RE: wp34s doesn't give correct zeta function value
These don't match the results I see....


Pauli
Find all posts by this user
Quote this message in a reply
03-07-2022, 08:05 AM
Post: #3
RE: wp34s doesn't give correct zeta function value
It seems to be a bug in the iOS version and this is strange as it uses the same C code as the other emulators.
Even stranger: it occurs on my iPhone but not my Ipad nor on the emulator.

I do not know if I can find the time to look at it (quite busy at the moment) but I'll try.
Find all posts by this user
Quote this message in a reply
03-07-2022, 09:57 PM (This post was last modified: 03-07-2022 09:57 PM by ijabbott.)
Post: #4
RE: wp34s doesn't give correct zeta function value
FWIW, the Android port (awp34s by Pablo Martin) works fine (or at least it agrees with the HP 20b/30b version). I'm not sure exactly which revision it is based on. The VERS command shows "34S 3.3 0".

— Ian Abbott
Find all posts by this user
Quote this message in a reply
03-08-2022, 08:52 AM
Post: #5
RE: wp34s doesn't give correct zeta function value
(03-07-2022 09:57 PM)ijabbott Wrote:  FWIW, the Android port (awp34s by Pablo Martin) works fine (or at least it agrees with the HP 20b/30b version). I'm not sure exactly which revision it is based on. The VERS command shows "34S 3.3 0".

For me it crashes the app.

(06-17-2021 12:15 PM)BINUBALL Wrote:  If you still develop this app, I can give bug report for you.

- Trying to calculate Zeta function results crash.
- In double mode, 5 sqrt f x<>y results crash.
- Integrate x^x from 0 to 1 results crash.
ex)
Code:
LBL 'O'
y^x
RTN

S.Korean / HP-50G | fx-570EX | fx-570CW | HP-200LX
Visit this user's website Find all posts by this user
Quote this message in a reply
03-09-2022, 02:56 AM
Post: #6
RE: wp34s doesn't give correct zeta function value
I verified that this works with an iOS version. I've no real hardware available currently.


Pauli
Find all posts by this user
Quote this message in a reply
03-09-2022, 12:25 PM
Post: #7
RE: wp34s doesn't give correct zeta function value
Hello!

I have tried the following versions:
iPad2, iOS 9.3.5, WP34s 1.18
iPhone8, iOS 15.3.1, WP34s 1.18
Samsung Galaxy A71, Android 11, WP34s 0.0.6 (?)

All three do what they are supposed to do.

Regards
Max
Find all posts by this user
Quote this message in a reply
03-09-2022, 01:18 PM
Post: #8
RE: wp34s doesn't give correct zeta function value
The WP34S implementation on the DM42 gives the wrong answers - the same wrong answers that have been reported on the iPhone version.

I've looked at the XROM code for the zeta function. It includes these lines:
Code:

zeta_int::        LocR 08
            STO .01
            STO .07
            Num 1/2
            x>? 0
                JMP zeta_calc
Changing this code to
Code:

zeta_int::        LocR 08
            STO .01
            STO .07
            x>0?
                JMP zeta_calc
gives the correct answers.

There are two things going on. First, I believe that the comparison "x>? 0" compares the value of x with the contents of register zero, rather than with the number zero. Second, as the code stands the comparison is with the fixed value of 1/2 that the previous command puts on the stack.

This page here shows the most recent change to zeta.wp34s. It shows that Num 1/2 has been removed from the WP31S branch but not from other branches. All three branches contain what I believe to be the incorrect comparison operation. As a result of this, evaluating \(\zeta(x)\) for negative values of \(x\) gives incorrect answers. For example, on my iPad, my physical WP34S, and on a Windows emulator I get \(\zeta(-7)=4.547\dots\times10^{-3}\), whereas Wolfram Alpha gives \(\frac1{240}=4.166\dots\times10^{-3}\). The code with the corrected comparison operator gives the correct answer.

Nigel (UK)
Find all posts by this user
Quote this message in a reply
03-10-2022, 12:40 AM
Post: #9
RE: wp34s doesn't give correct zeta function value
Nice work Nigel. I don't know what I was smoking when I made those changes...

Pauli
Find all posts by this user
Quote this message in a reply
03-10-2022, 02:20 AM
Post: #10
RE: wp34s doesn't give correct zeta function value
I've applied your suggested change to the code base.

Pauli
Find all posts by this user
Quote this message in a reply
03-10-2022, 08:40 AM
Post: #11
RE: wp34s doesn't give correct zeta function value
I put 0 into register 0 and zeta function worked correctly.
Previously I had 10 in register 0. Probably it can give correct value after reset.

S.Korean / HP-50G | fx-570EX | fx-570CW | HP-200LX
Visit this user's website Find all posts by this user
Quote this message in a reply
03-11-2022, 01:21 AM
Post: #12
RE: wp34s doesn't give correct zeta function value
It will give incorrect answers for some of the domain. Negative values e.g. would skip the reflection formula I think.
Find all posts by this user
Quote this message in a reply
Post Reply 




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