HP Forums

Full Version: wp34s doesn't give correct zeta function value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
These don't match the results I see....


Pauli
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.
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".
(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
I verified that this works with an iOS version. I've no real hardware available currently.


Pauli
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
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)
Nice work Nigel. I don't know what I was smoking when I made those changes...

Pauli
I've applied your suggested change to the code base.

Pauli
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.
It will give incorrect answers for some of the domain. Negative values e.g. would skip the reflection formula I think.
Reference URL's